apply 010_makefile-destdir-support
[ckermit.git] / ckermit70.txt
1
2    [ [1]Contents ] [ [2]C-Kermit ] [ [3]Kermit Home ]
3
4                  Supplement to Using C-Kermit, Second Edition
5
6 For C-Kermit 7.0
7
8 As of C-Kermit version:  7.0.196
9 This file last updated:  8 February 2000
10
11 Authors: Frank da Cruz and Christine M. Gianone
12 Address: The Kermit Project
13          Columbia University
14          612 West 115th Street
15          New York NY 10025-7799
16          USA
17 Fax:     +1 (212) 662-6442
18 E-Mail:  [4]kermit-support@columbia.edu
19 Web:     [5]http://www.columbia.edu/kermit/
20 Or:      [6]http://www.kermit-project.org/
21 Or:      [7]http://www.columbia.nyc.ny.us/kermit/
22      _________________________________________________________________
23
24   NOTICES
25
26    This document:
27           Copyright © 1997, 2000, Frank da Cruz and Christine M. Gianone.
28           All rights reserved.
29
30    Kermit 95:
31           Copyright © 1995, 2000, Trustees of Columbia University in the
32           City of New York. All rights reserved.
33
34    C-Kermit:
35           Copyright © 1985, 2000,
36           Trustees of Columbia University in the City of New York. All
37           rights reserved. See the C-Kermit [8]COPYING.TXT file or the
38           copyright text in the [9]ckcmai.c module for disclaimer and
39           permissions.
40
41    When Kerberos(TM) and/or SRP(TM) (Secure Remote Password) and/or SSL
42           protocol are included:
43           Portions Copyright © 1990, Massachusetts Institute of
44           Technology.
45           Portions Copyright © 1991, 1993 Regents of the University of
46           California.
47           Portions Copyright © 1991, 1992, 1993, 1994, 1995 by AT&T.
48           Portions Copyright © 1997, Stanford University.
49           Portions Copyright © 1995-1997, Eric Young
50           <eay@cryptosoft.com>.
51
52    For the full text of the third-party copyright notices, see
53    [10]Appendix V.
54      _________________________________________________________________
55
56   WHAT IS IN THIS FILE
57
58    This file lists changes made to C-Kermit since the second edition of
59    the book [11]Using C-Kermit was published and C-Kermit 6.0 was
60    released in November 1996. Use this file as a supplement to the second
61    edition of Using C-Kermit until the third edition is published some
62    time in 2000. If the "most recent update" shown above is long ago,
63    contact Columbia University to see if there is a newer release.
64
65    For further information, also see the [12]CKCBWR.TXT ("C-Kermit
66    beware") file for hints, tips, tricks, restrictions, frequently asked
67    questions, etc, plus the system-specific "beware file", e.g.
68    [13]CKUBWR.TXT for UNIX, [14]CKVBWR.TXT for VMS, etc, and also any
69    system-specific update files such as KERMIT95.HTM for Kermit 95 (in
70    the DOCS\MANUAL\ subdirectory of your K95 directory).
71
72      This Web-based copy of the C-Kermit 7.0 update notes supersedes the
73      plain-text CKERMIT2.TXT file. All changes after 19 January 2000
74      appear only here in the Web version. If you need an up-to-date
75      plain-text copy, use your Web browser to save this page as plain
76      text. 
77      _________________________________________________________________
78
79   ABOUT FILENAMES
80
81    In this document, filenames are generally shown in uppercase, but on
82    file systems with case-sensitive names such as UNIX, OS-9, and AOS/VS,
83    lowercase names are used: [15]ckubwr.txt, [16]ckermit70.txt, etc.
84      _________________________________________________________________
85
86   ADDITIONAL FILES
87
88    Several other files accompany this new Kermit release:
89
90    SECURITY.TXT
91           Discussion of Kermit's new authentication and encryption
92           features:
93
94           + [17]Plain-text version
95           + [18]HTML (hypertext) version
96
97    IKSD.TXT
98           How to install and manage an Internet Kermit Service Daemon.
99
100           + [19]Plain-text version
101           + [20]HTML (hypertext) version
102
103           Also see [21]cuiksd.htm for instructions for use.
104
105    TELNET.TXT
106           A thorough presentation of Kermit's new advanced Telnet
107           features and controls.
108
109           + [22]Plain-text version
110           + [23]HTML (hypertext) version
111      _________________________________________________________________
112
113   THE NEW C-KERMIT LICENSE
114
115    The C-Kermit license was rewritten for version 7.0 to grant automatic
116    permission to packagers of free operating-system distributions to
117    include C-Kermit 7.0. Examples include Linux (GNU/Linux), FreeBSD,
118    NetBSD, etc. The new license is in the [24]COPYING.TXT file, and is
119    also displayed by C-Kermit itself when you give the VERSION or
120    COPYRIGHT command. The new C-Kermit license does not apply to
121    [25]Kermit 95.
122      _________________________________________________________________
123
124   ACKNOWLEDGMENTS
125
126    Thanks to Jeff Altman, who joined the Kermit Project in 1995, for much
127    of what you see in C-Kermit 7.0, especially in the networking and
128    security areas, and his key role in designing and implementing the
129    Internet Kermit Service Daemon. And special thanks to Lucas Hart for
130    lots of help with the VMS version; to Peter Eichhorn for continuous
131    testing on the full range of HP-UX versions and for a consolidated set
132    of HP-UX makefile targets; and to Colin Allen, Mark Allen, Roger
133    Allen, Ric Anderson, William Bader, Mitch Baker, Mitchell Bass, Nelson
134    Beebe, Gerry Belanger, Jeff Bernsten, Mark Berryman, John Bigg, Volker
135    Borchert, Jonathan Boswell, Tim Boyer, Frederick Bruckman, Kenneth
136    Cochran, Jared Crapo, Bill Delaney, Igor Sobrado Delgado, Clarence
137    Dold, Joe Doupnik, John Dunlap, Max Evarts, Patrick French, Carl
138    Friedberg, Carl Friend, Hirofumi Fujii, Andrew Gabriel, Gabe Garza,
139    Boyd Gerber, David Gerber, George Gilmer, Hunter Goatley, DJ Hagberg,
140    Kevin Handy, Andy Harper, Randolph Herber, Sven Holström, Michal
141    Jaegermann, Graham Jenkins, Dick Jones, Terry Kennedy, Robert D Keys,
142    Nick Kisseberth, Igor Kovalenko, David Lane, Adam Laurie, Jeff
143    Liebermann, Eric Lonvick, Hoi Wan Louis, Arthur Marsh, Gregorie
144    Martin, Peter Mauzey, Dragan Milicic, Todd Miller, Christian Mondrup,
145    Daniel Morato, Dat Nguyen, Herb Peyerl, Jean-Pierre Radley, Steve
146    Rance, Stephen Riehm, Nigel Roles, Larry Rosenman, Jay S Rouman, David
147    Sanderson, John Santos, Michael Schmitz, Steven Schultz, Bob Shair,
148    Richard Shuford, Fred Smith, Michael Sokolov, Jim Spath, Peter Szell,
149    Ted T'so, Brian Tillman, Linus Torvalds, Patrick Volkerding, Martin
150    Vorländer, Steve Walton, Ken Weaverling, John Weekley, Martin
151    Whitaker, Jim Whitby, Matt Willman, Joellen Windsor, Farrell Woods,
152    and many others for binaries, hosting, reviews, suggestions, advice,
153    bug reports, and all the rest over the 3+ year C-Kermit 7.0
154    development cycle. Thanks to Russ Nelson and the board of the Open
155    Software Initiative ([26]http://www.opensource.org) for their
156    cooperation in developing the new C-Kermit license and to the
157    proprietors of those free UNIX distributions that have incorporated
158    C-Kermit 7.0 for their cooperation and support, especially FreeBSD's
159    Jörg Wunsch.
160      _________________________________________________________________
161
162   NOTE TO KERMIT 95 USERS
163
164    Kermit 95 and C-Kermit share the same command and scripting language,
165    the same Kermit file-transfer protocol implementation, and much else
166    besides.
167
168    Like the book [27]Using C-Kermit, this file concentrates on the
169    aspects of C-Kermit that are common to all versions: UNIX, VMS,
170    Windows, OS/2, VOS, AOS/VS, etc. Please refer to your Kermit 95
171    documentation for information that is specific to Kermit 95.
172
173    C-Kermit 7.0 corresponds to Kermit 95 1.1.19.
174      _________________________________________________________________
175
176   C-KERMIT VERSIONS AND VERSION NUMBERS
177
178    "C-Kermit" refers to all the many programs that are compiled in whole
179    or in part from common C-language source code, comprising:
180
181      * A Kermit file transfer protocol module
182      * A command parser and script execution module
183      * A modem-dialing module
184      * A network support module
185      * A character-set translation module.
186
187    and several others. These "system-independent" modules are combined
188    with system-dependent modules for each platform to provide the
189    required input/output functions, and also in some cases overlaid with
190    an alternative user interface, such as Macintosh Kermit's
191    point-and-click interface, and in some cases also a terminal emulator,
192    as Kermit 95.
193
194    The C-Kermit version number started as 1.0, ... 3.0, 4.0, 4.1 and then
195    (because of confusion at the time with Berkeley UNIX 4.2), 4B, 4C, and
196    so on, with the specific edit number in parentheses, for example
197    4E(072) or 5A(188). This scheme was used through 5A(191), but now we
198    have gone back to the traditional numbering scheme with decimal
199    points: major.minor.edit; for example 7.0.196. Internal version
200    numbers (the \v(version) variable), however, are compatible in
201    C-Kermit 5A upwards.
202
203    Meanwhile, C-Kermit derivatives for some platforms (Windows,
204    Macintosh) might go through several releases while C-Kermit itself
205    remains the same. These versions have their own platform-specific
206    version numbers, such as Kermit 95 1.1.1, 1.1.2, and so on.
207
208    C-Kermit Version History:
209
210   1.0       1981-1982         Command-line only, 4.2 BSD UNIX only
211   2.0       (*)               (who remembers...)
212   3.0       May 1984          Command-line only, supports several platforms
213   4.0-4.1   Feb-Apr 1985 (*)  First interactive and modular version
214   4C(050)   May 1985
215   4D(060)   April 1986
216   4E(066)   August 1987       Long packets
217   4E(068)   January 1988
218   4E(072)   January 1989
219   4F(095)   August 1989 (*)   Attribute packets
220   5A(188)   November 1992     Scripting, TCP/IP, sliding windows (1)
221   5A(189)   September 1993    Control-char unprefixing
222   5A(190)   October 1994      Recovery
223   5A(191)   April 1995        OS/2 only
224   6.0.192   September 1996    Intelligent dialing, autodownload, lots more (2)
225   6.1.193   1997-98 (*)       Development only
226   6.1.194   June 1998         K95 only - switches, directory recursion, more
227   7.0.195   August 1999       IKSD + more (CU only as K95 1.1.18-CU)
228   7.0.196   1 January 2000    Unicode, lots more
229
230    (*) Never formally released (4.0 was a total rewrite)
231    (1) Using C-Kermit, 1st Edition
232    (2) Using C-Kermit, 2nd Edition
233      _________________________________________________________________
234
235 CONTENTS
236
237  I.  [28]C-KERMIT DOCUMENTATION
238
239  II. [29]NEW FEATURES
240
241      (0) [30]INCOMPATIBILITIES WITH PREVIOUS RELEASES
242      (1) [31]PROGRAM AND FILE MANAGEMENT AND COMMANDS
243          1.0.  [32]Bug fixes
244          1.1.  [33]Command Continuation
245          1.2.  [34]Editor Interface
246          1.3.  [35]Web Browser and FTP Interface
247          1.4.  [36]Command Editing
248          1.5.  [37]Command Switches
249                1.5.1. [38]General Switch Syntax
250                1.5.2. [39]Order and Effect of Switches
251                1.5.3. [40]Distinguishing Switches from Other Fields
252                1.5.4. [41]Standard File Selection Switches
253                1.5.5. [42]Setting Preferences for Different Commands
254          1.6.  [43]Dates and Times
255          1.7.  [44]Partial Completion of Keywords
256          1.8.  [45]Command Recall
257          1.9.  [46]EXIT Messages
258          1.10. [47]Managing Keyboard Interruptions
259          1.11. [48]Taming the Wild Backslash -- Part Deux
260                1.11.1. [49]Background
261                1.11.2. [50]Kermit's Quoting Rules
262                1.11.3. [51]Passing DOS Filenames from Kermit to Shell Commands
263                1.11.4. [52]Using Variables to Hold DOS Filenames
264                1.11.5. [53]Passing DOS Filenames as Parameters to Macros
265                1.11.6. [54]Passing DOS File Names from Macro Parameters to the
266 DOS Shell
267                1.11.7. [55]Passing DOS Filenames to Kermit from the Shell
268          1.12. [56]Debugging
269          1.13. [57]Logs
270          1.14. [58]Automatic File-Transfer Packet Recognition at the Command Pr
271 ompt
272          1.15. [59]The TYPE Command
273          1.16. [60]The RESET Command
274          1.17. [61]The COPY and RENAME Commands
275          1.18. [62]The MANUAL Command
276          1.19. [63]String and Filename Matching Patterns
277          1.20. [64]Multiple Commands on One Line
278          1.21. [65]What Do I Have?
279          1.22. [66]Generalized File Input and Output
280                1.22.1. [67]Why Another I/O System?
281                1.22.2. [68]The FILE Command
282                1.22.3. [69]FILE Command Examples
283                1.22.4. [70]Channel Numbers
284                1.22.5. [71]FILE Command Error Codes
285                1.22.6. [72]File I/O Variables
286                1.22.7. [73]File I/O Functions
287                1.22.8. [74]File I/O Function Examples
288          1.23. [75]The EXEC Command
289          1.24. [76]Getting Keyword Lists with '?'
290      (2) [77]MAKING AND USING CONNECTIONS
291          2.0. [78]SET LINE and SET HOST Command Switches
292          2.1. [79]Dialing
293               2.1.1. [80]The Dial Result Message
294               2.1.2. [81]Long-Distance Dialing Changes
295               2.1.3. [82]Forcing Long-Distance Dialing
296               2.1.4. [83]Exchange-Specific Dialing Decisions
297               2.1.5. [84]Cautions about Cheapest-First Dialing
298               2.1.6. [85]Blind Dialing (Dialing with No Dialtone)
299               2.1.7. [86]Trimming the Dialing Dialog
300               2.1.8. [87]Controlling the Dialing Speed
301               2.1.9. [88]Pretesting Phone Number Conversions
302               2.1.10. [89]Greater Control over Partial Dialing
303               2.1.11. [90]New DIAL-related Variables and Functions
304               2.1.12. [91]Increased Flexibility of PBX Dialing
305               2.1.13. [92]The DIAL macro - Last-Minute Phone Number Conversions
306               2.1.14. [93]Automatic Tone/Pulse Dialing Selection
307               2.1.15. [94]Dial-Modifier Variables
308               2.1.16. [95]Giving Multiple Numbers to the DIAL Command
309          2.2. [96]Modems
310               2.2.1. [97]New Modem Types
311               2.2.2. [98]New Modem Controls
312          2.3. [99]TELNET and RLOGIN
313               2.3.0. [100]Bug Fixes
314               2.3.1. [101]Telnet Binary Mode Bug Adjustments
315               2.3.2. [102]VMS UCX Telnet Port Bug Adjustment
316               2.3.3. [103]Telnet New Environment Option
317               2.3.4. [104]Telnet Location Option
318               2.3.5. [105]Connecting to Raw TCP Sockets
319               2.3.6. [106]Incoming TCP Connections
320          2.4. [107]The EIGHTBIT Command
321          2.5. [108]The Services Directory
322          2.6. [109]Closing Connections
323          2.7. [110]Using C-Kermit with External Communication Programs
324               2.7.0. [111]C-Kermit over tn3270 and tn5250
325               2.7.1. [112]C-Kermit over Telnet
326               2.7.2. [113]C-Kermit over Rlogin
327               2.7.3. [114]C-Kermit over Serial Communication Programs
328               2.7.4. [115]C-Kermit over Secure Network Clients
329               2.7.4.1. [116]SSH
330               2.7.4.2. [117]SSL
331               2.7.4.3. [118]SRP
332               2.7.4.4. [119]SOCKS
333               2.7.4.5. [120]Kerberos and SRP
334          2.8. [121]Scripting Local Programs
335          2.9. [122]X.25 Networking
336               2.9.1. [123]IBM AIXLink/X.25 Network Provider Interface for AIX
337               2.9.2. [124]HP-UX X.25
338          2.10. [125]Additional Serial Port Controls
339          2.11. [126]Getting Access to the Dialout Device
340          2.12. [127]The Connection Log
341          2.13. [128]Automatic Connection-Specific Flow Control Selection
342          2.14. [129]Trapping Connection Establishment and Loss
343          2.15. [130]Contacting Web Servers with the HTTP Command
344      (3) [131]TERMINAL CONNECTION
345          3.1. [132]CONNECT Command Switches
346          3.2. [133]Triggers
347          3.3. [134]Transparent Printing
348          3.4. [135]Binary and Text Session Logs
349      (4) [136]FILE TRANSFER AND MANAGEMENT
350          4.0. [137]Bug Fixes, Minor Changes, and Clarifications
351          4.1. [138]File-Transfer Filename Templates
352          4.1.1. [139]Templates in the As-Name
353          4.1.2. [140]Templates on the Command Line
354          4.1.3. [141]Post-Transfer Renaming
355          4.2. [142]File-Transfer Pipes and Filters
356          4.2.1. [143]Introduction
357          4.2.1.1. [144]Terminology
358          4.2.1.2. [145]Notation
359          4.2.1.3. [146]Security
360          4.2.2. [147]Commands for Transferring from and to Pipes
361          4.2.2.1. [148]Sending from a Command
362          4.2.2.2. [149]Receiving to a Command
363          4.2.3. [150]Using File-Transfer Filters
364          4.2.3.1. [151]The SEND Filter
365          4.2.3.2. [152]The RECEIVE Filter
366          4.2.4. [153]Implicit Use of Pipes
367          4.2.5. [154]Success and Failure of Piped Commands
368          4.2.6. [155]Cautions about Using Pipes to Transfer Directory Trees
369          4.2.7. [156]Pipes and Encryption
370          4.2.8. [157]Commands and Functions Related to Pipes
371          4.2.8.1. [158]The OPEN !READ and OPEN !WRITE Commands
372          4.2.8.2. [159]The REDIRECT Command
373          4.2.8.3. [160]Receiving Mail and Print Jobs
374          4.2.8.4. [161]Pipe-Related Functions
375          4.3. [162]Automatic Per-File Text/Binary Mode Switching
376          4.3.1. [163]Exceptions
377          4.3.2. [164]Overview
378          4.3.3. [165]Commands
379          4.3.4. [166]Examples
380          4.4. [167]File Permissions
381          4.4.1. [168]When ATTRIBUTES PROTECTION is OFF
382          4.4.1.1. [169]Unix
383          4.4.1.2. [170]VMS
384          4.4.2. [171]When ATTRIBUTES PROTECTION is ON
385          4.4.2.1. [172]System-Specific Permissions
386          4.4.2.1.1. [173]UNIX
387          4.4.2.1.2. [174]VMS
388          4.4.2.2. [175]System-Independent Permissions
389          4.5. [176]File Management Commands
390          4.5.1. [177]The DIRECTORY Command
391          4.5.2. [178]The CD and BACK Commands
392          4.5.2.1. [179]Parsing Improvements
393          4.5.2.2. [180]The CDPATH
394          4.5.3. [181]Creating and Removing Directories
395          4.5.4. [182]The DELETE and PURGE Commands
396          4.6. [183]Starting the Remote Kermit Server Automatically
397          4.7. [184]File-Transfer Command Switches
398          4.7.1. [185]SEND Command Switches
399          4.7.2. [186]GET Command Switches
400          4.7.3. [187]RECEIVE Command Switches
401          4.8. [188]Minor Kermit Protocol Improvements
402          4.8.1. [189]Multiple Attribute Packets
403          4.8.2. [190]Very Short Packets
404          4.9. [191]Wildcard / File Group Expansion
405          4.9.1. [192]In UNIX C-Kermit
406          4.9.2. [193]In Kermit 95
407          4.9.3. [194]In VMS, AOS/VS, OS-9, VOS, etc.
408          4.10. [195]Additional Pathname Controls
409          4.11. [196]Recursive SEND and GET: Transferring Directory Trees
410          4.11.1. [197]Command-Line Options
411          4.11.2. [198]The SEND /RECURSIVE Command
412          4.11.3. [199]The GET /RECURSIVE Command
413          4.11.4. [200]New and Changed File Functions
414          4.11.5. [201]Moving Directory Trees Between Like Systems
415          4.11.6. [202]Moving Directory Trees Between Unlike Systems
416          4.12. [203]Where Did My File Go?
417          4.13. [204]File Output Buffer Control
418          4.14. [205]Improved Responsiveness
419          4.15. [206]Doubling and Ignoring Characters for Transparency
420          4.16. [207]New File-Transfer Display Formats
421          4.17. [208]New Transaction Log Formats
422          4.17.1. [209]The BRIEF Format
423          4.17.2. [210]The FTP Format
424          4.18. [211]Unprefixing NUL
425          4.19. [212]Clear-Channel Protocol
426          4.20. [213]Streaming Protocol
427          4.20.1. [214]Commands for Streaming
428          4.20.2. [215]Examples of Streaming
429          4.20.2.1. [216]Streaming on Socket-to-Socket Connections
430          4.20.2.2. [217]Streaming on Telnet Connections
431          4.20.2.3. [218]Streaming with Limited Packet Length
432          4.20.2.4. [219]Streaming on Dialup Connections
433          4.20.2.5. [220]Streaming on X.25 Connections
434          4.20.3. [221]Streaming - Preliminary Conclusions
435          4.21. [222]The TRANSMIT Command
436          4.22. [223]Coping with Faulty Kermit Implementations
437          4.22.1. [224]Failure to Accept Modern Negotiation Strings
438          4.22.2. [225]Failure to Negotiate 8th-bit Prefixing
439          4.22.3. [226]Corrupt Files
440          4.22.4. [227]Spurious Cancellations
441          4.22.5. [228]Spurious Refusals
442          4.22.6. [229]Failures during the Data Transfer Phase
443          4.22.7. [230]Fractured Filenames
444          4.22.8. [231]Bad File Dates
445          4.23. [232]File Transfer Recovery
446          4.24. [233]FILE COLLISION UPDATE Clarification
447          4.25. [234]Autodownload Improvements
448      (5) [235]CLIENT/SERVER
449          5.0. [236]Hints
450          5.1. [237]New Command-Line Options
451          5.2. [238]New Client Commands
452          5.3. [239]New Server Capabilities
453          5.3.1. [240]Creating and Removing Directories
454          5.3.2. [241]Directory Listings
455          5.4. [242]Syntax for Remote Filenames with Embedded Spaces
456          5.5. [243]Automatic Orientation Messages upon Directory Change
457          5.6. [244]New Server Controls
458          5.7. [245]Timeouts during REMOTE HOST Command Execution
459      (6) [246]INTERNATIONAL CHARACTER SETS
460          6.0. [247]ISO 8859-15 Latin Alphabet 9
461          6.1. [248]The HP-Roman8 Character Set
462          6.2. [249]Greek Character Sets
463          6.3. [250]Additional Latin-2 Character Sets
464          6.4. [251]Additional Cyrillic Character Sets
465          6.5. [252]Automatic Character-Set Switching
466          6.6. [253]Unicode
467          6.6.1. [254]Overview of Unicode
468          6.6.2. [255]UCS Byte Order
469          6.6.2. [256]UCS Transformation Formats
470          6.6.3. [257]Conformance Levels
471          6.6.4. [258]Relationship of Unicode with Kermit's Other Character Sets
472          6.6.5. [259]Kermit's Unicode Features
473          6.6.5.1. [260]File Transfer
474          6.6.5.2. [261]The TRANSLATE Command
475          6.6.5.3. [262]Terminal Connection
476          6.6.5.4. [263]The TRANSMIT Command
477          6.6.5.5. [264]Summary of Kermit Unicode Commands
478          6.7. [265]Client/Server Character-Set Switching
479      (7) [266]SCRIPT PROGRAMMING
480          7.0. [267]Bug Fixes
481          7.1. [268]The INPUT Command
482          7.1.1. [269]INPUT Timeouts
483          7.1.2. [270]New INPUT Controls
484          7.1.3. [271]INPUT with Pattern Matching
485          7.1.4. [272]The INPUT Match Result
486          7.2. [273]New or Improved Built-In Variables
487          7.3. [274]New or Improved Built-In Functions
488          7.4. [275]New IF Conditions
489          7.5. [276]Using More than Ten Macro Arguments
490          7.6. [277]Clarification of Function Call Syntax
491          7.7. [278]Autodownload during INPUT Command Execution
492          7.8. [279]Built-in Help for Functions.
493          7.9. [280]Variable Assignments
494          7.9.1. [281]Assignment Operators
495          7.9.2. [282]New Assignment Commands
496          7.10. [283]Arrays
497          7.10.1. [284]Array Initializers
498          7.10.2. [285]Turning a String into an Array of Words
499          7.10.3. [286]Arrays of Filenames
500          7.10.4. [287]Automatic Arrays
501          7.10.5. [288]Sorting Arrays
502          7.10.6. [289]Displaying Arrays
503          7.10.7. [290]Other Array Operations
504          7.10.8. [291]Hints for Using Arrays
505          7.10.9. [292]Do-It-Yourself Arrays
506          7.10.10. [293]Associative Arrays
507          7.11. [294]OUTPUT Command Improvements
508          7.12. [295]Function and Variable Diagnostics
509          7.13. [296]Return Value of Macros
510          7.14. [297]The ASSERT, FAIL, and SUCCEED Commands.
511          7.15. [298]Using Alarms
512          7.16. [299]Passing Arguments to Command Files
513          7.17. [300]Dialogs with Timed Responses
514          7.18. [301]Increased Flexibility of SWITCH Case Labels
515          7.19. "[302]Kerbang" Scripts
516          7.20. [303]IF and XIF Statement Syntax
517          7.20.1. [304]The IF/XIF Distinction
518          7.20.2. [305]Boolean Expressions (The IF/WHILE Condition)
519          7.21. [306]Screen Formatting and Cursor Control
520          7.22. [307]Evaluating Arithmetic Expressions
521          7.23. [308]Floating-Point Arithmetic
522          7.24. [309]Tracing Script Execution
523          7.25. [310]Compact Substring Notation
524          7.26. [311]New WAIT Command Options
525          7.26.1. [312]Waiting for Modem Signals
526          7.26.2. [313]Waiting for File Events
527          7.27. [314]Relaxed FOR and SWITCH Syntax
528      (8) [315]USING OTHER FILE TRANSFER PROTOCOLS
529      (9) [316]COMMAND-LINE OPTIONS
530          9.0. [317]Extended-Format Command-Line Options
531          9.1. [318]Command Line Personalities
532          9.2. [319]Built-in Help for Command Line Options
533          9.3. [320]New Command-Line Options
534     (10) [321]C-KERMIT AND G-KERMIT
535
536 III. [322]APPENDICES
537
538 III.1. [323]Character Set Tables
539 III.1.1. [324]The Hewlett Packard Roman8 Character Set
540 III.1.2. [325]Greek Character Sets
541 III.1.2.1. [326]The ISO 8859-7 Latin / Greek Alphabet
542 III.1.2.2. [327]The ELOT 927 Character Set
543 III.1.2.3. [328]PC Code Page 869
544 III.2. [329]Updated Country Codes
545
546 IV. [330]ERRATA & CORRIGENDA: Corrections to "Using C-Kermit" 2nd Edition.
547 V. [331]ADDITIONAL COPYRIGHT NOTICES
548      _________________________________________________________________
549
550 I. C-KERMIT DOCUMENTATION
551
552    The user manual for C-Kermit is:
553
554      Frank da Cruz and Christine M. Gianone, [332]Using C-Kermit, Second
555      Edition, Digital Press / Butterworth-Heinemann, Woburn, MA, 1997,
556      622 pages, ISBN 1-55558-164-1.
557
558    [333]CLICK HERE for reviews.
559
560    The present document is a supplement to Using C-Kermit 2nd Ed, not a
561    replacement for it.
562
563    US single-copy price: $52.95; quantity discounts available. Available
564    in bookstores or directly from Columbia University:
565
566   The Kermit Project
567   Columbia University
568   612 West 115th Street
569   New York NY  10025-7799
570   USA
571   Telephone: +1 (212) 854-3703
572   Fax:       +1 (212) 662-6442
573
574    Domestic and overseas orders accepted. Price: US $44.95 (US, Canada,
575    and Mexico). Shipping: $4.00 within the USA; $15.00 to all other
576    countries. Orders may be paid by MasterCard or Visa, or prepaid by
577    check in US dollars. Add $65 bank fee for checks not drawn on a US
578    bank. Do not include sales tax. Inquire about quantity discounts.
579
580    You can also order by phone from the publisher, Digital Press /
581    [334]Butterworth-Heinemann, with MasterCard, Visa, or American
582    Express:
583
584   +1 800 366-2665   (Woburn, Massachusetts office for USA & Canada)
585   +44 1865 314627   (Oxford, England distribution centre for UK & Europe)
586   +61 03 9245 7111  (Melbourne, Vic, office for Australia & NZ)
587   +65 356-1968      (Singapore office for Asia)
588   +27 (31) 2683111  (Durban office for South Africa)
589
590    A [335]German-language edition of the First Edition is also available:
591
592      Frank da Cruz and Christine M. Gianone, C-Kermit - Einführung und
593      Referenz, Verlag Heinz Heise, Hannover, Germany (1994). ISBN
594      3-88229-023-4. Deutsch von Gisbert W. Selke. Price: DM 88,00.
595      Verlag Heinz Heise GmbH & Co. KG, Helstorfer Strasse 7, D-30625
596      Hannover. Tel. +49 (05 11) 53 52-0, Fax. +49 (05 11) 53 52-1 29.
597
598    The [336]Kermit file transfer protocol is specified in:
599
600      Frank da Cruz, Kermit, A File Transfer Protocol, Digital Press,
601      Bedford, MA, 1987, 379 pages, ISBN 0-932376-88-6. US single-copy
602      price: $39.95. Availability as above.
603
604    News and articles about Kermit software and protocol are published
605    periodically in the journal, [337]Kermit News. Subscriptions are free;
606    contact Columbia University at the address above.
607
608    Online news about Kermit is published in the
609    [338]comp.protocols.kermit.announce and
610    [339]comp.protocols.kermit.misc newsgroups.
611      _________________________________________________________________
612
613 II. NEW FEATURES
614
615    Support for the Bell Labs Plan 9 operating system was added to version
616    6.0 too late to be mentioned in the book (although it does appear on
617    the cover).
618
619    Specific changes and additions are grouped together by major topic,
620    roughly corresponding to the chapters of [340]Using C-Kermit.
621      _________________________________________________________________
622
623   0. INCOMPATIBILITIES WITH PREVIOUS RELEASES
624
625     1. C-Kermit 7.0 uses FAST Kermit protocol settings by default. This
626        includes "unprefixing" of certain control characters. Because of
627        this, file transfers that worked with previous releases might not
628        work in the new release (but it is more likely that they will
629        work, and much faster). If a transfer fails, you'll get a
630        context-sensitive hint suggesting possible causes and cures.
631        Usually SET PREFIXING ALL does the trick.
632     2. C-Kermit 7.0 transfers files in BINARY mode by default. To restore
633        the previous behavior, put SET FILE TYPE TEXT in your C-Kermit
634        initialization file.
635     3. No matter whether FILE TYPE is BINARY or TEXT by default, C-Kermit
636        7.0 now switches between text and binary mode automatically on a
637        per-file basis according to various criteria, including (a) which
638        kind of platform is on the other end of the connection (if known),
639        (b) the version of Kermit on the other end, and (c) the file's
640        name (see [341]Section 4, especially [342]4.3). To disable this
641        automatic switching and restore the earlier behavior, put SET
642        TRANSFER MODE MANUAL in your C-Kermit initialization file. To
643        disable automatic switching for a particular transfer, include a
644        /TEXT or /BINARY switch with your SEND or GET command.
645     4. The RESEND and REGET commands automatically switch to binary mode;
646        previously if RESEND or REGET were attempted when FILE TYPE was
647        TEXT, these commands would fail immediately, with a message
648        telling you they work only when the FILE TYPE is BINARY. Now they
649        simply do this for you. See [343]Section 4.23 for additional
650        (important) information.
651     5. SET PREFIXING CAUTIOUS and MINIMAL now both prefix linefeed (10
652        and 138) in case rlogin, ssh, or cu are "in the middle", since
653        otherwise <LF>~ might appear in Kermit packets, and this would
654        cause rlogin, ssh, or cu to disconnect, suspend,escape back, or
655        otherwise wreck the file transfer. Xon and Xoff are now always
656        prefixed too, even when Xon/Xoff flow control is not in effect,
657        since unprefixing them has proven dangerous on TCP/IP connections.
658     6. In UNIX, VMS, Windows, and OS/2, the DIRECTORY command is built
659        into C-Kermit itself rather than implemented by running an
660        external command or program. The built-in command might not behave
661        the way the platform-specific external one did, but many options
662        are available for customization. Of course the underlying
663        platform-specific command can still be accessed with "!", "@", or
664        "RUN" wherever the installation does not forbid. In UNIX, the "ls"
665        command can be accessed directly as "ls" in C-Kermit. See
666        [344]Section 4.5.1 for details.
667     7. SEND ? prints a list of switches rather than a list of filenames.
668        If you want to see a list of filenames, use a (system-dependent)
669        construction such as SEND ./? (for UNIX, Windows, or OS/2), SEND
670        []? (VMS), etc. See [345]Sections 1.5 and [346]4.7.1.
671     8. In UNIX, OS-9, and Kermit 95, the wildcard characters in previous
672        versions were * and ?. In C-Kermit 7.0 they are *, ?, [, ], {, and
673        }, with dash used inside []'s to denote ranges and comma used
674        inside {} to separate list elements. If you need to include any of
675        these characters literally in a filename, precede each one with
676        backslash (\). See [347]Section 4.9.
677     9. SET QUIET { ON, OFF } is now on the command stack, just like SET
678        INPUT CASE, SET COUNT, SET MACRO ERROR, etc, as described on p.458
679        of [348]Using C-Kermit, 2nd Edition. This allows any macro or
680        command file to SET QUIET ON or OFF without worrying about saving
681        and restoring the global QUIET value. For example, this lets you
682        write a script that tries SET LINE on lots of devices until it
683        finds one free without spewing out loads of error messages, and
684        also without disturbing the global QUIET setting, whatever it was.
685    10. Because of the new "." operator (which introduces assignments),
686        macros whose names begin with "." can not be invoked "by name".
687        However, they still can be invoked with DO.
688    11. The syntax of the EVALUATE command has changed. See [349]Section
689        7.9.2. To restore the previous syntax, use SET EVALUATE OLD.
690    12. The \v(directory) variable now includes the trailing directory
691        separator; in previous releases it did not. This is to allow
692        constructions such as:
693   cd \v(dir)data.tmp
694        to work across platforms that might have different directory
695        notation, such as UNIX, Windows, and VMS.
696    13. Prior to C-Kermit 7.0, the FLOW-CONTROL setting was global and
697        sticky. In C-Kermit 7.0, there is an array of default flow-control
698        values for each kind of connection, that are applied automatically
699        at SET LINE/PORT/HOST time. Thus a SET FLOW command given before
700        SET LINE/PORT/HOST is likely to be undone. Therefore SET FLOW can
701        be guaranteed to have the desired effect only if given after the
702        SET LINE/PORT/HOST command.
703    14. Character-set translation works differently in the TRANSMIT
704        command when (a) the file character-set is not the same as the
705        local end of the terminal character-set, or (b) when the terminal
706        character-set is TRANSPARENT.
707      _________________________________________________________________
708
709   1. PROGRAM AND FILE MANAGEMENT AND COMMANDS
710
711   1.0. Bug Fixes
712
713    The following patches were issued to correct bugs in C-Kermit 6.0.
714    These are described in detail in the 6.0 PATCHES file. All of these
715    fixes have been incorporated in C-Kermit 6.1 (never released except as
716    K95 1.1.16-17) and 7.0.
717
718  0001   All UNIX         C-Kermit mishandles timestamps on files before 1970
719  0002   Solaris 2.5++    Compilation error on Solaris 2.5 with Pro C
720  0003   All VMS          CKERMIT.INI Fix for VMS
721  0004   VMS/VAX/UCX 2.0  C-Kermit 6.0 can't TELNET on VAX/VMS with UCX 2.0
722  0005   All              C-Kermit Might Send Packets Outside Window
723  0006   All              MOVE from SEND-LIST does not delete original files
724  0007   Solaris 2.5++    Higher serial speeds on Solaris 2.5
725  0008   All              C-Kermit application file name can't contain spaces
726  0009   AT&T 7300 UNIXPC setuid and hardware flow-control problems
727  0010   Linux on Alpha   Patch to make ckutio.c compile on Linux/Alpha
728  0011   OS-9/68000 2.4   Patch to make ck9con.c compile on OS-9/68000 2.4
729  0012   MW Coherent 4.2  Patches for successful build on Coherent 4.2
730  0013   SINIX-Y 5.43     "delay" variable conflicts with <sys/clock.h>
731  0014   VMS/VAX/CMU-IP   Subject: Patches for VAX/VMS 5.x + CMU-IP
732  0015   All              XECHO doesn't flush its output
733  0016   VMS              CD and other directory operations might not work
734  0017   Linux 1.2.x++    Use standard POSIX interface for high serial speeds
735  0018   UNIX             SET WILDCARD-EXPANSION SHELL dumps core
736  0019   All              Hayes V.34 modem init string problem
737  0020   All              READ command does not fail if file not open
738  0021   All              Problems with long function arguments
739  0022   All              Certain \function()s can misbehave
740  0023   All              X MOD 0 crashes program
741  0024   All              Internal bulletproofing for lower() function
742  0025   OpenBSD          Real OpenBSD support for C-Kermit 6.0
743  0026   All              Incorrect checks for macro/command-file nesting depth
744  0027   All              ANSWER doesn't automatically CONNECT
745  0028   All              Overzealous EXIT warning
746  0029   All              OUTPUT doesn't echo when DUPLEX is HALF
747  0030   All              Minor problems with REMOTE DIRECTORY/DELETE/etc
748  0031   All              CHECK command broken
749  0032   All              Problem with SET TRANSMIT ECHO
750  0033   UNIX, VMS, etc   HELP SET SERVER says too much
751  0034   All              READ and !READ too picky about line terminators
752  0035   All              END from inside SWITCH doesn't work
753  0036   All              Problem telnetting to multihomed hosts
754  0037   All              Redirection failures in REMOTE xxx > file
755
756    REDIRECT was missing in many UNIX C-Kermit implementations; in version
757    7.0, it should be available in all of them.
758      _________________________________________________________________
759
760   1.1. Command Continuation
761
762    Comments that start with ";" or "#" can no longer be continued. In:
763
764   ; this is a comment -
765   echo blah
766
767    the ECHO command will execute, rather than being taken as a
768    continuation of the preceding comment line. This allows easy
769    "commenting out" of commands from macro definitions.
770
771    However, the text of the COMMENT command can still be continued onto
772    subsequent lines:
773
774   comment this is a comment -
775   echo blah
776
777    As of version 6.0, backslash is no longer a valid continuation
778    character. Only hyphen should be used for command continuation. This
779    is to make it possible to issue commands like "cd a:\" on DOS-like
780    systems.
781
782    As of version 7.0:
783
784      * You can quote a final dash to prevent it from being a continuation
785        character:
786   echo foo\-
787        This prints "foo-". The command is not continued.
788      * You can enter commands such as:
789   echo foo - ; this is a comment
790        interactively and they are properly treated as continued commands.
791        Previously this worked only in command files.
792      _________________________________________________________________
793
794   1.2. Editor Interface
795
796    SET EDITOR name [ options ]
797           Lets you specify a text-editing program. The name can be a
798           fully specified pathname like /usr/local/bin/emacs19/emacs, or
799           it can be the name of any program in your PATH, e.g. "set
800           editor emacs". In VMS, it must be a DCL command like "edit",
801           "edit/tpu", "emacs", etc. If an environment variable EDITOR is
802           defined when Kermit starts, its value is the default editor.
803           You can also specify options to be included on the editor
804           command line. Returns to Kermit when the editor exits.
805
806    EDIT [ filename ]
807           If the EDIT command is given without a filename, then if a
808           previous filename had been given to an EDIT command, it is
809           used; if not, the editor is started without a file. If a
810           filename is given, the editor is started on that file, and the
811           filename is remembered for subsequent EDIT commands.
812
813    SHOW EDITOR
814           Displays the full pathname of your text editor, if any, along
815           with any command line options, and the file most recently
816           edited (and therefore the default filename for your next EDIT
817           command).
818
819    Related variables: \v(editor), \v(editopts), \v(editfile).
820      _________________________________________________________________
821
822   1.3. Web Browser and FTP Interface
823
824    C-Kermit includes an FTP command, which simply runs the FTP program;
825    C-Kermit does not include any built-in support for Internet File
826    Transfer Protocol, nor any method for interacting directly with an FTP
827    server. In version 7.0, however, C-Kermit lets you specify your FTP
828    client:
829
830    SET FTP-CLIENT [ name [ options ] ]
831           The name is the name of the FTP executable. In UNIX, Windows,
832           or OS/2, it can be the filename of any executable program in
833           your PATH (e.g. "ftp.exe" in Windows, "ftp" in UNIX); elsewhere
834           (or if you do not have a PATH definition), it must be the fully
835           specified pathname of the FTP program. If the name contains any
836           spaces, enclose it braces. Include any options after the
837           filename; these depend the particular ftp client.
838
839    The Web browser interface is covered in the following subsections.
840      _________________________________________________________________
841
842     1.3.1. Invoking your Browser from C-Kermit
843
844    BROWSE [ url ]
845           Starts your preferred Web browser on the URL, if one is given,
846           otherwise on the most recently given URL, if any. Returns to
847           Kermit when the browser exits.
848
849    SET BROWSER [ name [ options ] ]
850           Use this command to specify the name of your Web browser
851           program, for example: "set browser lynx". The name must be in
852           your PATH, or else it must be a fully specified filename; in
853           VMS it must be a DCL command.
854
855    SHOW BROWSER
856           Displays the current browser, options, and most recent URL.
857
858    Related variables: \v(browser), \v(browsopts), \v(browsurl).
859
860    Also see [350]Section 2.15: Contacting Web Servers with the HTTP
861    Command.
862      _________________________________________________________________
863
864     1.3.2. Invoking C-Kermit from your Browser
865
866    The method for doing this depends, of course, on your browser. Here
867    are some examples:
868
869    Netscape on UNIX (X-based)
870           In the Options->Applications section, set your Telnet
871           application to:
872
873   xterm -e /usr/local/bin/kermit/kermit -J %h %p
874
875           (replace "/usr/local/bin/kermit/kermit" by C-Kermit's actual
876           pathname). -J is C-Kermit's command-line option to "be like
877           Telnet"; %h and %p are Netscape placeholders for hostname and
878           port.
879
880    Lynx on UNIX
881           As far as we know, this can be done only at compile time. Add
882           the following line to the Lynx userdefs.h file before building
883           the Lynx binary:
884
885   #define TELNET_COMMAND "/opt/bin/kermit -J"
886
887           And then add lines like the following to the Lynx.cfg file:
888
889   DOWNLOADER:Kermit binary download:/opt/bin/kermit -i -V -s %s -a %s:TRUE
890   DOWNLOADER:Kermit text download:/opt/bin/kermit -s %s -a %s:TRUE
891
892   UPLOADER:Kermit binary upload:/opt/bin/kermit -i -r -a %s:TRUE
893   UPLOADER:Kermit text upload:/opt/bin/kermit -r -a %s:TRUE
894   UPLOADER:Kermit text get:/opt/bin/kermit -g %s:TRUE
895   UPLOADER:Kermit binary get:/opt/bin/kermit -ig %s:TRUE
896
897    But none of the above is necessary if you make C-Kermit your default
898    Telnet client, which you can do by making a symlink called 'telnet' to
899    the C-Kermit 7.0 binary. See [351]Section 9.1 for details.
900      _________________________________________________________________
901
902   1.4. Command Editing
903
904    Ctrl-W ("Word delete") was changed in 7.0 to delete back to the
905    previous non-alphanumeric, rather than all the way back to the
906    previous space.
907      _________________________________________________________________
908
909   1.5. Command Switches
910
911    As of version 7.0, C-Kermit's command parser supports a new type of
912    field, called a "switch". This is an optional command modifier.
913
914     1.5.1. General Switch Syntax
915
916    A switch is a keyword beginning with a slash (/). If it takes a value,
917    then the value is appended to it (with no intervening spaces),
918    separated by a colon (:) or equal sign (=). Depending on the switch,
919    the value may be a number, a keyword, a filename, a date/time, etc.
920    Examples:
921
922   send oofa.txt                              ; No switches
923   send /binary oofa.zip                      ; A switch without a value
924   send /protocol:zmodem oofa.zip             ; A switch with a value (:)
925   send /protocol=zmodem oofa.zip             ; A switch with a value (=)
926   send /text /delete /as-name:x.x oofa.txt   ; Several switches
927
928    Like other command fields, switches are separated from other fields,
929    and from each other, by whitespace, as shown in the examples just
930    above. You can not put them together like so:
931
932   send/text/delete/as-name:x.x oofa.txt
933
934    (as you might do in VMS or DOS, or as we might once have done in
935    TOPS-10 or TOPS0-20, or PIP). This is primarily due to ambiguity
936    between "/" as switch introducer versus "/" as UNIX directory
937    separator; e.g. in:
938
939   send /delete/as-name:foo/text oofa.txt
940
941    Does "foo/text" mean the filename is "foo" and the transfer is to be
942    in text mode, or does it mean the filename is "foo/text"? Therefore we
943    require whitespace between switches to resolve the ambiguity. (That's
944    only one of several possible ambiguities -- it is also conceivable
945    that a file called "text" exists in the path "/delete/as-name:foo/").
946
947    In general, if a switch can take a value, but you omit it, then either
948    a reasonable default value is supplied, or an error message is
949    printed:
950
951   send /print:-Plaserwriter oofa.txt         ; Value included = print options
952   send /print oofa.txt                       ; Value omitted, OK
953   send /mail:kermit@columbia.edu oofa.txt    ; Value included = address
954   send /mail oofa.txt                        ; Not OK - address required
955   ?Address required
956
957    Context-sensitive help (?) and completion (Esc or Tab) are available
958    in the normal manner:
959
960   C-Kermit> send /pr? Switch, one of the following:
961     /print /protocol
962   C-Kermit> send /pro<ESC>tocol:?  File-transfer protocol,
963    one of the following:
964     kermit   xmodem   ymodem   ymodem-g   zmodem
965   C-Kermit> send /protocol:k<TAB>ermit
966
967    If a switch takes a value and you use completion on it, a colon (:) is
968    printed at the end of its name to indicate this. If it does not take a
969    value, a space is printed.
970
971    Also, if you type ? in a switch field, switches that take values are
972    shown with a trailing colon; those that don't take values are shown
973    without one.
974      _________________________________________________________________
975
976     1.5.2. Order and Effect of Switches
977
978    The order of switches should not matter, except that they are
979    evaluated from left to right, so if you give two switches with
980    opposite effects, the rightmost one is used:
981
982   send /text /binary oofa.zip                ; Sends oofa.zip in binary mode.
983
984    Like other command fields, switches have no effect whatsoever until
985    the command is entered (by pressing the Return or Enter key). Even
986    then, switches affect only the command with which they are included;
987    they do not have global effect or side effects.
988      _________________________________________________________________
989
990     1.5.3. Distinguishing Switches from Other Fields
991
992    All switches are optional. A command that uses switches lets you give
993    any number of them, including none at all. Example:
994
995   send /binary oofa.zip
996   send /bin /delete oofa.zip
997   send /bin /as-name:mupeen.zip oofa.zip
998   send oofa.zip
999
1000    But how does Kermit know when the first "non-switch" is given? It has
1001    been told to look for both a switch and for something else, the data
1002    type of the next field (filename, number, etc). In most cases, this
1003    works well. But conflicts are not impossible. Suppose, for example, in
1004    UNIX there was a file named "text" in the top-level directory. The
1005    command to send it would be:
1006
1007   send /text
1008
1009    But C-Kermit would think this was the "/text" switch. To resolve the
1010    conflict, use braces:
1011
1012   send {/text}
1013
1014    or other circumlocutions such as "send //text", "send /./text", etc.
1015
1016    The opposite problem can occur if you give an illegal switch that
1017    happens to match a directory name. For example:
1018
1019   send /f oofa.txt
1020
1021    There is no "/f" switch (there are several switches that begin with
1022    "/f", so "/f" is ambiguous). Now suppose there is an "f" directory in
1023    the root directory; then this command would be interpreted as:
1024
1025      Send all the files in the "/f" directory, giving each one an
1026      as-name of "oofa.txt".
1027
1028    This could be a mistake, or it could be exactly what you intended;
1029    C-Kermit has no way of telling the difference. To avoid situations
1030    like this, spell switches out in full until you are comfortable enough
1031    with them to know the minimum abbreviation for each one. Hint: use ?
1032    and completion while typing switches to obtain the necessary feedback.
1033      _________________________________________________________________
1034
1035     1.5.4. Standard File Selection Switches
1036
1037    The following switches are used on different file-oriented commands
1038    (such as SEND, DIRECTORY, DELETE, PURGE) to refine the selection of
1039    files that match the given specification.
1040
1041    /AFTER:date-time
1042           Select only those files having a date-time later than the one
1043           given. See [352]Section 1.6 for date-time formats. Synonym:
1044           /SINCE.
1045
1046    /NOT-AFTER:date-time
1047           Select only those files having a date-time not later than (i.e.
1048           earlier or equal to) the one given. Synonym: /NOT-SINCE.
1049
1050    /BEFORE:date-time
1051           Select only those files having a date-time earlier than the one
1052           given.
1053
1054    /NOT-BEFORE:date-time
1055           Select only those files having a date-time not earlier than
1056           (i.e. later or equal to) the one given.
1057
1058    /DOTFILES
1059           UNIX and OS-9 only: The filespec is allowed to match files
1060           whose names start with (dot) period. Normally these files are
1061           not shown.
1062
1063    /NODOTFILES
1064           (UNIX and OS-9 only) Don't show files whose names start with
1065           dot (period). This is the opposite of /DOTFILES, and is the
1066           default. Note that when a directory name starts with a period,
1067           the directory and (in recursive operations) all its
1068           subdirectories are skipped.
1069
1070    /LARGER-THAN:number
1071           Only select files larger than the given number of bytes.
1072
1073    /SMALLER-THAN:number
1074           Only select files smaller than the given number of bytes.
1075
1076    /EXCEPT:pattern
1077           Specifies that any files whose names match the pattern, which
1078           can be a regular filename, or may contain "*" and/or "?"
1079           metacharacters (wildcards), are not to be selected. Example:
1080
1081   send /except:*.log *.*
1082
1083           sends all files in the current directory except those with a
1084           filetype of ".log". Another:
1085
1086   send /except:*.~*~ *.*
1087
1088           sends all files except the ones that look like Kermit or EMACS
1089           backup files (such as "oofa.txt.~17~") (of course you can also
1090           use the /NOBACKUP switch for this).
1091
1092           The pattern matcher is the same one used by IF MATCH string
1093           pattern ([353]Section 7.4), so you can test your patterns using
1094           IF MATCH. If you need to match a literal * or ? (etc), precede
1095           it by a backslash (\). If the pattern contains any spaces, it
1096           must be enclosed in braces:
1097
1098   send /except:{Foo bar} *.*
1099
1100           The pattern can also be a list of up to 8 patterns. In this
1101           case, the entire pattern must be enclosed in braces, and each
1102           sub-pattern must also be enclosed in braces; this eliminates
1103           the need for designating a separator character, which is likely
1104           to also be a legal filename character on some platform or
1105           other, and therefore a source of confusion. You may include
1106           spaces between the subpatterns but they are not necessary. The
1107           following two commands are equivalent:
1108
1109   send /except:{{ck*.o} {ck*.c}} ck*.?
1110   send /except:{{ck*.o}{ck*.c}} ck*.?
1111
1112           If a pattern is to include a literal brace character, precede
1113           it with "\". Also note the apparent conflict of this list
1114           format and the string-list format described in [354]Section
1115           4.9.1. In case you want to include a wildcard string-list with
1116           braces on its outer ends as an /EXCEPT: argument, do it like
1117           this:
1118
1119   send /except:{{{ckuusr.c,ckuus2.c,ckuus6.c}}} ckuus*.c
1120      _________________________________________________________________
1121
1122     1.5.5. Setting Preferences for Different Commands
1123
1124    Certain oft-used commands offer lots of switches because different
1125    people have different requirements or preferences. For example, some
1126    people want to be able to delete files without having to watch a list
1127    of the deleted files scroll past, while others want to be prompted for
1128    permission to delete each file. Different people prefer different
1129    directory-listing styles. And so on. Such commands can be tailored
1130    with the SET OPTIONS command:
1131
1132    SET OPTIONS command [ switch [ switch [ ... ] ] ]
1133           Sets each switch as the default for the given command,
1134           replacing the "factory default". Of course you can also
1135           override any defaults established by the SET OPTIONS command by
1136           including the relevant switches in the affected command any
1137           time you issue it.
1138
1139    SHOW OPTIONS
1140           Lists the commands that allows option-setting, and the options
1141           currently in effect, if any, for each. Switches that have
1142           synonyms are shown under their primary name; for example. /LOG
1143           and /VERBOSE are shown as /LIST.
1144
1145    Commands for which options may be set include DIRECTORY, DELETE,
1146    PURGE, and TYPE. Examples:
1147
1148   SET OPTIONS DIRECTORY /PAGE /NOBACKUP /HEADING /SORT:DATE /REVERSE
1149   SET OPTIONS DELETE /LIST /NOHEADING /NOPAGE /NOASK /NODOTFILES
1150   SET OPTIONS TYPE /PAGE
1151
1152    Not necessarily all of a command's switches can be set as options. For
1153    example, file selection switches, since these would normally be
1154    different for each command.
1155
1156    Put the desired SET OPTIONS commands in your C-Kermit customization
1157    file for each command whose default switches you want to change every
1158    time you run C-Kermit.
1159      _________________________________________________________________
1160
1161   1.6. Dates and Times
1162
1163    Some commands and switches take date-time values, such as:
1164
1165   send /after:{8-Feb-2000 10:28:01}
1166
1167    Various date-time formats are acceptable. The rules for the date are:
1168
1169      * The year must have 4 digits.
1170      * If the year comes first, the second field is the month.
1171      * The day, month, and year may be separated by spaces, /, -, or
1172        underscore.
1173      * The month may be numeric (1 = January) or spelled out or
1174        abbreviated in English.
1175
1176    If the date-time string contains any spaces, it must be enclosed in
1177    braces. Examples of legal dates:
1178
1179                            Interpretation:
1180   2000-Feb-8                8 February 2000
1181   {2000 Feb 8}              8 February 2000
1182   2000/Feb/8                8 February 2000
1183   2000_Feb_8                8 February 2000
1184   2000-2-8                  8 February 2000
1185   2000-02-08                8 February 2000
1186   8-Feb-2000                8 February 2000
1187   08-Feb-2000               8 February 2000
1188   12/25/2000                25 December 2000
1189   25/12/2000                25 December 2000
1190
1191    The last two examples show that when the year comes last, and the
1192    month is given numerically, the order of the day and month doesn't
1193    matter as long as the day is 13 or greater (mm/dd/yyyy is commonly
1194    used in the USA, whereas dd/mm/yyyy is the norm in Europe). However:
1195
1196   08/02/2000                Is ambiguous and therefore not accepted.
1197
1198    If a date is given, the time is optional and defaults to 00:00:00. If
1199    the time is given with a date, it must follow the date, separated by
1200    space, /, -, or underscore, and with hours, minutes, and seconds
1201    separated by colon (:). Example:
1202
1203   2000-Feb-8 10:28:01       Represents 8 February 2000, 10:28:01am
1204
1205    If a date is not given, the current date is used and a time is
1206    required.
1207
1208    Time format is hh:mm:ss or hh:mm or hh in 24-hour format, or followed
1209    by "am" or "pm" (or "AM" or "PM") to indicate morning or afternoon.
1210    Examples of times that are acceptable:
1211
1212                            Interpretation:
1213   3:23:56                    3:23:56am
1214   3:23:56am                  3:23:56am
1215   3:23:56pm                  3:23:56pm = 15:23:56
1216  15:23:56                    3:23:56pm = 15:23:56
1217   3:23pm                     3:23:00pm = 15:23:00
1218   3:23PM                     3:23:00pm = 15:23:00
1219   3pm                        3:00:00pm = 15:00:00
1220
1221    Examples of legal date-times:
1222
1223   send /after:{8 Feb 2000 10:28:01}
1224   send /after:8_Feb_2000_10:28:01
1225   send /after:8-Feb-2000/10:28:01
1226   send /after:2000/02/08/10:28:01
1227   send /after:2000/02/08_10:28:01
1228   send /after:2000/02/08_10:28:01am
1229   send /after:2000/02/08_10:28:01pm
1230   send /after:2000/02/08_10:28pm
1231   send /after:2000/02/08_10pm
1232   send /after:10:00:00pm
1233   send /after:10:00pm
1234   send /after:10pm
1235   send /after:22
1236
1237    Finally, there is a special all-numeric format you can use:
1238
1239   yyyymmdd hh:mm:ss
1240
1241    For example:
1242
1243   20000208 10:28:01
1244
1245    This is Kermit's standard date-time format (based on ISO 8601), and is
1246    accepted (among other formats) by any command or switch that requires
1247    a date-time, and is output by any function whose result is a calendar
1248    date-time.
1249
1250    There are no optional parts to this format and it must be exactly 17
1251    characters long, punctuated as shown (except you can substitute
1252    underscore for space in contexts where a single "word" is required).
1253    The time is in 24-hour format (23:00:00 is 11:00pm). This is the
1254    format returned by \fdate(filename), so you can also use constructions
1255    like this:
1256
1257   send /after:\fdate(oofa.txt)
1258
1259    which means "all files newer than oofa.txt".
1260
1261    Besides explicit dates, you can also use the any of the following
1262    shortcuts:
1263
1264    TODAY
1265           Stands for the current date at 00:00:00.
1266
1267    TODAY 12:34:56
1268           Stands for the current date at the given time.
1269
1270    YESTERDAY
1271           Stands for yesterday's date at 00:00:00. A time may also be
1272           given.
1273
1274    TOMORROW
1275           Stands for tomorrow's date at 00:00:00. A time may also be
1276           given.
1277
1278    + number { DAYS, WEEKS, MONTHS, YEARS } [ time ]
1279           Is replaced by the future date indicated, relative to the
1280           current date. If the time is omitted, 00:00:00 is used.
1281           Examples: +3days, +2weeks, +1year, +37months.
1282
1283    - number { DAYS, WEEKS, MONTHS, YEARS } [ time ]
1284
1285           Is replaced by the past date indicated, relative to the current
1286           date. If the time is omitted, 00:00:00 is used.
1287
1288    The time can be separated from the date shortcut by any of the same
1289    separators that are allowed for explicit date-times: space, hyphen,
1290    slash, period, or underscore. In switches and other space-delimited
1291    fields, use non-spaces to separate date/time fields, or enclose the
1292    date-time in braces, e.g.:
1293
1294   purge /before:-4days_12:00:00
1295   purge /before:{- 4 days 12:00:00}
1296
1297    Of course you can also use variables:
1298
1299   define \%n 43
1300   purge /before:-\%ndays_12:00:00
1301
1302    Shortcut names can be abbreviated to any length that still
1303    distinguishes them from any other name that can appear in the same
1304    context, e.g. "TOD" for today, "Y" for yesterday. Also, the special
1305    abbreviation "wks" is accepted for WEEKS, and "yrs" for "YEARS".
1306
1307    (To see how to specify dates relative to a specific date, rather than
1308    the current one, see the [355]\fmjd() function description below.)
1309
1310    You can check date formats with the DATE command. DATE by itself
1311    prints the current date and time in standard format: yyyymmdd
1312    hh:mm:ss. DATE followed by a date and/or time (including shortcuts)
1313    converts it to standard format if it can understand it, otherwise it
1314    prints an error message.
1315
1316    The following variables and functions deal with dates and times; any
1317    function argument designated as "date-time" can be in any of the
1318    formats described above.
1319
1320    \v(day)
1321           The first three letters of the English word for the current day
1322           of the week, e.g. "Wed".
1323
1324    \fday(date-time)
1325           The first three letters of the English word for day of the week
1326           of the given date. If a time is included, it is ignored.
1327           Example: \fday(8 Feb 1988) = "Mon".
1328
1329    \v(nday)
1330           The numeric day of the week: 0 = Sunday, 1 = Monday, ..., 6 =
1331           Saturday.
1332
1333    \fnday(date-time)
1334           The numeric day of the week for the given date. If a time is
1335           included, it is ignored. Example: \fnday(8 Feb 1988) = "1".
1336
1337    \v(date)
1338           The current date as dd mmm yyyy, e.g. "08 Feb 2000" (as in this
1339           example, a leading zero is supplied for day-of-month less than
1340           10).
1341
1342    \v(ndate)
1343           The current date in numeric format: yyyymmdd, e.g. "20000208".
1344
1345    \v(time)
1346           The current time as hh:mm:ss, e.g. "15:27:14".
1347
1348    \ftime(time)
1349           The given free-format date and/or time (e.g. "3pm") returns the
1350           time (without the date) converted to hh:mm:ss 24-hour format,
1351           e.g. "15:00:00" (the date, if given, is ignored).
1352
1353    \v(ntime)
1354           The current time as seconds since midnight, e.g. "55634".
1355
1356    \v(tftime)
1357           The elapsed time of the most recent file-transfer operation in
1358           seconds.
1359
1360    \v(intime)
1361           The elapsed time for the most recent INPUT command to complete,
1362           in milliseconds.
1363
1364    \fntime(time)
1365           The given free-format date and/or time is converted to seconds
1366           since midnight (the date, if given, is ignored). This function
1367           replaces \ftod2secs(), which is now a synonym for \fntime().
1368           Unlike \ftod2secs(), \fntime() allows a date to be included,
1369           and it allows the time to be in free format (like 3pm), and it
1370           allows the amount of time to be more than 24 hours. E.g.
1371           \fntime(48:00:00) = 172800. Example of use:
1372
1373   set alarm \fntime(48:00:00) ; set alarm 48 hours from now.
1374
1375    \fn2time(seconds)
1376           The given number of seconds is converted to hh:mm:ss format.
1377
1378    \fdate(filename)
1379           Returns the modification date-time of the given file in
1380           standard format: yyyymmdd hh:mm:ss.
1381
1382    \fcvtdate(date-time)
1383           Converts a free-format date and/or time to Kermit standard
1384           format: yyyymmdd hh:mm:ss. If no argument is given, returns the
1385           current date-time in standard format. If a date is given but no
1386           time, the converted date is returned without a time. If a time
1387           is given with no date, the current date is supplied. Examples:
1388
1389   \fcvtdate(4 Jul 2000 2:21:17pm) = 20000704 14:21:17
1390   \fcvtdate() = 20000704 14:21:17 (on 4 Jul 2000 at 2:21:17pm).
1391   \fcvtd(4 Jul 2000) = 20000704
1392   \fcvtd(6pm) = 20000704 18:00:00 (on 4 Jul 2000 at 6:00pm).
1393
1394    \fdayofyear(date-time)
1395    \fdoy(date-time)
1396           Converts a free-format date and/or time to yyyyddd, where ddd
1397           is the 3-digit day of the year, and 1 January is Day 1. If a
1398           time is included with the date, it is returned in standard
1399           format. If a date is included but no time, the date is returned
1400           without a time. If a time is given with no date, the time is
1401           converted and the current date is supplied. If no argument is
1402           given, the current date-time is returned. Synonym: \fdoy().
1403           Examples:
1404
1405   \fddayofyear(4 Jul 2000 2:21:17pm) = 2000185 14:21:17
1406   \fdoy() = 2000185 14:21:17 (on 4 Jul 2000 at 2:21:17pm).
1407   \fdoy(4 Jul 2000) = 2000185
1408   \fdoy(6pm) = 2000185 18:00:00 (on 4 Jul 2000 at 6:00pm).
1409
1410    Note: The yyyyddd day-of-year format is often erroneously referred to
1411    as a Julian date. However, a true Julian date is a simple counting
1412    number, the number of days since a certain fixed day in the past.
1413    [356]See \fmjd() below.
1414
1415    \fdoy2date(date-time)
1416           Converts a date or date-time in day-of-year format to a
1417           standard format date. A yyyyddd-format date must be supplied;
1418           time is optional. The given date is converted to yyyymmdd
1419           format. If a time is given, it is converted to 24-hour format.
1420           Examples:
1421
1422   \fdoy2date(2000185) = 20000704
1423   \fdoy2(2000185 3pm) = 20000704 15:00:00
1424
1425    \fmjd(date-time)
1426           Converts free-format date and/or time to a Modified Julian Date
1427           (MJD), the number of days since 17 Nov 1858 00:00:00. If a time
1428           is given, it is ignored. Examples:
1429
1430   \fmjd(4 Jul 2000) = 50998
1431   \fmjd(17 Nov 1858) = 0
1432   \fmjd(16 Nov 1858) = -1
1433
1434    \fmjd2date(mjd)
1435           Converts an MJD (integer) to standard date format, yyyymmdd:
1436
1437   \fmjd2(50998) = 4 Jul 1998
1438   \fmjd2(0) = 17 Nov 1858
1439   \fmjd2(-1) = 16 Nov 1858
1440   \fmjd2(-365) = 17 Nov 1857
1441
1442    MJDs are normal integers and, unlike DOYs, may be added, subtracted,
1443    etc, with each other or with other integers, to obtain meaningful
1444    results. For example, to find out the date 212 days ago:
1445
1446   echo \fmjd2date(\fmjd()-212)
1447
1448    Constructions such as this can be used in any command where a
1449    date-time is required, e.g.:
1450
1451   send /after:\fmjd2date(\fmjd()-212)
1452
1453    to send all files that are not older than 212 days (this is equivalent
1454    to "send /after:-212days").
1455
1456    MJDs also have other regularities not exhibited by other date formats.
1457    For example, \fmodulus(\fmjd(any-date),7) gives the day of the week
1458    for any date (where 4=Sun, 5=Mon, ..., 3=Sat). (However, it is easier
1459    to use \fnday() for this purpose, and it gives the more conventional
1460    result of 0=Sun, 1=Mon, ..., 6=Sat).
1461
1462    Note that if MJDs are to be compared, they must be compared
1463    numerically (IF <, =, >) and not lexically (IF LLT, EQUAL, LGT),
1464    whereas DOYs must be compared lexically if they include a time (which
1465    contains ":" characters); however, if DOYs do not include a time, they
1466    may also be compared numerically.
1467
1468    In any case, lexical comparison of DOYs always produces the
1469    appropriate result, as does numeric comparison of MJDs.
1470
1471    The same comments apply to sorting. Also note that DOYs are fixed
1472    length, but MJDs can vary in length. However, all MJDs between 3 April
1473    1886 and 30 Aug 2132 are 5 decimal digits long. (MJDs become 6 digits
1474    long on 31 Aug 2132, and 7 digits long on 13 Oct 4596).
1475      _________________________________________________________________
1476
1477   1.7. Partial Completion of Keywords
1478
1479    Partial completion of keywords was added in C-Kermit 7.0. In prior
1480    versions, if completion was attempted (by pressing the Esc or Tab key)
1481    on a string that matched different keywords, you'd just get a beep.
1482    Now Kermit completes up to the first character where the possibly
1483    matching keywords differ and then beeps. For example:
1484
1485   C-Kermit> send /n<Tab>
1486
1487    which matches /NOT-BEFORE and /NOT-AFTER, now completes up to the
1488    dash:
1489
1490   C-Kermit> send /n<Tab>ot-<Beep>
1491
1492    Partial completion works for filenames too (as it has for some years).
1493      _________________________________________________________________
1494
1495   1.8. Command Recall
1496
1497    C-Kermit has had a command history buffer for some time, which could
1498    be scrolled interactively using control characters or (in Kermit 95
1499    only) arrow keys. Version 7.0 adds a REDO command that allows the most
1500    recent command matching a given pattern to be re-executed:
1501
1502    { REDO, RR, ^ } [ pattern ]
1503           Search the command history list for the most recent command
1504           that matches the given pattern, and if one is found, execute it
1505           again.
1506
1507    The pattern can be a simple string (like "send"), in which case the
1508    last SEND command is re-executed. Or it can contain wildcard
1509    characters "*" and/or "?", which match any string and any single
1510    character, respectively (note that "?" must be preceded by backslash
1511    to override its normal function of giving help), and in most C-Kermit
1512    versions may also include [] character lists and {} string lists (see
1513    [357]Section 4.9).
1514
1515    The match works by appending "*" to the end of the given pattern (if
1516    you didn't put one there yourself). Thus "redo *oofa" becomes "redo
1517    *oofa*" and therefore matches the most recent command that contains
1518    "oofa" anywhere within the command. If you want to inhibit the
1519    application of the trailing "*", e.g. to force matching a string at
1520    the end of a command, enclose the pattern in braces:
1521
1522   redo {*oofa}
1523
1524    matches the most recent command that ends with "oofa".
1525
1526    REDO commands themselves are not entered into the command history
1527    list. If no pattern is given, the previous (non-REDO) command is
1528    re-executed. The REDOne command is reinserted at the end of the
1529    command history buffer, so the command scrollback character (Ctrl-P,
1530    Ctrl-B, or Uparrow) can retrieve it.
1531
1532    Examples:
1533
1534   C-Kermit> echo foo
1535   foo
1536   C-Kermit> show alarm
1537   (no alarm set)
1538   C-Kermit> echo blah
1539   blah
1540   C-Kermit> redo          ; Most recent command
1541   blah
1542   C-Kermit> redo s        ; Most recent command starting with "s"
1543   (no alarm set)
1544   C-Kermit> redo echo f   ; Most recent command starting with "echo f"
1545   foo
1546   C-Kermit> redo *foo     ; Most recent command that has "foo" in it
1547   foo
1548   C-Kermit> <Ctrl-P>      ; Scroll back
1549   C-Kermit> echo foo      ; The REDOne command is there
1550   C-Kermit> redo {*foo}   ; Most recent command that ends with "foo"
1551   foo
1552   C-Kermit>
1553
1554    Since REDO, REDIAL, and REDIRECT all start the same way, and RED is
1555    the designated non-unique abbreviation for REDIAL, REDO must be
1556    spelled out in full. For convenience, RR is included as an invisible
1557    easy-to-type synonym for REDO. You can also use the "^" character for
1558    this:
1559
1560   C-Kermit> ^             ; Most recent command
1561   C-Kermit> ^ s           ; Most recent command starting with "s"
1562   C-Kermit> ^s            ; Ditto (space not required after "^").
1563   C-Kermit> ^*foo         ; Most recent command that has "foo" in it.
1564   C-Kermit> ^{*foo}       ; Most recent command ends with "foo".
1565
1566    Unlike the manual command-history-scrolling keys, the REDO command can
1567    be used in a script, but it's not recommended (since the command to be
1568    REDOne might not be found, so if the REDO command fails, you can't
1569    tell whether it was because REDO failed to find the requested command,
1570    or because the command was found but it failed).
1571      _________________________________________________________________
1572
1573   1.9. EXIT Messages
1574
1575    The EXIT and QUIT commands now accept an optional message to be
1576    printed. This makes the syntax of EXIT and QUIT just like END and
1577    STOP:
1578
1579    { EXIT, QUIT, END, STOP } [ status-code [ message ] ]
1580
1581    where status-code is a number (0 indicating success, nonzero
1582    indicating failure). This is handy in scripts that are never supposed
1583    to enter interactive mode:
1584
1585   dial 7654321
1586   if fail exit 1 Can't make connection - try again later.
1587
1588    Previously this could only be done in two steps:
1589
1590   dial 7654321
1591   xif fail { echo Can't make connection - try again later, exit 1 }
1592
1593    A status code must be included in order to specify a message. In the
1594    case of EXIT and QUIT, the default status code is contained in the
1595    variable \v(exitstatus), and is set automatically by various events
1596    (file transfer failures, etc; it can also be set explicitly with the
1597    SET EXIT STATUS command). If you want to give an EXIT or QUIT command
1598    with a message, but without changing the exit status from what it
1599    normally would have been, use the \v(exitstatus) variable, e.g.:
1600
1601    exit \v(existatus) Goodbye from \v(cmdfile).
1602
1603    The EXIT status is returned to the system shell or whatever other
1604    process invoked C-Kermit, e.g. in UNIX:
1605
1606   C-Kermit> exit 97 bye bye
1607   bye bye
1608   $ echo $?
1609   97
1610   $
1611      _________________________________________________________________
1612
1613   1.10. Managing Keyboard Interruptions
1614
1615    When C-Kermit is in command or file-transfer mode (as opposed to
1616    CONNECT mode), it can be interrupted with Ctrl-C. Version 7.0 adds the
1617    ability to disarm the Ctrl-C interrupt:
1618
1619    SET COMMAND INTERRUPT { ON, OFF }
1620           COMMAND INTERRUPT is ON by default, meaning the Ctrl-C can be
1621           used to interrupt a command or a file transfer in progress. Use
1622           OFF to disable these interruptions, and use it with great
1623           caution for obvious reasons.
1624
1625    SET TRANSFER INTERRUPT { ON, OFF }
1626           This can be used to disable keyboard interruption of file
1627           transfer when C-Kermit is in local mode, or to re-enable it
1628           after it has been disabled. This applies to the X, Z, E, and
1629           similar keys as well as to the system interrupt character,
1630           usually Ctrl-C. This is distinct from SET TRANSFER
1631           CANCELLATION, which tells whether packet mode can be exited by
1632           sending a special sequence of characters.
1633
1634    Several other commands can be interrupted by pressing any key while
1635    they are active. Version 7.0 adds the ability to disable this form of
1636    interruption also:
1637
1638    SET INPUT CANCELLATION { ON, OFF }
1639           Whether an INPUT command in progress can be interrupted by
1640           pressing a key. Normally ON. Setting INPUT CANCELLATION OFF
1641           makes INPUT commands uninterruptible except by Ctrl-C (unless
1642           COMMAND INTERRUPTION is also OFF).
1643
1644    SET SLEEP CANCELLATION { ON, OFF }
1645           Whether a SLEEP, PAUSE, or WAIT command in progress can be
1646           interrupted by pressing a key. Normally ON. Setting SLEEP
1647           CANCELLATION OFF makes these commands uninterruptible except by
1648           Ctrl-C (unless COMMAND INTERRUPTION is also OFF). Synonyms: SET
1649           PAUSE CANCELLATION, SET WAIT CANCELLATION.
1650
1651    So to make certain a script is not interruptible by the user, include
1652    these commands:
1653
1654   SET TRANSFER INTERRUPT OFF
1655   SET SLEEP CANCELLATION OFF
1656   SET INPUT CANCELLATION OFF
1657   SET COMMAND INTERRUPTION OFF
1658
1659    Make sure to turn them back on afterwards if interruption is to be
1660    re-enabled.
1661
1662    When a PAUSE, SLEEP, WAIT, or INPUT command is interrupted from the
1663    keyboard, the new variable \v(kbchar) contains a copy of the (first)
1664    character that was typed and caused the interruption, provided it was
1665    not the command interrupt character (usually Ctrl-C). If these
1666    commands complete successfully or time out without a keyboard
1667    interruption, the \v(kbchar) variable is empty.
1668
1669    The \v(kbchar) variable (like any other variable) can be tested with:
1670
1671   if defined \v(kbchar) command
1672
1673    The command is executed if the variable is not empty.
1674
1675    The \v(kbchar) variable can be reset with WAIT 0 (PAUSE 0, SLEEP 0,
1676    etc).
1677      _________________________________________________________________
1678
1679   1.11. Taming The Wild Backslash -- Part Deux
1680
1681    [358]Using C-Kermit, 2nd Edition, contains a brief section, "Taming
1682    the Wild Backslash", on page 48, which subsequent experience has shown
1683    to be inadequate for Kermit users intent on writing scripts that deal
1684    with Windows, DOS, and OS/2 filenames, in which backslash (\) is used
1685    as the directory separator. This section fills in the blanks.
1686
1687     1.11.1. Background
1688
1689    The Kermit command language shares a certain unavoidable but annoying
1690    characteristic with most other command languages that are capable of
1691    string replacement, namely the necessity to "quote" certain characters
1692    when you want them to be taken literally. This is a consequence of the
1693    facts that:
1694
1695     1. One or more characters must be set aside to denote replacement,
1696        rather than acting as literal text.
1697     2. We have only 96 printable characters to work with in ASCII, which
1698        is still the only universally portable character set.
1699     3. There is no single printable character that is unused everywhere.
1700     4. Variables are not restricted to certain contexts, as they are in
1701        formal programming languages like C and Fortran, but can appear
1702        anywhere at all within a command, and therefore require special
1703        syntax.
1704
1705    Thus there can be conflicts. To illustrate, the standard UNIX shell
1706    uses dollar sign ($) to introduce variables. So the shell command:
1707
1708   echo $TERM
1709
1710    displays the value of the TERM variable, e.g. vt320. But suppose you
1711    want to display a real dollar sign:
1712
1713   echo The price is $10.20
1714
1715    This causes the shell to evaluate the variable "$1", which might or
1716    might not exist, and substitute its value, e.g.:
1717
1718   The price is 0.20
1719
1720    (in this case the $1 variable had no value.) This is probably not what
1721    you wanted. To force the dollar sign to be taken literally, you must
1722    apply a "quoting rule", such as "precede a character by backslash (\)
1723    to force the shell to take the character literally":
1724
1725   echo The price is \$10.20
1726   The price is $10.20
1727
1728    But now suppose you want the backslash AND the dollar sign to be taken
1729    literally:
1730
1731   echo The price is \\$10.20
1732
1733    This doesn't work, since the first backslash quotes the second one,
1734    thereby leaving the dollar sign unquoted again:
1735
1736   The price is \0.20
1737
1738    Quoting the dollar sign requires addition of a third backslash:
1739
1740   echo The price is \\\$10.20
1741   The price is \$10.20
1742
1743    The first backslash quotes the second one, and the third backslash
1744    quotes the dollar sign.
1745
1746    Every command language -- all UNIX shells, VMS DCL, DOS Batch, AOS/VS
1747    CLI, etc etc -- has similar rules. UNIX shell rules are probably the
1748    most complicated, since many printable characters -- not just one --
1749    are special there: dollar sign, single quote, double quote, backslash,
1750    asterisk, accent grave, number sign, ampersand, question mark,
1751    parentheses, brackets, braces, etc -- practically every
1752    non-alphanumeric character needs some form of quoting if it is to be
1753    taken literally. And to add to the confusion, the UNIX shell offers
1754    many forms of quoting, and many alternative UNIX shells are available,
1755    each using slightly different syntax.
1756      _________________________________________________________________
1757
1758     1.11.2. Kermit's Quoting Rules
1759
1760    Kermit's basic quoting rules are simple by comparison (there are, of
1761    course, additional syntax requirements for macro definitions, command
1762    blocks, function calls, etc, but they are not relevant here).
1763
1764    The following characters are special in Kermit commands:
1765
1766    Backslash (\)
1767           Introduces a variable, or the numeric representation of a
1768           special character, or a function, or other item for
1769           substitution. If the backslash is followed by a digit or by any
1770           of the following characters:
1771
1772   x, o, d, m, s, f, v, $, %, &, :, {
1773
1774           this indicates a special substitution item; otherwise the
1775           following character is to be taken literally (exceptions: \ at
1776           end of line is taken literally; \n, \b, and \n are special
1777           items in the OUTPUT command only).
1778
1779    Semicolon (;)
1780           (Only when at the beginning of a line or preceded by at least
1781           one space or tab) Introduces a comment.
1782
1783    Number sign (#)
1784           (Only when at the beginning of a line or preceded by at least
1785           one space or tab) Just like semicolon; introduces a comment.
1786
1787    Question mark (?)
1788           (Only at the command prompt - not in command files or macros)
1789           Requests context-sensitive help.
1790
1791    To force Kermit to take any of these characters literally, simply
1792    precede it by a backslash (\).
1793
1794    Sounds easy! And it is, except when backslash also has a special
1795    meaning to the underlying operating system, as it does in DOS,
1796    Windows, and OS/2, where it serves as the directory separator in
1797    filenames such as:
1798
1799   D:\K95\KEYMAPS\READ.ME
1800
1801    Using our rule, we would need to refer to this file in Kermit commands
1802    as follows:
1803
1804   D:\\K95\\KEYMAPS\\READ.ME
1805
1806    But this would not be obvious to new users of Kermit software on DOS,
1807    Windows, or OS/2, and it would be annoying to seasoned ones. Thus
1808    MS-DOS Kermit and Kermit 95 go to rather extreme lengths to allow the
1809    more natural notation, as in:
1810
1811   send d:\k95\keymaps\read.me
1812
1813    The reason this is tricky is that we also need to allow for variables
1814    and other expressions introduced by backslash in the same command. For
1815    example, suppose \%a is a variable whose value is "oofa" (without the
1816    quotes). What does the following command do?
1817
1818   send d:\%a
1819
1820    Does it send the file named "oofa" in the current directory of the D:
1821    disk, or does it send a file named "%a" in the root directory of the
1822    D: disk? This is the kind of trouble we get into when we attempt to
1823    bend the rules in the interest of user friendliness. (The answer is:
1824    if the variable \%a has definition that is the name of an existing
1825    file, that file is sent; if a file d:\%a exists, it is sent; otherwise
1826    if both conditions are true, the variable takes precedence, and the
1827    literal filename can be forced by quoting: \\%a.)
1828
1829    In Kermit 95 (but not MS-DOS Kermit), we also bend the rules another
1830    way by allowing you to use forward slash (/) rather than backslash (\)
1831    as the directory separator:
1832
1833   send d:/k95/keymaps/read.me
1834
1835    This looks more natural to UNIX users, and in fact is perfectly
1836    acceptable to the Windows 95/98/NT and OS/2 operating systems on the
1837    API level. BUT (there is always a "but") the Microsoft shell,
1838    COMMAND.COM, for Windows 95/98 and NT does not allow this notation,
1839    and therefore it can not be used in any Kermit command -- such as RUN
1840    -- that invokes the Windows command shell AND your command shell is
1841    COMMAND.COM or any other shell that does not allow forward slash as
1842    directory separator (some alternative shells do allow this).
1843
1844      NOTE: There exists a wide variety of alternative shells from third
1845      parties that do not have this restriction. If you are using a shell
1846      that accepts forward slash as a directory separator, you can stop
1847      reading right now -- UNLESS (there is always an "unless") you want
1848      your scripts to be portable to systems that have other shells. Also
1849      note that some Windows shells might actually REQUIRE forward
1850      slashes (instead of backslashes) as directory separators; we do not
1851      treat this situation below, but the treatment is obvious -- use
1852      slash rather backslash as the directory separator.
1853      _________________________________________________________________
1854
1855     1.11.3. Passing DOS Filenames from Kermit to Shell Commands
1856
1857    The following Kermit commands invoke the system command shell:
1858
1859   RUN (and its synonyms ! and @)
1860   REDIRECT
1861   PIPE
1862
1863    Each of these commands takes a shell command as an operand. These
1864    shell commands are not, and can not be, parsed by Kermit since Kermit
1865    does not know the syntax of shell commands, and so can't tell the
1866    difference between a keyword, a filename, a variable, a switch, or
1867    other item. Therefore the rules can not be bent since Kermit doesn't
1868    know where or how to bend them. To illustrate (using the regular
1869    Windows shell):
1870
1871   run c:\\windows\\command\\chkdsk.exe
1872
1873    works OK, but:
1874
1875   run c:/windows/command/chkdsk.exe
1876
1877    is not accepted by COMMAND.COM. But:
1878
1879   run c:\windows\command\chkdsk.exe
1880
1881    results in Kermit applying its quoting rules before sending the text
1882    to the shell. Since "w" and "c" are not in the list of backslash-item
1883    codes, the backslash means "take the following character literally".
1884    Thus, by the time this filename gets to the Windows shell, it has
1885    become:
1886
1887   c:windowscommandchkdsk.exe
1888
1889    which is probably not what you wanted. (If "w" and "c" were in the
1890    list, the results could be even stranger.) Even more confusing is the
1891    case where a directory or filename starts with one or more digits:
1892
1893   run c:\123\lotus.exe
1894
1895    in which "\123" is the Kermit notation for ASCII character 123, which
1896    happens to be left brace ({), resulting in "c:{lotus.exe".
1897
1898    So when passing filenames to a Windows shell, always use double
1899    backslashes as directory separators, to ensure that the shell gets
1900    single backslashes:
1901
1902   run c:\\windows\\command\\chkdsk.exe
1903   run c:\\123\\lotus.exe
1904
1905    Similar problems might occur with the built-in EDIT, BROWSE, and FTP
1906    commands. These commands result in Kermit building a shell command
1907    internally to invoke the associated helper program; the form of this
1908    command might conflict with the form demanded by certain alternative
1909    shells.
1910      _________________________________________________________________
1911
1912     1.11.4. Using Variables to Hold DOS Filenames
1913
1914    Now to the next level. Suppose you want to write a script in which
1915    filenames are parameters, and therefore are stored in variables.
1916    Example:
1917
1918   define \%f c:\windows\command\chkdsk.exe
1919   ...
1920   run \%f
1921
1922    Obviously this won't work for the reasons just noted; the RUN command
1923    requires directory separators be coded as double backslashes:
1924
1925   define \%f c:\\windows\\command\\chkdsk.exe
1926   ...
1927   run \%f
1928
1929    This will work; no surprises here. However, if you had used ASSIGN
1930    rather than DEFINE, you might have been surprised after all; review
1931    pages 348-349 of [359]Using C-Kermit (2nd Ed) for the difference
1932    between DEFINE and ASSIGN.
1933
1934    We have said that any Kermit 95 or MS-DOS Kermit command that parses
1935    filenames itself -- SEND, for example -- does not require double
1936    backslashes since it knows it is parsing a filename. So since the
1937    following works:
1938
1939   send c:\windows\command\chkdsk.exe
1940
1941    Should the following also work?
1942
1943   define \%f c:\windows\command\chkdsk.exe
1944   ...
1945   send \%f
1946
1947    Answer: No. Why? Because \%f is evaluated "recursively", to allow for
1948    the possibility that its definition contains further variable
1949    references. This is true of all "backslash-percent-letter" (or -digit)
1950    variables, and also for array references. So \%f becomes
1951    c:\windows\command\chkdsk.exe, which becomes
1952    c:windowscommandchkdsk.exe.
1953
1954    The trick here is to use the "other" kind of variable, that is
1955    evaluated only "one level deep" rather than recursively:
1956
1957   define filename c:\windows\command\chkdsk.exe
1958   ...
1959   send \m(filename)
1960
1961    Similarly if you want to prompt the user for a filename:
1962
1963   ask filename { Please type a filename: }
1964    Please type a filename: c:\windows\command\chkdsk.exe
1965   send \m(filename)
1966      _________________________________________________________________
1967
1968     1.11.5. Passing DOS Filenames as Parameters to Macros
1969
1970    Suppose you want to pass a DOS filename containing backslashes as a
1971    parameter to a Kermit macro. This raises two issues:
1972
1973     1. Parameters to macros are "just text" and so are fully evaluated
1974        before they are passed to the macro.
1975     2. Once inside the macro, the formal parameters \%1, \%2, ... \%9 are
1976        the type of variable that is evaluated recursively.
1977
1978    Thus a DOS filename is ruined once in the act of parsing the macro
1979    invocation, and again when referring to it from within the macro. To
1980    illustrate, suppose "test" is a macro. Then in the invocation:
1981
1982   test c:\mydir\blah.txt
1983
1984    "c:mydirblah.txt" is assigned to \%1. However, if we double the
1985    backslashes:
1986
1987   test c:\\mydir\\blah.txt
1988
1989    "c:\mydir\blah.txt" is assigned to \%1. But then when you refer to \%1
1990    in the macro, it is evaluated recursively, resulting in
1991    "c:mydirblah.txt". To illustrate:
1992
1993   define test echo \%1
1994   test c:\mydir\blah.txt
1995   c:mydirblah.txt
1996   test c:\\mydir\\blah.txt
1997   c:mydirblah.txt
1998   test c:\\\\mydir\\\\blah.txt
1999   c:\mydir\blah.txt
2000
2001    Let's address each part of the problem separately. First, inside the
2002    macro. You can use the \fcontents() function to force a
2003    backslash-percent variable (such as a macro argument) to be evaluated
2004    one level deep instead of recursively, for example:
2005
2006   define test echo { The filename is "\fcontents(\%1)"}
2007
2008   test c:\mydir\blah.txt               ; We don't expect this to work
2009    The filename is "c:mydirblah.txt"   ; and it doesn't.
2010   test c:\\mydir\\blah.txt             ; But this does...
2011    The filename is "c:\mydir\blah.txt"
2012
2013    Thus if the filename arrives inside the macro with single backslashes,
2014    the backslashes are preserved if you always refer to the parameter
2015    through the \fcontents() function.
2016
2017    Now how to ensure that backslashes are not stripped or misinterpreted
2018    when passing a filename to a macro? This brings us back to what we
2019    learned in earlier sections:
2020
2021     1. If it is a literal filename, either double the backslashes, or (if
2022        the filename is to be used only within Kermit itself and not
2023        passed to a DOS shell, or it is to be passed to an alternative
2024        shell that accepts forward slash as a directory separator), use
2025        forward slash instead of backslash as the directory separator.
2026     2. If it is a variable that contains a filename, make sure you use a
2027        macro-style variable name, rather than a
2028        backslash-percent-character name.
2029
2030    Examples:
2031
2032   define test echo \fcontents(\%1)
2033   define filename c:\mydir\blah.txt
2034
2035   test c:\\mydir\\blah.txt  ; Literal filename with double backslashes
2036   c:\mydir\blah.txt
2037
2038   test c:/mydir/blah.txt    ; Literal filename with forward slashes
2039   c:/mydir/blah.txt
2040
2041   test \m(filename)         ; Variable
2042   c:\mydir\blah.txt
2043
2044    But what if you don't like these rules and you still want to pass a
2045    literal filename containing single backslashes to a macro? This is
2046    possible too, but a bit tricky: turn command quoting off before
2047    invoking the macro, and then turn it back on inside the macro.
2048    Example:
2049
2050   define test set command quoting on, echo \fcontents(\%1)
2051
2052   set command quoting off
2053   test c:\mydir\blah.txt
2054   c:\mydir\blah.txt
2055
2056    Upon return from the macro, command quoting is back on (since the
2057    macro turned it on).
2058
2059    Obviously this trick can not be used if the filename is stored in a
2060    variable, since it prevents the variable from being evaluated.
2061      _________________________________________________________________
2062
2063     1.11.6. Passing DOS File Names from Macro Parameters to the DOS Shell
2064
2065    Now suppose you need to pass a DOS filename to a macro, and the macro
2066    needs to pass it, in turn, to the Windows shell via (say) Kermit's RUN
2067    command. This works too:
2068
2069   define xrun run \fcontents(\%1)
2070   xrun c:\\windows\\command\\chkdsk.exe
2071
2072    (or you can use the SET COMMAND QUOTING OFF / ON technique described
2073    above to avoid the double backslashes.) But..
2074
2075   xrun c:/windows/command/chkdsk.exe
2076
2077    does not work if the Windows shell does not recognize "/" as a
2078    directory separator. If there is a chance that a filename might be
2079    passed to the macro in this form, the macro will need to convert it to
2080    a form acceptable to the shell:
2081
2082   define xrun run \freplace(\fcontents(\%1),/,\\)
2083
2084    Here we replace all occurrences (if any) of "/" in the argument with
2085    "\" prior to issuing the RUN command. Of course, in order to specify
2086    "\" as a literal character in the \freplace() argument list, we have
2087    to double it.
2088      _________________________________________________________________
2089
2090     1.11.7. Passing DOS Filenames to Kermit from the Shell
2091
2092    As noted in the manual, the \&@[] array contains Kermit's command-line
2093    arguments. Suppose one of these arguments, say \&@[3], is a DOS
2094    filename such as C:\FOO\BAR\BAZ\OOFA.TXT. (Note: In C-Kermit 7.0 and
2095    K95 1.1.18 and later, command-line arguments after "=" or "--" are
2096    also available in the top-level \%1..9 variables; see [360]Section
2097    7.5.)
2098
2099    Of course you can eliminate any problems by using forward slashes
2100    rather than backslashes in the filename, but sometimes this is not
2101    possible, as when the Kermit command line is being generated by
2102    another program than can only generate "native" format DOS filenames.
2103
2104    As noted in the manual, "\%x" variables and \&x[] arrays are always
2105    evaluated "all the way" (recursively). If the contents of one of these
2106    variables contains backslashes, this causes another level of
2107    evaluation.
2108
2109    There is another kind of variable, which is evaluated only "one level
2110    deep". You can use this to prevent interpretation of the backslashes
2111    in the filenames. Example:
2112
2113   assign filename \fcontents(\&@[3])  ; Transfer contents
2114   ...
2115   send \m(filename)
2116
2117    Or, more simply:
2118
2119   send \fcontents(\&@[3])
2120      _________________________________________________________________
2121
2122   1.12. Debugging
2123
2124    The debug log is produced when you give a "log debug" command. This is
2125    normally done at the request of the Kermit help desk, for forwarding
2126    to the Kermit developers for analysis as a last resort in
2127    troubleshooting problems. (Last resort because it can grow quite huge
2128    in a very short time.) In cases where timing information is critical
2129    to understanding a problem, you can tell C-Kermit to put a timestamp
2130    on each debug log line by giving the command:
2131
2132   SET DEBUG TIMESTAMP ON
2133
2134    At any time before or after activating the debug log (SET DEBUG
2135    TIMESTAMP OFF turns off timestamping). Timestamps can be turned off
2136    and on as desired while logging. Obviously, they increase the size and
2137    growth rate of the log significantly, and so should be used sparingly.
2138    Timestamps are of the form hh:mm:ss.xxx, where .xxx is thousands of a
2139    second (but is included only on platforms that include this feature).
2140      _________________________________________________________________
2141
2142   1.13. Logs
2143
2144    In UNIX C-Kermit and in K-95, you can now direct any log to a pipe.
2145    This not only lets you send your logs to places other than disk files,
2146    but also lets you customize them to any desired degree.
2147
2148    LOG { DEBUG, PACKETS, SESSION, TRANSACTION, CONNECTION } { file, pipe
2149           } ...
2150           A "pipe" is the name of a command, preceded by a vertical bar.
2151           If the pipe contains any spaces, it must be enclosed in braces.
2152
2153    Here are some examples for UNIX (always remember the importance of
2154    getting the UNIX shell quoting rules right):
2155
2156    LOG TRANSACTIONS |lpr
2157           This sends the transaction log to the default UNIX printer,
2158           rather than to a file (use "lp" rather than "lpr" if
2159           necessary).
2160
2161    LOG TRANSACTIONS {| myfilter > t.log}
2162           For those who don't like the format of the transaction log, or
2163           want to extract certain information from it; write your own
2164           output filter.
2165
2166    LOG SESSION {| lpr -Plaserwriter}
2167           This sends the session log to a specific UNIX printer, rather
2168           than to a file. Note the braces around the pipeline. These are
2169           required because it contains spaces.
2170
2171    LOG DEBUG {| tail -100 > debug.log}
2172           This causes the debug log file to contain only the final 100
2173           lines. Suppose C-Kermit crashes under some unpredictable
2174           circumstances, and you need a debug log to catch it in the act.
2175           But the debug log can grow to huge proportions very quickly,
2176           possibly filling up the disk. Piping the debug log through
2177           "tail" results in keeping only the last 100 lines (or other
2178           number of your choice).
2179
2180    LOG DEBUG {| grep "^TELNET" > debug.log}
2181           This one shows how to log only Telnet negotiations. Piping the
2182           debug log through grep or egrep lets you log only specific
2183           information, rather than everything. "man grep" for further
2184           info.
2185
2186    LOG DEBUG {| gzip -c > debug.log.gz}
2187           Creates a full debug log, but compressed by gzip to save space.
2188
2189    LOG PACKETS {| tr "\\01" "X" | cut -c9- > packet.log}
2190           This one writes the regular packet log, but translates the
2191           Ctrl-A that starts each packet to the letter "X" and removes
2192           the s-nn-nn- notation from the beginning of each line. Note the
2193           double backslash (normal Kermit quoting rules). "man tr" and
2194           "man cut" for further info.
2195
2196    See [361]Section 2.12 for information about the new connection log.
2197      _________________________________________________________________
2198
2199   1.14. Automatic File-Transfer Packet Recognition at the Command Prompt
2200
2201    Beginning in version 7.0, C-Kermit can recognize Kermit (and in some
2202    cases also Zmodem) file-transfer packets while at its command prompt.
2203    This is convenient (for example), if you escaped back from a remote
2204    Kermit program and told the local Kermit program to send a file, but
2205    forgot to tell the remote Kermit program to receive it (and the local
2206    Kermit did not have the "send a Kermit receive command" feature
2207    available). This feature is controlled by the following command:
2208
2209    SET COMMAND AUTODOWNLOAD { ON, OFF }
2210           When ON, which is the default, the command parser recognizes
2211           Kermit packets when Kermit is in remote mode. An S packet makes
2212           it go into receive mode, an I packet makes it go into server
2213           mode. When OFF, packet recognition is disabled and the behavior
2214           when a packet is received at the command prompt is as it was in
2215           C-Kermit 6.1 and earlier (namely to print an error message).
2216
2217    COMMAND AUTODOWNLOAD is the command-mode equivalent of TERMINAL
2218    AUTODOWNLOAD, which is effective during CONNECT mode.
2219      _________________________________________________________________
2220
2221   1.15. The TYPE Command
2222
2223    The TYPE command now accepts a selection of optional switches
2224    ([362]Section 1.5), and also sets several variables.
2225
2226    Syntax: TYPE [ switches... ] filename
2227
2228    Variables:
2229
2230    \v(ty_ln)
2231           Line number of current line (during TYPE command; see /PREFIX)
2232
2233    \v(ty_lc)
2234           Line count of file most recently TYPEd.
2235
2236    \v(ty_mc)
2237           Match count of file most recently TYPEd (see /MATCH).
2238
2239    Switches:
2240
2241    /PAGE
2242           If /PAGE is included, Kermit pauses at the end of each
2243           screenful and issues a "more?" prompt. You may press the space
2244           bar to view the next page (screenful), or press "q" or "n" to
2245           return to the C-Kermit prompt. If this switch is given, it
2246           overrides the COMMAND MORE-PROMPTING setting for this command
2247           only. If it is not given, paging is according to COMMAND
2248           MORE-PROMPTING.
2249
2250    /NOPAGE
2251           Do not pause at the end of each screenful; show the whole file
2252           (or all selected lines) at once. If this switch is given, it
2253           overrides the COMMAND MORE-PROMPTING setting for this command
2254           only. If it is not given, paging is according to COMMAND
2255           MORE-PROMPTING.
2256
2257    /HEAD[:n]
2258           Only show the first n lines of the file (where n is a number).
2259           If n is omitted, 10 is used.
2260
2261    /TAIL[:n]
2262           Only show the last n lines of the file (where n is a number).
2263           If nis omitted, 10 is used. Note: /HEAD and /TAIL can't be
2264           combined; if you give both switches, only the most recent one
2265           is used.
2266
2267    /MATCH:pattern
2268           Only type lines from the file that match the given pattern (see
2269           [363]Section 4.9.1 for pattern notation). UNIX users familiar
2270           with grep should note a significant difference: there is no
2271           implied "*" at the beginning and end of the pattern. Thus:
2272
2273   TYPE /MATCH:foo    Lists lines whose entire contents are "foo".
2274   TYPE /MATCH:foo*   Lists lines that start with "foo".
2275   TYPE /MATCH:*foo   Lists lines that end with "foo".
2276   TYPE /MATCH:*foo*  Lists lines that have "foo" anywhere in them.
2277
2278           /HEAD and /TAIL apply after /MATCH, so "type /tail:20
2279           /match:x*" shows the last 20 lines in the file that start with
2280           "x".
2281
2282    /PREFIX:string
2283           Print the given string at the beginning of each line. The
2284           string may be a constant, a variable, or a quoted variable. If
2285           it's an unquoted variable, its value at the time the TYPE
2286           command was given is used as a constant. If it is a quoted
2287           variable, it is re-evaluated for each line; a useful variable
2288           for this context is \v(ty_ln) (the line number of the current
2289           line being typed). If the prefix is to include spaces, it must
2290           be enclosed in braces. Examples:
2291
2292         type /prefix:{oofa.txt: } /match:*thing* oofa.txt
2293                 Prints all lines in oofa.txt that contain "thing" with
2294                 the filename itself as the prefix (similar to UNIX grep).
2295
2296         type /prefix:{\v(time). } oofa.txt
2297                 Prefixes each line of oofa.txt with the time at which the
2298                 TYPE command was given (one backslash)
2299
2300         type /prefix:{\\v(time). } oofa.txt
2301                 Prefixes each line of oofa.txt with the time at which
2302                 that line is being typed (two backslashes).
2303
2304         type /prefix:{\\v(ty_ln). } oofa.txt
2305                 Prefixes each line of oofa.txt with its line number.
2306
2307         type /prefix:{\\flpad(\\v(ty_ln),4). } oofa.txt
2308                 Same as the previous example, except the line number is
2309                 right-adjusted in a 4-column field.
2310
2311    /WIDTH[:n]
2312           Truncates each line at column n (which must be a number) prior
2313           to printing it. This option can be used for long lines when you
2314           don't want them to wrap. If nis omitted, your current screen
2315           width is used.
2316
2317    /COUNT
2318           Counts lines and -- if /MATCH was included, matches -- but does
2319           not print any lines from the file. The line and match count is
2320           shown at the end, and the variables \v(ty_lc) and \v(ty_lm) are
2321           set accordingly.
2322
2323    SET OPTIONS TYPE { /PAGE, /NOPAGE, /WIDTH:n }
2324           Sets the paging default for TYPE commands, which can be
2325           overridden in any particular TYPE command by including the
2326           desired switch.
2327
2328    If a TYPE command is given with no switch, and no SET OPTIONS TYPE
2329    selection is in effect, paging is according to your COMMAND
2330    MORE-PROMPTING setting (SHOW COMMAND).
2331      _________________________________________________________________
2332
2333   1.16. The RESET Command
2334
2335    The RESET command, added in 7.0, closes all open files and logs, but
2336    does not affect the open connection (if any).
2337      _________________________________________________________________
2338
2339   1.17. The COPY and RENAME Commands
2340
2341    As of C-Kermit 7.0, in the UNIX version only, the COPY and RENAME
2342    commands are built in and do not call the underlying platform's COPY
2343    or RENAME command. This allows them to work in "NOPUSH" versions and
2344    other circumstances where it can't access system commands, and it
2345    allows file copying and renaming to be done portably in scripts. The
2346    characteristics of the built-in COPY or RENAME include:
2347      * It fails if the source file is a directory or is wild or lacks
2348        read access.
2349      * It fails if the source file is the destination file.
2350      * It allows the destination file to be a directory, in which case
2351        the source file is copied (or renamed) into it with the same name.
2352      * It overwrites an existing destination file if its permission
2353        allows.
2354      * It sets the new file's permission according to umask but also
2355        carries forward the source file's execute permission bits if the
2356        destination file did not already exist.
2357      * It fails if interrupted by Ctrl-C.
2358      * Upon error, it prints an appropriate message.
2359      * It returns standardized error codes that can be tested by IF
2360        SUCCESS / FAIL.
2361
2362    These commands now also accept the following switches:
2363
2364   /LIST (/LOG, /VERBOSE)    = Print "file1 => file2 (OK)" (or error message).
2365   /NOLIST (/NOLOG, /QUIET)  = Don't print anything (except error messages).
2366
2367    /NOLIST is the default.
2368
2369    The same built-in code is used by the UNIX C-Kermit server to execute
2370    REMOTE COPY commands (except in this case no switches are available).
2371
2372    The COPY command also accepts the following additional switches. When
2373    any of these are given (and they can be used in any combination except
2374    /SWAP and /APPEND), some of the checks listed above are relaxed, and
2375    thus it might be possible to get into trouble in certain cases, e.g.
2376    when the source and target files are the same file:
2377
2378   /APPEND                   = Append source file to destination file.
2379   /SWAP-BYTES               = Swap bytes (see [364]Section 6.6.5).
2380   /FROMB64                  = Decode the source file from Base64 encoding.
2381   /TOB64                    = Encode the target file in Base64.
2382
2383    Base64 is the encoding commonly used for enclosures in Internet email.
2384      _________________________________________________________________
2385
2386   1.18. The MANUAL Command
2387
2388    The MANUAL command can be used to access the appropriate Kermit manual
2389    or other manual. The general syntax is:
2390
2391    MANUAL [ string ]
2392           If the string is omitted, C-Kermit asks the underlying system
2393           to access the C-Kermit manual using whatever method is
2394           appropriate for the system.
2395
2396    The specific action depends on the system. In UNIX, a "man" command is
2397    issued; "kermit" is the default argument but other manual topics may
2398    be specified. If the "man" command allows index or string searching,
2399    the appropriate syntax may be included.
2400
2401    In Kermit 95, the MANUAL command brings up the HTML online K95 manual.
2402
2403    In VMS and elsewhere, "man" is simply translated to "help", with a
2404    default argument of "kermit"; other and/or additional arguments may be
2405    included according to the definition of the system's "help" command.
2406
2407    Correct operation of the "man" command in C-Kermit depends on the
2408    appropriate man page or help topic having been installed in the right
2409    place with the right permissions and format.
2410      _________________________________________________________________
2411
2412   1.19. String and Filename Matching Patterns
2413
2414    A pattern is a string that includes special notation for matching
2415    classes or sequences of characters. C-Kermit 7.0 / K95 1.1.19 supports
2416    patterns in several places:
2417
2418      * Filenames ([365]Section 4.9)
2419      * SWITCH case labels ([366]Section 7.18)
2420      * The new IF MATCH statement ([367]Section 7.4)
2421      * TYPE /MATCH ([368]Section 1.15)
2422      * SET FILE TEXT-PATTERNS and BINARY-PATTERNS ([369]Section 4.3)
2423      * The \fsearch() and \farraylook() functions ([370]Sections 7.3 and
2424        [371]7.10.7)
2425      * The \fpattern() function used with [M,RE]INPUT ([372]Section 7.1)
2426
2427    Patterns are also called wildcards, especially when used for filename
2428    matching. C-Kermit's pattern syntax is explained in [373]Section
2429    4.9.1, and also by the HELP WILDCARDS command.
2430      _________________________________________________________________
2431
2432   1.20. Multiple Commands on One Line
2433
2434    As of C-Kermit 7.0, commands can be grouped together on one line by
2435    separating the commands with commas and enclosing the list in braces.
2436    For example:
2437
2438   C-Kermit> { echo One, echo Two, echo Three }
2439   C-Kermit> do { echo One, echo Two, echo Three }
2440
2441    Command lists can be nested:
2442
2443   [ do ] { echo One, echo Two, if true { echo A, echo B}, echo Three }
2444
2445    and the END command works as it does in macros:
2446
2447   [ do ] { echo One, echo Two, if true end, echo Three }
2448
2449    The "one line" stricture is, of course, pliant to line-continuation
2450    conventions, namely that lines ending in hyphen (-) or left brace ({)
2451    are to be continued. Thus the first example can also be rendered:
2452
2453   [ do ] {
2454       echo One
2455       echo Two
2456       echo Three
2457   }
2458
2459    (the "do" is optional).
2460      _________________________________________________________________
2461
2462   1.21. What Do I Have?
2463
2464    C-Kermit can be built for hundreds of different platforms with
2465    practically countless configuration options. Certain commands might
2466    not be available in certain configurations, etc. Even on the same
2467    platform, different builds are possible: "maximum functionality",
2468    "minimum size", "maximum performance", and so on. You can find out a
2469    lot about the configuration of your C-Kermit program with the SHOW
2470    FEATURES command. Of course, a lot of what it says, especially in the
2471    bottom part, might seem like gibberish, but can be deciphered with a
2472    Rosetta Stone (such as the C-Kermit source or the [374]ckccfg.txt
2473    file). In any case, the output from SHOW FEATURES might easily explain
2474    why some expected feature is missing, or some buffer is smaller than
2475    expected. Here's a sample of the bottom section for the SunOS version:
2476
2477 C-Kermit 7.0.196, 1 Jan 2000
2478
2479 Major optional features included:
2480  Network support (type SHOW NET for further info)
2481  Telnet Kermit Option
2482  Hardware flow control
2483  External XYZMODEM protocol support
2484  Latin-1 (West European) character-set translation
2485  Latin-2 (East European) character-set translation
2486  Cyrillic (Russian, Ukrainian, etc) character-set translation
2487  Greek character-set translation
2488  Hebrew character-set translation
2489  Japanese character-set translation
2490  Unicode character-set translation
2491  Pseudoterminal control
2492  REDIRECT command
2493  RESEND command
2494  Fullscreen file transfer display
2495  Control-character unprefixing
2496  Streaming
2497  Autodownload
2498
2499 Major optional features not included:
2500  No Kerberos(TM) authentication
2501  No SRP(TM) (Secure Remote Password) protocol
2502  No Secure Sockets Layer (SSL) protocol
2503  No Transport Layer Security (TLS) protocol
2504  No encryption
2505  No X Windows forwarding
2506
2507 Host info:
2508  Machine:    sun4m
2509  Model:      (unknown)
2510  OS:         SunOS
2511  OS Release: 4.1.3_U1
2512  OS Version: 4
2513
2514 Target: sunos41gsc
2515 GCC version: 2.7.2
2516 Compiled Dec 31 1999 10:38:54, options:
2517  __GNUC__ __STDC__ _POSIX_JOB_CONTROL _SC_JOB_CONTROL ARRAYREFLEN=1024 BIGBUFOK
2518  BROWSER BSD4 CK_ANSIC CK_APC CK_AUTODL CK_CURSES CK_DNS_SRV CK_ENVIRONMENT
2519  CK_FAST CK_LOGIN CK_MKDIR CK_NAWS CK_PCT_BAR CK_PERMS CK_RECALL CK_RTSCTS
2520  CK_SPEED CK_TIMERS CK_TMPDIR CK_TTGWSIZ CK_TTYFD CK_WREFRESH CKEXEC
2521  CKFLOAT=double CKGHNLHOST ckmaxfiles=64 CKMAXOPEN=64 CKMAXPATH=1023 CKREALPATH
2522  CKREGEX CKSYSLOG CKTUNING CMDBL=32763 CMDDEP=64 CONGSPD DCMDBUF DIRENT DYNAMIC
2523  FNFLOAT FORDEPTH=32 GFTIMER HADDRLIST HDBUUCP IFDEBUG IKS_OPTION IKSDB
2524  IKSDCONF INBUFSIZE=32768 INPBUFSIZ=4096 MAC_MAX=16384 MACLEVEL=128 MAXDDIR=32
2525  MAXDNUMS=4095 MAXGETPATH=128 MAXTAKE=54 MAXWLD=102400 MSENDMAX=1024 NETCMD
2526  NETCONN NETPTY NOKVERBS NOSETBUF OBUFSIZE=32768 PARSENSE PATTERNS PIPESEND
2527  RENAME RLOGCODE SAVEDUID SELECT SIG_V SOL_SOCKET sparc STREAMING sun SUNOS4
2528  SYSTIMEH TCPSOCKET TIMEH TLOG TNCODE TTLEBUF TTSPDLIST UIDBUFLEN=256 UNIX
2529  UNPREFIXZERO USE_LSTAT USE_MEMCPY VNAML=4096 WHATAMI XFRCAN Z_MAXCHAN=46
2530  z_maxchan=46 ZXREWIND
2531
2532  byte order: big endian
2533
2534  sizeofs: int=4 long=4 short=2 char=1 char*=4 float=4 double=8
2535
2536  floating-point: precision=16 rounding=1
2537
2538    Without going into detail about what all the notation means, notice a
2539    couple things:
2540
2541      * The Options section shows symbols ("macros") in effect during
2542        compilation, together with their values (for those that have
2543        values). The options are listed in alphabetical order to make any
2544        particular option easier to find.
2545      * MAXWLD is the maximum number of files that a wildcard can expand
2546        to.
2547      * Anything starting with "NO" is a feature (or something other than
2548        a feature) that has been deliberately "compiled out", or omitted.
2549      * Important items for script writers include: CMDBL=32763 (the size
2550        of the command buffer and therefore the maximum length for a macro
2551        or variable definition; CMDDEP=64 (the limit on recursion depth);
2552        FORDEPTH=32 (the nesting limit on FOR loops); INBUFSIZE=32768 (the
2553        size of the INPUT command circular buffer); MAC_MAX=16384 (the
2554        maximum number of macros), etc.
2555
2556    See the [375]ckccfg.txt file for details.
2557      _________________________________________________________________
2558
2559   1.22. Generalized File Input and Output
2560
2561    C-Kermit 7.0 adds a new generalized I/O system for stream files,
2562    augmenting (and to some extent, overlapping with) the older OPEN,
2563    READ, WRITE, and CLOSE commands. In the new file i/o system, which can
2564    be used simultaneously with the old one, all commands are grouped
2565    together under the new FILE keyword, and some related functions and
2566    variables are added.
2567
2568     1.22.1. Why Another I/O System?
2569
2570    The well-known LOG, OPEN, READ, WRITE, and CLOSE commands have the
2571    following restrictions:
2572
2573     1. Only one READ file and one WRITE file can be open at a time.
2574     2. The READ and WRITE commands are strictly line oriented.
2575     3. These commands can not be used with binary files.
2576     4. They do not support read/write access or random access.
2577     5. The syntax is a bit counterintuitive for programmers.
2578
2579    The new file i/o system allows multiple files to be open at once, in
2580    any desired combination of modes (read/write/append) supported by the
2581    operating system, for line, block (record), or character i/o, for
2582    sequential or random access, using consistent syntax and conventions.
2583
2584    The new system, however, does not replace the old one, since the old
2585    system still must be used for:
2586
2587     1. The session, packet, debug, transaction, and connection logs.
2588     2. Reading and writing commands rather than files.
2589     3. Existing scripts.
2590
2591    The new system works only with regular files, not with commands or
2592    pipes or mailboxes or pseudoterminals. No special provisions are made
2593    in the FILE commands for handling devices or network connections, nor
2594    for preventing you from trying to open them; if the underlying
2595    operating system treats them like regular stream disk files, the FILE
2596    commands (except, of course SEEK, REWIND, and COUNT) might work with
2597    them. (In C programming terms, the FILE commands are, at present,
2598    nothing more than a front end to fopen() / fread() / fwrite() /
2599    fclose() and friends, which are a portable API to sequential files,
2600    but this might change in the future for platforms like VMS and VOS
2601    that have more complicated file systems.)
2602
2603    Definitions:
2604
2605    Channel
2606           A number assigned to a file when it is opened, by which it must
2607           be referred to in all input/output operations.
2608
2609    Read/Write Pointer
2610           The current position in an open file, expressed as the 0-based
2611           byte count from the beginning.
2612      _________________________________________________________________
2613
2614     1.22.2. The FILE Command
2615
2616    FILE keyword [ switches ] channel [ data ]
2617           The keyword specifies the function: FILE OPEN, FILE READ, FILE
2618           WRITE, FILE CLOSE, etc. For convenience (and for familiarity to
2619           C programmers), the two-word FILE commands can be shortened to
2620           the single words FOPEN, FREAD, FWRITE, FCLOSE, and so on.
2621           Switches are optional, and modify or amplify the requested file
2622           function.
2623
2624    As in C, Fortran, and other programming languages, open files are
2625    referred to by "channels", integers such as 0, 1, 2, 3, and so on. A
2626    channel number is assigned when you open a file. The number of
2627    available channels depends on the underlying operating system, and can
2628    be seen in the variable:
2629
2630   \v(f_max)
2631
2632    or by giving the FILE LIST (FLIST) command. Channels are discussed in
2633    greater detail in [376]Section 1.22.4.
2634
2635    FILE command errors can be caught with IF FAIL after the FILE command.
2636    In addition, the \v(f_error) variable is set to the completion code of
2637    the command: 0 if no error, or a negative number if there was an
2638    error. The error codes are listed in [377]Section 1.22.5.
2639
2640    The command to open a file is:
2641
2642    FILE OPEN [ switches ] variable filename
2643           Opens a file for the type of access specified by the switches,
2644           or for read-only access if no switches are given. Upon success,
2645           a channel number is assigned to this file and stored in the
2646           given variable so you can refer to the open file in subsequent
2647           i/o commands. If the file can not be opened, the FILE OPEN
2648           command fails. Synonym: FOPEN.
2649
2650    The FILE OPEN switches are:
2651
2652    /READ
2653           Open the file for read access. If no switches are given, /READ
2654           is assumed. If the file does not exist or can't be opened for
2655           read access, the FILE OPEN command fails.
2656
2657    /WRITE
2658           Allow writing. If a file of the same name already exists, it is
2659           overwritten unless /READ or /APPEND is also included. If a file
2660           of the given name does not exist, it is created.
2661
2662    /APPEND
2663           Equivalent to /WRITE, except that if the file exists, it is not
2664           destroyed. The read/write pointer is set to the end of the
2665           file, so unless you change it with FILE SEEK or REWIND (see
2666           below), the first FILE WRITE command adds to the end of the
2667           file, preserving what was there already. If /WRITE is also
2668           given, it is ignored.
2669
2670    /BINARY
2671           Open the file in "binary" mode, rather than text mode. This
2672           switch is meaningless (but still can be used) in UNIX. In VMS,
2673           Windows, and OS/2, it inhibits end-of-line processing and
2674           conversion, and so should be used for binary files and/or files
2675           that are to be accessed in record or character mode rather than
2676           line by line.
2677
2678    The variable for the channel number can be any kind of variable: the
2679    \%x kind, a macro name, or an array element. But it must be a
2680    variable, not a number -- C-Kermit assigns the channel number; you
2681    can't tell it what number to use.
2682
2683    Example:
2684
2685   FILE OPEN \%c oofa.txt                  ; Open oofa.txt for reading.
2686   IF FAIL exit 1 Can't open oofa.txt      ; Always check to see if it worked.
2687   ECHO oofa.txt: channel = \%c
2688
2689    If the file oofa.txt is opened successfully, a channel number is
2690    assigned to the variable \%c. Here's another example using a macro
2691    name for the channel number:
2692
2693   FILE OPEN channel oofa.txt              ; Open oofa.txt for reading.
2694   IF SUCCESS ECHO oofa.txt: channel = \m(channel)
2695
2696    Switches can be combined when it makes sense and the underlying
2697    operating system allows it. For example, to open a file in binary mode
2698    for reading and writing (sometimes called "update"):
2699
2700   FILE OPEN /READ /WRITE /BINARY \%c budget.db
2701
2702    Some combinations might be allowed, others not. For example /READ
2703    /APPEND will usually not be allowed. /WRITE /APPEND is treated as
2704    /APPEND.
2705
2706    A major advantage of the new system over the older one is that you can
2707    have multiple files open at once. Suppose, for example, that you want
2708    to open all the files in a certain directory at once:
2709
2710   .\%n := \ffiles(/usr/olga*,&f)          ; Get file list into array.
2711   if ( > \%n \v(f_max) ) {                ; Make sure there aren't too many.
2712       exit 1 {\v(dir): \%n = Too many files}
2713   }
2714   declare \&c[\%n]                        ; Make array for channel numbers.
2715   for \%i 1 \%n 1 {                       ; Loop to open every file...
2716       file open \&c[\%i] \&f[\%i]         ; Try to open this one
2717       if fail exit 1 Open error: \&f[\%i] ; Check for failure
2718   }
2719
2720    If this loop completes successfully, the \&c[] array will contain \%n
2721    channel numbers of open files in elements 1 through \%n.
2722
2723    Any file that you open with FILE OPEN stays open until Kermit exits,
2724    or you close it explicitly. The command to close a file is:
2725
2726    FILE CLOSE { ALL, channel }
2727           If a channel number is given and the channel refers to an open
2728           file, the file is closed and the channel is freed for reuse; if
2729           the channel does not refer to an open file, an error message is
2730           printed and the command fails. If ALL is specified instead of a
2731           specific channel, all files opened with FILE OPEN are closed
2732           and if all open files were closed successfully (even if no
2733           files were open), the command succeeds; if any open file could
2734           not be closed, the command fails; however, all open files that
2735           could be closed are still closed. Synonym: FCLOSE.
2736
2737    FILE CLOSE might fail because, for example, the disk filled up or a
2738    quota was exceeded. Example:
2739
2740   fopen /write \%c new.txt                ; Open new.txt for writing.
2741   if fail exit 1                          ; Check for error.
2742   fclose \%c                              ; Close the file we just opened.
2743
2744    This creates a 0-length file called new.txt.
2745
2746    Note that FILE OPEN /WRITE (without /READ or /APPEND) always creates a
2747    new file, and therefore destroys any file with the same name that
2748    might already exist (assuming you have permission to delete it). To
2749    avoid overwriting existing files, simply check first:
2750
2751   if exist new.txt exit 1 {Fatal - new.txt already exists}
2752   fopen /write \%c new.txt
2753   if fail ...
2754
2755    The next two commands give information about open files:
2756
2757    FILE STATUS channel
2758           Tells the name of the file, if any, open on the given channel
2759           and the switches it was opened with. The read/write pointer is
2760           also shown; this is where the next read or write will occur;
2761           "[EOF]" is shown if the current position in the open file is
2762           the end -- i.e. the next read will fail if the file was opened
2763           in /READ mode; the next write will add material to the end. The
2764           current line number (0-based) is also shown if known. The FILE
2765           STATUS command succeeds if the channel is open, and fails if
2766           there is no open file on the given channel, or if the channel
2767           number is invalid or out of range. Synonym: FSTATUS.
2768
2769    FILE LIST
2770           Lists the channel number and name of each open file, along with
2771           its OPEN modes (R, W, A, B, RW, etc) and its current read/write
2772           pointer or "[EOF]" if it is at the end. Also tells the number
2773           of files currently opened with FILE OPEN, plus the maximum
2774           number of open files allowed by the system and the maximum
2775           number allowed for FILE OPEN. Synonym: FLIST.
2776
2777    Next come the commands for reading and writing files:
2778
2779    FILE READ [ switches ] channel [ variable ]
2780           Reads data from the file on the given channel number into the
2781           variable, if one was given; if no variable was given, the
2782           result is printed on the screen. IMPORTANT: The variable should
2783           normally be a macro name rather than a \%x or \&x[] variable if
2784           you want backslash characters in the file to be taken literally
2785           (see pp.408-412 of [378]Using C-Kermit for an explanation; you
2786           can also read into a \%x or \&x[] variable, but then you must
2787           remember to protect future references to by \fcontents() if you
2788           don't want C-Kermit to process any backslashes it might
2789           contain). The desired amount of data (according to the
2790           switches) is read from the file at the current read/write
2791           pointer, and upon completion the read/write position is updated
2792           to first byte after the data that was read, no matter what
2793           switches were given. Synonym: FREAD.
2794
2795    FILE WRITE [ switches ] channel text
2796           Writes the given text to the file on the given channel number.
2797           The text, of course, can be literal text or a variable, or any
2798           combination. If the text might contain leading or trailing
2799           spaces, it must be enclosed in braces if you want to preserve
2800           them. Synonym: FWRITE.
2801
2802    Before proceeding, a caution about the NUL character. C-Kermit is so
2803    named because it is a Kermit program written in the C language. In C,
2804    character strings are represented as a sequence of non-NUL bytes
2805    terminated by a NUL byte (a byte in which all bits are 0). Thus a C
2806    string can not contain NUL bytes; it always ends with the first NUL
2807    byte. C-Kermit variables are implemented as C strings and therefore
2808    can't contain NUL bytes either, so the FILE READ and FILE WRITE
2809    commands do not handle files or strings that contain NUL bytes, except
2810    when the /CHARACTER switch is included with the FILE READ or WRITE
2811    command, or when /LPAD:0 or /RPAD:0 is given with the FILE WRITE
2812    command; these switches are explained below.
2813
2814    Also note that Kermit can not be used read or write binary numbers in
2815    the machine's internal format (integer or floating-point); in general,
2816    numbers can be processed only when represented as numeric or
2817    floating-point strings.
2818
2819    FILE READ switches are:
2820
2821    /LINE
2822           Specifies that a line of text is to be read. A line is defined
2823           according to the underlying operating system's text-file
2824           format. For example, in UNIX a line is a sequence of characters
2825           up to and including a linefeed, or the end of the file, which
2826           ever comes first. The line terminator (if any) is removed
2827           before assigning the text to the variable. If no switches are
2828           included with the FILE READ command, /LINE is assumed. Normally
2829           this switch should not be used with files opened in /BINARY
2830           mode (but nothing prevents it either).
2831
2832    /SIZE:number
2833           Specifies that the given number of bytes (characters) is to be
2834           read. The actual number of bytes returned will be less if the
2835           end of file is reached (or a NUL byte is encountered). For
2836           example, if a file is 514 bytes long, FILE READ /SIZE:512
2837           returns 512 bytes the first time and 2 bytes the second time.
2838           FILE READ /SIZE provides a kind of "record i/o" for files that
2839           do not necessarily contain lines. The resulting block of
2840           characters is assigned to the variable without any editing.
2841           Synonym: /BLOCK.
2842
2843    /CHARACTER
2844           Equivalent to /SIZE:1. If FILE READ /CHAR succeeds but the
2845           variable is empty, this indicates a NUL byte was read. Synonym:
2846           BYTE.
2847
2848    FILE WRITE switches are:
2849
2850    /LINE
2851           Specifies that an appropriate line terminator is to be added to
2852           the end of the text. If no switches are included, /LINE is
2853           assumed.
2854
2855    /SIZE:number
2856           Specifies that the given number of bytes (characters) is to be
2857           written. If the given text is longer than the requested size,
2858           it is truncated; if is shorter, it is padded according /LPAD
2859           and /RPAD switches. Synonym: /BLOCK.
2860
2861    /LPAD[:value]
2862           If /SIZE was given, but the text is shorter than the requested
2863           size, the text is padded on the left with sufficient copies of
2864           the character whose ASCII value is given to write the given
2865           length. If no value is specified, 32 (the code for Space) is
2866           used. The value can also be 0 to write the indicated number of
2867           NUL bytes. If /SIZE was not given, this switch is ignored.
2868
2869    /RPAD[:value]
2870           Like LPAD, but pads on the right.
2871
2872    /CHARACTER
2873           Specifies that one character should be written. If the text is
2874           empty or not given, a NUL character is written; otherwise the
2875           first character of text is given. Synonym: /BYTE.
2876
2877    /STRING
2878           Specifies that the text is to be written as-is, with no
2879           terminator added.
2880
2881    Here's an example in which we copy a text file line by line:
2882
2883   file open /read \%c oofa.txt            ; Open input file
2884   if fail exit 1 Can't open input file    ; Check that it's open
2885   file open /write \%d new.txt            ; Open output file
2886   if fail exit 1 Can't open output file   ; Check
2887   while true {                            ; Loop to copy lines
2888       file read /line \%c line            ; Read a line
2889       if fail break                       ; Assume failure = end of file
2890       file write /line \%d {\m(line)}     ; Write the line to output file
2891       if fail exit 1 Write failure        ; Failure here is fatal
2892   }
2893   file close \%c                          ; Close the two files
2894   file close \%d
2895
2896    Note that since /LINE is the default for both FILE READ and FILE
2897    WRITE, it can be omitted as in the following example, where we also
2898    use the short names for the FILE commands.
2899
2900   fopen /read \%c oofa.txt                ; Open input file
2901   if fail exit 1 Can't open input file    ; Check that it's open
2902   fopen /write \%d new.txt                ; Open output file
2903   if fail exit 1 Can't open output file   ; Check
2904   while true {                            ; Loop to copy lines
2905       fread \%c line                      ; Read a line
2906       if fail break                       ; Assume failure = end of file
2907       fwrite \%d {\m(line)}               ; Write the line to output file
2908       if fail exit 1 Write failure        ; Failure here is fatal
2909   }
2910   fclose \%c                              ; Close the two files
2911   fclose \%d
2912
2913    Here's the same example using "record i/o" (the open and close
2914    sequences are are omitted since they are the same as above). The
2915    result is the same, but execution is much faster:
2916
2917   while true {                            ; Loop to copy blocks
2918       fread /size:512 \%c block           ; Read a block into \%a
2919       if fail break                       ; Assume failure = end of file
2920       fwrite /string \%d {\m(block)}      ; Write the block to output file
2921       if fail exit 1 Write failure        ; Failure here is fatal
2922   }
2923
2924    Although record i/o is faster, it should not be used in line-oriented
2925    applications, since it returns arbitrary chunks of the file to your
2926    script, rather than lines. In this example, FWRITE /STRING is used
2927    rather than FWRITE /SIZE:512 to avoid the last output block being
2928    padded beyond the original file's length.
2929
2930    A file can also be copied character by character, but this is much
2931    slower than line i/o and VERY much slower than block i/o:
2932
2933   while true {                            ; Loop to copy blocks
2934       fread /char \%c c                   ; Read a character into c
2935       if fail break                       ; Assume failure = end of file
2936       fwrite /char \%d {\m(c)}            ; Write character to output file
2937       if fail exit 1 Write failure        ; Failure is fatal
2938   }
2939
2940    Although character i/o is slow, it is the only way to process files
2941    that contain NUL characters (i.e. bytes composed of only zero bits).
2942    In the example above, when "fread /char \%c c" returns a NUL, the c
2943    variable is empty. But since the FREAD /CHAR command did not fail, we
2944    know the result was really a NUL. FWRITE /CHAR, when given an empty
2945    variable (or no variable at all) writes a NUL. Thus the loop above
2946    will copy any file at all (very slowly). In non-copying applications,
2947    NULs are detected like this:
2948
2949   fread /char \%c c
2950   if fail (do something)
2951   if not def c (a NUL byte was read)
2952
2953    Finally some advanced file operations:
2954
2955    FILE FLUSH channel
2956           For output files only: commits all previous writes to disk, in
2957           case the computer was buffering them. Synonym: FFLUSH.
2958
2959    FILE COUNT [ { /BYTES, /LINES, /LIST, /NOLIST } ] channel
2960           By default, or if the /BYTES switch is given, counts the bytes
2961           in the file, if any, open on the given channel. If the /LINES
2962           switch is given, counts lines in the file. If the /LIST switch
2963           is given, the result is printed. If the /NOLIST switch is
2964           given, the result is not printed. /QUIET is a synonym for
2965           /NOLIST. If neither /LIST nor /NOLIST is given, the result is
2966           printed if the command is given at top level, i.e. not from a
2967           command file or macro. In all cases, the result of the most
2968           recent FILE COUNT command is stored in the variable
2969           \v(f_count). Note that FILE COUNT /LINE works (and can only
2970           work) by reading the entire file; expect it to take some time
2971           if the file is large. Synonym: FCOUNT.
2972
2973    FILE REWIND channel
2974           Moves the read/write pointer to the beginning of the file.
2975           Equivalent to FILE SEEK channel 0. Synonym: FREWIND.
2976
2977    FILE SEEK [ switches ] channel { [{+,-}]number, LAST, EOF }
2978           Moves the read/write pointer for the file on this channel to
2979           the given position, which may be a byte (character) number or a
2980           line number, expressed in either absolute or relative terms.
2981           Switches:
2982
2983         /BYTE
2984                 The number given is a byte number. Synonym: /CHARACTER.
2985
2986         /LINE
2987                 The number given is a line number.
2988
2989         /ABSOLUTE
2990                 The number given is absolute.
2991
2992         /RELATIVE
2993                 The number given is relative to the current position.
2994
2995           By default, or if the /BYTE switch is given, the number is a
2996           byte number (0 = first byte). If /LINE is given, the number is
2997           a line number (0 = first line). EOF means to move to the end of
2998           the file. LAST means to move to the last line or character of
2999           the file, depending on whether it's a line or character seek.
3000
3001           If neither the /RELATIVE nor the /ABSOLUTE switch is given,
3002           then if a signed number is given, the motion is relative to the
3003           current position. An expression that evaluates to a negative
3004           number is not considered signed for this purpose; that is, a
3005           sign (+ or -) must be included as the first character of the
3006           number in the command itself to force a relative seek (in the
3007           absence of /RELATIVE or /ABSOLUTE).
3008
3009           If the number has no sign, or if the /ABSOLUTE switch is given,
3010           the number represents an absolute position (relative to the
3011           beginning of the file). Subsequent FILE READs or WRITEs will
3012           take place at the new position.
3013
3014           If the read/write pointer is placed after the end of the file,
3015           a subsequent FILE READ will fail, but a FILE WRITE will succeed
3016           (possibly creating a file with "holes"). If a FILE SEEK /BYTE
3017           command is given, the current line becomes unknown (unless the
3018           position is 0) and subsequent FILE SEEK /RELATIVE /LINE
3019           commands will fail until the next non-relative FILE SEEK /LINE
3020           command is given. Synonym: FSEEK.
3021
3022    An absolute FILE SEEK to a negative position fails silently, as does a
3023    relative seek to a position before the beginning of the file.
3024
3025    A caution about relative SEEKs: remember that the number is relative
3026    to the current position. Whenever you read or write, this changes the
3027    position. In each of the following examples, assume the file open on
3028    channel \%c is positioned at line n (the FREAD target variable is
3029    omitted for lack of space):
3030
3031   { FREAD \%c, FSEEK /LINE \%c -1, FREAD \%c }  <-- Reads line n twice
3032   { FREAD \%c, FSEEK /LINE \%c +0, FREAD \%c }  <-- Reads lines n and n+1
3033   { FREAD \%c, FSEEK /LINE \%c +1, FREAD \%c }  <-- Reads lines n and n+2
3034   { FREAD \%c, FSEEK /LINE \%c -2, FREAD \%c }  <-- Reads lines n and n-1
3035   { FREAD \%c, FSEEK /LINE \%c -3, FREAD \%c }  <-- Reads lines n and n-2
3036
3037    Another caution: Using FSEEK and FREAD /SIZE to repeatedly read the
3038    same disk block (e.g. when sampling a database record that is
3039    frequently updated) might not give you updated disk blocks due to the
3040    internal buffering and caching of the C library (this probably varies
3041    from one platform/compiler combination to another). If necessary you
3042    can force a fresh disk read with a close/open sequence:
3043
3044   FCLOS \%c
3045   FOPEN \%c samefilename
3046   FSEEK \%c samespot
3047   FREAD /SIZE:howmanybytes \%c variable
3048      _________________________________________________________________
3049
3050     1.22.3. FILE Command Examples
3051
3052    To read the last 10 lines of a text file into an array:
3053
3054   fopen /read \%c oofa.txt                ; Open the file
3055   if fail exit 1 Can't open oofa.txt      ; Always check for failure
3056   dcl \&a[10]                             ; Declare a 10-element array
3057   fcount /line \%c                        ; Count lines in the file
3058   fseek /line \%c \v(f_count)-10          ; Seek to 10 lines from the end
3059   if fail exit 1 Can't seek               ; Check for failure
3060   for \%i 1 10 1 { fread \%c \&a[\%i] }   ; Read the last 10 lines
3061   fclose \%c                              ; Close the file
3062
3063    Note that blank lines show up as empty (undefined) array elements, for
3064    example if you give a "show array a" command at this point. This is
3065    normal. You can still use these elements; e.g.:
3066
3067   for \%i 1 10 1 { echo \%i. \&a[\%i] }   ; Display the 10 lines
3068
3069    Here is how to read the last line of a file (already open on channel
3070    \%c):
3071
3072   fseek /line \%c last                    ; Seek directly to last line
3073
3074    Alternatively:
3075
3076   fseek /line \%c eof                     ; Seek to end of file
3077   fseek /line \%c -1                      ; Seek to beginning of last line
3078
3079    Alternatively:
3080
3081   fcount /line \%c                        ; Count the file's lines
3082   fseek /line \%c \v(f_count)-1           ; Seek to last line
3083   fread \%c                               ; Read it
3084
3085    To read every other line from the file (using relative SEEK), skipping
3086    the first line:
3087
3088   fopen /read \%c oofa.txt                ; Open the file
3089   while ( success ) {                     ; Loop through lines
3090       fseek /line \%c +1                  ; Skip a line
3091       if success fread \%c                ; Read & display a line
3092   }
3093   fclose \%c                              ; Close the file
3094
3095    Here is how to read the lines of a file in reverse order:
3096
3097   fopen /read \%c oofa.txt                ; Open
3098   if fail exit 1                          ; Check
3099   fseek /line \%c last                    ; Seek to last line
3100   while success {                         ; Loop
3101       fread \%c                           ; Read line
3102       fseek /line \%c -2                  ; Seek backwards two lines
3103   }
3104   fclose \%c                              ; Close the file
3105
3106    The loop works because a relative SEEK outside the file fails.
3107
3108    It is also possible to use block i/o to manage random-access files
3109    with fixed-length records (as long as they don't contain NUL
3110    characters). Suppose, for example, you have a file of "card image"
3111    records with fixed-field information about customers, such as:
3112
3113   Name:     Columns  1-32  (column numbers are 1-based)
3114   Address:  Columns 33-72
3115   Balance:  Columns 73-80
3116
3117    The records are indexed by customer number, starting with 0. There are
3118    no line terminators separating them. Therefore the record for customer
3119    number n starts at position nx 80 (\%n*80).
3120
3121    Now suppose we received a payment from customer number 173 and want to
3122    update the balance:
3123
3124   .\%n = 173                               ; Customer (record) number
3125   .\%a = 12.72                             ; Amount
3126   fopen /read /write \%c customer.db       ; Open the file
3127   if fail stop 1 OPEN FAILED: \f_errmsg()  ; Check
3128   fseek /byte \%c 80*\%n                   ; Seek to record
3129   fread /size:80 \%c r                     ; Read the record
3130   if fail stop 1 READ FAILED: \f_errmsg()  ; Check (IMPORTANT)
3131   .\%b := \fright(\m(r),8)                 ; Extract the balance
3132   .\%b := \ffpadd(\%b,\%a,2)               ; Add the new payment
3133   if fail stop 1 ARITHMETIC ERROR: \%b/\%a ; Catch bad records
3134   .r := {\fleft(\m(r),72)\flpad(\%b,8)}    ; Update the record
3135   fseek /byte \%c 80*\%n                   ; Reposition to same spot
3136   fwrite /size:80 \%c {\m(r)}              ; Replace the record
3137   if fail stop 1 WRITE FAILED: \f_errmsg() ; Check
3138   fclose \%c                               ; Close the file
3139
3140    REMEMBER: Using FILE SEEK to move beyond the end of file can result in
3141    a file with holes when writing; when reading, an end-of-file error
3142    will occur -- be sure to check for it.
3143      _________________________________________________________________
3144
3145     1.22.4. Channel Numbers
3146
3147    C-Kermit's channel numbers are integers from 0 to some
3148    platform-dependent limit, such as 46 or 1985 (the value of \v(f_max)).
3149    This is the limit placed by the operating system on the number of
3150    files that may be opened by one process or user or job, minus the
3151    standard input, output, and error files, and minus the number of files
3152    reserved by C-Kermit for logs, OPEN READ and WRITE, and file transfer
3153    (and maybe some command files -- the \v(f_max) number can't be exact).
3154
3155    Although you must include a variable in the FILE OPEN command, to
3156    which the channel number is assigned, you don't have to use a variable
3157    in the other FILE commands if you know what the number is -- you can
3158    just put the number. This saves you a few keystrokes when typing
3159    commands at the prompt:
3160
3161   fopen \%c oofa.txt
3162   flist
3163   0. /usr/olga.oofa.txt (R) 0
3164
3165    This tells the channel number is 0 (the number on the left is the
3166    channel file's channel number). Of course you can also find it by
3167    echoing the variable:
3168
3169   echo \%c
3170   0
3171
3172    Or with "fstatus \%c". Now you can type commands like:
3173
3174   fread 0
3175
3176    to read a line from the file. Obviously, however, using digits rather
3177    than a variable for the channel number would be poor practice in a
3178    script.
3179
3180    If in commands like:
3181
3182   fread \%c \%a
3183
3184    you have trouble remembering which variable is which, note that the
3185    channel number is, indeed, a number. Anywhere C-Kermit accepts a
3186    number it can also accept an expression, so you can put parentheses
3187    around the channel number to remind you it's the channel number and
3188    not the variable into which data is to be read:
3189
3190   fread (\%c) \%a
3191
3192    Normally channel numbers are assigned sequentially as 0, 1, 2, ... up
3193    to the limit. However, once you start closing files, there can be
3194    holes in the sequence. New channels are assigned to fill in the holes.
3195    Thus you can't depend on channel numbers being in any particular
3196    sequence.
3197      _________________________________________________________________
3198
3199     1.22.5. FILE Command Errors
3200
3201    Each FILE command sets the variable \v(f_error) to one of the
3202    following values:
3203
3204     0 = No error
3205    -1 = System error
3206    -2 = Attempt to read after end of file
3207    -3 = Channel not open
3208    -4 = Channel number out of range (negative or too large)
3209    -5 = Numeric argument (size, ...) out of range
3210    -6 = File not found
3211    -7 = Bad or missing filename
3212    -8 = Too many files are already open (FILE OPEN only)
3213    -9 = Forbidden operation (e.g. write to a read-only file)
3214   -10 = Access denied
3215   -11 = Illegal combination of OPEN modes (FILE OPEN only)
3216   -12 = Buffer overflow
3217   -13 = Current line number unknown (for relative line seeks)
3218   -14 through -98: Reserved.
3219   -99 = Requested operation not implemented in this version of C-Kermit
3220  -999 = Unknown error
3221
3222    When \v(f_error) is -1, this means the FILE command failed because
3223    because of a system error, in which case you can examine the following
3224    variables:
3225
3226   \v(errno)     = System error number.
3227   \v(errstring) = Error message corresponding to \v(errno).
3228
3229    A special function is available for translating the \v(f_error) code
3230    to an error message string:
3231
3232 \f_errmsg([code])
3233   If the code is -1, returns error message of the most recent system
3234   error; otherwise if the code is a valid \v(f_error) value, the associated
3235   message is returned.  If the code is omitted, the status message
3236   corresponding to the current \v(f_error) value is returned.
3237
3238    A FILE command that fails prints the appropriate error message
3239    automatically, except when the command is READ or SEEK and the error
3240    is -2 (end of file); in that case, the command still fails, but does
3241    not print a message. This allows constructions such as:
3242
3243   fopen \%c oofa.txt
3244   while success { fread \%c }
3245   fclose \%c
3246
3247    to work as expected, i.e. without an annoying message when the end of
3248    file is reached.
3249      _________________________________________________________________
3250
3251     1.22.6. File I/O Variables
3252
3253    The variables associated with the file i/o package are:
3254
3255    \v(f_count)
3256           Result of the most recent FILE COUNT (FCOUNT) command.
3257
3258    \v(f_error)
3259           Numeric error code of most recent FILE command (0 = no error).
3260
3261    \v(f_max)
3262           Maximum number of files open simultaneously.
3263      _________________________________________________________________
3264
3265     1.22.7. File I/O Functions
3266
3267    Some of the FILE commands can also be issued as function calls, which
3268    makes script writing a bit more convenient, especially for C
3269    programmers. Also, several functions are provided that do not have
3270    command equivalents. Each of these functions takes a channel number as
3271    the first argument. These functions do not work for OPEN { READ,
3272    !READ, WRITE, !WRITE, and APPEND } files.
3273
3274    \f_status(channel)
3275           Returns 0 if the channel is not open, otherwise a number
3276           between 1 and 15 which is the sum of the OPEN modes:
3277
3278   1 = /READ
3279   2 = /WRITE
3280   4 = /APPEND
3281   8 = /BINARY
3282
3283    The remaining functions work only for open channels. Each of these
3284    functions can fail for the applicable reasons listed in [379]Section
3285    1.22.5. For instructions on handling function errors, see [380]Section
3286    7.12.
3287
3288    \f_pos(channel)
3289           Returns the file's current read/write pointer (0-based). There
3290           is no FILE command equivalent.
3291
3292    \f_line(channel)
3293           Returns the file's current line number (0-based), if known,
3294           otherwise -1. There is no FILE command equivalent. The line
3295           number is known as long as no character or block i/o has been
3296           done on the channel.
3297
3298    \f_handle(channel)
3299           Returns the "file handle" of the file. That is, it translates
3300           the portable C-Kermit channel number into a system-specific
3301           file handle or number that can be passed to other programs on
3302           the same platform. In UNIX this is a file descriptor. There is
3303           no FILE command equivalent.
3304
3305    \f_eof(channel)
3306           Returns 1 if the read/write pointer of the file on the given
3307           channel is at the end of the file, 0 otherwise. Convenient in
3308           WHILE statements, e.g.:
3309
3310     while not \f_eof(\%c) { fread \%c }
3311
3312    \f_getchar(channel)
3313           Equivalent to FREAD /CHAR. Returns the character actually read.
3314           If \f_getchar() does not fail but the return value is empty,
3315           this means a NULL character was read.
3316
3317    \f_getline(channel)
3318           Equivalent to FREAD /LINE. Returns the line actually read, but
3319           with the line terminator stripped. If \f_getline() does not
3320           fail but the return value is empty, this normally means an
3321           empty line was read.
3322
3323    \f_getblock(channel,n)
3324           Equivalent to FREAD /SIZE:n. Returns the block of characters
3325           actually read. If the returned block is smaller than n, it
3326           indicates either that the end of file was reached or a NUL
3327           character is in the block.
3328
3329    \f_putchar(channel,c)
3330           Equivalent to FWRITE /CHARACTER. Writes the character c. If c
3331           contains more than one character, only the first is written. If
3332           c is empty a NUL is written. Returns the number of characters
3333           written on success, or a negative error code upon failure.
3334
3335    \f_putline(channel,string)
3336           Equivalent to FWRITE /LINE. Writes the string and adds the
3337           appropriate line termination character or sequence. If the
3338           string is empty or omitted, an empty line is written. Returns
3339           the number of characters written on success, or a negative
3340           error code upon failure.
3341
3342    \f_putblock(channel,string)
3343           Equivalent to FWRITE /STRING. Writes the string as given. If
3344           the string is empty or omitted, nothing is written. Returns the
3345           number of characters written on success, or a negative error
3346           code upon failure.
3347      _________________________________________________________________
3348
3349     1.22.8. File I/O Function Examples
3350
3351   fopen /read \%c oofa.txt            ; Open our favorite file for reading
3352   if failure exit 1                   ; Check that it's open
3353   while not \f_eof(\%c) {             ; Loop until EOF
3354       .line := \f_getline(\%c)        ; Get a line
3355       if success echo {\m(line)}      ; Echo it
3356   }
3357   if not \f_eof(\%c) {                ; Check reason for loop exit
3358       exit 1 File Error: \f_errmsg()  ; If not EOF say so.
3359   }
3360
3361   frewind \%c                         ; Rewind the file
3362   while not \f_eof(\%c) {             ; Same thing but with block i/o
3363       .block := \f_getblock(\%c,256)  ; (much faster than line i/o)
3364       if success xecho {\m(block)}
3365   }
3366
3367   frewind \%c                         ; Rewind again
3368   while not \f_eof(\%c) {             ; Same deal but with character i/o
3369       .c := \f_getchar(\%c)           ; (much slower than line i/o)
3370       if success xecho {\m(c)}
3371   }
3372   close \%c
3373
3374    To close all open files (equivalent to FCLOSE ALL):
3375
3376   for \%i 0 \v(f_max)-1 1 {
3377       if \f_status(\%i) fclose \%i
3378   }
3379      _________________________________________________________________
3380
3381   1.23. The EXEC Command
3382
3383    The EXEC command is available only in UNIX.
3384
3385    EXEC [ /REDIRECT ] command [ arg1 [ arg2 [ ... ] ]
3386           Runs the given command with the arguments in such a way that
3387           the command replaces C-Kermit in memory, and C-Kermit ceases to
3388           execute. EXEC is like RUN, except instead of returning to
3389           C-Kermit when finished, the command returns to whatever process
3390           invoked Kermit.
3391
3392    In the normal case, no files are closed, so the EXEC'd command
3393    inherits the open files, read/write pointers, working directory,
3394    process ID, user ID (unless command is SUID), group ID (unless command
3395    is SGID), groups, etc. (In UNIX, the EXEC command is simply a front
3396    end for execvp().)
3397
3398    If the /REDIRECT switch is included, then if a connection is open (SET
3399    LINE or SET HOST), it becomes the standard input and output of the
3400    EXEC'd program. If no connection is open, the /REDIRECT switch has no
3401    effect. For example to use C-Kermit for PPP dialing in Linux:
3402
3403   set modem type usr          ; Specify the kind of modem you have
3404   set line /dev/ttyS1         ; Specify the device it's connected to
3405   set speed 57600             ; and the speed
3406   set flow rts/cts            ; and flow control.
3407   set dial retries 100        ; Try the dial sequence up to 100 times.
3408   dial {{9-212-555-1212}{9-212-555-1213}{9-212-555-1214}{9-212-555-1215}}
3409   if fail exit 1
3410   for \%i 1 16 1 {            ; Try up to 16 times to get login prompt
3411       input 10 Login:         ; Wait 10 sec for it to appear
3412       if success break        ; Got it - proceed...
3413       output \13              ; Send a carriage return and try again
3414   }
3415   if ( > \%i 16 ) stop 1 NO LOGIN PROMPT
3416   lineout \(myuserid)         ; Send user ID
3417   input 30 assword:           ; Wait for Password prompt
3418   if fail stop 1 NO PASSWORD PROMPT
3419   lineout \m(mypassword)      ; Send the password.
3420   exec /redirect pppd         ; Replace ourselves with pppd.
3421
3422    In this example we assume that the script has already set up the
3423    myuserid and mypassword variables -- normally the password should be
3424    prompted for, rather than stored on disk. Notice the advantages over
3425    the well-known "chat script":
3426      * You don't have to control the modem itself with AT commands;
3427        Kermit's DIAL command does this for you.
3428      * You can have Kermit automatically redial as many times as you want
3429        until it gets a connection (if this is legal in your country).
3430      * You can have Kermit fetch the number or numbers from a dialing
3431        directory.
3432      * You can have Kermit cycle through a list of phone numbers (this is
3433        new in C-Kermit 7.0; see [381]Section 2.1.16) without having to
3434        enter the numbers in a dialing directory.
3435      * Dialing is location-independent; you can use the same script to
3436        dial from different areas or countries.
3437      * Once the connection is made, the full power of Kermit's script
3438        language is available to manage the dialog with the terminal
3439        server or other device that answers the phone call.
3440
3441    NOTE: PPP and SLIP dialing are not available in Windows 95/98/NT/2000,
3442    whose APIs do not provide a method for an application to hand over a
3443    connection to the PPP or SLIP driver.
3444      _________________________________________________________________
3445
3446   1.24. Getting Keyword Lists with '?'
3447
3448    Suppose you type "te" at the C-Kermit> 6.0 prompt and then Esc or Tab
3449    to request keyword completion. Kermit beeps, indicating that more than
3450    one command starts with "te". But if you type '?' to see what they
3451    are, Kermit shows only "telnet". So why the beep? Because of invisible
3452    keywords like "telopt", "terminal", and "text". Lots of keywords are
3453    invisible because they are either synonyms for other keywords or else
3454    esoteric options to be used only in special circumstances, so we don't
3455    want them cluttering up the menus.
3456
3457    But then there is no way for you to discover them. So in C-Kermit 7.0,
3458    if you type '?' AFTER the beginning of a keyword field, then invisible
3459    keywords are shown too:
3460
3461   C-Kermit> te<Esc><BEEP>
3462   C-Kermit> te? Command, one of the following:
3463    telnet    telopt    terminal  text
3464   C-Kermit>te
3465
3466    But if '?' is typed at the beginning of a field, only visible keywords
3467    are shown, as before (so, in this example, if '?' is typed at the
3468    C-Kermit> prompt, "telnet" is the only command shown that starts with
3469    "te").
3470      _________________________________________________________________
3471
3472   2. MAKING AND USING CONNECTIONS The SET LINE, SET HOST, and SET PORT (a
3473   synonym for SET LINE) commands have new synonyms, in which the word SET is
3474   replaced by the word OPEN: OPEN LINE, etc. There is no new functionality
3475   here, but OPEN is a better verb, since SET generally takes no action, whereas
3476   these commands actually try to open a connection. Furthermore, there is the
3477   symmetry with CLOSE.
3478     ________________________________________________________________________
3479
3480   2.0. SET LINE and SET HOST Command SwitchesThe SET LINE (SET PORT) and SET
3481   HOST commands now allow switches before the device or host name, in most
3482   cases, and under certain circumstances, also at the end. The new syntax is
3483   backwards compatible with the previous syntax; thus SET LINE, SET PORT, and
3484   SET HOST commands in command files written for C-Kermit 6.0 or earlier still
3485   work. The expanded syntax is:
3486
3487   { OPEN, SET } { LINE, PORT, HOST } [ switches ] device-or-address [ switches
3488   ]
3489
3490   The first group of switches is:
3491
3492    /NETWORK-TYPE:{TCP/IP,X.25,PIPE,PTY...}
3493           When more than one network type is available, this lets you
3494           specify the type of network to use for this connection without
3495           affecting your global SET NETWORK TYPE. See [382]Section 2.7
3496           about pipes and ptys.
3497
3498    /USERID:[string]
3499           This switch is equivalent to SET LOGIN USERID. If a string is
3500           given, it sent to host during Telnet negotiations; if this
3501           switch is given but the string is omitted, no user ID is sent
3502           to the host. If this switch is not given, your current LOGIN
3503           USERID (\v(userid) value), if any, is sent. Unlike most other
3504           switches, this one is "sticky", since the value must persist
3505           throughout the session in case the server requests the ID
3506           string at a later time.
3507
3508    /CONNECT
3509           Enter CONNECT mode immediately and automatically after the
3510           device or connection is open. On serial devices, however, when
3511           CARRIER-WATCH is not OFF, wait up to 1 second for the Carrier
3512           Detect signal to appear before trying to connect, to give the
3513           device time to react DTR, which might have been off prior to
3514           opening the device.
3515
3516    /SERVER
3517           Enter server mode immediately and automatically after the
3518           device or connection is open. Treatment of carrier is the same
3519           as for /CONNECT.
3520
3521    /WAIT
3522    /NOWAIT
3523           For Telnet connections only: Like SET TELNET WAIT { ON, OFF },
3524           but applies only to this connection, and in fact applies only
3525           when OPENing this connection (which is usually the only place
3526           it matters). Typically you would use TELNET /NOWAIT to make a
3527           connection to a misbehaving Telnet server that does not reply
3528           to negotiations as required by the Telnet protocol definition.
3529
3530    Note: /CONNECT and /SERVER switches are not available in the RLOGIN
3531    and TELNET commands, since these commands already include an implicit
3532    /CONNECT and preclude automatic entry into server mode.
3533
3534    The /CONNECT and /SERVER switches are especially useful with "set host
3535    *" connections. For example, suppose you want to start a Kermit server
3536    on socket 3000 of your TCP host. Normally you would have to give the
3537    command:
3538
3539   set host * 3000
3540
3541    and then wait for a connection to come in, and only then could you
3542    give the SERVER command (or else define a macro to do this, and then
3543    execute the macro). Now you can do it in one step:
3544
3545   set host /server * 3000
3546
3547    This tells C-Kermit to wait for the connection and then enter server
3548    mode once it comes in, no matter how long it takes. Similarly, "set
3549    host /conn *" can be used to wait for a "chat" connection to come in.
3550
3551    Another set of switches is available in VMS only, for use only with
3552    SET LINE:
3553
3554    /SHARE
3555           Allows the SET LINE device to be opened in shared mode.
3556           Normally it makes no sense to open a serial device in shared
3557           mode, but it's necessary when C-Kermit is running in an
3558           environment such as DECIntact, that opens your job's
3559           controlling terminal in such a way that C-Kermit can't open it
3560           too, unless it enables SHARE privilege. Note: SHARE privilege
3561           is required.
3562
3563    /NOSHARE
3564           Requires that the SET LINE device not be in use by any other
3565           process in order for it to be successfully opened by C-Kermit.
3566           If neither /SHARE nor /NOSHARE is specified, /NOSHARE is used.
3567
3568    The second group of switches is:
3569
3570    /NO-TELNET-INIT
3571           Do not send initial Telnet negotiations even if this is a
3572           Telnet port.
3573
3574    /RAW-SOCKET
3575           This is a connection to a raw TCP socket ([383]Section 2.3.5).
3576
3577    /RLOGIN
3578           Use Rlogin protocol even if this is not an Rlogin port.
3579
3580    /TELNET
3581           Send initial Telnet negotiations even if this is not a Telnet
3582           port.
3583
3584    As of C-Kermit 7.0 and K95 1.1.19, the TELNET command includes an
3585    implicit /TELNET switch. So if you TELNET to a non-TELNET port, Kermit
3586    sends initial Telnet negotiations. This makes sense, since that's what
3587    "telnet" means.
3588
3589    If you want to make a connection to a non-Telnet port without sending
3590    initial Telnet negotiations, use:
3591
3592   set host [ /connect ] name-or-address port
3593
3594    or:
3595
3596   telnet name-or-address port /no-telnet-init
3597
3598    Additional switches might be added in the future; type "set host ?" or
3599    "set line ?" to see a current list.
3600      _________________________________________________________________
3601
3602   2.1. Dialing
3603
3604    Automatic redialing is illegal or restricted in many countries, so
3605    until C-Kermit 7.0, it was disabled by default, i.e. until a SET DIAL
3606    RETRIES command was given. In C-Kermit 7.0, if no SET DIAL RETRIES
3607    command has been given, a default is picked dynamically at DIAL time
3608    based on the calling country code, if known. At this writing, the only
3609    country code known to have no restrictions on automatic redialing is
3610    1. So in this case a limit of 10 is chosen; otherwise 1. If you have
3611    not given an explicit SET DIAL RETRIES command, SHOW DIAL shows the
3612    value as "(auto)", and then the value actually used is shown when you
3613    give the DIAL command.
3614
3615    As of C-Kermit 7.0, automatic redialing is automatically canceled if
3616    the call could not be placed because no dialtone was detected.
3617      _________________________________________________________________
3618
3619     2.1.1. The Dial Result Message
3620
3621    If DIAL DISPLAY is not ON, the "Call complete" message now shows the
3622    modem's call result message, for example:
3623
3624   Dialing: ...
3625   Call complete: "CONNECT 31200/ARQ/V32/LAPM/V42BIS"
3626
3627    The exact format and contents of this message, of course, depends on
3628    the make, model, and configuration of your modem, so use your modem
3629    manual to interpret it. The call result message is also available in
3630    C-Kermit's \v(dialresult) variable.
3631
3632   C-Kermit> echo \v(dialresult)
3633   CONNECT 31200/ARQ/V32/LAPM/V42BIS
3634   C-Kermit> echo Speed = \fword(\v(dialresult),2)
3635   Speed = 31200
3636   C-Kermit>
3637
3638    Suppose your modem reports the modulation speed as shown above and you
3639    want to ensure your call is completed at (say) 24000 bps or more. You
3640    can use a little macro to do the job:
3641
3642 define HSDIAL {                ; High Speed DIAL
3643     local \%s
3644     if < \v(argc) 1 if not def \v(dialnumber) end 1 Usage: \%0 number
3645     set dial retries 100
3646     set dial interval 1
3647     while true {
3648         dial \%*
3649         if fail end 1 DIAL failed.
3650         asg \%s \fword(\v(dialresult),2)
3651         if def \%s if numeric \%s if not < \%s 24000 break
3652     }
3653 }
3654
3655    (See [384]Section 7.5 about the \%* variable.)
3656      _________________________________________________________________
3657
3658     2.1.2. Long-Distance Dialing Changes
3659
3660    Due to the glut of cell phones, pagers, fax machines, ISPs, etc, area
3661    codes and dialing rules are changing all the time. In the North
3662    American Numbering Plan (NANP) countries (USA, Canada, etc), area
3663    codes are split or overlayed with increasing frequency, and 10- and
3664    11-digit dialing is gradually becoming the norm for local calls.
3665    Changes are occurring In Europe, too, partly for these reasons and
3666    partly because of some new EC rules.
3667
3668    In France, effective 18 October 1996, all calls, even local ones, must
3669    be dialed with an area code. French area codes are presently 1-digit
3670    numbers, 1-6, and the long-distance dialing prefix is 0. All calls
3671    within France are considered long distance and begin with 01, 02, ...,
3672    06.
3673
3674    Effective 1 May 1997, all calls within the US state of Maryland, even
3675    local ones, must be dialed with an area code but without the
3676    long-distance prefix -- this is the now widely-known North American
3677    phenomenon of "ten digit dialing". The same is happening elsewhere --
3678    many cities in Florida adopted 10-digit dialing in 1998.
3679
3680    In Italy beginning 19 June 1998, all calls to fixed (as opposed to
3681    mobile) numbers must be prefixed by 0. When calling into Italy from
3682    outside, the 0 must follow the country code (39). Calls to cell
3683    phones, however, must be placed without the 0. Then on 29 December
3684    2000, the 0 will become a 4 (for calling fixed numbers) and a prefix
3685    of 3 must used for calling mobile phones. More info at:
3686    http://www.telecomitalia.it/npnn/.
3687
3688    In Spain, effective 4 April 1998, with hard cutover on 18 July 1998,
3689    all calls within the country must be dialed with 9 digits, and all
3690    calls from outside Spain must also be dialed with 9 digits (after the
3691    country code, 34). The new 9-digit numbers all begin with "9". More
3692    info at: [385]http://www.telefonica.es/cambiodenumeracion/
3693
3694    Several new dialing features and commands have been added in version
3695    6.1 and 7.0 to address these changes.
3696
3697    C-Kermit 6.0 and Kermit 95 1.1.11 and earlier handle the French
3698    situation via a reasonable subterfuge (setting the local area code to
3699    a nonexistent one), but did not handle "ten-digit dialing" well at
3700    all; the recommended technique was to change the long-distance dialing
3701    prefix to nothing, but this defeated Kermit's "list numbers for one
3702    name" feature when the numbers were in different locations. For
3703    example:
3704
3705   set dial ld-prefix
3706   dial onlineservice
3707
3708    where "onlineservice" is a dialing directory entry name corresponding
3709    to entries that are in (say) Maryland as well as other states, would
3710    not correctly dial the numbers not in Maryland.
3711
3712    A new command lets you specify a list of area codes to be considered
3713    local, except that the area code must be dialed:
3714
3715    SET DIAL LC-AREA-CODES [ areacode [ areacode [ areacode [ ... ] ] ] ]
3716           The list may include up to 32 area codes. If a number is called
3717           whose area code is in this list, it is dialed WITHOUT the
3718           long-distance prefix, but WITH the area code.
3719
3720    So in Maryland, which (last time we looked) has two area codes, 410
3721    and 301, the setup would be:
3722
3723   SET DIAL LC-AREA-CODES 410 301
3724
3725    Example:
3726
3727   SET DIAL LD-PREFIX 1
3728   SET DIAL AREA-CODE 301
3729   SET DIAL LC-AREA-CODES 410 301 <-- Area codes in 10-digit dialing region
3730   DIAL +1 (301) 765-4321         <-- Dials 3017654321  (local with area code)
3731   DIAL +1 (410) 765-4321         <-- Dials 4107654321  (local with area code)
3732   DIAL +1 (212) 765-4321         <-- Dials 12127654321 (long distance)
3733
3734    The SET DIAL LC-AREA-CODES command does not replace the SET DIAL
3735    AREA-CODE command. The latter specifies the area code you are dialing
3736    from. If the called number is in the same area code, then the area
3737    code is dialed if it is also in the LC-AREA-CODES list, and it is not
3738    dialed otherwise. So if "301" had not appeared in the LC-AREA-CODES
3739    list in the previous example:
3740
3741   SET DIAL LD-PREFIX 1
3742   SET DIAL AREA-CODE 301
3743   SET DIAL LC-AREA-CODES 410     <-- Area codes in 10-digit dialing region
3744   DIAL +1 (301) 765-4321         <-- Dials 7654321     (local)
3745   DIAL +1 (410) 765-4321         <-- Dials 4107654321  (local with area code)
3746   DIAL +1 (212) 765-4321         <-- Dials 12127654321 (long distance)
3747
3748    The new Kermit versions also add a Local Call Prefix and Local Call
3749    Suffix, in case you have any need for it. These are added to the
3750    beginning and of local phone numbers (i.e. numbers that are not
3751    long-distance or international). Examples:
3752
3753   SET DIAL LD-PREFIX 1
3754   SET DIAL LC-PREFIX 9
3755   SET DIAL LC-SUFFIX *
3756   SET DIAL LC-AREA-CODES 410     <-- Area codes in 10-digit dialing region
3757   SET DIAL AREA-CODE 301
3758   DIAL +1 (301) 765-4321         <-- Dials 97654321*     (local)
3759   DIAL +1 (410) 765-4321         <-- Dials 94107654321*  (local with area code)
3760   DIAL +1 (212) 765-4321         <-- Dials 12127654321   (long distance)
3761      _________________________________________________________________
3762
3763     2.1.3. Forcing Long-Distance Dialing
3764
3765    Suppose a number is in your country and area, but for some reason you
3766    need to dial it long-distance anyway (as is always the case in
3767    France). There have always been various ways to handle this:
3768
3769     1. Temporarily set your area code to a different (or nonexistent or
3770        impossible) one (but this required knowledge of which area codes
3771        were nonexistent or impossible in each country).
3772     2. Dial the number literally instead of using the portable format,
3773        but this defeats the purpose of the portable dialing directory.
3774
3775    Now there is also a new command that, very simply, can force
3776    long-distance dialing:
3777
3778    SET DIAL FORCE-LONG-DISTANCE { ON, OFF }
3779           If a call is placed to a portable phone number within the same
3780           country code as the calling number, it is dialed with the
3781           long-distance prefix and the area code if FORCE-LONG-DISTANCE
3782           is ON. If OFF, the regular rules and procedures apply.
3783
3784    Example (France):
3785
3786   SET DIAL COUNTRY-CODE 33
3787   SET DIAL AREA-CODE 6
3788   SET DIAL FORCE-LONG-DISTANCE ON
3789
3790    (In fact, SET DIAL COUNTRY-CODE 33 automatically sets DIAL
3791    FORCE-LONG-DISTANCE ON...)
3792
3793    Example (USA, for a certain type of reverse-charge calling in which
3794    the called number must always be fully specified):
3795
3796   SET DIAL PREFIX 18002666328$     ; 1-800-COLLECT
3797   SET DIAL COUNTRY-CODE 1
3798   SET DIAL AREA-CODE 212
3799   SET DIAL FORCE-LONG-DISTANCE ON
3800
3801    Example (Toronto, where calls to exchange 976 within area code 416
3802    must be dialed as long distance, even when you are dialing from area
3803    code 416):
3804
3805   SET DIAL COUNTRY-CODE 1
3806   SET DIAL AREA-CODE 416
3807   SET DIAL FORCE-LONG-DISTANCE ON
3808   DIAL +1 (416) 976-xxxx
3809
3810    If dialing methods were consistent and sensible, of course it would be
3811    possible to always dial every domestic call as if it were long
3812    distance. But in many locations this doesn't work or if it does, it
3813    costs extra. The following macro can be used for dialing any given
3814    number with forced long-distance format:
3815
3816   define LDIAL {
3817       local \%x
3818       set dial force-long-distance on
3819       dial \%*
3820       asg \%x \v(success)
3821       set dial force-long-distance off
3822       end \%x
3823   }
3824
3825    (See [386]Section 7.5 about the \%* variable.)
3826      _________________________________________________________________
3827
3828     2.1.4. Exchange-Specific Dialing Decisions
3829
3830    This applies mainly to the North American Numbering Plan (NANP). Refer
3831    to the section "Alternative notations" in [387]Using C-Kermit 2nd
3832    Edition, pages 106-107, and the story about Toronto on page 110. Using
3833    the new LC-AREA-CODES list, we can address the problem by treating the
3834    exchange as part of the area code:
3835
3836   SET DIAL LD-PREFIX 1
3837   SET DIAL AREA-CODE 416
3838   SET DIAL LC-AREA-CODES 905276
3839   DIAL +1 416 765 4321               <-- 7654321      (local)
3840   DIAL +1 905 276 4321               <-- 9052764321   (local with area code)
3841   DIAL +1 905 528 4321               <-- 19055284321  (long distance)
3842
3843    The same technique can be used in Massachusetts (story at top of page
3844    111) and in any other place where dialing to some exchanges within a
3845    particular area code is local, but to others in the same area code is
3846    long distance.
3847      _________________________________________________________________
3848
3849     2.1.5. Cautions about Cheapest-First Dialing
3850
3851    Kermit does not maintain a knowledge base of telephony information; it
3852    only provides the tools to let you enter a phone number in a standard
3853    format and dial it correctly from any location in most cases.
3854
3855    In particular, Kermit does not differentiate the charging method from
3856    the dialing method. If a call that is DIALED as long-distance (e.g.
3857    from 212 to 718 in country code 1) is not CHARGED as long distance, we
3858    have no way of knowing that without keeping a matrix of charging
3859    information for every area-code combination within every country, and
3860    any such matrix would be obsolete five minutes after it was
3861    constructed. Thus, "cheapest-first" sorting is only as reliable as our
3862    assumption that the charging method follows the dialing method. A good
3863    illustration would be certain online services that have toll-free
3864    dialup numbers which they charge you a premium (in your online service
3865    bill) for using.
3866      _________________________________________________________________
3867
3868     2.1.6. Blind Dialing (Dialing with No Dialtone)
3869
3870    C-Kermit's init string for Hayes-like modems generally includes an X4
3871    command to enable as many result codes as possible, so that Kermit can
3872    react appropriately to different failure reasons. One of the result
3873    codes that X4 enables is "NO DIALTONE". A perhaps not obvious side
3874    effect of enabling this result code that the modem must hear dialtone
3875    before it will dial.
3876
3877    It is becoming increasingly necessary to force a modem to dial even
3878    though it does not hear a dialtone on the phone line; for example,
3879    with PBXs that have strange dialtones, or with phone systems in
3880    different countries, or with ISDN phones, etc. This is called "blind
3881    dialing".
3882
3883    C-Kermit 7.0 has two new commands to cope with this situation:
3884
3885    SET DIAL IGNORE-DIALTONE { ON, OFF }
3886           OFF (the default) means to tell the modem to wait for dialtone
3887           before dialing. ON means to enable "blind dialing", i.e. tell
3888           the modem NOT to wait for dialtone before dialing. Generally
3889           this is accomplished by sending ATX3 to the modem just prior to
3890           dialing. SET MODEM TYPE xxx and then SHOW MODEM displays
3891           Kermit's built-in "ignore dialtone" command.
3892
3893    SET DIAL COMMAND IGNORE-DIALTONE text
3894           This lets you change the built-in ignore-dialtone command (such
3895           as ATX3) to whatever you choose, in case the built-in one does
3896           not work, or another command works better.
3897
3898    Notes:
3899     1. The ignore-dialtone command is not sent unless SET DIAL
3900        IGNORE-DIALTONE is ON.
3901     2. The ATX3 command generally disables not only NO DIALTONE, but also
3902        BUSY. So this will prevent Kermit from detecting when the line is
3903        busy. This is a property of the modem, not of Kermit.
3904      _________________________________________________________________
3905
3906     2.1.7. Trimming the Dialing Dialog
3907
3908    The command:
3909
3910   SET MODEM COMMAND action [ command ]
3911
3912    is used to override Kermit's built-in modem commands for each action,
3913    for each kind of modem in its internal database. If you include a
3914    command, this is used instead of the built-in one. If you omit the
3915    command, this restores the original built-in command.
3916
3917    If you want to omit the command altogether, so Kermit doesn't send the
3918    command at all, or wait for a response, use:
3919
3920   SET MODEM COMMAND action {}
3921
3922    That is, specify a pair of empty braces as the command, for example:
3923
3924   SET MODEM COMMAND ERROR-CORRECTION ON {}
3925      _________________________________________________________________
3926
3927     2.1.8. Controlling the Dialing Speed
3928
3929    The rate at which characters are sent to the modem during dialing is
3930    normally controlled by the built-in modem database. You might want to
3931    override this if Kermit seems to be dialing too slowly, or it is
3932    sending characters to the modem faster than the modem handle them. A
3933    new command was added for this in C-Kermit 7.0:
3934
3935    SET DIAL PACING number
3936           Specifies the number of milliseconds (thousandths of seconds)
3937           to pause between each character when sending commands to the
3938           modem during DIAL or ANSWER command execution. 0 means no pause
3939           at all, -1 (the default) or any other negative number means to
3940           use the value from the database. Any number greater than 0 is
3941           the number of milliseconds to pause.
3942
3943    HINT: You might also need to control the rate at which the modem
3944    generates Touch Tones during dialing, for example when sending a
3945    numeric page. There are two ways to do this. One way is to insert
3946    pause characters into the dialing string. For modems that use the AT
3947    command set, the pause character is comma (,) and causes a 2-second
3948    pause. On most modems, you can use the S8 register to change the pause
3949    interval caused by comma in the dialing string. The other way is to
3950    set your modem's tone generation interval, if it has a command for
3951    that. Most AT-command-set modems use S11 for this; the value is in
3952    milliseconds. For example on USR modems:
3953
3954   ATS11=200
3955
3956    selects an interval of 200 milliseconds to separate each dialing tone.
3957
3958    Hint: To add S-Register settings or other commands to your dialing
3959    procedure, use the new SET MODEM COMMAND PREDIAL-INIT command
3960    ([388]Section 2.2.2).
3961      _________________________________________________________________
3962
3963     2.1.9. Pretesting Phone Number Conversions
3964
3965    The LOOKUP command now accepts telephone numbers as well as
3966    directory-entry names, for example:
3967
3968   LOOKUP +1 (212) 7654321
3969
3970    When given a phone number, LOOKUP prints the result of converting the
3971    phone number for dialing under the current dialing rules. For example,
3972    if my country code is 1 and my area code is 212, and I am dialing out
3973    from a PBX whose outside-line prefix is "93,":
3974
3975   C-Kermit> lookup +1 (212) 7654321
3976   +1 (212) 7654321 => 93,7654321
3977   C-Kermit>
3978
3979    You can also use the \fdialconvert(phone-number) function
3980    ([389]Section 2.1.11) to do this programmatically:
3981
3982   C-Kermit> echo "\fdialconvert(+1 (212) 7654321)"
3983   "93,7654321"
3984   C-Kermit>
3985
3986    So the new LOOKUP behaves as follows:
3987
3988    LOOKUP portable-format-phone-number
3989           Displays how the number would actually be dialed Sets FAILURE
3990           if there was a conversion error, otherwise SUCCESS.
3991
3992    LOOKUP literal-format-phone-number
3993           Displays the same literal-format-phone-number Always sets
3994           SUCCESS.
3995
3996    LOOKUP dialing-directory-name
3997           Displays all matching entries and converts portable phone
3998           numbers. Sets SUCCESS if at least one entry was found,
3999           otherwise FAILURE.
4000
4001    LOOKUP =anything
4002           Displays "=anything" and sets SUCCESS.
4003
4004    There is, at present, no programmatic way to fetch numbers from the
4005    dialing directory. This will be considered for a future release.
4006      _________________________________________________________________
4007
4008     2.1.10. Greater Control over Partial Dialing
4009
4010    The following rules now apply to partial dialing:
4011
4012      * Phone number transformations based on country and area code,
4013        application of prefixes, etc, are performed only on the first
4014        PDIAL.
4015      * Each PDIAL argument is looked up in the dialing directory, so it
4016        is possible have directory entries for pieces of phone numbers or
4017        other information.
4018      * Suffixes are not applied automatically, since there is no way for
4019        C-Kermit to know in which PDIAL segment you want them to be
4020        applied.
4021
4022    However, the suffix that *would* have been applied, based on the
4023    dialing rules that were invoked when processing the first PDIAL
4024    command, is stored in the variable:
4025
4026   \v(dialsuffix)
4027
4028    which you can include in any subsequent PDIAL or DIAL commands.
4029
4030    Example:
4031
4032   pdial {\m(my_long_distance_pager_number_part_1)}
4033   pdial {\m(my_long_distance_pager_number_part_2)}
4034   pdial {\v(dialsuffix)}
4035   pdial {\m(my_long_distance_pager_number_part_3)}
4036   pdial {@\m(numeric_pager_code)#}
4037      _________________________________________________________________
4038
4039     2.1.11. New DIAL-related Variables and Functions
4040
4041    \fdialconvert(s)
4042           s is a phone number in either literal or portable format (not a
4043           dialing directory entry name). The function returns the dial
4044           string that would actually be used by the DIAL command when
4045           dialing from the current location, after processing country
4046           code, area code, and other SET DIAL values, and should be the
4047           same as the result of LOOKUP when given a telephone number.
4048
4049    \v(dialsuffix)
4050           Contains the suffix, if any, that was applied in the most
4051           recent DIAL command, or the suffix that would have been applied
4052           in the most recent PDIAL command. Use this variable to send the
4053           dial suffix at any desired point in a PDIAL sequence.
4054
4055    \v(dialtype)
4056           A number indicating the type of call that was most recently
4057           placed. Can be used after a normal DIAL command, or after the
4058           first PDIAL command in a PDIAL sequence. Values are:
4059
4060   -2: Unknown because TAPI handled the phone number translation.
4061   -1: Unknown because some kind of error occured.
4062    0: Internal within PBX.
4063    1: Toll-free.
4064    2: Local within calling area.
4065    3: Unknown (e.g. because a literal-format phone number was given).
4066    4: Long distance within country.
4067    5: International
4068
4069    \v(dialcount)
4070           The current value of the DIAL retry counter, for use in a DIAL
4071           macro ([390]Section 2.1.13).
4072
4073    \v(d$px)
4074           PBX Exchange (see [391]Section 2.1.12).
4075
4076    Other dial-related variables, already documented in [392]Using
4077    C-Kermit (or other sections of this document, e.g. [393]Section
4078    2.1.1), include \v(dialnumber), \v(dialstatus), etc. A convenient way
4079    to display all of them is:
4080
4081   show variable dial  ; hint: abbreviate "sho var dial"
4082
4083    This shows the values of all the variables whose names start with
4084    "dial". Also "show variable d$" (to show the \v(d$...) variables).
4085      _________________________________________________________________
4086
4087     2.1.12. Increased Flexibility of PBX Dialing
4088
4089    Refer to [394]Using C-Kermit, 2nd Edition, pages 107-108. Recall that
4090    three commands are needed to configure C-Kermit for dialing from a
4091    PBX:
4092
4093   SET DIAL PBX-EXCHANGE number
4094   SET DIAL PBX-INSIDE-PREFIX number
4095   SET DIAL PBX-OUTSIDE-PREFIX number
4096
4097    Unfortunately, this model does not accommodate PBXs that have more
4098    than one exchange. For example our PBX at Columbia University (which
4099    must handle more than 10,000 phones) has 853-xxxx and 854-xxxx
4100    exchanges.
4101
4102    Beginning in C-Kermit 7.0, the SET DIAL PBX-EXCHANGE command accepts a
4103    list of exchanges, e.g.:
4104
4105   SET DIAL PBX-EXCHANGE 853 854
4106
4107    (multiple exchanges are separated by spaces, not commas).
4108
4109    So now when dialing a portable-format number that has the same country
4110    and area codes as those of your dialing location, C-Kermit compares
4111    the exchange of the dialed number with each number in the PBX Exchange
4112    list (rather than with a single PBX Exchange number, as it did
4113    formerly) to determine whether this is an internal PBX number or an
4114    external call. If it is an external call, then the PBX Outside Prefix
4115    is applied, and then the normal dialing rules for local or
4116    long-distance calls.
4117
4118    If it is an inside call, the exchange is replaced by the PBX Inside
4119    Prefix. But if the PBX has more than one exchange, a single fixed PBX
4120    Inside Prefix is probably not sufficient. For example, at Columbia
4121    University, we must dial 3-xxxx for an internal call to 853-xxxx, but
4122    4-xxxx for a call to 854-xxxx. That is, the inside prefix is the final
4123    digit of the exchange we are dialing. For this reason, C-Kermit 7.0
4124    provides a method to determine the inside prefix dynamically at
4125    dialing time, consisting of a new variable and new syntax for the SET
4126    DIAL PBX-INSIDE-PREFIX command:
4127
4128    \v(d$px)
4129           This variable contains the exchange that was matched when a PBX
4130           internal call was detected. For example, if the PBX exchange
4131           list is "853 854" and a call is placed to +1 (212) 854-9999,
4132           \v(d$px) is set to 854.
4133
4134    SET DIAL PBX-INSIDE-PREFIX \fxxx(...)
4135           If the PBX Inside Prefix is defined to be a function, its
4136           evaluation is deferred until dialing time. Normally, this would
4137           be a string function having \v(d$px) as an operand. Of course,
4138           you can still specify a constant string, as before.
4139
4140    So given the following setup:
4141
4142   SET DIAL COUNTRY-CODE 1
4143   SET DIAL AREA-CODE 212
4144   SET DIAL PBX-OUTSIDE-PREFIX 93,
4145   SET DIAL PBX-EXCHANGE 853 854
4146   SET DIAL PBX-INSIDE-PREFIX \fright(\v(d$px),1)
4147
4148    The following numbers give the results indicated:
4149
4150  Number                   Result
4151   +1 (212) 854-9876        4-9876
4152   +1 (212) 853-1234        3-1234
4153   +1 (212) 765-4321        93,765-4321
4154   +1 (333) 765-4321        93,1333765-4321
4155
4156    Furthermore, the K_PBX_XCH environment variable may now be set to a
4157    list of exchanges to automatically initialize C-Kermit's PBX exchange
4158    list, for example (in UNIX ksh or bash):
4159
4160   export K_PBX_XCH="853 854"
4161
4162    (Quotes required because of the space.) Of course, this variable can
4163    also be set to a single exchange, as before:
4164
4165   export K_PBX_XCH=853
4166      _________________________________________________________________
4167
4168     2.1.13. The DIAL macro - Last-Minute Phone Number Conversions
4169
4170    After a DIAL or LOOKUP command is given, a list of phone numbers is
4171    assembled from the dialing directory (if any), with all
4172    location-dependent conversion rules applied as described in Chapter 5
4173    of [395]Using C-Kermit.
4174
4175    However, additional conversions might still be required at the last
4176    minute based on local or ephemeral conditions. So that you can have
4177    the final word on the exact format of the dial string, C-Kermit 7.0
4178    lets you pass the converted string through a macro of your own design
4179    for final processing before dialing. The relevant command is:
4180
4181    SET DIAL MACRO [ name ]
4182           Specifies the name of a macro to be run on each phone number
4183           after all built-in conversions have been applied, just before
4184           the number is dialed. If no name is given, no macro is run. The
4185           phone number, as it would have been dialed if there were no
4186           dial macro, is passed to the macro.
4187
4188    The dial macro can do anything at all (except start a file transfer).
4189    However, the normal use for the macro would be to modify the phone
4190    number. For this reason the phone number is passed to the macro as
4191    argument number 1 (\%1). To cause a modified number to be dialed, the
4192    macro should terminate with a RETURN statement specifying a return
4193    value. To leave the number alone, the macro should simply end.
4194    Example:
4195
4196   define xxx return 10108889999$\%1
4197   set dial macro xxx
4198   dial xyzcorp
4199
4200    This defines a DIAL MACRO called xxx, which puts an access code on the
4201    front of the number. Another example might be:
4202
4203   def xxx if equal "\v(modem)" "hayes-1200" return \freplace(\%1,$,{,,,,,})
4204   set dial macro xxx
4205   dial xyzcorp
4206
4207    which replaces any dollar-sign in the dial string by a series of five
4208    commas, e.g. because this particular modem does not support the "wait
4209    for bong" feature (remember that commas that are to be included
4210    literally in function arguments must be enclosed in braces to
4211    distinguish them from the commas that separate the arguments) and when
4212    the IF condition is not satisfied, the macro does not return a value,
4213    and so the number is not modified. Then when a DIAL command is given
4214    referencing a dialing directory entry, "xyzcorp". The macro is
4215    automatically applied to each matching number.
4216
4217    Numerous dial-, modem-, communications-, and time-related variables
4218    are available for decision making your dial macro. Type SHOW VARIABLES
4219    for a list. Of particular interest is the \v(dialcount) variable,
4220    which tells how many times the DIAL command gone through its retry
4221    loop: 1 on the first try, 2 on the second, 3 on the third, and so on,
4222    and the \v(dialresult) and \v(dialstatus) variables.
4223
4224    Here are some other applications for the DIAL MACRO (from users):
4225
4226      * Phone numbers in the dialing directory are formatted with '-' for
4227        readability, but some modems don't like the hyphens, so the DIAL
4228        macro is used to remove them before dialing; e.g
4229        0090-123-456-78-99 becomes 00901234567899: "def xxx return
4230        \freplace(\%1,-)".
4231      * To set some specific modem (or other) options depending on the
4232        called customer or telephone number.
4233      * Choosing the most appropriate provider based on (e.g.) time of
4234        day, or cycling through a list of providers in case some providers
4235        might be busy.
4236
4237    To illustrate the final item, suppose you have a choice among many
4238    phone service providers; the provider is chosen by dialing an access
4239    code before the number. Different providers might be better (e.g.
4240    cheaper) for certain times of day or days of the week, or for dialing
4241    certain locations; you can use the DIAL macro to add the access for
4242    the most desirable provider.
4243
4244    Similarly, when the same number might be reached through multiple
4245    providers, it's possible that one provider might not be able to
4246    complete the call, but another one can. In that case, you can use the
4247    DIAL macro to switch providers each time through the DIAL loop --
4248    that's where the \v(dialcount) variable comes in handy.
4249
4250    The following command can be used to debug the DIAL macro:
4251
4252    SET DIAL TEST { ON, OFF }
4253           Normally OFF, so the DIAL command actually dials. When ON, the
4254           DIAL command performs all lookups and number conversions, and
4255           then goes through the number list and retry loop, but instead
4256           of actually dialing, lists the numbers it would have called if
4257           none of the DIAL attempts succeeded (or more precisely, every
4258           number was always busy).
4259      _________________________________________________________________
4260
4261     2.1.14. Automatic Tone/Pulse Dialing Selection
4262
4263    SET DIAL METHOD { AUTO, DEFAULT, PULSE, TONE }
4264           Chooses the dialing method for subsequent calls.
4265
4266    Prior to version 7.0, C-Kermit's DIAL METHOD was DEFAULT by default,
4267    meaning it does not specify a dialing method to the modem, but relies
4268    on the modem to have an appropriate default dialing method set. So,
4269    for example, when using Hayes compatible modems, the dial string would
4270    be something like ATD7654321, rather than ATDT7654321 or ATDP7654321.
4271
4272    In C-Kermit 7.0 and K95 1.1.19, the dial method can be set from the
4273    environment variable:
4274
4275   K_DIAL_METHOD
4276
4277    when Kermit starts. The values can be TONE, PULSE, or DEFAULT, e.g.
4278    (UNIX):
4279
4280   set K_DIAL_METHOD=TONE; export K_DIAL_METHOD
4281
4282    In the absence of a K_DIAL_METHOD definition, the new default SET DIAL
4283    METHOD is AUTO rather than DEFAULT. When DIAL METHOD is AUTO and the
4284    local country code is known, then if tone dialing is universally
4285    available in the corresponding area, tone dialing is used; if dialing
4286    from a location where pulse dialing is mandatory, pulse dialing is
4287    used.
4288
4289    The "tone country" and "pulse country" lists are preloaded according
4290    to our knowledge at the time of release. You can see their contents in
4291    the SHOW DIAL listing. You can change the lists with:
4292
4293    SET DIAL TONE-COUNTRIES [ cc [ cc [ ... ] ] ]
4294           Replaces the current TONE-COUNTRIES list with the one given.
4295           Each cc is a country code; separate them with spaces (not
4296           commas). Example:
4297
4298   set dial tone-countries 1 358 44 46 49
4299
4300           If no country codes are given, the current list, if any, is
4301           removed, in which case SET DIAL METHOD AUTO is equivalent to
4302           SET DIAL METHOD DEFAULT.
4303
4304    SET DIAL PULSE-COUNTRIES [ cc [ cc [ ... ] ] ]
4305           Replaces the current PULSE-COUNTRIES list with the one give.
4306           Syntax and operation is like SET DIAL TONE-COUNTRIES.
4307
4308    If the same country code appears in both lists, Pulse takes
4309    precedence.
4310
4311    The SET DIAL TONE- and PULSE-COUNTRIES commands perform no
4312    verification whatsoever on the cc's, since almost any syntax might be
4313    legal in some settings. Furthermore, there is no facility to edit the
4314    lists; you can only replace the whole list. However, since the only
4315    purpose of these lists is to establish a basis for picking tone or
4316    pulse dialing automatically, all you need to override the effect of
4317    the list is to set a specific dialing method with SET DIAL METHOD TONE
4318    or SET DIAL METHOD PULSE.
4319      _________________________________________________________________
4320
4321     2.1.15. Dial-Modifier Variables
4322
4323    As of C-Kermit 7.0, dial modifiers are available in the following
4324    variables:
4325
4326  \v(dm_lp) Long pause
4327  \v(dm_sp) Short pause
4328  \v(dm_pd) Pulse dial
4329  \v(dm_td) Tone dial
4330  \v(dm_wa) Wait for answer
4331  \v(dm_wd) Wait for dialtone
4332  \v(dm_rc) Return to command mode
4333
4334    You can use these in your dial strings in place of hardwired modifiers
4335    like "@", ",", etc, for increased portability of scripts. Example:
4336
4337   C-Kermit>set modem type usrobotics
4338   C-Kermit>sho variables dm
4339    \v(dm_lp) = ,
4340    \v(dm_sp) = /
4341    \v(dm_pd) = P
4342    \v(dm_td) = T
4343    \v(dm_wa) = @
4344    \v(dm_wd) = W
4345    \v(dm_rc) = ;
4346   C-Kermit>exit
4347      _________________________________________________________________
4348
4349     2.1.16. Giving Multiple Numbers to the DIAL Command
4350
4351    Prior to C-Kermit 7.0, the only way to give a DIAL command a list of
4352    phone numbers to try until one answers was to create a dialing
4353    directory that had multiple entries under the same name, and then use
4354    that entry name in the DIAL command. Now a list of numbers can be
4355    given to the DIAL command directly in the following format:
4356
4357   dial {{number1}{number2}{number3}...}
4358
4359    This is the same list format used by SEND /EXCEPT: and other commands
4360    that allow a list where normally a single item is given. Restrictions
4361    on this form of the DIAL command are:
4362
4363      * The first two braces must be adjacent; spacing is optional
4364        thereafter.
4365      * Each number must be an actual number to dial, not a dialing
4366        directory entry.
4367      * Dialing directory entries may not contain number lists in this
4368        format.
4369
4370    In all other respects, the numbers are treated as if they had been
4371    fetched from the dialing directory; they can be in literal or portable
4372    format, etc. Example:
4373
4374   dial {{7654321} {+1 (212) 5551212} { 1-212-5556789 }}
4375
4376    The list can be any length at all, within reason.
4377
4378    This feature is especially handy for use with the K95 Dialer, allowing
4379    a list of phone numbers to be specified in the Telephone Number box
4380    without having to set up or reference a separate dialing directory.
4381
4382    You can also use it to add commonly-dialed sequences as variables in
4383    your C-Kermit customization file, e.g.:
4384
4385   define work {{7654321}{7654322}{7654323}}
4386
4387    and then:
4388
4389   dial {\m(work)}
4390
4391    (the variable name must be enclosed in braces).
4392
4393    Or more simply:
4394
4395   define work dial {{7654321}{7654322}{7654323}}
4396
4397    and then:
4398
4399   work
4400      _________________________________________________________________
4401
4402   2.2. Modems
4403
4404     2.2.1. New Modem Types
4405
4406    Since C-Kermit 6.0:
4407
4408   atlas-newcom-33600ifxC Atlas/Newcom 33600
4409   att-keepintouch        AT&T KeepinTouch PCMCIA V.32bis Card Modem
4410   att-1900-stu-iii       AT&T Secure Data STU-III Model 1900
4411   att-1910-stu-iii       AT&T Secure Data STU-III Model 1910
4412   bestdata               Best Data
4413   cardinal               Cardinal V.34 MVP288X series.
4414   compaq                 Compaq Data+Fax (e.g. in Presario)
4415   fujitsu                Fujitsu Fax/Modem Adapter
4416   generic-high-speed     Any modern error-correcting data-compressing modem
4417   itu-t-v25ter/v250      ITU-T (CCITT) V.25ter (V.250) standard command set
4418   megahertz-att-v34      Megahertz AT&T V.34
4419   megahertz-xjack        Megahertz X-Jack
4420   motorola-codex         Motorola Codex 326X Series
4421   motorola-montana       Motorola Montana
4422   mt5634zpx              Multitech MT5634ZPX
4423   rockwell-v90           Rockwell V.90 56K
4424   rolm-244pc             Siemens/Rolm 244PC (AT command set)
4425   rolm-600-series        Siemens/Rolm 600 Series (AT command set)
4426   spirit-ii              QuickComm Spirit II
4427   suprasonic             SupraSonic V288+
4428   supra-express-v90      Supra Express V.90
4429
4430    One of the new types, "generic-high-speed" needs a bit of explanation.
4431    This type was added to easily handle other types that are not
4432    explicitly covered, without going through the bother of adding a
4433    complete user-defined modem type. This one works for modern modems
4434    that use the AT command set, on the assumption that all the default
4435    ("factory") settings of the modem (a) are appropriate for Kermit, (b)
4436    include error correction, data compression, and speed buffering; and
4437    (c) are recallable with the command AT&F.
4438
4439    If the command to recall your modem's profile is not AT&F, use the SET
4440    MODEM COMMAND INIT-STRING command to specify the appropriate modem
4441    command. The default init-string is AT&F\13 (that is, AT, ampersand,
4442    F, and then carriage return); a survey of about 20 modern modem types
4443    shows they all support this, but they might mean different things by
4444    it. For example, the USR Sportster or Courier needs AT&F1 (not AT&F,
4445    which is equivalent to AT&F0, which recalls an inappropriate profile),
4446    so for USR modems:
4447
4448   set modem type generic-high-speed
4449   set modem command init AT&F1\13
4450
4451    Of course, USR modems already have their own built-in modem type. But
4452    if you use this one instead, it will dial faster because it has fewer
4453    commands to give to the modem; in that sense "&F1" is like a macro
4454    that bundles numerous commands into a single one. See your modem
4455    manual for details about factory profiles and commands to recall them.
4456
4457    WARNING: Do not use the generic-high-speed modem type in operating
4458    systems like VMS where hardware flow control is not available, at
4459    least not unless you change the init string from AT&F\13 to something
4460    else that enables local Xon/Xoff or other appropriate type of flow
4461    control.
4462
4463    Also see [396]Section 2.1.7 for additional hints about making dialing
4464    go faster.
4465      _________________________________________________________________
4466
4467     2.2.2. New Modem Controls
4468
4469    SET MODEM CAPABILITIES list
4470           In C-Kermit 7.0, this command automatically turns MODEM
4471           SPEED-MATCHING OFF if SB (Speed Buffering) is in the list, and
4472           turns it ON if SB is absent.
4473
4474    SET MODEM COMMAND PREDIAL-INIT [ text ]
4475           Commands to be sent to the modem just prior to dialing.
4476           Normally none.
4477
4478    SET MODEM SPEAKER { ON, OFF }
4479           Determines whether modem speaker is on or off while call is
4480           being placed. ON by default. Note: This command does not
4481           provide fine-grained control over when the speaker is on or
4482           off. Normally, ON means while the call is being placed, until
4483           the point at which carrier is successfully established. If your
4484           modem has a different speaker option that you want to choose,
4485           then use the SET MODEM COMMAND SPEAKER ON text command to
4486           specify this option.
4487
4488    SET MODEM COMMAND SPEAKER { ON, OFF } [ text ]
4489           Specify or override the commands to turn your modem's speaker
4490           on and off.
4491
4492    SET MODEM VOLUME { LOW, MEDIUM, HIGH }
4493           When MODEM SPEAKER is on, select volume. Note: In some modems,
4494           especially internal ones, these commands have no effect; this
4495           is a limitation of the particular modem, not of Kermit.
4496
4497    SET MODEM COMMAND VOLUME { LOW, MEDIUM, HIGH } [ text ]
4498           Specify or override the commands to set your modem's speaker
4499           volume.
4500
4501    SET MODEM COMMAND IGNORE-DIALTONE [ text ]
4502           The command to enable blind dialing ([397]Section 2.1.6).
4503
4504    SET MODEM ESCAPE-CHARACTER code
4505           Has been augmented to allow codes of 0 or less: < 0 means the
4506           escape mechanism is disabled. = 0 means to use (restore) the
4507           default value from the modem database. > 0 and < 128 is a
4508           literal value to be used instead of the default one. > 127
4509           means the escape mechanism is disabled. This affects "modem
4510           hangup". When the escape mechanism is disabled, but SET MODEM
4511           HANGUP-METHOD is MODEM-COMMAND, it sends the hangup command
4512           immediately, without the <pause>+++<pause> business first. This
4513           is useful (for example) when sending lots of numeric pages, a
4514           process in which never we go online, and so never need to
4515           escape back. Eliminating the unnecessary pauses and escape
4516           sequence allows a lot more pages to be sent per unit time.
4517
4518    Recall that C-Kermit can dial modems to which it is connected via
4519    TCP/IP (Telnet or Rlogin) as described on page 126 of [398]Using
4520    C-Kermit, 2nd Ed. In this case the MODEM HANGUP-METHOD should be
4521    MODEM-COMMAND, since RS-232 signals don't work over TCP/IP
4522    connections. As noted in the manual, such connections are set up by
4523    the following sequence:
4524
4525   set host host [ port ]
4526   set modem type name
4527   dial number
4528
4529    But this can cause complications when you use Kermit to switch between
4530    serial and TCP/IP connections. In the following sequence:
4531
4532   set host name
4533   set modem type name
4534   set port name
4535
4536    the first two commands obey the rules for dialing out over Telnet.
4537    However, the SET PORT command requires that Kermit close its current
4538    (Telnet) connection before it can open the serial port (since Kermit
4539    can only have one connection open at a time). But since a modem type
4540    was set after the "set host" command was given, Kermit assumes it is a
4541    Telnet dialout connection and so sends the modem's hangup sequence is
4542    sent to the Telnet host. To avoid this, close the network connection
4543    explicitly before opening the serial one:
4544
4545   set host name
4546   close
4547   set modem type name
4548   set port name
4549      _________________________________________________________________
4550
4551   2.3. TELNET and RLOGIN
4552
4553    For additional background, please also read the [399]TELNET.TXT file,
4554    also available on the Web in [400]HTML format.
4555
4556    Cautions:
4557
4558      * If making a Telnet connection with C-Kermit takes a very long
4559        time, like over a minute, whereas the system Telnet program makes
4560        the same connection immediately, try including the /NOWAIT switch:
4561   C-Kermit> telnet /nowait hostname
4562        See [401]TELNET.TXT or [402]TELNET.HTM for details. If it also
4563        takes a very long time to make a Telnet connection with system
4564        Telnet, then the delay is most likely caused by reverse DNS
4565        lookups when your host is not properly registered in DNS.
4566      * When supplying numeric IP addresses to C-Kermit or to any other
4567        application (regular Telnet, Rlogin, etc), do not include leading
4568        0's in any fields unless you intend for those fields to be
4569        interpreted as octal (or hex) numbers. The description of the
4570        Internet address interpreter (the sockets library inet_addr()
4571        routine) includes these words:
4572
4573      All numbers supplied as "parts" in a "." notation may be decimal,
4574      octal, or hexadecimal, as specified in the C language (that is, a
4575      leading 0x or 0X implies hexadecimal; otherwise, a leading 0
4576      implies octal; otherwise, the number is interpreted as decimal).
4577        To illustrate, 128.59.39.2 and 128.059.039.002 are not the same
4578        host! Even though most of the fields contain non-octal digits.
4579        Using system Telnet (not Kermit):
4580   $ telnet 128.059.039.002
4581   Trying 128.49.33.2 ...
4582        Of course the same thing happens with Kermit because it uses (as
4583        it must) the same system service for resolving network addresses
4584        that Telnet, FTP, and all other TCP/IP applications use.
4585      * The RLOGIN section on page 123 does not make it clear that you can
4586        use the SET TELNET TERMINAL-TYPE command to govern the terminal
4587        type that is reported by C-Kermit to the RLOGIN server.
4588      * Note that the SET TCP commands described on pages 122-123 might be
4589        absent; some platforms that support TCP/IP do not support these
4590        particular controls.
4591
4592    New commands:
4593
4594    TELOPT { AO, AYT, BREAK, CANCEL, EC, EL, EOF, EOR, GA, IP, DMARK,
4595           DO, DONT, NOP, SB, SE, SUSP, WILL, WONT }
4596           This command was available previously, but supported only DO,
4597           DONT, WILL, and WONT. Now it lets you send all the Telnet
4598           protocol commands. Note that certain commands do not require a
4599           response, and therefore can be used as nondestructive "probes"
4600           to see if the Telnet session is still open; e.g.:
4601
4602   set host xyzcorp.com
4603   ...
4604   telopt nop
4605   if fail stop 1 Connection lost
4606
4607    SET TCP ADDRESS [ ip-address ]
4608           Specifies the IP address of the computer that C-Kermit is
4609           running on. Normally this is not necessary. The exception would
4610           be if your machine has multiple network adapters (physical or
4611           virtual) with a different address for each adapter AND you want
4612           C-Kermit to use a specific address when making outgoing
4613           connections or accepting incoming connections.
4614
4615    SET TCP DNS-SERVICE-RECORDS { ON, OFF }
4616           Tells C-Kermit whether to try to use DNS SRV records to
4617           determine the host and port number upon which to find an
4618           advertised service. For example, if a host wants regular Telnet
4619           connections redirected to some port other than 23, this feature
4620           allows C-Kermit to ask the host which port it should use. Since
4621           not all domain servers are set up to answer such requests, this
4622           feature is OFF by default.
4623
4624    SET TCP REVERSE-DNS-LOOKUP { ON, OFF, AUTO }
4625           Tells Kermit whether to perform a reverse DNS lookup on TCP/IP
4626           connections. This allows Kermit to determine the actual
4627           hostname of the host it is connected to, which is useful for
4628           connections to host pools, and is required for Kerberos
4629           connections to host pools and for incoming connections. If the
4630           other host does not have a DNS entry, the reverse lookup could
4631           take a long time (minutes) to fail, but the connection will
4632           still be made. Turn this option OFF for speedier connections if
4633           you do not need to know exactly which host you are connected to
4634           and you are not using Kerberos. AUTO, the default, means the
4635           lookup is done on hostnames, but not on numeric IP addresses.
4636
4637    SET TELNET WAIT-FOR-NEGOTIATIONS { ON, OFF }
4638           Each Telnet option must be fully negotiated either On or Off
4639           before the session can continue. This is especially true with
4640           options that require sub-negotiations such as Authentication,
4641           Encryption, and Kermit; for proper support of these options
4642           Kermit must wait for the negotiations to complete. Of course,
4643           Kermit has no way of knowing whether a reply is delayed or not
4644           coming at all, and so will wait a minute or more for required
4645           replies before continuing the session. If you know that
4646           Kermit's Telnet partner will not be sending the required
4647           replies, you can set this option of OFF to avoid the long
4648           timeouts. Or you can instruct Kermit to REFUSE specific options
4649           with the SET TELOPT command.
4650
4651    SET TELOPT [ { /CLIENT, /SERVER } ] option
4652           { ACCEPTED, REFUSED, REQUESTED, REQUIRED }
4653           [ { ACCEPTED, REFUSED, REQUESTED, REQUIRED } ]
4654           SET TELOPT lets you specify policy requirements for Kermit's
4655           handling of Telnet option negotiations. Setting an option is
4656           REQUIRED causes Kermit to offer the option to the peer and
4657           disconnect if the option is refused. REQUESTED causes Kermit to
4658           offer an option to the peer. ACCEPTED results in no offer but
4659           Kermit will attempt to negotiate the option if it is requested.
4660           REFUSED instructs Kermit to refuse the option if it is
4661           requested by the peer.
4662
4663           Some options are negotiated in two directions and accept
4664           separate policies for each direction; the first keyword applies
4665           to Kermit itself, the second applies to Kermit's Telnet
4666           partner; if the second keyword is omitted, an appropriate
4667           (option-specific) default is applied. You can also include a
4668           /CLIENT or /SERVER switch to indicate whether the given
4669           policies apply when Kermit is the Telnet client or the Telnet
4670           server; if no switch is given, the command applies to the
4671           client.
4672
4673           Note that some of Kermit's Telnet partners fail to refuse
4674           options that they do not recognize and instead do not respond
4675           at all. In this case it is possible to use SET TELOPT to
4676           instruct Kermit to REFUSE the option before connecting to the
4677           problem host, thus skipping the problematic negotiation.
4678
4679           Use SHOW TELOPT to view current Telnet Option negotiation
4680           settings. SHOW TELNET displays current Telnet settings.
4681      _________________________________________________________________
4682
4683     2.3.0. Bug Fixes
4684
4685    If "set host nonexistent-host" was given (and it properly failed),
4686    followed by certain commands like SEND, the original line and modem
4687    type were not restored and C-Kermit thought that it still had a
4688    network hostname; fixed in 7.0.
4689
4690     2.3.1. Telnet Binary Mode Bug Adjustments
4691
4692    SET TELNET BUG BINARY-ME-MEANS-U-TOO { ON, OFF } was added to edit 192
4693    after the book was printed. Also SET TELNET BUG BINARY-U-MEANS-ME-TOO.
4694    The default for both is OFF. ON should be used when communicating with
4695    a Telnet partner (client or server) that mistakenly believes that
4696    telling C-Kermit to enter Telnet binary mode also means that it, too,
4697    is in binary mode, contrary to the Telnet specification, which says
4698    that binary mode must be negotiated in each direction separately.
4699
4700     2.3.2. VMS UCX Telnet Port Bug Adjustment
4701
4702    A new command, SET TCP UCX-PORT-BUG, was added for VMS versions with
4703    UCX (DEC TCP/IP), applying only to early versions of UCX, like 2.2 or
4704    earlier. If you try to use VMS C-Kermit to make a Telnet connection
4705    using a port name (like "telnet", which is used by default), the
4706    underlying UCX getservbyname() function might return the service
4707    number with its bytes swapped and the connection will fail. If "telnet
4708    hostname 23" works, then your version of UCX has this bug and you can
4709    put "set tcp ucx-port-bug on" in your CKERMIT.INI file to get around
4710    it.
4711
4712     2.3.3. Telnet New Environment Option
4713
4714    The TELNET NEW-ENVIRONMENT option ([403]RFC 1572) is supported as 7.0.
4715    This option allows the C-Kermit Telnet client to send certain
4716    well-known variables to the Telnet server, including USER, PRINTER,
4717    DISPLAY, and several others. This feature is enabled by default in
4718    Windows and OS/2, disabled by default elsewhere. The command to enable
4719    and disable it is:
4720
4721   SET TELNET ENVIRONMENT { ON, OFF }
4722
4723    When ON, and you Telnet to another computer, you might (or might not)
4724    notice that the "login:" or "Username:" prompt does not appear --
4725    that's because your username was sent ahead, in which case the remote
4726    system might prompt you only for your password (similar to Rlogin).
4727    Use "set telnet environment off" to defeat this feature, particularly
4728    in scripts where the dialog must be predictable. You can also use this
4729    command to specify or override specific well-known environment
4730    variable values:
4731
4732  SET TELNET ENVIRONMENT { ACCT,DISPLAY,JOB,PRINTER,SYSTEMTYPE,USER } [ text ]
4733
4734     2.3.4. Telnet Location Option
4735
4736    The TELNET LOCATION option ([404]RFC 779) is supported in 7.0. This
4737    option allows the C-Kermit Telnet client to send a location string to
4738    the server if the server indicates its willingness to accept one. If
4739    an environment variable named LOCATION exists at the time C-Kermit
4740    starts, its value is used as the location string. If you want to
4741    change it, use:
4742
4743   SET TELNET LOCATION text
4744
4745    If you omit the text from this command, the Telnet location feature is
4746    disabled.
4747
4748    SET TELNET ENVIRONMENT DISPLAY is used to set the DISPLAY variable
4749    that is sent to the host, as well as the the XDISPLAY location.
4750
4751     2.3.5. Connecting to Raw TCP Sockets
4752
4753    The SET HOST and TELNET commands now accept an optional switch,
4754    /RAW-SOCKET, at the end, only if you first give a host and a port.
4755    Example:
4756
4757   set host xyzcorp.com 23 /raw-socket
4758   set host 128.49.39.2:2000 /raw-socket
4759   telnet xyzcorp.com 3000 /raw
4760
4761    Without this switch, C-Kermit behaves as a Telnet client when (a) the
4762    port is 23 or 1649, or (b) the port is not 513 and the server sent
4763    what appeared to be Telnet negotiations -- that is, messages starting
4764    with 0xFF (IAC). With this switch, Kermit should treat all incoming
4765    bytes as raw data, and will not engage in any Telnet negotiations or
4766    NVT CRLF manipulations. This allows transparent operation through
4767    (e.g.) raw TCP ports on Cisco terminal servers, through the 'modemd'
4768    modem server, etc.
4769
4770     2.3.6. Incoming TCP Connections
4771
4772    Accomplished via SET HOST * port, were introduced in C-Kermit 6.0, but
4773    for UNIX only. In Version 7.0, they are also available for VMS.
4774      _________________________________________________________________
4775
4776   2.4. The EIGHTBIT Command
4777
4778    EIGHTBIT is simply a shorthand for: SET PARITY NONE, SET TERMINAL
4779    BYTESIZE 8, SET COMMAND BYTESIZE 8; that is, a way to set up an 8-bit
4780    clean connection in a single command.
4781      _________________________________________________________________
4782
4783   2.5. The Services Directory
4784
4785    Chapter 7 of [405]Using C-Kermit does not mention the ULOGIN macro,
4786    which is used by our sample services directory, CKERMIT.KND. Unlike
4787    UNIXLOGIN, VMSLOGIN, etc, this one is for use with systems that
4788    require a user ID but no password. Therefore it doesn't prompt for a
4789    password or wait for a password prompt from the remote service.
4790
4791    In version 7.0, the CALL macro was changed to not execute a SET MODEM
4792    TYPE command if the given modem type was the same as the current one;
4793    otherwise the new SET MODEM TYPE command would overwrite any
4794    customizations that the user had made to the modem settings. Ditto for
4795    SET LINE / SET PORT and SET SPEED.
4796      _________________________________________________________________
4797
4798   2.6. Closing Connections
4799
4800    Until version 7.0, there was never an obvious and general way to close
4801    a connection. If a serial connection was open, it could be closed by
4802    "set line" or "set port" (giving no device name); if a network
4803    connection was open, it could be closed by "set host" (no host name).
4804
4805    In version 7.0, a new command closes the connection in an obvious and
4806    straightforward way, no matter what the connection type:
4807
4808   CLOSE [ CONNECTION ]
4809
4810    The CLOSE command was already present, and required an operand such as
4811    DEBUG-LOG, WRITE-FILE, etc, and so could never be given by itself. The
4812    new CONNECTION operand is now the default operand for CLOSE, so CLOSE
4813    by itself closes the connection, if one is open, just as you would
4814    expect, especially if you are a Telnet or Ftp user.
4815
4816    Also see the description of the new SET CLOSE-ON-DISCONNECT command in
4817    [406]Section 2.10.
4818      _________________________________________________________________
4819
4820   2.7. Using C-Kermit with External Communication Programs
4821
4822    C-Kermit 7.0 includes a new ability to create and conduct sessions
4823    through other communications programs. Two methods are available:
4824
4825     1. Pty (pseudoterminal): The external program is run on a
4826        "pseudoterminal", which is controlled by Kermit. This method works
4827        with practically any external program, but it is not portable. At
4828        this writing, it works only on some (not all) UNIX versions, and
4829        not on any non-UNIX platforms.
4830     2. Pipe: The external program's standard input and output are
4831        redirected through a "pipe" controlled by Kermit. This method is
4832        relatively portable -- it should work across all UNIX versions,
4833        and it also works in Windows and OS/2 -- but it is effective only
4834        when the external program actually uses standard i/o (and many
4835        don't).
4836
4837    The two methods are started differently but are used the same way
4838    thereafter.
4839
4840    The purpose of this feature is to let you use C-Kermit services like
4841    file transfer, character-set translation, scripting, automatic
4842    dialing, etc, on connections that Kermit can't otherwise make itself.
4843
4844    This feature is the opposite of the REDIRECT feature, in which
4845    C-Kermit makes the connection, and redirects an external (local)
4846    command or program over this connection. In a pty or pipe connection,
4847    C-Kermit runs and controls a local command or program, which makes the
4848    connection. (The same method can be used to simply to control a local
4849    program without making a connection; see [407]Section 2.8.)
4850
4851    To find out if your version of Kermit includes PTY support, type "show
4852    features" and look for NETPTY in the alphabetical list of options. For
4853    pipes, look for NETCMD.
4854
4855    The commands are:
4856
4857    SET NETWORK TYPE PTY or SET NETWORK TYPE PIPE
4858    SET HOST command
4859           where command is any interactive command. If the command does
4860           not use standard i/o, you must use SET NETWORK TYPE PTY.
4861
4862    Notes:
4863
4864      * COMMAND is an invisible synonym for PIPE.
4865      * The command and its arguments are case-sensitive in UNIX.
4866
4867    The SET NETWORK TYPE, SET HOST sequence sets the given network type
4868    for all subsequent SET HOST commands until another SET NETWORK TYPE
4869    command is given to change it.
4870
4871    You can also use the new /NETWORK-TYPE:PTY or /NETWORK-TYPE:PIPE (or
4872    simply /PIPE or /PTY) switches on the SET HOST command itself:
4873
4874   SET HOST /NETWORK-TYPE:PIPE command  ; These two are the same
4875   SET HOST /PIPE command
4876
4877   SET HOST /NETWORK-TYPE:PTY command   ; Ditto
4878   SET HOST /PTY command
4879
4880    These are like SET NETWORK TYPE followed by SET HOST, except they
4881    apply only to the connection being made and do not change the global
4882    network type setting (see [408]Section 1.5 about the difference
4883    between switches and SET commands).
4884
4885    Include any command-line options with the command that might be
4886    needed, as in this example where C-Kermit uses another copy of itself
4887    as the communications program:
4888
4889   SET HOST /PIPE /CONNECT kermit -YQJ xyzcorp.com
4890
4891    As usual, if you include the /CONNECT switch, SET HOST enters CONNECT
4892    mode immediately upon successful execution of the given command.
4893    Therefore new commands are available as a shorthand for SET HOST
4894    /CONNECT /PTY and /PIPE:
4895
4896    PTY [ command ]
4897    PIPE [ command ]
4898           The PTY and PIPE commands work like the TELNET and RLOGIN
4899           commands: they set up the connection (in this case, using the
4900           given command) and then enter CONNECT mode automatically (if
4901           the PIPE or PTY command is given without a command, it
4902           continues the current session if one is active; otherwise it
4903           gives an error message).
4904
4905    The PIPE command is named after the mechanism by which C-Kermit
4906    communicates with the command: UNIX pipes. C-Kermit's i/o is "piped"
4907    through the given command. Here is a typical example:
4908
4909   PIPE rlogin -8 xyzcorp.com
4910
4911    This is equivalent to:
4912
4913   SET HOST /PIPE rlogin -8 xyzcorp.com
4914   CONNECT
4915
4916    and to:
4917
4918   SET HOST /PIPE /CONNECT rlogin -8 xyzcorp.com
4919
4920    IMPORTANT:
4921           If you are writing a script, do not use the PIPE, PTY, TELNET,
4922           or RLOGIN command unless you really want C-Kermit to enter
4923           CONNECT mode at that point. Normally SET HOST is used in
4924           scripts to allow the login and other dialogs to be controlled
4925           by the script itself, rather than by an actively participating
4926           human at the keyboard.
4927
4928    Throughput of pty and pipe connections is limited by the performance
4929    of the chosen command or program and by the interprocess communication
4930    (IPC) method used and/or buffering capacity of the pipe or pty, which
4931    in turn depends on the underlying operating system.
4932
4933    In one trial (on SunOS 4.1.3), we observed file transfer rates over an
4934    rlogin connection proceeding at 200Kcps for downloads, but only 10Kcps
4935    for uploads on the same connection with the same settings (similar
4936    disparities were noted in HP-UX). Examination of the logs revealed
4937    that a write to the pipe could take as long as 5 seconds, whereas
4938    reads were practically instantaneous. On the other hand, using Telnet
4939    as the external program rather than rlogin, downloads and uploads were
4940    better matched at about 177K each.
4941
4942    Most external communication programs, like C-Kermit itself, have
4943    escape characters or sequences. Normally these begin with (or consist
4944    entirely of) a control character. You must be sure that this control
4945    character is not "unprefixed" when uploading files, otherwise the
4946    external program will "escape back" to its prompt, or close the
4947    connection, or take some other unwanted action. When in CONNECT mode,
4948    observe the program's normal interaction rules. Of course C-Kermit's
4949    own escape character (normally Ctrl-\) is active too, unless you have
4950    taken some action to disable it.
4951
4952    On PTY connections, the underlying PTY driver is not guaranteed to be
4953    transparent to control characters -- for example, it might expand
4954    tabs, translate carriage returns, generate signals if it sees an
4955    interrupt character, and so on. Similar things might happen on a PIPE
4956    connection. For this reason, if you plan to transfer files over a PTY
4957    or PIPE connection, tell the file sender to:
4958
4959    SET PREFIXING ALL
4960           This causes all control characters to be prefixed and
4961           transmitted as printable ASCII characters.
4962
4963    If the external connection program is not 8-bit clean, you should
4964    also:
4965
4966    SET PARITY SPACE
4967           This causes 8-bit data to be encoded in 7 bits using single
4968           and/or locking shifts.
4969
4970    And if it does not make a reliable connection (such as those made by
4971    Telnet, Rlogin, Ssh, etc), you should:
4972
4973    SET STREAMING OFF
4974           This forces C-Kermit to treat the connection as unreliable and
4975           to engage in its normal ACK/NAK protocol for error detection
4976           and correction, rather than "streaming" its packets, as it
4977           normally does on a network connection ([409]Section 4.20).
4978
4979    In some cases, buffer sizes might be restricted, so you might also
4980    need to reduce the Kermit packet length to fit; this is a
4981    trial-and-error affair. For example, if transfers always fail with
4982    4000-byte packets, try 2000. If that fails too, try 1000, and so on.
4983    The commands are:
4984
4985    SET RECEIVE PACKET-LENGTH number
4986           This tells the file receiver to tell the file sender the
4987           longest packet length it can accept.
4988
4989    SET SEND PACKET-LENGTH number
4990           This tells the file sender not to send packets longer than the
4991           given length, even if the receiver says longer ones are OK. Of
4992           course, if the receiver's length is shorter, the shorter length
4993           is used.
4994
4995    If none of this seems to help, try falling back to the bare minimum,
4996    lowest-common-denominator protocol settings:
4997
4998    ROBUST
4999           No sliding windows, no streaming, no control-character
5000           unprefixing, packet length 90.
5001
5002    And then work your way back up by trial and error to get greater
5003    throughput.
5004
5005    Note that when starting a PIPE connection, and the connection program
5006    (such as telnet or rlogin) prints some greeting or information
5007    messages before starting the connection, these are quite likely to be
5008    printed with a stairstep effect (linefeed without carriage return).
5009    This is because the program is not connected with the UNIX terminal
5010    driver; there's not much Kermit can do about it. Once the connection
5011    is made, everything should go back to normal. This shouldn't happen on
5012    a PTY connection because a PTY is, indeed, a terminal.
5013
5014    On a similar note, some connection programs (like Solaris 2.5 rlogin)
5015    might print lots of error messages like "ioctl TIOCGETP: invalid
5016    argument" when used through a pipe. They are annoying but usually
5017    harmless. If you want to avoid these messages, and your shell allows
5018    redirection of stderr, you can redirect stderr in your pipe command,
5019    as in this example where the user's shell is bash:
5020
5021   PIPE rlogin xyzcorp.com 2> /dev/null
5022
5023    Or use PTY rather than PIPE, since PTY is available on Solaris.
5024      _________________________________________________________________
5025
5026     2.7.0. C-Kermit over tn3270 and tn5250
5027
5028    Now you can make a connection from C-Kermit "directly" to an IBM
5029    mainframe and transfer files with it, assuming it has Kermit-370
5030    installed. Because tn3270 is neither 8-bit clean nor transparent to
5031    control characters, you must give these commands:
5032
5033   SET PREFIXING ALL   ; Prefix all control characters
5034   SET PARITY SPACE    ; Telnet connections are usually not 8-bit clean
5035
5036    and then:
5037
5038   SET HOST /PTY /CONNECT tn3270 abccorp.com
5039
5040    or simply:
5041
5042   pty tn3270 abccorp.com
5043
5044    SET HOST /PIPE does not work in this case, at least not for file
5045    transfer. File transfer does work, however, with SET HOST /PTY,
5046    provided you use the default packet length of 90 bytes; anything
5047    longer seems to kill the session.
5048
5049    You can also make connections to IBM AS/400 computers if you have a
5050    tn5250 program installed:
5051
5052   pty tn5250 hostname
5053
5054    In this case, however, file transfer is probably not in the cards
5055    since nobody has ever succeeded in writing a Kermit program for the
5056    AS/400. Hint:
5057
5058   define tn3270 {
5059       check pty
5060       if fail end 1 Sorry - no PTY support...
5061       pty tn3270 \%*
5062   }
5063
5064    Similarly for tn5250. Note that CHECK PTY and CHECK PIPE can be used
5065    in macros and scripts to test whether PTY or PIPE support is
5066    available.
5067      _________________________________________________________________
5068
5069     2.7.1. C-Kermit over Telnet
5070
5071    Although C-Kermit includes its own Telnet implementation, you might
5072    need to use an external Telnet program to make certain connections;
5073    perhaps because it has access or security features not available in
5074    C-Kermit itself. As noted above, the only precautions necessary are
5075    usually:
5076
5077   SET PREFIXING ALL   ; Prefix all control characters
5078   SET PARITY SPACE    ; Telnet connections might not be 8-bit clean
5079
5080    and then:
5081
5082   SET HOST /PTY (or /PIPE) /CONNECT telnet abccorp.com
5083
5084    or, equivalently:
5085
5086   PTY (or PIPE) telnet abccorp.com
5087      _________________________________________________________________
5088
5089     2.7.2. C-Kermit over Rlogin
5090
5091    C-Kermit includes its own Rlogin client, but this can normally be used
5092    only if you are root, since the rlogin TCP port is privileged. But
5093    ptys and pipes let you make rlogin connections with C-Kermit through
5094    your computer's external rlogin program, which is normally installed
5095    as a privileged program:
5096
5097   SET PREFIXING ALL
5098
5099    and then:
5100
5101   SET HOST /PTY (or /PIPE) /CONNECT rlogin -8 abccorp.com
5102
5103    or, equivalently:
5104
5105   PTY (or PIPE) rlogin -8 abccorp.com
5106
5107    The "-8" option to rlogin enables transmission of 8-bit data. If this
5108    is not available, then include SET PARITY SPACE if you intend to
5109    transfer files.
5110
5111    Note that the normal escape sequence for rlogin is Carriage Return
5112    followed by Tilde (~), but only when the tilde is followed by certain
5113    other characters; the exact behavior depends on your rlogin client, so
5114    read its documentation.
5115      _________________________________________________________________
5116
5117     2.7.3. C-Kermit over Serial Communication Programs
5118
5119    Ptys and pipes also let you use programs that make serial connections,
5120    such as cu or tip. For example, C-Kermit can be used through cu to
5121    make connections that otherwise might not be allowed, e.g. because
5122    C-Kermit is not installed with the required write permissions to the
5123    dialout device and the UUCP lockfile directory.
5124
5125    Suppose your UUCP Devices file contains an entry for a serial device
5126    tty04 to be used for direct connections, but this device is protected
5127    against you (and Kermit when you run it). In this case you can:
5128
5129   SET CONTROL PREFIX ALL
5130   PTY (or PIPE) cu -l tty04
5131
5132    (Similarly for dialout devices, except then you also need to include
5133    the phone number in the "cu" command.)
5134
5135    As with other communication programs, watch out for cu's escape
5136    sequence, which is the same as the rlogin program's: Carriage Return
5137    followed by Tilde (followed by another character to specify an action,
5138    like "." for closing the connection and exiting from cu).
5139      _________________________________________________________________
5140
5141     2.7.4. C-Kermit over Secure Network Clients
5142
5143      DISCLAIMER: There are laws in the USA and other countries regarding
5144      use, import, and/or export of encryption and/or decryption or other
5145      forms of security software, algorithms, technology, and
5146      intellectual property. The Kermit Project attempts to follow all
5147      known statutes, and neither intends nor suggests that Kermit
5148      software can or should be used in any way, in any location, that
5149      circumvents any regulations, laws, treaties, covenants, or other
5150      legitimate canons or instruments of law, international relations,
5151      trade, ethics, or propriety.
5152
5153    For secure connections or connections through firewalls, C-Kermit 7.0
5154    can be a Kerberos, SRP, and/or SOCKS client when built with the
5155    appropriate options and libraries. But other application-level
5156    security acronyms and methods -- SSH, SSL, SRP, TLS -- pop up at an
5157    alarming rate and are (a) impossible to keep up with, (b) usually
5158    mutually incompatible, and (c) have restrictions on export or
5159    redistribution and so cannot be included in C-Kermit itself.
5160
5161    However, if you have a secure text-based Telnet (or other) client that
5162    employs one of these security methods, you can use C-Kermit "through"
5163    it via a pty or pipe.
5164      _________________________________________________________________
5165
5166     2.7.4.1. SSH
5167
5168    C-Kermit does not and can not incorporate SSH due to licensing,
5169    patent, and USA export law restrictions.
5170
5171    The UNIX SSH client does not use standard input/output, and therefore
5172    can be used only by Kermit's PTY interface, if one is present. The
5173    cautions about file transfer, etc, are the same as for Rlogin.
5174    Example:
5175
5176   SET PREFIXING ALL
5177   PTY ssh XYZCORP.COM
5178
5179    Or, for a scripted session:
5180
5181   SET PREFIXING ALL
5182   SET HOST /PTY ssh XYZCORP.COM
5183
5184    Hint:
5185
5186   define ssh {
5187       check pty
5188       if fail end 1 Sorry - no PTY support...
5189       pty ssh \%*
5190   }
5191      _________________________________________________________________
5192
5193     2.7.4.2. SSL
5194
5195    Secure Sockets Layer (SSL) is another TCP/IP security overlay, this
5196    one designed by and for Netscape. An SSL Telnet client is available
5197    for UNIX from the University of Queensland. More info at:
5198
5199   [410]http://www.psy.uq.oz.au/~ftp/Crypto/
5200
5201    Interoperability with C-Kermit is unknown. C-Kermit also includes its
5202    own built-in SSL/TLS support, but it is not exportable; [411]CLICK
5203    HERE file for details.
5204      _________________________________________________________________
5205
5206     2.7.4.3. SRP
5207
5208    SRP(TM) is Stanford University's Secure Remote Password protocol. An
5209    SRP Telnet client is available from Stanford:
5210
5211   [412]http://srp.stanford.edu/srp/
5212
5213    Stanford's SRP Telnet client for UNIX has been tested on SunOS and
5214    works fine with C-Kermit, as described in [413]Section 2.7.1, e.g.
5215
5216   SET PREFIX ALL
5217   PTY (or PIPE) srp-telnet xenon.stanford.edu
5218
5219    C-Kermit itself can be built as an SRP Telnet client on systems that
5220    have libsrp.a installed; the C-Kermit support code, however, may not
5221    be exported outside the USA or Canada.
5222      _________________________________________________________________
5223
5224     2.7.4.4. SOCKS
5225
5226    C-Kermit can be built as a SOCKS-aware client on systems that have a
5227    SOCKS library. See section 8.1.1 of the [414]ckccfg.txt file.
5228
5229    C-Kermit 7.0 can also be run over SOCKSified Telnet or rlogin clients
5230    with SET NETWORK TYPE COMMAND. Suppose the Telnet program on your
5231    system is SOCKS enabled but C-Kermit is not. Make Kermit connections
5232    like this:
5233
5234   SET PREFIX ALL
5235   PTY (or PIPE) telnet zzz.com
5236      _________________________________________________________________
5237
5238     2.7.4.5. Kerberos
5239
5240    UNIX C-Kermit can be built with MIT Kerberos IV or V authentication
5241    and encryption. Instructions are available in a [415]separate
5242    document. Additional modules are required that can not be exported
5243    from the USA to any country except Canada, by US law.
5244
5245    If you have Kerberos installed but you don't have a Kerberized version
5246    of C-Kermit, you can use ktelnet as C-Kermit's external communications
5247    program to make secure connections without giving up C-Kermit's
5248    services:
5249
5250   SET PREFIX ALL
5251   PTY (or PIPE) ktelnet cia.gov
5252      _________________________________________________________________
5253
5254   2.8. Scripting Local Programs
5255
5256    If your version of Kermit has PTY support built in, then any
5257    text-based program can be invoked with SET HOST /PTY or equivalent
5258    command and controlled using the normal sequence of OUTPUT, INPUT, IF
5259    SUCCESS commands (this is the same service that is provided by the
5260    'expect' program, but controlled by the Kermit script language rather
5261    than Tcl).
5262
5263    When PTY service is not available, then any program that uses standard
5264    input and output can be invoked with SET HOST /PIPE.
5265
5266    Here's an example in which we start an external Kermit program, wait
5267    for its prompt, give it a VERSION command, and then extract the
5268    numeric version number from its response:
5269
5270   set host /pty kermit -Y
5271   if fail stop 1 {Can't start external command}
5272   input 10 C-Kermit>
5273   if fail stop 1 {No C-Kermit> prompt}
5274   output version\13
5275   input 10 {Numeric: }
5276   if fail stop 1 {No match for "Numeric:"}
5277   clear input
5278   input 10 \10
5279   echo VERSION = "\fsubstr(\v(input),1,6)"
5280   output exit\13
5281
5282    This technique could be used to control any other interactive program,
5283    even those that do screen formatting (like Emacs or Vi), if you can
5284    figure out the sequence of events. If your Kermit program doesn't have
5285    PTY support, then the commands are restricted to those using standard
5286    i/o, including certain shells, interactive text-mode "hardcopy"
5287    editors like ex, and so on.
5288
5289    If you are using the PTY interface, you should be aware that it runs
5290    the given program or command directly on the pty, without any
5291    intervening shell to interpret metacharacters, redirectors, etc. If
5292    you need this sort of thing, include the appropriate shell invocation
5293    as part of your command; for example:
5294
5295   pty echo *
5296
5297    just echoes "*"; whereas:
5298
5299   pty ksh -c "echo *"
5300
5301    echoes all the filenames that ksh finds matching "*".
5302
5303    Similarly for redirection:
5304
5305   set host /pty ksh -c "cat > foo"  ; Note: use shell quoting rules here
5306   set transmit eof \4
5307   transmit bar
5308
5309    And for that matter, for built-in shell commands:
5310
5311   set host /pty ksh -c "for i in *; do echo $i; done"
5312
5313    The PIPE interface, on the other hand, invokes the shell
5314    automatically, so:
5315
5316   pipe echo *
5317
5318    prints filenames, not "*".
5319      _________________________________________________________________
5320
5321   2.9. X.25 Networking
5322
5323    X.25 networking is documented in [416]Using C-Kermit, 2nd Edition.
5324    When the book was published, X.25 was available only in SunOS,
5325    Solaris, and Stratus VOS. Unlike TCP/IP, X.25 APIs are not
5326    standardized; each vendor's X.25 libraries and services (if they have
5327    them at all) are unique.
5328
5329    This section describes new additions.
5330      _________________________________________________________________
5331
5332     2.9.1. IBM AIXLink/X.25 Network Provider Interface for AIX
5333
5334    Support for X.25 was added via IBM's Network Provider Interface (NPI),
5335    AIXLink/X.25 1.1, to the AIX 4.x version of C-Kermit 7.0.
5336    Unfortunately, AIXLink/X.25 is a rather bare-bones facility, lacking
5337    in particular any form of PAD support (X.3, X.28, X.29). Thus, the AIX
5338    version of C-Kermit, when built to include X.25 networking, has
5339    neither a PAD command, nor a SET PAD command. The same is true for the
5340    underlying AIX system: no PAD support. Thus it is not possible to have
5341    an interactive shell session over an X.25 connection into an AIX
5342    system (as far as we know), even from X.25-capable Kermit versions
5343    (such as Solaris or VOS) that do include PAD support.
5344
5345    Thus the X.25 capabilities in AIX C-Kermit are limited to peer-to-peer
5346    connections, e.g. from a C-Kermit client to a C-Kermit server. Unlike
5347    the Solaris, SunOS, and VOS versions, the AIX version can accept
5348    incoming X.25 connections:
5349
5350   set network type x.25
5351   if fail stop 1 Sorry - no X.25 support
5352   ; Put any desired DISABLE or ENABLE or SET commands here.
5353   set host /server *
5354   if fail stop 1 X.25 "set host *" failed
5355
5356    And then access it from the client as follows:
5357
5358   set network type x.25
5359   if fail stop 1 Sorry - no X.25 support
5360   set host xxxxxxx ; Specify the X.25/X.121 address
5361   if fail stop 1 Can't open connection
5362
5363    And at this point the client can use the full range of client
5364    commands: SEND, GET, REMOTE xxx, FINISH, BYE.
5365
5366    The AIX version also adds two new variables:
5367
5368    \v(x25local_nua)
5369           The local X.25 address.
5370
5371    \v(x25remote_nua)
5372           The X.25 address of the host on the other end of the
5373           connection.
5374
5375    C-Kermit's AIX X.25 client has not been tested against anything other
5376    than a C-Kermit X.25 server on AIX. It is not known if it will
5377    interoperate with C-Kermit servers on Solaris, SunOS, or VOS.
5378
5379    To make an X.25 connection from AIX C-Kermit, you must:
5380
5381   set x25 call-user-data xxxx
5382
5383    where xxxx can be any even-length string of hexadecimal digits, e.g.
5384    123ABC.
5385      _________________________________________________________________
5386
5387     2.9.2. HP-UX X.25
5388
5389    Although C-Kermit presently does not include built-in support for
5390    HP-UX X.25, it can still be used to make X.25 connections as follows:
5391    start Kermit and tell it to:
5392
5393   set prefixing all
5394   set parity space
5395   pty padem address
5396
5397    This should work in HP-UX 9.00 and later (see [417]Section 2.7). If
5398    you have an earlier HP-UX version, or the PTY interface doesn't work
5399    or isn't available, try:
5400
5401   set prefixing all
5402   set parity space
5403   pipe padem address
5404
5405    Failing that, use Kermit to telnet to localhost and then after logging
5406    back in, start padem as you would normally do to connect over X.25.
5407      _________________________________________________________________
5408
5409   2.10. Additional Serial Port Controls
5410
5411    C-Kermit 7.0 adds the following commands for greater control over
5412    serial ports. These commands are available only in C-Kermit versions
5413    whose underlying operating systems provide the corresponding services
5414    (such as POSIX and UNIX System V), and even then their successful
5415    operation depends on the capabilities of the specific device and
5416    driver.
5417
5418    SET DISCONNECT { ON, OFF }
5419           On a SET LINE or SET PORT connection with SET CARRIER ON or
5420           AUTO, if the carrier signal drops during the connection,
5421           indicating that the connection has been lost, and C-Kermit
5422           notices it, this setting governs what happens next. With SET
5423           DISCONNECT OFF, which is consistent with previous behavior, and
5424           therefore the default, C-Kermit continues to keep the device
5425           open and allocated. With SET DISCONNECT ON, C-Kermit
5426           automatically closes and releases the device when it senses a
5427           carrier on-to-off transition, thus allowing others to use it.
5428           However, it remains the default device for i/o (DIAL, REDIAL,
5429           INPUT, SEND, CONNECT, etc), so if a subsequent i/o command is
5430           given, the device is reopened if it is still available. When it
5431           has been automatically closed in this manner, SHOW
5432           COMMUNICATIONS puts "(closed)" after its name, and in UNIX, the
5433           lockfile disappears -- both from SHOW COMM and from the
5434           lockfile directory itself. Synonym: SET CLOSE-ON-DISCONNECT.
5435
5436    SET EXIT ON-DISCONNECT { ON, OFF }
5437           Like DISCONNECT, but makes the program exit if a connection
5438           drops.
5439
5440    Note that SET CLOSE-ON-DISCONNECT and SET EXIT ON-DISCONNECT apply
5441    only to connections that drop; they do not apply to connections that
5442    can't be made in the first place. For example, they have no effect
5443    when a SET LINE, SET HOST, TELNET, or DIAL command fails.
5444
5445    HANGUP
5446           If [CLOSE-ON-]DISCONNECT is ON, and the HANGUP command is given
5447           on a serial device, and the carrier signal is no longer present
5448           after the HANGUP command, the device is closed and released.
5449
5450    SET PARITY HARDWARE { EVEN, ODD }
5451           Unlike SET PARITY { EVEN, ODD, MARK, SPACE }, which selects 7
5452           data bits plus the indicated kind of parity (to be done in
5453           software by Kermit itself), SET PARITY HARDWARE selects 8 data
5454           bits plus even or odd parity, to be done by the underlying
5455           hardware, operating system, or device driver. This command is
5456           effective only with a SET LINE or SET PORT device. That is, it
5457           has no effect in remote mode, nor on network connections. There
5458           is presently no method for selecting 8 data bits plus mark or
5459           space parity. If hardware parity is in effect, the variable
5460           \v(hwparity) is set to "even" or "odd". Note: some platforms
5461           might also support settings of SPACE, MARK, or NONE.
5462
5463    SET STOP-BITS { 1, 2 }
5464           This tells the number of 1-bits to insert after an outbound
5465           character's data and parity bits, to separate it from the next
5466           character. Normally 1. Choosing 2 stop bits should do no harm,
5467           but will slow down serial transmission by approximately 10
5468           percent. Historically, 2 stop bits were used with Teletypes (at
5469           110 bps or below) for print-head recovery time. There is
5470           presently no method for choosing any number of stop bits
5471           besides 1 and 2.
5472
5473    SET SERIAL [ dps ]
5474           dps stands for Data-bits, Parity, Stop-bits. This is the
5475           notation familiar to many people for serial port configuration:
5476           7E1, 8N1, 7O2, etc. The data bits number also becomes the
5477           TERMINAL BYTESIZE setting. The second character is E for Even,
5478           O for Odd, M for Mark, S for Space, or N for None. The list of
5479           available options depends on the capabilities of the specific
5480           platform. If dps is omitted, 8N1 is used. Type "set serial ?"
5481           for a list of available choices. Examples:
5482
5483         SET SERIAL 7E1
5484                 Equivalent to SET PARITY EVEN, SET STOP-BITS 1, SET TERM
5485                 BYTE 7.
5486
5487         SET SERIAL 8N1
5488                 Equivalent to SET PARITY NONE, SET STOP-BITS 1, SET TERM
5489                 BYTE 8.
5490
5491         SET SERIAL 7E2
5492                 Equivalent to SET PARITY EVEN and SET STOP-BITS 2, SET
5493                 TERM BYTE 7.
5494
5495         SET SERIAL 8E2
5496                 Same as SET PARITY HARDWARE EVEN, SET STOP-BITS 2, SET
5497                 TERM BYTE 8.
5498
5499         SET SERIAL
5500                 Same as SET PARITY NONE and SET STOP-BITS 1, SET TERM
5501                 BYTE 8.
5502
5503    Notes:
5504
5505      * The SET SERIAL xx2 options are available only in Kermit versions
5506        where the SET PARITY HARDWARE command is also available. (SHOW
5507        FEATURES includes "HWPARITY" in its options list.)
5508      * The SET SERIAL 7xx and 8N1 options affect the software parity
5509        setting, even for network connections.
5510      * As noted in the manual, selecting 8 data bits does not give you
5511        8-bit terminal sessions in CONNECT mode unless you also SET
5512        TERMINAL BYTESIZE 8. The default terminal bytesize remains 7, to
5513        protect against the situation where the remote host is generating
5514        parity but you don't know about it. If the terminal bytesize was 8
5515        by default and you CONNECTed to such a host, you would see only
5516        garbage on your screen.
5517      * If you do not give a SET STOP-BITS or SET SET SERIAL command,
5518        C-Kermit does not attempt to set the device's stop bits; instead,
5519        it uses whatever setting the device uses when not given explicit
5520        instructions about stop bits.
5521
5522    SHOW COMMUNICATIONS displays the current settings. Stop bits and
5523    hardware parity are shown only for SET PORT / SET LINE (serial)
5524    devices, since they do not apply to network connections or to remote
5525    mode. STOP-BITS is shown as "(default)" if you have not given an
5526    explicit SET STOP-BITS or SET SERIAL command.
5527
5528    The \v(serial) variable shows the SET SERIAL setting (8N1, 7E1, etc).
5529      _________________________________________________________________
5530
5531   2.11. Getting Access to the Dialout Device
5532
5533      This section is for UNIX only; note the special words about QNX at
5534      the end. Also see [418]Section 2.0 for SET LINE switches,
5535      particularly the /SHARE switch for VMS only.
5536
5537    C-Kermit does its best to obey the UUCP lockfile conventions of each
5538    platform (machine, operating system, OS version) where it runs, if
5539    that platform uses UUCP.
5540
5541    But simply obeying the conventions is often not good enough, due to
5542    the increasing likelihood that a particular serial device might have
5543    more than one name (e.g. /dev/tty00 and /dev/term/00 are the same
5544    device in Unixware 7; /dev/cua and /dev/cufa are the same device in
5545    NeXTSTEP), plus the increasingly widespread use of symlinks for device
5546    names, such as /dev/modem.
5547
5548    C-Kermit 7.0 goes to greater lengths than previous versions to
5549    successfully interlock with other communications program (and other
5550    instances of Kermit itself); for example, by:
5551
5552      * Creation of dual lockfiles whenever a symlink is used; one for the
5553        link name and one for the real name.
5554      * Creation of dual lockfiles in HP-UX according to HP rules.
5555      * Creation of dual uppercase/lowercase lockfile names in SCO
5556        UNIX/ODT/OSR5.
5557      * The use of ttylock() in versions of AIX where it works.
5558      * The use, wherever possible, of lockfile names based on
5559        inode/major/minor device number rather than device name.
5560
5561    See the [419]ckuins.txt and [420]ckubwr.txt files for details.
5562
5563    QNX is almost unique among UNIX varieties in having no UUCP programs
5564    nor UUCP-oriented dialout-device locking conventions. QNX does,
5565    however, allow a program to get the device open count. This can not be
5566    a reliable form of locking unless all applications do it (and they
5567    don't), so by default, Kermit uses this information only for printing
5568    a warning message such as:
5569
5570   C-Kermit>set line /dev/ser1
5571   WARNING - "/dev/ser1" looks busy...
5572
5573    However, if you want to use it as a lock, you can do so with:
5574
5575   SET QNX-PORT-LOCK { ON, OFF }
5576
5577    QNX-PORT-LOCK is OFF by default; if you set in ON, C-Kermit fails to
5578    open any dialout device when its open count indicates that another
5579    process has it open. SHOW COMM (in QNX only) displays the setting, and
5580    if you have a port open, it also shows the current open count (with
5581    C-Kermit's own access always counting as 1).
5582      _________________________________________________________________
5583
5584   2.12. The Connection Log
5585
5586    C-Kermit 7.0 adds the ability to log connections, so you can see where
5587    you've been and have a record of calls you've made. A connection is
5588    defined as any communications session that is begun by SET LINE, SET
5589    PORT, DIAL, SET HOST, TELNET, or RLOGIN. Connections are not logged
5590    unless you request it; the command is:
5591
5592    LOG CX [ filename [ { NEW, APPEND } ] ]
5593           Enables logging of connections in the given file. If the
5594           trailing { NEW, APPEND } keyword is omitted, the file is opened
5595           for appending; i.e. new records are written to the end. If NEW
5596           is specified, a new file is created; if a file of the same name
5597           already existed, it is overwritten. If the filename is omitted,
5598           CX.LOG in your home (login) directory is used (note:
5599           uppercase). To accept all defaults, just use "log connections"
5600           (or "l c" for short). Synonym: LOG CONNECTIONS.
5601
5602    CLOSE CX-LOG
5603           This closes the connection log if it was open. (Note, the CLOSE
5604           CONNECTION command closes the connection itself).
5605
5606    SHOW CX
5607           This shows your current connection, if any, including the
5608           elapsed time (since you opened it). Synonym: SHOW CONNECTION.
5609
5610    \v(cx_time)
5611           This variable shows the elapsed time of your current
5612           connection, or if there is no current connection, of your most
5613           recent connection, of if there have been no connections, 0.
5614
5615    The connection contains one line per connection, of the form:
5616
5617   yyyymmdd hh:mm:ss username pid p=v [ p=v [ ... ] ]
5618
5619    where the timestamp (in columns 1-18) shows when the connection was
5620    made; username is the login identity of the person who made the
5621    connection; pid is Kermit's process ID when it made the connection.
5622    The p's are parameters that depend on the type of connection, and the
5623    v's are their values:
5624
5625   T = Connection Type (TCP, SERIAL, DIAL, DECNET, etc).
5626   H = The name of the Host from which the connection was made.
5627   N = Destination phone Number or Network host name or address.
5628   D = Serial connections only: Device name.
5629   O = Dialed calls only: Originating country code & area code if known.
5630   E = Elapsed time in hh:mm:ss format (or hhh:mm:ss, etc).
5631
5632    If you always want to keep a connection log, simply add:
5633
5634   log connections
5635
5636    to your C-Kermit customization file. Note, however, that if you make a
5637    lot of connections, your CX.LOG will grow and grow. You can handle
5638    this by adding a "logrotate" procedure like the following to your
5639    customization file, before the "log connections" command:
5640
5641   define LOGROTATE {                    ; Define LOGROTATE macro
5642       local \%i \%m \%d \%n \%f MAX
5643       def MAX 4                         ; How many months to keep
5644       if not def \%1 -                  ; No argument given
5645         end 1 \%0: No filename given
5646       if not = 1 \ffiles(\%1) -         ; Exactly 1 file must match
5647         end 1 \%0: \%1 - File not found
5648       .\%d := \fsubstr(\fdate(\%1),1,6) ; Arg OK - get file year & month
5649       if = \%d -                        ; Compare file year & month
5650         \fsubstr(\v(ndate),1,6) -       ; with current year & month
5651           end 0                         ; Same year & month - done
5652       rename \%1 \%1.\%d                ; Different - rename file
5653       .\%n := \ffiles(\%1.*)            ; How many old files
5654       if < \%n \m(MAX) end 0            ; Not enough to rotate
5655       .\%m := \%1.999999                ; Initial compare string
5656       for \%i 1 \%n 1 {                 ; Loop thru old logs
5657          .\%f := \fnextfile()           ; Get next file name
5658          if llt \%f \%m .\%m := \%f     ; If this one older remember it
5659       }
5660       delete \%m                        ; Delete the oldest one
5661   }
5662   log connections                       ; Now open the (possibly new) log
5663   logrotate \v(home)CX.LOG              ; Run the LOGROTATE macro
5664
5665    As you can see, this compares the yyyymm portion of the modification
5666    date (\fdate()) of the given file (\%1) with the current yyyymm. If
5667    they differ, the current file has the yyyymm suffix (from its most
5668    recent modification date) appended to its name. Then we search through
5669    all other such files, find the oldest one, and delete it. Thus the
5670    current log, plus the logs from the most recent four months, are kept.
5671    This is all done automatically every time you start C-Kermit.
5672
5673    On multiuser systems, it is possible to keep a single, shared,
5674    system-wide connection log, but this is not recommended since (a) it
5675    requires you keep a publicly write-accessible logfile (a glaring
5676    target for mischief), and (b) it would require each user to log to
5677    that file and not disable logging. A better method for logging
5678    connections, in UNIX at least, is syslogging (see [421]ckuins.txt
5679    Section 15 and [422]Section 4.2 of the [423]IKSD Administration Guide
5680    for details).
5681      _________________________________________________________________
5682
5683   2.13. Automatic Connection-Specific Flow Control Selection
5684
5685    Beginning in C-Kermit 7.0, the appropriate flow-control method for
5686    each connection type is kept in a table, for example:
5687
5688   Remote:           NONE
5689   Modem:            RTS/CTS
5690   Direct-Serial:    NONE
5691   TCPIP:            NONE
5692
5693    The size of the table and values for each connection type can vary
5694    from platform to platform. Type "set flow ?" for a list of available
5695    flow-control types.
5696
5697    The table is used to automatically select the appropriate kind of flow
5698    control whenever you make a connection. You can display the table
5699    with:
5700
5701   SHOW FLOW-CONTROL
5702
5703    The defaults are as follows:
5704
5705    Remote:
5706           NONE or XON/XOFF. This is because C-Kermit is not allowed to
5707           find out what type of connection the incoming user has (*). No
5708           kind of flow control will work on every kind of connection,
5709           including (unexpectedly) KEEP, which we would have liked to
5710           use, but not turning off flow control at the remote end during
5711           file transfer on TCP/IP connections is fatal to the transfer
5712           (except in VMS and HP-UX, where it must be set to Xon/Xoff!)
5713           Therefore if you are dialing in to a serial port on a server
5714           (UNIX or VMS) where C-Kermit is running, you will need to tell
5715           C-Kermit to "set flow keep" before transferring files (assuming
5716           the modem and port are configured correctly by the system
5717           administrator; otherwise you'll need to give a specific kind of
5718           flow control, e.g. "set flow xon/xoff"), so in this case
5719           C-Kermit will not disable flow control, as it must do when you
5720           are coming via Telnet (directly or through a terminal server,
5721           except on VMS and HP-UX).
5722
5723    Modem:
5724           This applies when you dial out with a modem. In this case, the
5725           MODEM FLOW-CONTROL setting takes affect after the SET FLOW
5726           setting, so it can pick the most appropriate flow control for
5727           the combination of the particular modem and the
5728           computer/port/driver that is dialing.
5729
5730    Direct-Serial:
5731           The default here is NONE because C-Kermit has no way of knowing
5732           what kind of flow control, if any, is or can be done by the
5733           device at the other end of the connection. RTS/CTS would be a
5734           bad choice here, because if the CTS signal is not asserted, the
5735           connection will hang. And since direct connections are often
5736           made with 3-wire cables, there is a good chance the CTS signal
5737           will not be received.
5738
5739    TCPIP:
5740           NONE, since TCP and IP provide their own flow control
5741           transparently to the application, except in VMS, where Xon/Xoff
5742           is the default due to the requirements of the VMS TCP/IP
5743           products.
5744
5745    Other networks:
5746           NONE, since networks should provide their flow control
5747           transparently to the application.
5748
5749    (*) This is possibly the worst feature of UNIX, VMS, and other
5750    platforms where C-Kermit runs. If C-Kermit was able to ask the
5751    operating system what kind of connection it had to the user, it could
5752    set up many things for you automatically.
5753
5754    You can modify the default-flow-control table with:
5755
5756   SET FLOW-CONTROL /xxx { NONE, KEEP, RTS/CTS, XON/XOFF, ... }
5757
5758    where "xxx" is the connection type, e.g.
5759
5760   SET FLOW /REMOTE NONE
5761   SET FLOW /DIRECT RTS/CTS
5762
5763    If you leave out the switch, SET FLOW works as before, choosing the
5764    flow control method to be used on the current connection:
5765
5766   SET FLOW XON/XOFF
5767
5768    Thus, whenever you make a connection with SET PORT, SET LINE, DIAL,
5769    SET HOST, TELNET, RLOGIN, etc, an appropriate form of flow control is
5770    selected automatically. You can override the automatic selection with
5771    a subsequent SET FLOW command, such as SET FLOW NONE (no switch
5772    included).
5773
5774    The flow control is changed automatically too when you give a SET
5775    MODEM TYPE command. For example, suppose your operating system (say
5776    Linux) supports hardware flow control (RTS/CTS). Now suppose you give
5777    the following commands:
5778
5779   set line /dev/ttyS2    ; Automatically sets flow to NONE
5780   set modem type usr     ; Automatically sets flow to RTS/CTS
5781   set modem type rolm    ; Doesn't support RTS/CTS so now flow is XON/XOFF
5782
5783    IMPORTANT: This new feature tends to make the order of SET LINE/HOST
5784    and SET FLOW commands matter, where it didn't before. For example, in
5785    VMS:
5786
5787   SET FLOW KEEP
5788   SET LINE TTA0:
5789
5790    the SET LINE undoes the SET FLOW KEEP command; the sequence now must
5791    be:
5792
5793   SET FLOW /DIRECT KEEP
5794   SET LINE TTA0:
5795
5796    or:
5797
5798   SET LINE TTA0:
5799   SET FLOW KEEP
5800      _________________________________________________________________
5801
5802   2.14. Trapping Connection Establishment and Loss
5803
5804    If you define a macro called ON_OPEN, it is executed any time that a
5805    SET LINE, SET PORT, SET HOST, TELNET, RLOGIN or similar command
5806    succeeds in opening a connection. The argument is the host or device
5807    name (as shown by SHOW COMMUNICATIONS, and the same as \v(line)). This
5808    macro can be used for all sorts of things, like automatically setting
5809    connection- or host-specific parameters when the connection is opened.
5810    Example:
5811
5812   def ON_OPEN {
5813       switch \%1 {
5814         :abccorp.com, set reliable off, break
5815         :xyzcorp.com, set receive packet-length 1000, break
5816         etc etc...
5817       }
5818   }
5819
5820    If you define a macro called ON_CLOSE, it will be executed any time
5821    that a SET LINE, SET PORT, SET HOST, TELNET, RLOGIN or any other kind
5822    of connection that C-Kermit has made is closed, either by the remote
5823    or by a local CLOSE, HANGUP, or EXIT command or other local action,
5824    such as when a new connection is opened before an old one was
5825    explicitly closed.
5826
5827    As soon as C-Kermit notices the connection has been closed, the
5828    ON_CLOSE macro is invoked at (a) the top of the command parsing loop,
5829    or (b) when a connection is closed implicitly by a command such as SET
5830    LINE that closes any open connection prior to making a new connection,
5831    or (c) when C-Kermit closes an open connection in the act of exiting.
5832
5833    The ON_CLOSE macro was inspired by the neverending quest to unite
5834    Kermit and SSH. In this case using the "tunnel" mechanism:
5835
5836   def TUNNEL {                                ; \%1 = host to tunnel to
5837       local \%p
5838       if not def \%1 stop 1
5839       assign tunnelhost \%1                   ; Make global copy
5840       undef on_close
5841       set macro error off
5842       close connection                        ; Ignore any error
5843       open !read tunnel start \%1
5844       read \%p                                ; Get port number
5845       if fail stop 1 Tunnel failure: \%1
5846       close read
5847       if fail stop 1 Tunnel failure: \%1      ; See [424]Section 4.2.8.1
5848       assign on_close {                       ; Set up close handler
5849           echo Closing tunnel: \m(tunnelhost)
5850           !tunnel stop \m(tunnelhost)
5851           undef on_close
5852       }
5853       set host localhost:\%p /telnet
5854       if success end 0
5855       undef on_close
5856       stop 1 Connection failure: \%1
5857   }
5858
5859    In this case, when the connection stops, we also need to shut down the
5860    tunnel, even if it is at a later time after TUNNEL has finished
5861    executing. This way we can escape back, reconnect, transfer files, and
5862    so on until the connection is broken by logging out from the remote,
5863    or by explicitly closing it, or by EXITing from C-Kermit, at which
5864    time the tunnel is shut down.
5865
5866    When the connection is closed, no matter how, the ON_CLOSE macro
5867    executes and then undefines (destroys) itself, since we don't want to
5868    be closing tunnels in the future when we close subsequent connections.
5869
5870    Other such tricks can be imagined, including ending ON_CLOSE with a
5871    STOP command to force the command stack to be peeled all the way back
5872    to the top, for example in a deeply nested script that depends on the
5873    connection being open:
5874
5875   def on_close { stop 1 CONNECTION LOST }
5876
5877    When C-Kermit invokes the ON_CLOSE macro, it supplies one argument
5878    (\%1): the reason the connection was closed as a number, one of the
5879    following:
5880
5881   2 - Fatal failure to negotiate a required item on a network connection.
5882   1 - Closed by C-Kermit command.
5883   0 - All others (normally closed by remote).
5884
5885    which may be used for any purpose; for example, to add a comment to
5886    the connection log:
5887
5888   def on_close {
5889       local \%m
5890       if not open cx end 0
5891       switch \%1 {
5892         :0, .\%m = Closed by remote, break
5893         :1, .\%m = Closed by me, break
5894         :2, .\%m = Network protocol negotiation failure, break
5895       }
5896       if def \%m writeln cx {# \%m}
5897   }
5898      _________________________________________________________________
5899
5900   2.15. Contacting Web Servers with the HTTP Command
5901
5902    C-Kermit 7.0 (at this writing, the UNIX version only) supports direct
5903    contact and interaction with Web servers via HTTP 1.0 protocol. To
5904    make a connection, use Kermit's normal method for making a TCP/IP
5905    connection, but specify the HTTP port:
5906
5907   SET HOST host http [ switches ]
5908
5909    where host is the IP hostname or address, and http is the name of the
5910    TCP port for the Web server. Relevant switches include:
5911
5912    /RAW
5913           Treat the connection as a transparent binary pipe. This switch
5914           may be required if a port other than 'http' is used.
5915
5916    /SSL
5917           Make an secure private connection with SSL (only if SSL support
5918           is included in your version of Kermit). In this case the port
5919           name might need to be https rather than http, e.g. "set host
5920           secureserver.xyxcorp.com https /ssl".
5921
5922    /TLS
5923           Make an secure private connection with TLS (only if TLS support
5924           is included in your version of Kermit). In this case the port
5925           name would be https rather than http.
5926
5927    Then you can issue an HTTP command. In most cases, the server closes
5928    the connection when the command is complete. Example:
5929
5930   SET HOST www.columbia.edu http
5931   IF FAIL EXIT 1 Can't contact server
5932   HTTP GET kermit/index.html
5933
5934    At this point the connection is closed, since that's how HTTP 1.0
5935    works. If you want to perform additional operations, you must
5936    establish a new connection with another SET HOST command.
5937
5938    The HTTP command acts as a client to the Web server, except instead of
5939    displaying the results like a Web browser would, it stores them. Any
5940    HTTP command can (but need not) include any or all of the following
5941    switches:
5942
5943    /AGENT:user-agent
5944           Identifies the client to the server; "C-Kermit" or "Kermit-95"
5945           by default.
5946
5947    /HEADER:header-line
5948           Used for specifying any optional headers. A list of headers is
5949           provided using braces for grouping:
5950
5951   /HEADER:{{tag:value}{tag:value}...}
5952
5953           For a listing of valid tag value and value formats see [425]RFC
5954           1945: Hypertext Transfer Protocol -- HTTP/1.0. A maximum of
5955           eight headers may be specified.
5956
5957    /USER:name
5958           In case a page requires a username for access.
5959
5960    /PASSWORD:password
5961           In case a page requires a password for access.
5962
5963    /ARRAY:arrayname
5964           Tells Kermit to store the response headers in the given array,
5965           one line per element. The array need not be declared in
5966           advance. Example:
5967
5968   C-Kermit? http /array:c get kermit/index.html
5969   C-Kermit? show array c
5970   Dimension = 9
5971   1. Date: Fri, 26 Nov 1999 23:12:22 GMT
5972   2. Server: Apache/1.3.4 (Unix)
5973   3. Last-Modified: Mon, 06 Sep 1999 22:35:58 GMT
5974   4. ETag: "bc049-f72-37d441ce"
5975   5. Accept-Ranges: bytes
5976   6. Content-Length: 3954
5977   7. Connection: close
5978   8. Content-Type: text/html
5979
5980    As you can see, the header lines are like MIME e-mail header lines:
5981    identifier, colon, value. The /ARRAY switch is the only method
5982    available to a script to process the server responses for a POST or
5983    PUT command.
5984
5985    The HTTP commands are:
5986
5987    HTTP [ switches ] GET remote-filename [ local-filename ]
5988           Retrieves the named file. If a local-filename is given, the
5989           file is stored locally under that name; otherwise it is stored
5990           with its own name.
5991
5992    HTTP [ switches ] HEAD remote-filename local-filename
5993           Like GET except without actually getting the file; instead it
5994           gets only the headers, storing them into the given file, whose
5995           name must be given, one line per header item, as shown above in
5996           the /ARRAY: switch description.
5997
5998    HTTP [ switches ] INDEX remote-directory [ local-filename ]
5999           Retrieves the file listing for the given server directory.
6000           NOTE: This command is not supported by most Web servers.
6001
6002    HTTP [ switches ] POST [ /MIME-TYPE:type ] local-file remote-file
6003           Used to send a response as if it were sent from a form. The
6004           data to be posted must be read from a file.
6005
6006    HTTP [ switches ] PUT [ /MIME-TYPE:type ] local-file remote-file
6007           Uploads a local file to a server file.
6008
6009    HTTP [ switches ] DELETE remote-filename
6010           Instructs the server to delete the specified filename.
6011      _________________________________________________________________
6012
6013   3. TERMINAL CONNECTION
6014
6015   3.1. CONNECT Command Switches
6016
6017    The following switches (see [426]Section 1.5) were added to the
6018    CONNECT command in 7.0:
6019
6020    /QUIETLY
6021           Don't print the "Connecting to..." or "Back at..." messages. CQ
6022           is an invisible command synonym for CONNECT /QUIETLY.
6023
6024    /TRIGGER:string
6025           Specify a trigger or triggers ([427]Section 3.2) effective for
6026           this CONNECT command only, temporarily overriding any current
6027           SET TERMINAL TRIGGER values ([428]Section 3.2).
6028
6029    Note: Other switches might also be available; type "connect ?" for a
6030    list, "help connect" for a description of each.
6031      _________________________________________________________________
6032
6033   3.2. Triggers
6034
6035    Triggers were added for UNIX, VMS, AOS/VS, and K95 in C-Kermit 7.0.
6036
6037    SET TERMINAL TRIGGER string
6038           Tells C-Kermit to look for the given string during all
6039           subsequent CONNECT sessions, and if seen, to return to command
6040           mode automatically, as if you had escaped back manually. If the
6041           string includes any spaces, you must enclose it in braces.
6042           Example:
6043
6044   set terminal trigger {NO CARRIER}
6045
6046    Comparisons are made after character-set translation.
6047
6048    If a string is to include a literal brace character, precede it with a
6049    backslash:
6050
6051   ; My modem always makes this noise when the connection is lost:
6052   set terminal trigger |||ppp\{\{\{\{UUUUUUU
6053
6054    If you want Kermit to look for more than one string simultaneously,
6055    use the following syntax:
6056
6057   set terminal trigger {{string1}{string2}...{stringn}}
6058
6059    In this case, C-Kermit will return to command mode automatically if
6060    any of the given strings is encountered. Up to 8 strings may be
6061    specified.
6062
6063    If the most recent return to command mode was caused by a trigger, the
6064    new variable, \v(trigger), shows the trigger value; otherwise
6065    \v(trigger) is empty.
6066
6067    The SHOW TRIGGER command displays the SET TERMINAL TRIGGER values as
6068    well as the \v(trigger) value.
6069      _________________________________________________________________
6070
6071   3.3. Transparent Printing
6072
6073    As noted in the manual, C-Kermit's CONNECT command on UNIX is not a
6074    terminal emulator, but rather a "semitransparent pipe" between the
6075    terminal or emulator you are using to access C-Kermit, and the remote
6076    host to which C-Kermit is connected. The "semitransparent" qualifier
6077    is because of character-set translation as well as several actions
6078    taken by the emulator in response to the characters or strings that
6079    pass through it, such as APCs, Kermit packets (autodownload),
6080    triggers, etc.
6081
6082    The UNIX version of C-Kermit 7.0 adds another such action: Transparent
6083    printing, also called Controller printing (as distinct from Autoprint
6084    or line or screen print). It is intended mainly for use on UNIX
6085    workstation consoles (as opposed to remote logins), but with some care
6086    can also be used when accessing C-Kermit remotely.
6087
6088    Transparent printing is related to APC by sharing C-Kermit's built-in
6089    ANSI escape-sequence parser to detect "printer on" and "printer off"
6090    sequences from the host. When the printer-on sequence is received, all
6091    subsequent arriving characters -- including NUL, control characters,
6092    and escape sequences -- are sent to the SET PRINTER device instead of
6093    to your screen until the printer-off sequence is received, or you
6094    escape back, whichever happens first. These bytes are not translated
6095    or modified or filtered in any way by Kermit (except for possibly
6096    stripping of the 8th bit, as noted below), but if filtering or
6097    translation is desired, this can be accomplished by your SET PRINTER
6098    selection (e.g. by choosing a pipeline of filters).
6099
6100    By default, your SET PRINTER device is your default UNIX printer, but
6101    it can also be a file, a command, or the null device (which causes all
6102    printer material to be discarded). See [429]Using C-Kermit, 2nd Ed.,
6103    p.41 for details.
6104
6105    Transparent printing is controlled by the command:
6106
6107    SET TERMINAL PRINT { ON, OFF }
6108           When ON, transparent-print sequences are obeyed, and printing
6109           occurs on the system where C-Kermit is running. When OFF,
6110           transparent print sequences are ignored and passed through to
6111           your actual terminal or emulator, along with the data they
6112           enclose. OFF is the default, for compatibility with earlier
6113           C-Kermit releases. As noted in the manual, when the current SET
6114           PRINTER device is a file, transparent-print material is
6115           appended to it; the file is not overwritten.
6116
6117    SET TERMINAL BYTESIZE { 7, 8 }
6118    SET PARITY { EVEN, ODD, MARK, SPACE, NONE }
6119           If the terminal bytesize is 7, or PARITY is not NONE, the 8th
6120           bit of each byte is stripped prior to printing.
6121
6122    The transparent-print escape sequences are:
6123
6124    <ESC>[5i
6125           Printer On. Send all subsequent incoming bytes to the printer
6126           without any kind of filtering, translation, or alteration.
6127           Note: <ESC> stands for ASCII character number 27 (decimal),
6128           Escape.
6129
6130    <ESC>[4i
6131           Printer Off. Resume displaying incoming bytes on the screen.
6132
6133    These are the same sequences used by DEC VT100 and higher terminals
6134    and other ANSI X3.64 and ISO 6429 compatible terminals. There is no
6135    provision for selecting other printer-control sequences.
6136
6137    Restrictions:
6138
6139     1. You must SET TERM TRANSPARENT-PRINT ON before you can use this
6140        feature.
6141     2. Only the 7-bit forms of the escape sequences are supported. The
6142        8-bit CSI C1 control is not recognized.
6143     3. Autoprint is not supported, since this requires a full-fledged
6144        terminal emulator with direct access to the screen.
6145     4. The start-print and stop-print sequences pass through to the
6146        screen (there is no way to avoid this without causing unacceptable
6147        delays or deadlocks in CONNECT mode). Thus if your terminal or
6148        emulator also supports transparent printing via these same
6149        sequences, an empty file will be sent to its printer. Normally
6150        this has no effect.
6151
6152    Point (4) is similar to the situation with autodownload and APC --
6153    when you have several Kermit clients in a chain, you should take care
6154    that these features are enabled in only one of them.
6155
6156    Example 1:
6157
6158   set printer {|lpr -Plaser}  ; Specify the printer (if not default).
6159   set term print on           ; Enable transparent printing.
6160   set term byte 8             ; Enable 8-bit characters.
6161   connect                     ; Enter CONNECT mode.
6162
6163    Example 2:
6164
6165   set printer /home/users/olga/printer.log  ; Send printer material to a file.
6166
6167    Example 3:
6168
6169   set printer {| grep -v ^Received | lpr}   ; Filter out some lines
6170
6171    Then use "pcprint" or "vtprint" commands on the host to initiate
6172    transparent print operations. See [430]Using C-Kermit, 2nd Ed., p.406
6173    for details.
6174
6175    Here is a sample "pcprint" shell script for UNIX:
6176
6177   #!/bin/sh
6178   echo -n '<ESC>[5i'
6179   if [ $# -eq 0 ]; then
6180     cat
6181   else
6182     cat $*
6183   fi
6184   echo -n '<FF><ESC>[4i'
6185   # (end)
6186
6187    (Replace "<ESC>" by the actual ASCII Escape character and "<FF>" by
6188    the ASCII Formfeed character).
6189
6190    If you always want transparent printing enabled, put "set term print
6191    on" in your C-Kermit customization file (~/.mykermrc in UNIX). The
6192    "set term bytesize" selection, however, is a property of each separate
6193    connection.
6194      _________________________________________________________________
6195
6196   3.4. Binary and Text Session Logs
6197
6198    C-Kermit 7.0 corrects an oversight in earlier releases, in which
6199    binary session logs (SET SESSION-LOG BINARY) translated character sets
6200    and performed various formatting transformations (e.g. "newline mode")
6201    before writing characters to the session log. In C-Kermit 7.0,
6202    binary-mode session logging writes characters as they come in, before
6203    anything (other that parity-bit stripping) is done to them. Text-mode
6204    session logging records the characters after processing.
6205      _________________________________________________________________
6206
6207   4. FILE TRANSFER
6208
6209    Every file is transferred either in text mode (which implies
6210    record-format and character-set translation) or binary mode (in which
6211    each byte is sent literally without any kind of conversion). The mode
6212    in which a file is transferred is controlled by (a) the default mode,
6213    in the absence of any other indications; (b) the SET FILE TYPE
6214    command; (c) various automatic mechanisms based on client/server
6215    negotiations, directory information or filename patterns, etc.
6216
6217    The default FILE TYPE was changed from TEXT to BINARY in C-Kermit 7.0
6218    because:
6219
6220      * Transferring a text file in binary mode does less damage than
6221        transferring a binary file in text mode.
6222      * Only binary-mode transfers can be recovered from the point of
6223        failure.
6224      * The automatic transfer-mode mechanisms switch to text mode on a
6225        per-file basis anyway, so only those files that are not covered by
6226        the automatic mechanisms are affected.
6227      * All file transfers on the Web are done in binary mode, so people
6228        are accustomed to it and expect it.
6229      _________________________________________________________________
6230
6231   4.0. BUG FIXES, MINOR CHANGES, AND CLARIFICATIONS
6232
6233     4.0.0. Filenames with Spaces
6234
6235    Filenames that contain spaces are a major nuisance to a program like
6236    Kermit, whose command language is line- and word-oriented, in which
6237    words are separated by spaces and a filename is assumed to be a
6238    "word". In general (unless noted otherwise in the description of a
6239    particular command), there is only one way to refer to such files in
6240    Kermit commands, and that is to enclose the name in braces:
6241
6242   send {this file}
6243
6244    Tells Kermit to send the file whose name is "this file" (two words, no
6245    quotes). Of course, various circumlocutions are also possible, such
6246    as:
6247
6248   define \%a this file
6249   send \%a
6250
6251    BUT, perhaps contrary to expectation, you can't use "\32" to represent
6252    the space:
6253
6254   send this\32file
6255
6256    does not work. Why? Because the Kermit parser, which must work on many
6257    operating systems including Windows, has no way of knowing what you
6258    mean by "this\32file". Do you mean a file whose name is "this file" in
6259    the current directory? Or do you mean a file whose name is "32file" in
6260    the "this" subdirectory of the current directory? Guessing won't do
6261    here; Kermit must behave consistently and deterministically in all
6262    cases on all platforms.
6263
6264    Note that you can't use Esc or Tab within {...} for filename
6265    completion, or question mark to get a filename list. However, you can
6266    include wildcards; for example:
6267
6268   send {* *}
6269
6270    sends all files whose name contains a space.
6271
6272    All things considered, it is best to avoid spaces in file and
6273    directory names if you can. Also see [431]Section 5.4 on this topic.
6274      _________________________________________________________________
6275
6276     4.0.1. Packet out of Window
6277
6278    C-Kermit 6.0 could send packets "out of window" if the window size was
6279    greater than 1 and ACKs had arrived out of order. Fixed in 6.1.
6280      _________________________________________________________________
6281
6282     4.0.2. MOVE after ADD SEND-LIST
6283
6284    ADD SEND-LIST followed by MOVE did not delete original files; fixed in
6285    6.1. Carrier loss was not detected during transfer; in 7.0 C-Kermit
6286    checks for this (but results can not be guaranteed). In any case, the
6287    protocol will eventually time out if the connection is lost.
6288      _________________________________________________________________
6289
6290     4.0.3. GET and RECEIVE As-Names
6291
6292    In 5A(190) through 6.0.192, the GET and RECEIVE as-name did not
6293    properly override the RECEIVE PATHNAMES setting. In 7.0 it does.
6294      _________________________________________________________________
6295
6296     4.0.4. New Brief Statistics Listing
6297
6298    Version 7.0 adds a /BRIEF switch to the STATISTICS command, to display
6299    a short file-transfer statistics report. /BRIEF is now the default.
6300    Use /VERBOSE to see the full display, which is about 25 lines long.
6301      _________________________________________________________________
6302
6303     4.0.5. Improved FAST Command
6304
6305    The preinstalled definition of the FAST macro did not take enough
6306    factors into account. Now it sets packet lengths and window sizes
6307    appropriate to the configuration. Furthermore, in IRIX only, it might
6308    restrict the SEND packet length to 4000, to work around a bug in the
6309    IRIX Telnet server, depending on the IRIX version (see
6310    [432]ckubwr.txt, IRIX section). To see the built-in definition of the
6311    FAST macro, type "show macro fast". To change it, simply define it to
6312    be whatever you want -- it's just a macro, like any other.
6313      _________________________________________________________________
6314
6315     4.0.6. The SET SEND BACKUP Command
6316
6317    Version 7.0 adds SET SEND BACKUP { ON, OFF }. This tells whether
6318    backup files should be sent. Backup files are the ones created by
6319    Kermit (and EMACS, and possibly other applications) to preserve old
6320    copies of files when creating new ones with the same name. Kermit does
6321    this when receiving a file and its FILE COLLISION setting is BACKUP
6322    (or RENAME, in which case it the new file gets the backup name). On
6323    most platforms, the backup name is formed by adding:
6324
6325   .~n~
6326
6327    to the end of the filename, where "n" is a number. For example, if the
6328    original file is oofa.txt, a backup file might be called:
6329
6330   oofa.txt.~1~
6331
6332    (or oofa.txt.~2~, etc). If you SET SEND BACKUP OFF, this tells Kermit
6333    not to send files that have backup names. Normally, SET SEND BACKUP is
6334    ON (as shown by SHOW PROTOCOL), and backup files are sent if their
6335    names match the SEND file specification.
6336
6337    Also see PURGE, SET FILE COLLISION, SEND /NOBACKUP, DIRECTORY
6338    /[NO]BACKUP.
6339      _________________________________________________________________
6340
6341     4.0.7. The SET { SEND, RECEIVE } VERSION-NUMBERS Command
6342
6343    VMS Only. Normally when sending files, VMS C-Kermit strips the version
6344    number. For example, if the file is FOO.BAR;34, the name is sent as
6345    FOO.BAR (without the ";34"). If you want to keep version numbers on
6346    when sending files, use SET SEND VERSION-NUMBERS ON. The effect
6347    depends on the receiver.
6348
6349    Normally when receiving files, and an incoming filename includes a
6350    VMS-style version number (such as FOO.BAR;34) VMS C-Kermit strips it
6351    before trying to create the new file; this way the new file receives
6352    the next highest version number in the customary manner for VMS. If
6353    you want version numbers on incoming filenames to be used in creating
6354    the new files, use SET RECEIVE VERSION-NUMBERS ON.
6355
6356    Normally these commands would be effective only when VMS C-Kermit is
6357    exchanging files with a non-VMS Kermit program, since VMS-to-VMS
6358    transfers use labeled mode unless you have gone out of your way to
6359    defeat it.
6360
6361    Example: You want to send all versions of all files in the current
6362    directory from a VMS C-Kermit client to a UNIX C-Kermit server. Use:
6363
6364   set send version-numbers on
6365   send *.*;*
6366
6367    The resulting Unix files will have VMS-style version numbers as part
6368    of their name, for example "foo.bar;1", "foo.bar;2", etc.
6369
6370    Now suppose you want to send these files from Unix to another VMS
6371    system and preserve the version numbers. Again we have a Unix C-Kermit
6372    server and VMS C-Kermit client. Give these commands to the client:
6373
6374   set receive version-numbers on
6375   get *
6376      _________________________________________________________________
6377
6378     4.0.8. The SET { SEND, RECEIVE } { MOVE-TO, RENAME-TO } Commands
6379
6380    These commands are persistent global versions of the /MOVE-TO: and
6381    /RENAME-TO: switches of the SEND, GET, and RECEIVE commands. They
6382    should normally be used only when setting up a dedicated
6383    transaction-processing application, in which each file is to be moved
6384    or renamed immediately after, and only if, it is transferred
6385    successfully, so that (for example) an independent, concurrent process
6386    can notice when new files appear and process them immediately without
6387    having to guess whether they are complete.
6388      _________________________________________________________________
6389
6390     4.0.9. SET FILE INCOMPLETE AUTO
6391
6392    SET FILE INCOMPLETE { KEEP, DISCARD }, which tells whether to keep or
6393    discard incompletely received files, has a new option, AUTO, which is
6394    also the default. It means KEEP the incomplete file if the transfer is
6395    in binary mode, otherwise DISCARD it. This reduces the chances that a
6396    subsequent recovery operation (RESEND, REGET, etc) could produce a
6397    corrupt file, since recovery works only for binary-mode transfers.
6398      _________________________________________________________________
6399
6400   4.1. FILE-TRANSFER FILENAME TEMPLATES
6401
6402    File-transfer filename templates allow files to be renamed
6403    automatically by the file sender, the receiver, or both, during
6404    transfer of groups of files.
6405
6406     4.1.1. Templates in the As-Name
6407
6408    Prior to C-Kermit 6.1 and Kermit 95 1.1.12 the only options that could
6409    be used to affect the names of files being transferred were SET
6410    FILENAMES { LITERAL, CONVERTED } and SET { SEND, RECEIVE } PATHNAMES {
6411    ON, OFF }, plus the "as-name" feature of the SEND (MOVE, etc) and
6412    RECEIVE commands.
6413
6414    Previously, the as-name could be used only for a single file. For
6415    example:
6416
6417   SEND FOO BAR
6418
6419    would send the file FOO under the name BAR, but:
6420
6421   SEND *.TXT anything
6422
6423    was not allowed, since it would give the same name to each file that
6424    was sent. When receiving:
6425
6426   RECEIVE FOO
6427
6428    would rename the first incoming file to FOO before storing it on the
6429    disk, but subsequent files would not be renamed to FOO, since this
6430    would result in overwriting the same file repeatedly. Instead, they
6431    were stored under the names they arrived with.
6432
6433    Beginning in C-Kermit 6.1 and Kermit 95 1.1.12, it is possible to
6434    specify as-names in SEND, RECEIVE, and related commands even for file
6435    groups. This is accomplished by using replacement variables in the
6436    as-name, along with optional material such character-string functions
6437    and/or constant strings. An as-name containing replacement variables
6438    is called a filename template.
6439
6440    The key to filename templates is the new variable:
6441
6442   \v(filename)
6443
6444    During file transfer it is replaced by the name of each file currently
6445    being transferred (after transfer, it is the name of the last file
6446    transferred).
6447
6448    So, for example:
6449
6450   send *.txt \v(filename).new
6451
6452    sends each file with its own name, but with ".new" appended to it. Of
6453    course if the name already contains periods, this could confuse the
6454    file receiver, so you can also achieve fancier effects with
6455    constructions like:
6456
6457   send *.txt \freplace(\v(filename),.,_).new
6458
6459    which replaces all periods in the original filename by underscores,
6460    and then appends ".new" to the result. So, for example, oofa.txt would
6461    be sent as oofa_txt.new.
6462
6463    Another new variable that is useful in this regard is \v(filenumber),
6464    which is the ordinal number of the current file in the file group, so
6465    you can also:
6466
6467   send *.txt FILE\flpad(\v(filenum),2,0)
6468
6469    resulting in a series of files called FILE00, FILE01, FILE02, etc. (At
6470    the end of the transfer, \v(filenum) tells the number of files that
6471    were transferred).
6472
6473    If you specify a constant as-name when sending a file group:
6474
6475   send *.txt thisnameonly
6476
6477    Kermit complains and asks you to include replacement variables in the
6478    as-name. You should generally use \v(filename) or \v(filenumber) for
6479    this purpose, since other variables (with the possible exception of
6480    date/time related variables) do not change from one file to the next.
6481    But Kermit accepts any as-name at all that contains any kind of
6482    variables for file group, even if the variable will not change. So:
6483
6484   send *.txt \%a
6485
6486    is accepted, but all files are sent with the same name (the value of
6487    \%a, if it has one and it is constant). If the variable has no value
6488    at all, the files are sent under their own names.
6489
6490    Of course, the value of \%a in the previous example need not be
6491    constant:
6492
6493   define \%a FILE\flpad(\v(filenum),2,0)_at_\v(time)
6494   send *.txt \%a
6495
6496    The RECEIVE command, when given without an as-name, behaves as always,
6497    storing all incoming files under the names they arrive with, subject
6498    to SET FILE NAME and SET RECEIVE PATHNAMES modifications ([433]Section
6499    4.10).
6500
6501    However, when an as-name is given in the RECEIVE command, it is
6502    applied to all incoming files rather than to just the first. If it
6503    does not contain replacement variables, then the current FILE
6504    COLLISION setting governs the result. For example:
6505
6506   receive foo
6507
6508    will result in incoming files named foo, foo.~1~, foo.~2~, and so on,
6509    with the default FILE COLLISION setting of BACKUP. If it does contain
6510    replacement variables, of course they are used.
6511
6512    When receiving files, the \v(filename) variable refers to the name
6513    that was received in the incoming file-header packet, BEFORE any
6514    processing by SET FILE NAMES or SET RECEIVE PATHNAMES. Since the
6515    filenames in file-header packets are usually in uppercase, you would
6516    need to convert them explicitly if you want them in lowercase, e.g.:
6517
6518   receive \flower(\v(filename)).new
6519      _________________________________________________________________
6520
6521     4.1.2. Templates on the Command Line
6522
6523    On the command-line, use templates as shown above as the -a option
6524    argument, bearing in mind the propensity of UNIX and perhaps other
6525    shells to treat backslash as a shell escape character. So in UNIX (for
6526    example):
6527
6528   kermit -s oofa.* -a x.\\v(filenum)
6529
6530    By the way, this represents a change from 6.0 and earlier releases in
6531    which the as-name (-a argument or otherwise) was not evaluated by the
6532    command parser. Thus, for example, in VMS (where the shell does not
6533    care about backslashes), it was possible to:
6534
6535   kermit -s oofa.txt -a c:\tmp\oofa.txt
6536
6537    Now backslashes in the as-name must be quoted not only for the shell
6538    (if necessary) but also for Kermit itself:
6539
6540   kermit -s oofa.txt -a c:\\tmp\\oofa.txt      ; Kermit only
6541   kermit -s oofa.txt -a c:\\\\tmp\\\\oofa.txt  ; Shell and Kermit
6542
6543    You can also use the \fliteral() function for this:
6544
6545   kermit -s oofa.txt -a \fliteral(c:\tmp\oofa.txt)      ; Kermit only
6546   kermit -s oofa.txt -a \\fliteral(c:\\tmp\\oofa.txt)   ; Shell and Kermit
6547      _________________________________________________________________
6548
6549     4.1.3. Post-Transfer Renaming
6550
6551    Filename templates are now also useful in SET { SEND, RECEIVE }
6552    RENAME-TO and in the /RENAME-TO: switch, that can be given to the
6553    SEND, GET, or RECEIVE commands; this is similar to an as-name, but is
6554    effective on a per-file basis if and only if the file was transferred
6555    successfully.
6556
6557    MOVE-TO and RENAME-TO address a requirement commonly stated for
6558    transaction processing and similar systems. Suppose, for example, a
6559    central system "X" accepts connections from multiple clients
6560    simultaneously; a process on X waits for a file to appear and then
6561    processes the file. This process must have a way of knowing when the
6562    file has been completely and successfully transferred before it starts
6563    to process it. This can be accomplished easily using C-Kermit's SET {
6564    SEND, RECEIVE } { MOVE-TO, RENAME-TO } command or /MOVE-TO: or
6565    /RENAME-TO: switches, described in [434]Sections 4.7.1 through
6566    [435]4.7.3.
6567
6568    Here's an example for the client side, in which files to be sent are
6569    placed in a certain directory (/usr/olga/tosend in this example) by
6570    another process when they are ready to go. This might be in a hospital
6571    or big doctor's office, where medical insurance claims are entered at
6572    a number of workstations, and then deposited in the "tosend"
6573    directory, from which they are sent to a claims clearinghouse. We
6574    assume the connection is already made and a Kermit server is on the
6575    other end.
6576
6577   local srcdir findir              ; Declare local (automatic) variables
6578   assign srcdir /usr/olga/tosend   ; Local source directory (files to send)
6579   assign findir /usr/olga/sent     ; Where to move files after they are sent
6580   log transactions                 ; Keep a log of transfers
6581   cd \m(srcdir)                    ; Change to the source directory
6582   while true {                     ; Loop forever...
6583       send /move-to:\m(findir) *   ; Send all files
6584       sleep 60                     ; Sleep a minute
6585   }                                ; Go back and do it again
6586
6587    Note how simple this is. Once each file is sent, it is moved so it
6588    won't be sent again (you could also use SEND /RENAME-TO: or even SEND
6589    /DELETE). If a transfer fails, the file is not moved and so we try
6590    again to send it next time around. If there are no files to send, the
6591    SEND command does nothing but a message is printed; you can avoid the
6592    message by checking first to see if any files are in the directory:
6593
6594   while true {                     ; Loop forever...
6595       if > \ffiles(*) 0 -          ; If there are any files
6596         send /move-to:\m(findir) * ; send them.
6597       sleep 60                     ; Sleep a minute.
6598   }                                ; Go back and do it again.
6599
6600    It's even simpler on the server side (here again we assume the
6601    connection is already in place):
6602
6603   local rcvdir findir              ; Declare local (automatic) variables
6604   assign rcvdir /usr/ivan/tmp      ; Temporary receiving directory
6605   assign findir /usr/ivan/new      ; Where to move files after reception
6606   log transactions                 ; Keep a log of transfers
6607   cd \m(rcvdir)                    ; Change to the source directory
6608   set receive move-to \m(findir)   ; Declare move-to directory.
6609   server                           ; Enter server mode.
6610
6611    A separate process (e.g. the medical claim-form decoder) can look for
6612    files appearing in the /usr/ivan/new directory and process them with
6613    every confidence that they have been completely received.
6614
6615    Note that the use of MOVE-TO can result in moved files overwriting one
6616    another (the application would normally avoid this by assigning each
6617    transaction a unique, e.g. based on customer number and claim number).
6618    But if filename collisions are a possibility in your application,
6619    RENAME-TO might be a better choice; you can use any variables you like
6620    in the template to ensure uniqueness of the RENAME-TO filename; for
6621    example:
6622
6623   SET RECEIVE RENAME-TO \v(filename)_\v(ndate)_\v(ntime)_\v(userid)_\v(pid)
6624      _________________________________________________________________
6625
6626   4.2. FILE-TRANSFER PIPES AND FILTERS
6627
6628     4.2.1. INTRODUCTION
6629
6630    Beginning in C-Kermit 6.1 and Kermit 95 1.1.12, it is possible to send
6631    from a command, or "pipe", as well as from a file, and to receive to a
6632    pipe or command. In a typical example, we might want to transfer an
6633    entire directory tree from one UNIX system to another (but without
6634    using the methods described in [436]Sections 4.3 , [437]4.10,
6635    [438]4.11, and [439]4.15). We could do this in multiple steps as
6636    follows:
6637
6638   1. Create a tar archive of the desired directory tree
6639   2. Compress the tar archive
6640   3. Transfer it in binary mode to the other computer
6641   4. Decompress it
6642   5. Extract the directory tree from the tar archive
6643
6644    But this is inconvenient and it requires a temporary file, which might
6645    be larger than we have room for.
6646
6647    The new pipe-transfer feature lets you do such things in a single
6648    step, and without intermediate files.
6649
6650    Additional new features, also discussed here, let you specify pre- and
6651    post- processing filters for outbound and incoming files, and give you
6652    a way to insert the output from shell or system commands into C-Kermit
6653    commands.
6654
6655    The file-transfer related features are available only with Kermit
6656    protocol, not with any external protocols, nor with K95's built-in
6657    XYZMODEM protocols (because XYZMODEM recovers from transmission errors
6658    by rewinding the source file, and you can't rewind a pipe).
6659
6660    This section begins by discussing the simple and straightforward use
6661    of these features in UNIX, in which pipes and input/output redirection
6662    are a fundamental component and therefore "just work", and then goes
6663    on to discuss their operation in Windows and OS/2, where matters are
6664    much more complicated.
6665      _________________________________________________________________
6666
6667     4.2.1.1. TERMINOLOGY
6668
6669    Standard Input
6670           This is a precise technical term denoting the normal source of
6671           input for a command or program, which is the keyboard of your
6672           terminal by default, but which can be redirected to a file or
6673           pipe.
6674
6675    Stdin
6676           Abbreviation for Standard Input.
6677
6678    Standard Output
6679           A precise technical term denoting the normal destination for
6680           output from a command or program, which is your terminal screen
6681           by default, but which can be redirected to a file.
6682
6683    Stdout
6684           Abbreviation for Standard Output.
6685
6686    Stdio
6687           Abbreviation for Standard Input / Standard Output.
6688
6689    I/O
6690           Abbreviation for Input / Output.
6691
6692    Shell
6693           Text-based system command processor, such as the UNIX shell,
6694           DOS COMMAND.COM, etc.
6695
6696    Pipe
6697           A mechanism by which the standard output of one program is sent
6698           to the standard input of another.
6699
6700    Pipeline
6701           A series of programs connected by pipes.
6702      _________________________________________________________________
6703
6704     4.2.1.2. NOTATION
6705
6706    In command descriptions, "command" is replaced by a shell or system
6707    command or pipeline. The command names specified in these commands are
6708    interpreted by your shell, just as if you were typing them at the
6709    shell prompt, and so if they are in your PATH, they will be found in
6710    the expected manner. Therefore you don't have to specify complete
6711    pathnames for commands that are programs (but it shouldn't hurt if you
6712    do).
6713
6714    The normal notation for I/O redirection is as follows:
6715
6716   <  Read Stdin from the given file.
6717   >  Send Stdout to the given file.
6718   |  Send Stdout from the command on the left to the command on the right.
6719
6720    Examples:
6721
6722    sort < foo > bar
6723           Sorts the lines in file "foo" and writes the results to file
6724           "bar"
6725
6726    grep -c "some text" *.txt | grep -v ":0" | sort | pr -3 | lpr
6727           This is a command pipeline composed of 5 commands:
6728
6729    grep -c "some text" *.txt
6730           Looks in all files whose names end with ".txt" for the string
6731           "some text" and writes to Stdout the names of each file
6732           followed by a colon and the number of occurrences in each.
6733
6734    grep -v ":0"
6735           Prints to Stdout the lines from Stdin that do NOT contain the
6736           string ":0", in this case, it removes the names of files that
6737           do not contain "some text".
6738
6739    sort
6740           Sorts the lines from Stdin alphabetically to Stdout.
6741
6742    pr -3
6743           Arranges the lines from Stdin in three columns.
6744
6745    lpr
6746           Prints its Stdin on the default printer.
6747
6748    Note that the Kermit features described here work only with commands
6749    that use Stdio. If you attempt to use them with commands whose input
6750    and output can not be redirected, Kermit will most likely get stuck.
6751    Kermit has no way of telling how an external command works, nor what
6752    the syntax of the shell is, so it's up to you to make sure you use
6753    these features only with redirectable commands.
6754
6755    The quoting rules of your shell apply to the command. Thus in UNIX,
6756    where C-Kermit tries to use your preferred shell for running commands,
6757    shell "metacharacters" within commands must be escaped if they are to
6758    be taken literally, using the methods normal for your shell. For
6759    example, the UNIX tr (translate) command must have its arguments in
6760    quotes:
6761
6762   tr "[a-z]" "[A-Z]"
6763
6764    otherwise the shell is likely to replace them by all filenames that
6765    match, which is probably not what you want. This is also true when
6766    using your shell directly, and has nothing to do with Kermit.
6767      _________________________________________________________________
6768
6769     4.2.1.3. SECURITY
6770
6771    Some sites might not wish to allow access to system commands or
6772    external programs from within Kermit. Such access, including all the
6773    features described here, can be disabled in various ways:
6774
6775     1. When building from source code, include -DNOPUSH among the CFLAGS.
6776     2. At runtime, give the NOPUSH command.
6777     3. For server mode, give the DISABLE HOST command.
6778     4. Implicit use of pipes can be disabled as described in [440]Section
6779        4.2.4.
6780
6781    Note: 3 and 4 are not necessary if you have done 1 or 2.
6782      _________________________________________________________________
6783
6784     4.2.2. Commands for Transferring from and to Pipes
6785
6786    SEND /COMMAND sends data from a command or command pipeline, and
6787    RECEIVE /COMMENT writes data to a command or pipeline. The GET
6788    /COMMAND command asks a server to send material, and then writes the
6789    incoming material to a command or pipeline. These features, along with
6790    switches (like "/COMMAND", described in [441]Section 4.7) are new to
6791    C-Kermit 6.1. The following synonyms are also provided:
6792
6793   CSEND    = SEND /COMMAND
6794   CRECEIVE = RECEIVE /COMMAND
6795   CGET     = GET /COMMAND
6796
6797    None of these commands can be used if a SEND or RECEIVE FILTER
6798    (respectively, [442]Section 4.2.3) is in effect, or if a NOPUSH
6799    command ([443]Section 4.2.1.3) has been given, or if the current
6800    protocol is not Kermit.
6801      _________________________________________________________________
6802
6803     4.2.2.1. Sending from a Command
6804
6805    SEND /COMMAND command [ as-name ]
6806    SEND /AS-NAME:as-name /COMMAND command
6807    CSEND command [ as-name ]
6808           These three forms are the same. They work like the SEND
6809           command, but instead of sending a file, it sends the standard
6810           output of the given command, either under the command's own
6811           name, or else with the given as-name. If the command contains
6812           spaces, it must be enclosed in braces. Braces should also be
6813           used for the as-name if it contains spaces. If braces are
6814           included around either the command or the as-name, they are
6815           removed after parsing but before use. As with SEND, the
6816           transfer is in text or binary mode according the current FILE
6817           TYPE setting, unless you override the global transfer mode by
6818           including a /TEXT or /BINARY switch. The command must require
6819           no input.
6820
6821    When sending from a command or pipeline, C-Kermit has no way of
6822    knowing in advance how much data will be sent, and so it can not send
6823    the size to the other Kermit in the Attribute packet, and so the
6824    receiving Kermit has no way of displaying "percent done" or a progress
6825    bar (thermometer).
6826
6827    Examples that make sense in text mode (illustrated by common UNIX
6828    commands):
6829
6830    SEND /COMMAND finger
6831    CSEND finger
6832           sends the current "finger" listing (who's logged in) under the
6833           name "finger". The two forms "send /command" and "csend" are
6834           equivalent; we won't bother showing them both in the rest of
6835           the examples.
6836
6837    SEND /COMMAND:{finger}
6838    CSEND {finger}
6839           Same as previous example (braces are removed from "{finger}").
6840
6841    SEND /COMMAND:{ finger }
6842    CSEND { finger }
6843           Same as previous example, but note that the spaces are kept.
6844           This does not prevent the shell from running the "finger"
6845           program, but its output is sent under the name " finger " (with
6846           a leading and trailing space).
6847
6848    SEND /COMMAND:finger /AS-NAME:userlist
6849    CSEND finger userlist
6850           sends the current finger listing under the name "userlist".
6851
6852    SEND /COMMAND:{finger | sort -r} /AS-NAME:userlist
6853    CSEND {finger | sort -r} userlist
6854           sends the current finger listing, sorted in reverse order,
6855           under the name "userlist". The braces are needed to distinguish
6856           the command from the as-name.
6857
6858    SEND /COMMAND:{finger | sort -r} /AS-NAME:{userlist}
6859    CSEND {finger | sort -r} {userlist}
6860           Same as previous example (braces are removed from
6861           "{userlist}").
6862
6863    SEND /COMMAND:{finger | sort -r}
6864           /AS-NAME:{\freplace(\v(filename),\32,_)}
6865
6866    CSEND {finger | sort -r} {\freplace(\v(filename),\32,_)}
6867           Like the previous example, but sends the output of the command
6868           under the name of the command, but with all spaces (\32)
6869           replaced by underscores, so the as-name is "finger_|_sort_-r".
6870
6871    Examples that make sense in binary mode (three equivalent forms are
6872    shown):
6873
6874    SEND /COMMAND /BINARY {tar cf - . | gzip -c} mydir.tar.gz
6875    SEND /COMMAND /BINARY /AS-NAME:mydir.tar.gz {tar cf - . | gzip -c}
6876    CSEND /BINARY {tar cf - . | gzip -c} mydir.tar.gz
6877           Makes a tar archive of the current directory, compresses it
6878           with the GNU gzip program, and sends it as "mydir.tar.gz". The
6879           other Kermit can, of course, just store it as a file, or it can
6880           use CRECEIVE to uncompress and dearchive it as part of the
6881           transfer process.
6882
6883    When using a "pipeline" of commands in the command field, obviously,
6884    the first command must not require any input, and the last command
6885    should produce some output, and all intermediate commands should get
6886    some input and produce some output.
6887      _________________________________________________________________
6888
6889     4.2.2.2. Receiving to a Command
6890
6891    RECEIVE /COMMAND command
6892    CRECEIVE command
6893           This is like RECEIVE, except incoming material is written to
6894           the standard input of the given command, in text or binary mode
6895           according to the normal rules for file reception. Be sure to
6896           include a redirector to a file (if the command normally writes
6897           to standard output), or the output of the command won't go
6898           anywhere. The command may contain spaces; braces are not
6899           needed, but they are removed if used.
6900
6901    WARNING: C-Kermit has no way of knowing anything about the command, or
6902    even whether it is a command. Thus this command will always cause
6903    C-Kermit to enter protocol mode, as long as some text is specified in
6904    the command field. However, if the text does not correspond to a
6905    command, the transfer will eventually fail with a message such as
6906    "Error writing data" or "Failure to close file".
6907
6908    Examples for text mode (in UNIX):
6909
6910    RECEIVE /COMMAND sort -r > reverse.txt
6911    CRECEIVE sort -r > reverse.txt
6912           The text that is received is sorted in reverse order and stored
6913           in the file "reverse.txt". The two forms shown are equivalent.
6914
6915    RECEIVE /COMMAND {sort -r > reverse.txt}
6916    CRECEIVE {sort -r > reverse.txt}
6917           The same as the previous example; if braces are included, they
6918           are simply removed.
6919
6920    RECEIVE /COMMAND {sort -r > \flower(\v(filename)).reverse}
6921    CRECEIVE {sort -r > \flower(\v(filename)).reverse}
6922           Same but stores result under the incoming filename, lowercased,
6923           and with ".reverse" appended to it.
6924
6925    RECEIVE /COMMAND sort
6926    CRECEIVE sort
6927           Does nothing useful, since the output of sort has nowhere to
6928           go.
6929
6930    RECEIVE /COMMAND sort -r | pr -3 | lpr -Plaserjet
6931    CRECEIVE sort -r | pr -3 | lpr -Plaserjet
6932           The text that is received is sorted in reverse order, arranged
6933           into three columns, and sent to the "laserjet" printer.
6934
6935    Examples for binary mode:
6936
6937    RECEIVE /COMMAND:{gunzip -c | tar xf -}
6938    CRECEIVE {gunzip -c | tar xf -}
6939           Assuming the data that is received is a compressed tar archive,
6940           uncompresses the archive and passes it to tar for extraction.
6941           In this case the braces are needed because otherwise the final
6942           "-" would be taken as a command continuation character (see
6943           [444]Using C-Kermit, 2nd Edition, p.33).
6944
6945    GET /COMMAND remote-file command
6946    GET /COMMAND /AS-NAME:command remote-file
6947    CGET remote-file command
6948           This command tells the Kermit client to send a GET request for
6949           the given remote file to a Kermit server. Unlike GET, however,
6950           the incoming material is written to a command, rather than to a
6951           file. If the remote-file or the command contain spaces, they
6952           must be enclosed in braces. The same cautions about the command
6953           apply as for CRECEIVE.
6954
6955    Examples (for UNIX):
6956
6957    GET /COMMAND oofa.txt sort -r > oofa.new
6958    GET /COMMAND {oofa.txt} {sort -r > oofa.new}
6959    CGET oofa.txt sort -r > oofa.new
6960    CGET {oofa.txt} {sort -r > oofa.new}
6961           These four are equivalent. Each of them requests the server to
6962           send its "oofa.txt" file, and as it arrives, it is sorted in
6963           reverse order and written to "oofa.new".
6964
6965    GET /COMMAND {profile exec a} lpr
6966    GET /COMMAND {profile exec a} {lpr}
6967    GET /COMMAND /AS-NAME:lpr {profile exec a}
6968    GET /COMMAND /AS-NAME:{lpr} {profile exec a}
6969    GET /COMMAND /AS:lpr {profile exec a}
6970    CGET {profile exec a} lpr
6971    CGET {profile exec a} {lpr}
6972           Here the remote filename contains spaces so it MUST be enclosed
6973           in braces. As it arrives it is sent to the lpr program for
6974           printing. Braces are optional around "lpr" since it contains no
6975           spaces.
6976
6977    GET /COMMAND *.txt {cat >> new.txt}
6978    GET /AS-NAME:{cat >> new.txt} /COMMAND *.txt
6979    CGET *.txt {cat >> new.txt}
6980           This gets all the ".txt" files from the server and concatenates
6981           them all into a single "new.txt" file on the client.
6982
6983    GET /COMMAND *.txt {echo \v(filename)>>new.txt;cat>>new.txt}
6984    CGET *.txt {echo \v(filename)>>new.txt;cat>>new.txt}
6985           As above, but inserts each file's name before its contents.
6986      _________________________________________________________________
6987
6988     4.2.3. Using File-Transfer Filters
6989
6990    The commands described in [445]Section 4.2.2 let you send the output
6991    of a command, or receive data into a command. But what if you want to
6992    specify preprocessing for files that you send, or postprocessing of
6993    files that you receive, even when multiple files are involved? For
6994    this you need a way to specify send and receive filters. The commands
6995    are SET SEND FILTER and SET RECEIVE FILTER; SHOW PROTOCOL displays the
6996    current settings.
6997
6998     4.2.3.1. The SEND Filter
6999
7000    SET SEND FILTER [ command ]
7001           This command specifies a command to be run on any file that you
7002           SEND (or MOVE, MSEND, etc). It also applies to files sent when
7003           in server mode, in response to GET commands, but not to the
7004           results of REMOTE commands like REMOTE DIRECTORY, REMOTE TYPE,
7005           REMOTE HOST, etc. The command may be, but need not be, enclosed
7006           in braces; if it is, the braces are stripped before use. The
7007           output of this command is sent, rather than the file itself.
7008           The current FILE TYPE setting (TEXT or BINARY) applies to the
7009           output of the command. The command must contain at least one
7010           instance of \v(filename), for which the name of the actual file
7011           is substituted. If the command is omitted, the send filter is
7012           removed and files are sent in the normal manner.
7013
7014    The SET SEND FILTER sets up a "global" filter -- that is, one that
7015    applies to all subsequent file-sending commands until you change or
7016    remove it. You can also specify a "local" filter to be used in a
7017    specific file-sending command by using the /FILTER switch (see
7018    [446]Section 1.5); for example:
7019
7020   SEND /FILTER:command [ other-switches ] filename
7021
7022    Besides \v(filename), you can include any other script programming
7023    notation in the send filter: variable names, array references, calls
7024    to built-in string or other functions, and so on. These are evaluated
7025    during file transfer, NOT during parsing, and they are evaluated
7026    separately for each file.
7027
7028    When the SEND or MOVE (SEND /DELETE) command is used with a send
7029    filter, the output from the filter is sent under the file's original
7030    name unless you specify an "as-name" or template. The Attribute packet
7031    (if any) contains the original file's attributes (size, creation date,
7032    etc). So (for example) if the filter changes the file's size, the
7033    progress thermometer might be wrong. (We can't send the size of the
7034    output from the filter, because it is not known until the transfer is
7035    finished.) If you prefer that the size not be sent, use "set
7036    attributes size off".
7037
7038    You can not use send filters with RESEND (SEND /RECOVER) or PSEND
7039    (SEND /START).
7040
7041    Examples for text mode:
7042
7043    SET SEND FILTER sort -r \v(filename) ; Braces may be omitted
7044    SET SEND FILTER {sort -r \v(filename)} ; Braces may be included
7045    SEND *.txt
7046           This sends every file in the current directory whose name ends
7047           with ".txt" under its own name, but with its lines sorted in
7048           reverse order.
7049
7050    SEND /FILTER:{sort -r \v(filename)} *.txt
7051           Same as above, but the filter applies only to this SEND
7052           command. Braces are required in this case.
7053
7054    SET SEND FILTER {sort -r \v(filename)}
7055    SEND oofa.txt reverse.txt
7056           Sends the oofa.txt file with its lines sorted in reverse order
7057           under the name "reverse.txt".
7058
7059    SET SEND FILTER {sort -r \v(filename)}
7060    SEND oofa.* \v(filename).reverse
7061           Sends all the oofa.* files with their lines sorted in reverse
7062           order; each file is sent under its own name but with ".reverse"
7063           appended to it.
7064
7065    SET SEND FILTER {tr "[a-z]" "[A-Z]" < \v(filename)}
7066    SEND *.txt
7067           Sends all ".txt" files under their own names, but uppercasing
7068           their contents.
7069
7070    Note that the SEND FILTER applies not only to files that are sent with
7071    SEND, MOVE, MSEND, etc, but also to files sent by the C-Kermit server
7072    in response to GET requests.
7073
7074    Examples for binary mode:
7075
7076    SET SEND FILTER {gzip -c \v(filename)}
7077    SEND /BINARY oofa.txt oofa.txt.gz
7078           Sends the oofa.txt file, compressed by gzip, as oofa.txt.gz.
7079
7080    SEND /BINARY /FILTER:{gzip -c \v(filename)} oofa.txt oofa.txt.gz
7081           As above, but the filter applies only to this SEND command.
7082
7083    SET SEND FILTER {gzip -c \v(filename)}
7084    SEND /BINARY oofa.* \fupper(\replace(\v(filename),.,_)).GZ
7085           Sends all the oofa.* files, compressed by gzip, each under its
7086           own name, but with the name uppercased, all periods within the
7087           name converted to underscores, and ".GZ" appended to it. So,
7088           for example, "oofa.txt" is sent as "OOFA_TXT.GZ".
7089
7090    In the gzip examples, note that the amount of data that is sent is
7091    normally less than the original file size because gzip compresses the
7092    file. But Kermit sends the original file size ahead in the attribute
7093    packet anyway (unless you tell it not too). Thus the transfer will
7094    probably appear to terminate early, e.g. when the receiver's
7095    file-transfer display thermometer is only at 40%. If this annoys you,
7096    tell Kermit to "set attribute length off". On the other hand, you can
7097    use the final position of the thermometer as a measure of the
7098    effectiveness of compression.
7099      _________________________________________________________________
7100
7101     4.2.3.2. The RECEIVE Filter
7102
7103    SET RECEIVE FILTER [ command ]
7104           This command specifies that the given command will be run on
7105           any file that is received before it is written to disk. The
7106           command may be, but need not be, enclosed in braces; if it is
7107           the braces are stripped before use. The following two commands
7108           are equivalent:
7109
7110   SET RECEIVE FILTER sort -r > \v(filename)
7111   SET RECEIVE FILTER {sort -r > \v(filename)}
7112
7113    The RECEIVE filter command may contain a "\v(filename)" sequence to be
7114    replaced by the incoming filename from the file header packet, but it
7115    is not required. However you must use it whenever your filter would
7116    normally write to Stdout, otherwise its output will be lost.
7117
7118    The RECEIVE filter command may contain one or more "\v(filename)"
7119    sequence to be replaced by the incoming filename from the file header
7120    packet, but it is not required. However you must use it whenever your
7121    filter would normally write to Stdout, otherwise its output will be
7122    lost.
7123
7124    RECEIVE /FILTER:command and GET /FILTER:command can also be used to
7125    specify a filter to be used for only one file-transfer operation.
7126
7127    UNIX examples for text mode:
7128
7129    SET RECEIVE FILTER lpr
7130    RECEIVE
7131           All the files that are received are sent to the default UNIX
7132           print spooler.
7133
7134    RECEIVE /FILTER:lpr
7135           Same as above, except the lpr filter is used only with this
7136           RECEIVE command.
7137
7138    RECEIVE lpr
7139           This is probably not what you want; it creates a file called
7140           lpr.
7141
7142    SET RECEIVE FILTER {sort -r > \v(filename)}
7143    RECEIVE
7144           Stores each incoming file with its lines sorted in reverse
7145           order, under its own name.
7146
7147    RECEIVE /FILTER:{sort -r > \v(filename)}
7148           As above, but the filter is used only for this RECEIVE command.
7149
7150    SET RECEIVE FILTER sort -r > \v(filename)
7151    RECEIVE reverse.txt
7152           Stores each incoming file with its lines sorted in reverse
7153           order, under the name "reverse.txt". The actual result depends
7154           on the FILE COLLISION setting. If it is OVERWRITE and multiple
7155           files arrive, then each incoming file destroys the previous
7156           one. If it is BACKUP (the default), filename conflicts are
7157           resolve by adding "version numbers" to the filenames:
7158           reverse.txt, reverse.txt.~1~, reverse.txt.~2~, etc.
7159
7160    SET RECEIVE FILTER sort -r > \v(filename)
7161    RECEIVE \v(filename).reverse
7162           Stores each incoming file with its lines sorted in reverse
7163           order, under the name it arrived with, but with ".reverse"
7164           appended to it.
7165
7166    SET RECEIVE FILTER sort -r > \v(filename)
7167    RECEIVE \flower(\v(filename)).reverse
7168           Like the previous example, but ensures that the filename is
7169           lowercase.
7170
7171           Examples for binary mode:
7172
7173    SET RECEIVE FILTER gunzip -c > \v(filename)
7174    RECEIVE
7175           This receives one or more presumably compressed file and
7176           uncompresses each one into a file having the same name it was
7177           sent with. For example, if the file is sent with the name
7178           OOFA.TXT.GZ, it is stored with that name, even after
7179           decompression.
7180
7181    SET RECEIVE FILTER gunzip -c > \v(filename)
7182    RECEIVE \flower(\fsubstring(\v(filename),1,\flength(\v(filename))-3))
7183           Like the previous example, but the resulting filename has its
7184           rightmost three characters removed from it and the remainder is
7185           lowercased. So if the incoming filename is OOFA.TXT.GZ, it is
7186           stored as oofa.txt after decompression.
7187
7188    Of course you don't want to type such long hideous commands, so we
7189    have also introduced several new functions:
7190
7191    \fstripx(string[,character])
7192           This function removes the rightmost segment of the string that
7193           starts with the given character. If no character is given,
7194           period (.) is used. Thus it is most conveniently used for
7195           stripping the extension from a filename (or the decimal portion
7196           from a floating-point number written in US/UK style). Examples:
7197
7198    \fstripx(OOFA.TXT.GZ)             => OOFA.TXT
7199    \fstripx(OOFA.TXT.GZ,.)           => OOFA.TXT
7200    \fstripx(OOFA.TXT.GZ,X)           => OOFA.T
7201    \fstripx(\fstripx(OOFA.TXT.GZ))   => OOFA
7202    \fstripx($100.00)                 => $100
7203
7204    \fstripn(string,number)
7205           Removes the rightmost number characters from the string.
7206           Examples:
7207
7208    \fstripn(OOFA.TXT.GZ)             => OOFA.TXT.GZ
7209    \fstripn(OOFA.TXT.GZ,3)           => OOFA.TXT
7210    \fstripn(OOFA.TXT.GZ,7)           => OOFA
7211
7212    \fstripb(string[,c1[,c2]])
7213           Strips enclosing matching braces, brackets, parentheses, or
7214           quotes from the string. The second argument, c1, specifies
7215           which kind of enclosure to look for; if not specified, any
7216           enclosing (), [], <>, {}, "", '', or `' are removed. If c1 is
7217           specified and c2 is not, then if c1 is an opening brace,
7218           bracket, or parenthesis, the matching closing one is supplied
7219           automatically as c2. If both c1 and c2 are specified, then to
7220           be stripped the string must begin with c1 and end with c2. If
7221           the string is not enclosed in the indicated manner, the result
7222           is the original string. Examples:
7223
7224    \fstripb("abc")                   => abc
7225    \fstripb([abc])                   => abc
7226    \fstripb([abc)                    => [abc
7227    \fstripb(<abc>)                   => abc
7228    \fstripb(<abc>,[)                 => <abc>
7229    \fstripb((abc))                   => abc
7230    \fstripb((abc),[)                 => (abc)
7231    \fstripb((abc),{(})               => abc
7232    \fstripb(+abc+)                   => +abc+
7233    \fstripb(+abc+,+)                 => abc
7234    \fstripb(+abc+,+,^)               => +abc+
7235    \fstripb(+abc^,+,^)               => abc
7236    \fstripb('abc')                   => abc
7237    \fstripb(`abc')                   => abc
7238    \fstripb(``abc'')                 => `abc'
7239    \fstripb(\fstripb(``abc''))       => abc
7240
7241           Notice the special syntax required for including a literal
7242           parenthesis in the argument list. As the last two examples
7243           illustrate, \fstripb() strips only one level at at a time;
7244           nesting can be used to strip a small fixed number of levels;
7245           loops can be used to strip larger or indeterminate numbers of
7246           levels.
7247
7248    \flop(string[,char])
7249           Removes the leftmost segment of the string that ends with the
7250           given character. If no character is given, period (.) is used.
7251           Examples:
7252
7253   \flop(OOFA.TXT.GZ)               => TXT.GZ
7254   \flop(OOFA.TXT.GZ,.)             => TXT.GZ
7255   \flop(OOFA.TXT.GZ,X)             => T.GZ
7256
7257           To remove the leftmost number characters, just use
7258           \fsubstring(s,number+1). To return the rightmost number
7259           characters, use \fright(s,number).
7260
7261    So the hideous example:
7262
7263   receive \flower(\fsubstring(\v(filename),1,\flength(\v(filename))-3))
7264
7265    can now be written as:
7266
7267   receive \flower(\fstripx(\v(filename)))
7268
7269    That is, the filename stripped of its extension and then lowercased.
7270    This is not only shorter and less hideous, but also does not depend on
7271    the length of the extension being 3.
7272
7273    Note that when a receive filter is in effect, this overrides your FILE
7274    COLLISION setting, since Kermit has no way of knowing what the final
7275    destination filename will be (because it does not know, and can not be
7276    expected to know, the syntax of every version of every command shell
7277    on every platform on the planet).
7278      _________________________________________________________________
7279
7280     4.2.4. Implicit Use of Pipes
7281
7282    If you wish, C-Kermit can also examine incoming filenames to see if
7283    they start with "!", and if so, the subsequent text is treated as a
7284    command to read from or write to. For example, if a Kermit client is
7285    given the following command:
7286
7287   get {!finger | sort}
7288
7289    the server on the other end, if it supports this feature, will run the
7290    "finger" program, pipe its standard output to the "sort" program, and
7291    send sort's standard output back to you. Similarly, if you:
7292
7293   send oofa.txt !sort -r > oofa.new
7294
7295    or, equivalently:
7296
7297   send oofa.txt {!sort -r > oofa.new}
7298
7299    or:
7300
7301   send /as-name:{!sort -r > oofa.new} oofa.txt
7302
7303    this has the receiver send the contents of the incoming oofa.txt file
7304    to the sort program, which sorts the text in reverse order and stores
7305    the result in oofa.new.
7306
7307    This use of the exclamation mark should be familiar to UNIX users as
7308    the "bang" feature that lets you run an external application or
7309    command from within another application.
7310
7311    Kermit's "bang" feature is disabled by default, since it is not
7312    unheard for filenames to actually begin with "!". So if you want to
7313    use this feature, you must enable it with the following command:
7314
7315    SET TRANSFER PIPES { ON, OFF }
7316           ON enables the recognition of "!" notation in incoming
7317           filenames during file transfer as an indicator that the
7318           remaining text is the name of a command. OFF, the default,
7319           disables this feature and uses the text as a filename in the
7320           normal fashion. This command does NOT affect SEND /COMMAND, GET
7321           /COMMAND, CSEND, etc.
7322
7323    So using a combination of CSEND (SEND /COMMAND) and the "bang"
7324    feature, you can transfer a directory tree all in one command
7325    (assuming the remote Kermit supports pipe transfers and has them
7326    enabled):
7327
7328   CSEND {tar cf - . | gzip -c} {!gunzip -c | tar xf -}
7329
7330    or:
7331
7332   SEND /COMMAND:{tar cf - . | gzip -c} /as:{!gunzip -c | tar xf -}
7333
7334    Pay close attention to the syntax. Braces are needed around the
7335    command because it contains spaces; braces are needed around the
7336    as-name because it ends with "-". The as-name must begin with "!" or
7337    receiving Kermit will not recognize it as a command. The CSEND command
7338    must NOT begin with "!" unless you are running a command whose name
7339    really does start that character.
7340
7341    Similarly, you have a Kermit server send a directory tree to be
7342    unpacked on the client end:
7343
7344   CGET {!tar cf - . | gzip -c} {gunzip -c | tar xf -}
7345
7346    or:
7347
7348   GET /COMMAND {!tar cf - . | gzip -c} /as:{gunzip -c | tar xf -}
7349
7350    Notice how, in this case, the bang is required in the remote command,
7351    to distinguish it from a filename, but not in the local command, since
7352    by definition of CGET (or GET /COMMAND), it is known to be a command.
7353
7354    SEND and RECEIVE FILTERs supersede the bang feature. For example, if a
7355    file arrives under the name "!gunzip -c | tar xf -", but the receiving
7356    Kermit also has been given a command like:
7357
7358   set receive filter sort -r > \v(filename)
7359
7360    then the incoming data will be sorted rather than gunzipped.
7361
7362    Finally, if SET TRANSFER PIPES is ON (and in this case, this must be
7363    done in your C-Kermit initialization file), you can send from a pipe
7364    on the C-Kermit command line:
7365
7366   kermit -s "!finger | sort -r" -a userlist
7367
7368    In this case the "filename" contains spaces and so must be quoting
7369    using your shell's quoting rules.
7370      _________________________________________________________________
7371
7372     4.2.5. Success and Failure of Piped Commands
7373
7374    Commands or programs started by Kermit as a result of CSEND or
7375    CRECEIVE commands, CGET, SEND /COMMAND, REDIRECT commands (see
7376    [447]Section 4.2.8.2), implicit use of pipes, RUN commands, and so
7377    forth, should return their exit status codes to the Kermit command
7378    that caused them to be run, and therefore IF SUCCESS and IF FAILURE
7379    tests after these commands should work as expected. For example:
7380
7381   CSEND blah < filename
7382
7383    should fail if there is no command called "blah" or if there is no
7384    file called "filename". However, this is not foolproof and sometimes
7385    C-Kermit might think a command succeeded when it failed, or vice
7386    versa. This is most likely to happen when the highly system-dependent
7387    methods that Kermit must use to determine a command's exit status code
7388    do not supply the right information.
7389
7390    It can also happen because some commands might define success and
7391    failure differently from what you expect, or because you are using a
7392    pipeline composed of many commands, and one of them fails to pass
7393    failing exit status codes up the chain. The most likely culprit is the
7394    shell itself, which in most cases must be interposed between Kermit
7395    and any external program to be run.
7396
7397    In any case, you can examine the following variable to find out the
7398    exit status code returned to Kermit by the process most recently run
7399    by any command that runs external commands or programs, including
7400    CSEND, CRECEIVE, REDIRECT, RUN, etc:
7401
7402   \v(pexitstat)
7403
7404    In UNIX, Windows and OS/2, the value should be -2 if no command has
7405    been run yet, 0 if the most recent command succeeded, -1, -3, or -4 if
7406    there was an internal error, and a positive number returned by the
7407    command itself if the command failed. If the number is in the range
7408    1-127, this is the program's exit status code. If it is 128 or
7409    greater, this is supposed to indicate that the command or program was
7410    interrupted or terminated from outside itself.
7411
7412    In Windows 95 and 98, the return values of the default shell are
7413    unreliable; various third-party shells can be used to work around this
7414    deficiency.
7415
7416    In VMS, it is the actual exit status code of the command that was run.
7417    This is an odd number if the command succeeded, and an even number if
7418    it failed. You can see the associated message as follows:
7419
7420   run write sys$output f$message(\v(pexitstat))
7421
7422    Or, more conveniently, use the new Kermit function:
7423
7424   echo \ferrstring(\v(pexitstat))
7425
7426    which converts a system error code (number) to the corresponding
7427    message.
7428      _________________________________________________________________
7429
7430     4.2.6. Cautions about Using Pipes to Transfer Directory Trees
7431
7432    Although utilities such as tar and zip/unzip might be available on
7433    different platforms (such as UNIX and Windows), this does not
7434    necessarily mean you can use them successfully to transfer directory
7435    trees between unlike platforms. For example:
7436
7437   CSEND {tar cf - . | gzip -c} {!gunzip -c | tar xf -}
7438
7439    when used from UNIX to Windows will have satisfactory results for
7440    binary files, but not for text files. UNIX text files have lines
7441    ending with Linefeed (LF) only, whereas Windows text files have lines
7442    ending in Carriage Return and Linefeed (CRLF). Thus any text files
7443    that were in the archive formed by the first tar command will be
7444    unpacked by the second tar command in their original form, and will
7445    display and print incorrectly in Windows (except in applications that
7446    have been explicitly coded to handle UNIX-format text files). On the
7447    other hand if you told gzip to use "text mode" to do record format
7448    conversion (assuming there was a way to tell it, as there is with most
7449    "zip" programs), this would destroy any binary files in the archive.
7450
7451    Furthermore, if the archive contains text files that are written in
7452    languages other than English, the "special" (accented and/or
7453    non-Roman) characters are NOT translated, and are therefore likely
7454    show up as gibberish on the target system. For example, West European
7455    languages are usually encoded in ISO Latin Alphabet 1 in UNIX, but in
7456    PC code page 850 on the PC. Capital A with acute accent is code point
7457    193 (decimal) Latin-1, but 181 in CP850. So A-acute in the UNIX file
7458    becomes Middle Box Bottom on the PC, and similarly for all the other
7459    special characters, and for all other languages -- Greek, Russian,
7460    Hebrew, Japanese, etc.
7461
7462    So when transferring text files between unlike platforms, you should
7463    use direct Kermit file transfers so Kermit can apply the needed
7464    record-format and character-set transformations. Use pipelines
7465    containing archivers like tar or zip only if all the files are binary
7466    or the two systems use the same record format and character set for
7467    text files.
7468
7469    Also see [448]Sections 4.3, [449]4.10, [450]4.11, and [451]4.15 for
7470    how to transfer directory trees between both like and unlike systems
7471    directly with Kermit.
7472      _________________________________________________________________
7473
7474     4.2.7. Pipes and Encryption
7475
7476    Of course pipelines could be used for encrypted file transfers,
7477    assuming proper precautions could be taken concerning the transmission
7478    of the key. But there is rarely a good way to do this. To illustrate
7479    using UNIX crypt:
7480
7481   csend {crypt key < filename} {!crypt key > filename}
7482
7483    Or, more ambitiously:
7484
7485   csend {tar cf - . | gzip -c | crypt key} {!crypt key | gunzip -c | tar xf -}
7486
7487    transmits the key in the file header packet as part of the
7488    (clear-text) remote command, defeating the entire purpose of
7489    encrypting the file data.
7490
7491    But if you are connected in terminal mode to the remote computer and
7492    type:
7493
7494   creceive {crypt key > filename}
7495
7496    at the remote Kermit prompt, you have also transmitted the key in
7497    clear text over the communications link.
7498
7499    At present, the only secure way to use CSEND and CRECEIVE with an
7500    encryption filter is to have a human operator at both ends, so the key
7501    does not have to be transmitted.
7502
7503    Theoretically it would be possible to use PGP software (Pretty Good
7504    Privacy, by Phil Zimmerman, Phil's Pretty Good Software) to avoid key
7505    transmission (since PGP uses separate public and private key and "lets
7506    you communicate securely with people you've never met, with no secure
7507    channels needed for prior exchange of keys"), but the specific method
7508    has yet to be worked out.
7509
7510      HINT: See the PGP User's Guide, e.g. at:
7511      [452]http://www.telstra.com.au/docs/PGP/
7512      Especially the topic "Using PGP as a UNIX-Style Filter":
7513      [453]http://www.telstra.com.au/docs/PGP/pgpdoc2/pgpdoc2_17.html
7514
7515    In any case, better and more convenient security options are now
7516    available: Kerberos authentication and encryption ([454]CLICK HERE for
7517    details) and the new ability to run C-Kermit "though" other
7518    communication programs, described in [455]Section 2.7.
7519      _________________________________________________________________
7520
7521     4.2.8. Commands and Functions Related to Pipes
7522
7523     4.2.8.1. The OPEN !READ and OPEN !WRITE Commands
7524
7525    These are described in [456]Using C-Kermit, and are generally useful
7526    with reading output from commands that produce more than one line on
7527    their standard output, or writing multiple lines into commands that
7528    accept them on their standard input.
7529
7530    In C-Kermit 7.0 CLOSE !READ is accepted as a synonym for CLOSE READ,
7531    and CLOSE !WRITE for CLOSE WRITE.
7532
7533    Testing the success and failure of these commands, however, can be a
7534    bit tricky. Consider:
7535
7536   open !read lalaskjfsldkfjsldkfj
7537
7538    (where "lalaskjfsldkfjsldkfj" is neither a valid command nor the name
7539    of a program or script that can be run). OPEN !READ, in UNIX at least,
7540    translates this into execl(shellpath,shellname,"-c",command). This
7541    means it starts your preferred shell (e.g. from the SHELL environment
7542    variable) and asks it to execute the given command. It must be this
7543    way, because your command can be a either an internal shell command
7544    (which only your shell can execute) or an external command, which only
7545    your shell knows how to find (it knows your PATH and interprets, etc).
7546    Therefore unless OPEN !READ can't start your shell, it always
7547    succeeds.
7548
7549    Continuing with the nonexistent-command example:
7550
7551   C-Kermit> open !read lalaskjfsldkfjsldkfj
7552   C-Kermit> status
7553    SUCCESS
7554   C-Kermit> read line
7555   C-Kermit> status
7556    SUCCESS
7557   C-Kermit> echo "\m(line)"
7558   "bash: lalaskjfsldkfjsldkfj: command not found"
7559   C-Kermit> close read
7560   C-Kermit> status
7561    FAILURE
7562   C-Kermit>
7563
7564    In other words, the failure can not be detected on OPEN, since the
7565    OPEN command succeeds if it can start your shell. It can't be detected
7566    on READ, since all this does is read output from the shell, which in
7567    this case happens to be an error message. However, failure IS detected
7568    upon close, since this is the occasion upon which the shell gives
7569    Kermit its exit status code.
7570
7571    For an illustration of this situation, see [457]Section 2.14.
7572      _________________________________________________________________
7573
7574     4.2.8.2. The REDIRECT Command
7575
7576    A second method of I/O redirection is offered by the REDIRECT command.
7577    This is a rather advanced and tricky feature that is presently
7578    supported only in UNIX C-Kermit, in OS-9 C-Kermit, and in Kermit 95.
7579    Syntax:
7580
7581    REDIRECT command
7582           Runs the given command, sending its standard output to the
7583           current communications channel (SET LINE, SET PORT, or SET HOST
7584           connection), and reading its standard input from the same
7585           connection. Works only in local mode -- i.e. a connection is
7586           required -- and then only if the given command uses Standard
7587           I/O.
7588
7589    Example:
7590
7591   redirect finger
7592
7593    runs the local "finger" command and sends its output over the
7594    connection as plain text, where presumably there is a process set up
7595    to read it. Another example:
7596
7597   redirect finger | sort -r
7598
7599    shows the use of a pipeline.
7600
7601    Note: REDIRECT differs from CSEND/CRECEIVE in two important ways: (1)
7602    it does not use the Kermit protocol, and (2) it uses a bidirectional
7603    pipe rather than a one-way pipe.
7604
7605    The primary use of the REDIRECT command is to run external protocols,
7606    such as sz/rz in UNIX for ZMODEM, when they work over Standard I/O(*).
7607    Example:
7608
7609   set host xyzcorp.com
7610   (login, etc)
7611   redirect sz oofa.zip
7612
7613    lets you make a Telnet connection with C-Kermit and then do a ZMODEM
7614    transfer over it. ZMODEM protocol messages go both ways over the same
7615    connection simultaneously.
7616
7617    It is possible to use C-Kermit on UNIX as your PPP dialer and then to
7618    REDIRECT the connection to the PPP software, but C-Kermit 7.0 offers a
7619    better approach to PPP dialing in its new EXEC command ([458]Section
7620    1.23).
7621
7622    In theory, you can also redirect an interactive process. For example,
7623    suppose you tell Kermit 95 to wait for an incoming TCP/IP connection:
7624
7625   set host * 3000
7626
7627    and then tell C-Kermit on UNIX to:
7628
7629   set host kermit95hostname 3000
7630   redirect ksh
7631
7632    and then tell Kermit 95 to CONNECT: now you are talking to the UNIX
7633    K-shell; you can give commands (pwd, ls, etc) and see the results. In
7634    practice, the K-shell's terminal modes are messed up because (a) it is
7635    not going through the Unix terminal driver, and (b) it is "smart" and
7636    knows it is being redirected, and so acts in a decidedly inhospitable
7637    manner (other applications like EMACS, vi, etc, simply refuse to run
7638    if their standard i/o has been redirected).
7639
7640      (*) The publicly-distributed sz/rz programs do not work as clients.
7641      However, Omen Technology does offer an up-to-date redirectable
7642      client XYZMODEM program called crzsz.
7643      _________________________________________________________________
7644
7645     4.2.8.3. Receiving Mail and Print Jobs
7646
7647    As of 7.0, and in UNIX only, files that are sent to C-Kermit as mail
7648    (when the other Kermit uses a MAIL or SEND /MAIL command) or to be
7649    printed (via REMOTE PRINT or SEND /PRINT) are now piped directly to
7650    the mail or print program, rather than written to temporary files and
7651    then mailed or printed and then deleted. This has the advantages of
7652    (a) not requiring a temporary file, and (b) allowing mail to have a
7653    proper subject in place of the filename. Temporary files were bad not
7654    only because they required (a) space, and (b) writeability of the
7655    current directory, but also because using them could result in wiping
7656    out an existing file. See [459]Section 4.7 for more about SEND /MAIL
7657    and SEND /PRINT.
7658      _________________________________________________________________
7659
7660     4.2.8.4. Pipe-Related Functions
7661
7662    The \fcommand(command) function runs the given shell or system command
7663    and returns the command's standard output as its value (with any
7664    newline characters stripped from the end), unless the result is too
7665    long, in which case it returns the empty string. The maximum length
7666    for the result is at least 1022 bytes, and it might be longer on some
7667    platforms. Examples (UNIX):
7668
7669   C-Kermit> echo "\fcommand(date)"
7670   "Fri Apr 18 13:31:42 1997"
7671   C-Kermit> echo "\fcommand(finger | wc -l)" ; how many users logged in?
7672   "      83"
7673   C-Kermit> evaluate \fcommand(finger | wc -l) * 2
7674   166
7675   C-Kermit> echo Welcome to \fcommand(tty) on \fcommand(date)
7676   Welcome to /dev/ttyre on Fri Apr 18 13:31:42 1997
7677   C-Kermit> echo "\fcommand(ls oofa.*)"
7678   "oofa.c
7679   oofa.h
7680   oofa.o"
7681   C-Kermit> cd /directory-with-thousands-of-files
7682   C-Kermit> echo "\fcommand(ls -l)" ; This would be too long
7683   ""
7684   C-Kermit>
7685
7686    If a command's output would be too long, you can use the other, more
7687    laborious method of reading from a command: OPEN !READ command, READ
7688    each line, CLOSE !READ.
7689
7690    The \frawcommand(command) function is identical to \fcommand(command),
7691    except it does not remove trailing newline characters:
7692
7693   C-Kermit> echo "\frawcommand(date)"
7694   "Fri Apr 18 13:31:42 1997
7695   "
7696   C-Kermit> echo "\frawcommand(ls oofa.*)"
7697   "oofa.c
7698   oofa.h
7699   oofa.o
7700   "
7701   C-Kermit>
7702
7703    Use \frawcommand() if you want to retain the final line terminators,
7704    or if the command's output is "binary". But remember that if the
7705    result of this (or any other) function contains any NUL (ASCII code 0)
7706    characters, the first NUL will terminate the result string because
7707    this is how C strings work (it's "C-Kermit", remember?).
7708
7709    These functions are useful not only locally, but also in the
7710    client/server arena. If you need to get the results from a system
7711    command on the server end into a variable on the client end, just do:
7712
7713   [ remote ] query kermit command(date)
7714
7715    The result is in the local \v(query) variable; see [460]Using
7716    C-Kermit, 2nd Ed., pp.359-360 for details.
7717      _________________________________________________________________
7718
7719   4.3. Automatic Per-File Text/Binary Mode Switching
7720
7721    When transferring files between like systems (e.g. UNIX-to-UNIX),
7722    binary mode can be used for all files unless character-set translation
7723    is needed, and in fact Kermit programs of recent vintage recognize
7724    each others' platforms and switch to binary mode automatically when it
7725    is appropriate (e.g. DOS to OS/2, or UNIX to UNIX). (Exception:
7726    LABELED mode is chosen for VMS-to-VMS and OS/2-to-OS/2 transfers so
7727    complex file formats can be preserved.)
7728
7729    On a client/server connection between like systems, the transfer mode
7730    is currently determined by the file sender, rather than always by the
7731    client. If the client is sending, it controls the transfer mode. If a
7732    GET command is sent to the server, the server sends all files in
7733    binary mode if its TRANSFER CHARACTER-SET is TRANSPARENT; otherwise it
7734    uses text mode for text files (according to its text-pattern list) and
7735    binary mode for binary files. Of course, the client can control the
7736    server's transfer character-set with the REMOTE SET TRANSFER
7737    CHARACTER-SET command.
7738
7739    When transferring files between unlike systems, however, (e.g.
7740    UNIX-to-DOS), some files (such as executable program images) must be
7741    transferred in binary mode but others (such as plain-text files) must
7742    be transferred in text mode so their record format and character sets
7743    can be appropriately converted. If a binary file is transferred in
7744    text mode, it is ruined. If a text file is transferred in binary mode,
7745    then at the very least, its format can be incorrect; at worst it is
7746    also corrupted because its character set was not converted (in extreme
7747    cases the corruption is total, e.g. because one system is ASCII-based
7748    and the other EBCDIC).
7749      _________________________________________________________________
7750
7751     4.3.1. Exceptions
7752
7753    VMS C-Kermit, when sending files to a non-VMS system, switches to text
7754    or binary mode automatically for each file, based on the record format
7755    in the file's directory entry; thus the mechanisms described in this
7756    section do not apply to VMS C-Kermit, yet the effect is the same:
7757    automatic text/binary mode switching when VMS C-Kermit is sending
7758    files. See the VMS Appendix of [461]Using C-Kermit for details.
7759
7760    Kermit versions that support LABELED or IMAGE transfer mode are
7761    likewise not affected by this feature when one of those modes is
7762    selected (normally used only when transferring between like systems).
7763
7764    Kermit versions that support file-transfer pipes and filters are not
7765    affected by this feature when pipes or filters are used, since the
7766    output of a pipe or filter (such as gzip) is likely to require
7767    transfer in a different mode than the original file.
7768
7769    Finally, SEND /TEXT or SEND /BINARY will force files to be sent in the
7770    indicated mode, overriding all automatic transfer-mode-choosing
7771    mechanisms.
7772      _________________________________________________________________
7773
7774     4.3.2. Overview
7775
7776    Suppose you give C-Kermit a command like:
7777
7778   SEND *.*
7779
7780    And suppose the pattern *.* matches a mixture of text files (such as
7781    program source code) and binary files (such os object modules or
7782    executable programs).
7783
7784    C-Kermit 6.0 and earlier (except on VMS) send all files in the same
7785    mode: whatever you said in your most recent SET FILE TYPE command, or
7786    else whatever mode was chosen automatically according to the rules on
7787    page 236 of Using C-Kermit, 2nd Ed.
7788
7789    But when text and binary files are mixed in the same group, and the
7790    files are being transferred to an unlike system (e.g. UNIX to IBM
7791    Mainframe), this results in corruption of either all the text files or
7792    all the binary files.
7793
7794    Stream-oriented file systems such as in UNIX and DOS do not record any
7795    information about the file to tell us whether the file should be
7796    transferred in binary or text mode, making it impossible to select the
7797    transfer mode for each file in a group automatically with any
7798    certainty.
7799
7800    However, we can use some fairly-well established file naming
7801    conventions for this purpose. C-Kermit 7.0 lets you provide lists of
7802    filename patterns that are used to separately determine the file type
7803    for each individual file being transfered. A pattern is a string,
7804    possibly containing the special characters "*" (asterisk, which
7805    matches any string of zero of more characters) and/or "?" (question
7806    mark, which matches any single character). For example "a*b" matches
7807    all files whose names start with "a" and end with "b", such as "ab",
7808    "arb", "ababababab", etc, but not "abba". And "a?b" matches any file
7809    whose name starts with "a", ends with "b", and is exactly 3 characters
7810    long.
7811
7812      NOTE: When typing commands at the C-Kermit prompt, you must prefix
7813      "?" with \ to override its normal function of giving help.
7814
7815    (Also see [462]Section 4.9 for additional pattern-matching notations
7816    that might be available in your version of C-Kermit.)
7817
7818    When you have specified filename recognition patterns, C-Kermit can
7819    transfer the ones whose names match any of the binary-mode patterns in
7820    binary mode, and those with names that match any of the text-mode
7821    patterns in text mode, and those whose names match neither in the
7822    prevailing mode you have chosen, or that was chosen automatically via
7823    peer recognition.
7824      _________________________________________________________________
7825
7826     4.3.3. Commands
7827
7828    SET FILE PATTERNS { ON, OFF, AUTO }
7829           This tells Kermit whether to do per-file filename
7830           pattern-matching to determine text or binary mode. The normal
7831           and default setting is AUTO, which means to use pattern lists
7832           to switch transfer mode only when it is certain that the other
7833           Kermit program supports automatic notification of transfer mode
7834           (via Attribute packets) on a per-file basis (this information
7835           is obtained automatically during protocol startup negotiation).
7836           ON means to always determine the transfer mode from the
7837           filename and pattern list when sending files. Use OFF to
7838           disable this feature (without resetting your pattern lists).
7839           Also note that if you have selected LABELED file transfer (SET
7840           FILE TYPE LABELED), this takes precedence over
7841           filename-matching patterns and all files are sent in labeled
7842           mode.
7843
7844    SET TRANSFER MODE MANUAL
7845           Disables the use of filename patterns, no matter what the FILE
7846           PATTERNS setting.
7847
7848    REMOTE SET TRANSFER MODE MANUAL
7849           Client command to disable automatic transfer mode, and
7850           therefore also filename patterns, in the server. Synonym:
7851           REMOTE SET XFER MODE MANUAL.
7852
7853    { GET, SEND, etc } { /BINARY, /TEXT }
7854           Including a /BINARY or /TEXT (or, where supported, /IMAGE or
7855           /LABELED) switch with a file-transfer command changes the
7856           transfer mode to manual for that command only, and therefore
7857           disables patterns that that command.
7858
7859    SET FILE BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
7860           A list of zero or more patterns, separated by spaces (not
7861           commas). Letters in a pattern are case-sensitive if the
7862           underlying filenames are case sensitive (as in UNIX), and
7863           case-insensitive otherwise (as in Windows). If a file's name is
7864           matched by any pattern in the list and SET FILE PATTERNS is ON,
7865           the file is sent in binary mode. Examples:
7866
7867   SET FILE BINARY-PATTERNS *.gz *.Z *.tar *.zip *.o *.so *.a *.out ; UNIX
7868   SET FILE BINARY-PATTERNS *.EXE *.ZIP *.OBJ *.COM ; DOS or OS/2 or Windows
7869
7870           If a pattern contains spaces, enclose it in braces.
7871
7872    SET FILE TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
7873           Like SET FILE BINARY-PATTERNS, but the patterns choose text
7874           files rather than binary ones. Examples:
7875
7876   SET FILE TEXT-PATTERNS *.TXT *.KSC *.HTM* *.BAT ; DOS, Windows, OS/2
7877
7878    ADD BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
7879           Adds one or more patterns to the BINARY-PATTERN list.
7880
7881    ADD TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
7882           Adds one or more patterns to the TEXT-PATTERN list.
7883
7884    REMOVE BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
7885           Removes one or more patterns from the BINARY-PATTERN list. The
7886           given patterns are matched with the ones in the BINARY-PATTERNS
7887           list with case sensitivity if the underlying file system has
7888           case-sensitive names (as do UNIX and OS-9), otherwise with case
7889           independence.
7890
7891    REMOVE TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
7892           Removes one or more patterns from the TEXT-PATTERN list.
7893
7894    SHOW PATTERNS
7895           Displays the current pattern selections.
7896
7897    Whenever you give a SET FILE BINARY-PATTERNS or SET FILE TEXT-PATTERNS
7898    command, the previous list is replaced. If you give one of these
7899    commands without a pattern list, the previous list is removed.
7900
7901    When patterns are active and files are being sent, text patterns (if
7902    any) are applied first (but only if not RESENDing and not sending in
7903    LABELED mode), then binary patterns, so if the same pattern appears in
7904    both lists, binary mode is chosen.
7905      _________________________________________________________________
7906
7907     4.3.4. Examples
7908
7909    Here's an example that might be used when sending files from UNIX:
7910
7911   set file type binary
7912   set file text-patterns *.c *.h *.w *.txt makefile
7913   set file binary-patterns *.o
7914   msend makefile wermit wart ck*.[cwho] ck*.txt
7915
7916    Note that "wermit" and "wart" do not match any patterns so they are
7917    sent in the prevailing mode, which is binary. Also note the use of
7918    "makefile" as a pattern that does not contain any wildcard characters
7919    (there is no other convention to distinguish among "wermit" and
7920    "wart", which are binary executables, and "makefile", which is a text
7921    file, purely by their names).
7922
7923    Most C-Kermit implementations have a default pattern list built in,
7924    which includes patterns that are almost certain to succeed in picking
7925    the right transfer mode. Others are omitted due to ambiguity. For
7926    example ".hlp", and ".ini" are generally binary types in Windows but
7927    text types everywhere else.
7928
7929      NOTE: ".doc", used for decades to denote plain-text documentation
7930      files, now more often than not denotes a Microsoft Word Document,
7931      so ".doc" is now considered a binary type since it does less harm
7932      to transfer a plain-text document in binary mode than it does to
7933      transfer an MS Word file in text mode (except when IBM mainframes
7934      are involved!)
7935
7936      ANOTHER NOTE: ".com" files are binary in DOS-like operating
7937      systems, but they are text (DCL command procedures) in VMS. VMS
7938      C-Kermit sends .COM files in text mode; K95 sends them in binary
7939      mode. If you download a .COM file from VMS to DOS or Windows, and
7940      then upload it to another VMS system, be sure to use SEND /TEXT to
7941      preserve its textness.
7942
7943    You can see the default pattern list by starting C-Kermit without its
7944    initialization file (e.g. "kermit -Y") and using the SHOW PATTERNS
7945    command. If you will be depending on this feature, be sure to examine
7946    the list carefully in conjunction with the applications that you use.
7947
7948    The default pattern list does not take "backup files" into account
7949    because (a) people usually don't want to transfer them; and (b) it
7950    would make the pattern lists more than twice as long. For example, we
7951    would need to include both *.txt and *.txt.~[0-9]*~ for ".txt" files,
7952    and similarly for all the others. Instead, you can use SEND /NOBACKUP
7953    (or SET SEND BACKUP OFF) to skip over all backup files.
7954
7955    Put your most commonly-used safe pattern declarations in your C-Kermit
7956    customization file (ckermod.ini, .mykermrc, k95custom.ini, etc).
7957
7958    As noted, SET FILE PATTERNS is ON by default. Sometimes, however, it
7959    is desirable, or necessary, to force files to be sent in a particular
7960    mode, and often this must be done from the command line (e.g. when
7961    using Kermit as a download helper in a Web browser like Lynx). The -V
7962    command-line options is equivalent to SET FILE PATTERNS OFF and SET
7963    TRANSFER MODE MANUAL. Example:
7964
7965   kermit -Vis oofa.txt
7966
7967    forces oofa.txt to be sent in binary mode, even though ".txt" might
7968    match a text pattern.
7969      _________________________________________________________________
7970
7971   4.4. File Permissions
7972
7973    "Permissions" refers to a code associated with a file that specifies
7974    who is allowed to access it, and in what manner. For example, the
7975    owner, the members of one or more groups, the system administrator,
7976    and everybody else, might be allowed various combinations of Read,
7977    Write, Append, Execute, or Listing access.
7978
7979    The permission code goes by different names on different platforms. In
7980    UNIX, it might be called the filemode. In VMS, it is called the file
7981    protection (or protection mask).
7982
7983    The comments in this section presently apply only to the UNIX and VMS
7984    versions of C-Kermit, to which these features were added in version
7985    7.0; the DOS, Windows, and OS/2 file systems embody no notions of
7986    protection, and so MS-DOS Kermit and Kermit 95 do not send file
7987    permissions, and ignore them when received.
7988
7989    The permissions for a received file are determined by a combination of
7990    the file transfer mode (VMS-to-VMS transfers only), whether a file of
7991    the same name exists already, whether permissions of the file are
7992    received in the file attribute packet, and the setting of ATTRIBUTES
7993    PROTECTION.
7994
7995    The default for ATTRIBUTES PROTECTION is ON. If no attributes are
7996    received, the effect is the same as if attributes PROTECTION were OFF.
7997
7998    For VMS-to-VMS transfers, the default LABELED mode simply copies the
7999    protection code from source to destination.
8000      _________________________________________________________________
8001
8002     4.4.1. When ATTRIBUTES PROTECTION is OFF
8003
8004    If no file of the same name exists, system defaults determine the
8005    permissions of the new file. Otherwise, the actions taken depend on
8006    the current FILE COLLISION setting: BACKUP, OVERWRITE, RENAME, etc, as
8007    documented in [463]Using C-Kermit. But now the new file (if it is
8008    created at all) automatically inherits the permissions (mode bits) of
8009    the existing file in a way that is appropriate for the platform.
8010
8011     4.4.1.1. Unix
8012
8013    All mode bits are inherited except the directory bit, since the
8014    incoming file can not possibly be a directory. (In any case, it is not
8015    possible to receive a file that has the same name as an existing
8016    directory unless FILE COLLISION is set to RENAME).
8017
8018     4.4.1.2. VMS
8019
8020    Files with the same name as an existing file, transferred in modes
8021    other than LABELED between VMS systems, inherit the protection of the
8022    prior version.
8023      _________________________________________________________________
8024
8025     4.4.2 When ATTRIBUTES PROTECTION is ON
8026
8027    File permissions can be conveyed as part of the file transfer process,
8028    in accordance with the Kermit protocol definition. If the file sender
8029    puts system-dependent and/or system-independent versions of the file
8030    protection (permissions) into the Attribute (A) packet, the file
8031    receiver can set the new file's permissions from them. Otherwise, the
8032    permissions are set the same as for ATTRIBUTES PROTECTION OFF.
8033
8034    When the incoming A packet contains system-dependent permissions, the
8035    file receiver checks to see if the sender has the same system ID (e.g.
8036    both the sending and receiving systems are UNIX, or both are VMS); if
8037    so, it decodes and uses the system-dependent permissions; otherwise it
8038    uses the generic ones (if any) and applies them to the owner field,
8039    setting the other fields appropriately as described in the following
8040    sections.
8041
8042    Setting the incoming file's protection from the A packet is controlled
8043    by SET ATTRIBUTES PROTECTION (or PERMISSION), which is ON by default,
8044    and its status is displayed by SHOW ATTRIBUTES.
8045
8046    The main benefit of this feature is to not have to "chmod +x" an
8047    executable file after transfer from UNIX to UNIX. Its cross-platform
8048    benefits are less evident, perhaps to retain the status of the Unix
8049    'x' bit on a VMS system, for subsequent transfer back to a Unix
8050    system.
8051      _________________________________________________________________
8052
8053     4.4.2.1. System-Specific Permissions
8054
8055    System-specific file permissions are used when the two Kermit programs
8056    recognize each other as running on the same type of system. For
8057    example, both are running under some form of UNIX (it doesn't matter
8058    which UNIX variation -- HP-UX, Solaris, AIX, etc -- all use the same
8059    scheme for file permissions); or both are running under VMS (even if
8060    one is on an Alpha and the other on a VAX, and/or one is old and the
8061    other is new).
8062
8063     4.4.2.1.1. UNIX
8064
8065    UNIX supports three categories of users, File Owner, Group, and World,
8066    and three types of file access permission: Read, Write, and Execute.
8067    Thus, a UNIX file's permissions are expressed in 9 bits.
8068
8069    The system-dependent permission string for UNIX is a 3-digit octal
8070    string, the low-order 9 bits of the st_mode member of the stat struct;
8071    we deliberately chop off the "file format" bits because they are not
8072    permissions, nor do we convey the setuid/setgid bits, lock bit, sticky
8073    bit, etc.
8074
8075     4.4.2.1.2. VMS
8076
8077    VMS supports four categories of users, System, File Owner, Group, and
8078    World, and four types of file access permission: Read, Write, Execute,
8079    and Delete. Thus, a VMS file's permissions are expressed in 16 bits.
8080
8081    The system-dependent protection string for VMS is a 4-digit
8082    hexadecimal string, corresponding to the internal-format protection
8083    word of the file (RWED for each of World,Group,Owner,System). A new
8084    file normally gets all 16 protection bits from the original file of
8085    the same name.
8086
8087    Note: VMS-to-VMS transfers take place in LABELED mode when the two
8088    C-Kermits recognize each other's platform as VMS (unless you have
8089    disabled LABELED-mode transfers). In this case, all of a file's
8090    attributes are preserved in the transfer and the protection mask (and
8091    other information) is taken from the file's internal information, and
8092    this takes precedence over any information in the Attribute packets.
8093    You can defeat the automatic switching into LABELED mode (if you want
8094    to) with SET TRANSFER MODE MANUAL.
8095      _________________________________________________________________
8096
8097     4.4.2.2. System-Independent Permissions
8098
8099    The system-independent ("generic") protection is used when the system
8100    IDs of the two Kermit programs do not agree (e.g. one is UNIX, the
8101    other is VMS). The generic protection attribute includes the following
8102    permissions (not all are applicable to every file system): Read,
8103    Write, Append, Execute, Delete, Search. The generic permissions are
8104    derived from the owner permissions of the source file, thus, a Unix
8105    'w' permission becomes VMS Write,Delete.
8106
8107    The Owner field of the new file's permissions is set from the incoming
8108    generic protection attribute.
8109
8110    In UNIX, the Group and World permissions are set according to your
8111    umask, except that execute permission is NOT set in these fields if it
8112    was not also set in the generic protection (and consequently, is set
8113    in the Owner field).
8114
8115    In VMS, the System, Group, and World permissions are set according to
8116    the process default file permission (as shown in VMS by SHOW
8117    PROTECTION), except that no permissions are allowed in these fields
8118    that are not included in the generic permissions.
8119
8120    Note that the VMS and UNIX interpretations of Execute permission are
8121    not identical. In UNIX, a file (binary executable, shell script, etc)
8122    may not be executed unless it has Execute permission, and normally
8123    files that are not intended for execution do not have Execute
8124    permission. In VMS, Read permission implicitly supplies Execute
8125    capability. Generally files that have Read permission also have
8126    explicit Execute permission, but files (binary executables, DCL
8127    command procedures) that have Read permission and not Execute
8128    permission can still be executed.
8129      _________________________________________________________________
8130
8131   4.5. File Management Commands
8132
8133     4.5.1. The DIRECTORY Command
8134
8135    Prior to C-Kermit 7.0, the DIRECTORY command always ran an external
8136    system command (such as "ls" on UNIX) or program to product the
8137    directory listing. This had certain advantages, mostly that you could
8138    include system-dependent options for customized listings, e.g. on
8139    UNIX:
8140
8141   dir -lt c* | more
8142
8143    or in VMS:
8144
8145   directory /size/date/protection/except=*.obj oofa.*;0
8146
8147    This approach, however, carries some disadvantages: C-Kermit can't
8148    return SUCCESS or FAILURE status for (e.g.) "dir foo" according to
8149    whether the file "foo" exists; and it runs an inferior process, which
8150    might be a problem in some environments for resource and/or security
8151    reasons, and won't work at all in a "nopush" environment (e.g. one in
8152    which C-Kermit is configured to forbid access to exterior commands and
8153    programs, e.g. in a VMS "captive account").
8154
8155    In C-Kermit 7.0 on VMS and UNIX, and in K95 1.1.19 and later, the
8156    DIRECTORY command is internal to Kermit. It can be run in a "nopush"
8157    environment and returns SUCCESS or FAILURE status appropriately. In
8158    UNIX it prints all dates and times in a consistent way (unlike ls). In
8159    VMS it prints precise file sizes, rather than "blocks". It offers
8160    several formatting and other options, but it is not necessarily more
8161    flexible than the corresponding external commands or programs (the
8162    UNIX "ls" program, the VMS "directory" command). The syntax is:
8163
8164    DIRECTORY [ switch [ switch [ ... ] ] ] [ filespec ]
8165
8166    If no filespec is given, all files in the current directory are
8167    listed.
8168
8169    Optional switches include all the standard file-selection switches
8170    presented in [464]Section 1.5.4, plus:
8171
8172    /ALL
8173           Show both regular files and directories; this is the default.
8174
8175    /ARRAY:x
8176           Instead of displaying a directory listing, put the files that
8177           would have been shown (based on the filespec and other
8178           selection switches) in the given array. The array need not (and
8179           should not) be predeclared; if the array already exists, it is
8180           destroyed and reused. The array name can be a single letter,
8181           like "a", or any fuller form, such as "&a", "\&a", "\&a[]",
8182           etc. If the /ARRAY switch is included, the following other
8183           switches are ignored: /BRIEF, /VERBOSE, /HEADING, /PAGE,
8184           /ENGLISHDATE, /ISODATE, /XFERMODE, /MESSAGE, /SORT, /REVERSE,
8185           /ASCENDING. In other words, only file selection switches are
8186           meaningful with /ARRAY: /FILES, /DIRECTORIES, /ALL, /DOTFILES,
8187           /NOBACKUP, /RECURSIVE, /SMALLER, /LARGER, /AFTER, /BEFORE,
8188           /EXCEPT, etc. The resulting array has the number of files (n)
8189           as its 0th element, and the filenames in elements 1 through n
8190           Example:
8191
8192   dir /array:&a /files /nobackup /after:19990101 /larger:10000 [ab]*
8193   show array &a
8194
8195    /FILES
8196           Only show regular files.
8197
8198    /DIRECTORIES
8199           Only show directories.
8200
8201    /BACKUP
8202           In UNIX, OS-9, K-95, and other versions that support SET FILE
8203           COLLISION BACKUP and create backup files by appending .~n~ to
8204           the filename (where "n" is a number), /BACKUP means to include
8205           these files in directory listings. This is the default.
8206
8207    /NOBACKUP
8208           This is the opposite of /BACKUP: that is, do not include backup
8209           files in the listing.
8210
8211    /BRIEF
8212           List filenames only; use a compact format, as many filenames as
8213           will fit across the screen (based on the longest name). A brief
8214           listing is always sorted alphabetically.
8215
8216    /VERBOSE
8217           List one file per line, and include date, size, and (in UNIX
8218           only) permissions of each file. This is the opposite of /BRIEF,
8219           and is the default.
8220
8221    /PAGE
8222           Pause at the end of each screenful and give a "more?" prompt,
8223           even if SET COMMAND MORE-PROMPTING is OFF.
8224
8225    /NOPAGE
8226           Don't pause at the end of each screenful and give a "more?"
8227           prompt, even if SET COMMAND MORE-PROMPTING is ON. If neither
8228           /PAGE or /NOPAGE is given, paging is according to the
8229           prevailing COMMAND MORE-PROMPTING setting (which can be
8230           displayed with SHOW COMMAND).
8231
8232    /ENGLISHDATE
8233           Show dates in dd-mmm-yyyy format; mmm is the first three
8234           letters of the English month name.
8235
8236    /ISODATE
8237           Show dates in yyyy-mm-dd format; mm is the month number, 1-12.
8238           This is the opposite of /ENGLISHDATE, and is the default.
8239
8240    /HEADINGS
8241           Print a heading before the listing and a summary at the end.
8242
8243    /NOHEADINGS
8244           Don't print a heading before the listing or a summary at the
8245           end. This is the opposite of /HEADINGS, and is the default.
8246
8247    /XFERMODE
8248           Only in Kermit programs that support SET FILE PATTERNS. If this
8249           switch is included, and the filename matches any FILE
8250           BINARY-PATTERN ([465]Section 4.3), "(B)" is printed after the
8251           filename; otherwise, if it matches a FILE TEXT-PATTERN, "(T)"
8252           is printed.
8253
8254    /NOXFERMODE
8255           Don't display transfer-mode indicators. This is the opposite of
8256           /XFERMODE and is the default.
8257
8258    /RECURSIVE
8259           Show files not only in the given directory, but also in its
8260           subdirectories (if any), their subdirectories, etc.
8261
8262    /NORECURSIVE
8263           Don't show files in subdirectories. This is the opposite of
8264           /RECURSIVE, and is the default.
8265
8266    /MESSAGE:text
8267           This lets you specify a short text string to be appended to the
8268           end of each directory listing line (a space is supplied
8269           automatically). If the text contains any spaces, enclose it in
8270           braces, e.g. /MESSAGE:{two words}.
8271
8272    /NOMESSAGE
8273           Don't append any message to the end of each directory listing
8274           line (default).
8275
8276    /SORT:[{NAME,SIZE,DATE}]
8277           Sort the listing by name, size, or date. If the /SORT switch is
8278           given but the "sort-by" keyword is omitted, the listing is
8279           sorted by name. /SORT:NAME /ASCENDING (alphabetic sort by name)
8280           is the default.
8281
8282    /NOSORT
8283           Don't sort the listing. Files are listed in whatever order they
8284           are supplied by the operating system, e.g. inode order in UNIX.
8285
8286    /REVERSE
8287           If the /SORT switch is given, reverse the order of the sort.
8288           Synonym: /DESCENDING.
8289
8290    /ASCENDING
8291           If the /SORT switch is given, sort the listing in normal order.
8292           This is the opposite of /REVERSE and is the default.
8293
8294    Note that most of the DIRECTORY-specific switches come in pairs, in
8295    which one member of a pair (e.g. /NOHEADINGS) is the opposite of the
8296    other (e.g. /HEADINGS).
8297
8298    If you always want to use certain options, you can set them with the
8299    SET OPTIONS DIRECTORY command ([466]Section 1.5.5). Use SHOW OPTIONS
8300    to list the options currently in effect. To make the desired options
8301    apply every time you run C-Kermit, put a SET OPTIONS DIRECTORY command
8302    in your C-Kermit customization file, specifying the desired options.
8303    Options set in this manner apply to every subsequent DIRECTORY
8304    command. Of course, if you include switches in a DIRECTORY command,
8305    these override any defaults, built-in or custom. Example:
8306
8307   DIRECTORY            ; Use "factory defaults"
8308   SET OPTIONS DIRECTORY /SORT:SIZE /REVERSE /HEADINGS  ; Customize defaults
8309   DIRECTORY            ; Use customized defaults
8310   DIR /SORT:NAME       ; Override customized default SORT key
8311   SET OPT DIR /RECURS  ; Add /RECURSIVE to customized defaults
8312   DIR /ASCEND          ; Override customized default SORT order
8313
8314    Notes:
8315
8316      * Only a single sort key is supported; there is presently no way to
8317        have multiple sort keys.
8318      * If the /BRIEF switch is given, all other switches (except
8319        /[NO]RECURSIVE, /[NO]DOTFILES, /DIRECTORIES, /FILES, and /ALL) are
8320        ignored.
8321      * /SORT:anything gives incorrect results if any files have lengths
8322        greater than 10 digits (i.e. that are more than 9999999999 bytes
8323        long, i.e. if they are 10GB or more in size) because the overlong
8324        length field causes the date and name fields to be misaligned.
8325      * /SORT:NAME is redundant in VMS since VMS returns filenames in
8326        alphabetic order anyway.
8327      * /SORT:NAME ignores alphabetic case on platforms where case does
8328        not matter in filenames, but this works only for unaccented Roman
8329        letters A-Z.
8330      * /SORT:NAME is currently based on code values, and so works fine
8331        for ASCII, but will probably produce unexpected results for files
8332        with non-ASCII or 8-bit characters in their names. (Locale-based
8333        sorting raises rather significant issues of portability, size,
8334        performance, etc.)
8335      * /SORT:DATE works right only for ISO-format dates, not English
8336        ones.
8337      * /SORT:SIZE sorts the size field lexically. On some platforms (e.g.
8338        Windows), the size of a directory file is listed as "<DIR>" rather
8339        than as a number; in this case, the "<DIR>" files are gathered at
8340        the end (or beginning, depending on the sort order) of the
8341        listing.
8342      * /RECURSIVE is accepted but ignored in AOS/VS. Use the normal
8343        system-specific filespec notation, e.g. "dir #.txt".
8344      * /RECURSIVE has no affect when a full, absolute pathname is given;
8345        e.g. "dir /recursive /tmp/foo" (where "foo" is a regular file)
8346        only shows the "/tmp/foo" file. If you want to see all "foo" files
8347        in the /tmp tree, do "cd /tmp" and then "dir /recursive foo".
8348      * If a file size of -1 is shown, or date-time of 0000-00-00
8349        00:00:00, this means the file was located, but access to
8350        information about the file was denied to C-Kermit.
8351      * In VMS, if FOO.DIR;1 is a directory within your current directory,
8352        "directory foo" and "directory [.foo]" list the files in the
8353        [.FOO] subdirectory, but "directory foo.dir" lists the directory
8354        file itself; similarly for "*.dir" versus "[.*]", etc.
8355      * In UNIX, if "foo" is a directory within your current directory,
8356        "directory foo" lists the files in the foo directory. If you want
8357        to list the foo directory file itself, put an asterisk at the end:
8358        "dir foo*".
8359
8360    Hint: How to find the biggest files in a directory tree:
8361
8362   cd xxx ; (root of tree)
8363   directory /sort:size /recursive /reverse /dotfiles /page
8364
8365    Another hint: If you often use several different directory-listing
8366    formats, define macro shortcuts for them:
8367
8368   DEFINE WD DIRECTORY /SORT:DATE /REVERSE \%*  ; Reverse chronological order
8369   DEFINE SD DIRECTORY /SORT:SIZE /REVERSE \%*  ; Reverse order of size
8370   DEFINE ND DIRECTORY /SORT:NAME /ASCEND \%*   ; Alphabetical by name
8371   DEFINE DL DIR /DIR /SORT:NAME /ASCEND \%*    ; Alphabetical directory list
8372
8373    Put these definitions in your C-Kermit customization file. Note that
8374    "\%*" ([467]Section 7.5) in these definitions lets you include other
8375    switches in your macro invocations, e.g.:
8376
8377   wd /headings *.txt
8378
8379    Of course you can still access your external directory listing program
8380    by using RUN or "!", e.g. in VMS:
8381
8382   run directory /size/date/protection/except=*.obj oofa.*;0
8383
8384    or:
8385
8386   !dir /size/date/prot/exc=*.obj oofa.*;0
8387
8388    In UNIX, use "!ls" or just "ls" (which is a special synonym for
8389    "!ls").
8390      _________________________________________________________________
8391
8392     4.5.2. The CD and BACK Commands
8393
8394    In C-Kermit 7.0, the CD command has a new friend, the BACK command.
8395    BACK means "CD to my previous current directory". A second BACK brings
8396    you back to where you were before the first one; thus successive BACK
8397    commands switch back and forth between two directories.
8398
8399     4.5.2.1. Parsing Improvements
8400
8401    The CD command, as well as other commands that parse a directory name,
8402    were changed in 7.0 to provide all the expected functions: completion
8403    on Tab or Esc, directory-name lists on ?, etc. Other affected commands
8404    include SET SERVER GET-PATH, SET TEMP-DIRECTORY, SET FILE
8405    DOWNLOAD-DIRECTORY, and SPACE. CD and REMOTE CD also now work with
8406    logical names.
8407
8408    In VMS, the situation is a bit complicated since a directory name can
8409    look like "DEV:", "[FOO.BAR]", "DEV:[FOO.BAR]", "[FOO]BAR.DIR;1", etc.
8410    Completion and ?-help might not always work, but they do in many
8411    cases. Examples:
8412
8413   cd ?           Lists all subdirectories of the current directory
8414   cd []?         Ditto
8415   cd k?          Ditto, but only those starting with K
8416   cd [foo]?      Lists all subdirectories of the [FOO] directory
8417   cd [-]?        Lists all subdirectories of the superior directory
8418   cd [--]?       Lists all subdirectories of the directory 2 levels up
8419   cd [...]?      Lists all directories below the current one
8420   cd [foo.?      Does not work.
8421
8422    C-Kermit allows all of the following in VMS:
8423
8424   cd bar         CD to subdirectory BAR of the current directory
8425   cd .bar        Ditto
8426   cd [.bar]      Ditto
8427   cd bar.dir     etc...
8428   cd bar.dir;
8429   cd bar.dir;1
8430   cd [foo.bar]
8431   cd bar.baz     This can go more than 1 level deep...
8432   cd dir:        (where logical name DIR is defined as [FOO.BAR])
8433
8434    As well as the following:
8435
8436   cd ..          Go up one level as in UNIX
8437   cd .           The current directory
8438   cd             My login directory
8439
8440    Note that "cd -" (go up one level) does not work as expected, because
8441    "-" is Kermit's command continuation character. However, "cd [-]", and
8442    "
8443    cd {-}" have the desired effect (and so does "cd ..", which is easier
8444    to type).
8445      _________________________________________________________________
8446
8447     4.5.2.2. The CDPATH
8448
8449    The CD command in the UNIX, Windows, OS/2, and VMS versions of
8450    C-Kermit, as of version 6.1 / 1.1.12, searches the CDPATH for the
8451    given directory, if it is not absolute and if a CDPATH environment
8452    variable is defined. Example (in UNIX ksh or bash):
8453
8454   $ export CDPATH=$HOME:$HOME/kermit:/tmp
8455
8456    Now if you give a "cd xxx" command, no matter what your current
8457    directory is, if the "xxx" directory is not a subdirectory of your
8458    current directory, then the xxx subdirectory of your home directory is
8459    used or if that does not exist, then the xxx subdirectory of the
8460    kermit subdirectory of your home directory is used or if that does not
8461    exist, then /tmp/xxx is used. This is how the ksh "cd" command works,
8462    and now the C-Kermit CD command works the same way.
8463
8464    In VMS, you can define CDPATH to be a list of directories that contain
8465    actual directory delimiters, and/or logical names representing
8466    directories, using commas to separate them, e.g.:
8467
8468   $ define cdpath [HOME],[SOMEOTHERDIR],[HOME.MISC]
8469   $ define cdpath SYS$LOGIN:,DISK1:[HOME],DISK2:[SCRATCH.IVAN]
8470
8471    Example:
8472
8473   $ define cdpath SYS$LOGIN:,[IVAN],[OLAF],[OLGA.MISC]
8474   $ kermit
8475   DISK1:[OLGA] C-Kermit> cd blah
8476
8477    tries the BLAH subdirectory of the user's login directory, then
8478    [OLGA.BLAH], [IVAN.BLAH], [OLAF.BLAH], and [OLGA.MISC.BLAH], in that
8479    order, using the first one it finds, failing if it finds none.
8480
8481    In C-Kermit 7.0, you may also set the CDPATH from the Kermit prompt:
8482
8483    SET CD PATH path
8484           Allows the CD PATH to be set from within C-Kermit.
8485
8486    SHOW CD shows the CD path and all other information relevant to the CD
8487    command.
8488      _________________________________________________________________
8489
8490     4.5.2.3. CD Messages
8491
8492    Whenever you change directory, you can have C-Kermit display a "Read
8493    Me" file from the new directory automatically. The commands are:
8494
8495    SET CD MESSAGE { ON, OFF, FILE list }
8496           ON enables this feature; OFF (the default) disables it. File
8497           lets you specify the name of the "Read Me" file. A list of
8498           names to look for can be given in the following format:
8499
8500   {{name1}{name2}{name3}{...}}
8501
8502           e.g.:
8503
8504   SET SERVER CD-MESSAGE FILE {{./.readme}{README.TXT}{READ.ME}}
8505
8506           The default list of CD-message files is system dependent.
8507
8508    SHOW CD shows your current directory, previous directory, CD path, and
8509    CD message info.
8510      _________________________________________________________________
8511
8512     4.5.3. Creating and Removing Directories
8513
8514    The MKDIR command now allows you to create multiple directories at
8515    once:
8516
8517   C-Kermit> mkdir a/b/c/d
8518
8519    creates the directory a in the current directory (if it doesn't exist
8520    already), and then creates subdirectory b in the a directory (if it
8521    didn't exist already), and so on.
8522
8523    If you use MKDIR to try to create a directory that already exists,
8524    C-Kermit will print a warning ("?Directory already exists"), but the
8525    MKDIR command will still succeed. If you want to avoid the warning
8526    message, use IF DIRECTORY first to check if the directory already
8527    exists.
8528
8529    The RMDIR command, however, will not remove more than one directory,
8530    nor will it remove a directory that contains any files. (There is, as
8531    yet, no RMDIR /RECURSIVE command, although one might be added later.)
8532
8533    In VMS, these commands (like CD) are more forgiving of your syntax
8534    than is the DCL command shell; "mkdir oofa" is equivalent to "mkdir
8535    [.oofa]" and so on. Also in VMS, you'll find that C-Kermit's RMDIR
8536    command is easier than deleting a directory in DCL, since it
8537    automatically first gives it owner delete permission if you are the
8538    owner.
8539      _________________________________________________________________
8540
8541     4.5.4. The DELETE and PURGE Commands
8542
8543    The DELETE command now offers a selection of switches, and has a new
8544    companion, the PURGE command. First, DELETE:
8545
8546    DELETE [ switches... ] filespec
8547           Deletes the file or files that match the filespec, which may
8548           contain wildcards ([468]Section 4.9).
8549
8550    Optional switches include the standard file-selection switches
8551    presented in [469]Section 1.5.4, plus:
8552
8553    /ASK
8554           Before deleting each file, ask permission interactively.
8555           Answers are Yes or OK (delete the file), No (don't delete it),
8556           or Quit (stop executing the DELETE command).
8557
8558    /NOASK
8559           Don't ask permission to delete each file.
8560
8561    /LIST
8562           List each file and show whether it was deleted. Synonyms: /LOG,
8563           /VERBOSE.
8564
8565    /NOLIST
8566           Don't list files while deleting them. Synonyms: /NOLOG, /QUIET.
8567
8568    /HEADING
8569           Print a heading and summary line.
8570
8571    /NOHEADING
8572           Don't print a heading and summary line.
8573
8574    /PAGE
8575           When listing, pause at the end of each screenful and give the
8576           "More?" prompt. If you reply "n" (no), the DELETE command
8577           terminates.
8578
8579    /SIMULATE
8580           Do everything implied by the given switches and filespec,
8581           except do not actually delete any files. This lets you preview
8582           which files would be deleted; implies /LIST.
8583
8584    Now the PURGE command:
8585
8586    PURGE [ switches... ] [ filespec ]
8587           (VMS only) Runs the DCL PURGE command. Switches and filespec,
8588           if any, are passed directly to DCL without parsing or
8589           verification. Deletes excess versions of the given (or all)
8590           files. The rest of this section does not apply to VMS.
8591
8592    PURGE [ switches... ] [ filespec ]
8593           (UNIX only) Deletes "backup files" that match the filespec,
8594           which may contain wildcards ([470]Section 4.9). If no filespec
8595           is given, all backup files in the current directory are
8596           selected (subject to modification by any switches). Do not
8597           include backup notation in the filespec.
8598
8599    Explanation:
8600
8601    To avoid destroying preexisting files when a new file arrives that has
8602    the same name, C-Kermit backs up the old file by appending a "backup
8603    number" to its name. In UNIX, the backup suffix consists of a period,
8604    a tilde, a number, and another tilde. For example, if a file called
8605    oofa.txt exists and a new oofa.txt file arrives, the original is
8606    renamed to oofa.txt.~1~. If another oofa.txt file arrives, the
8607    existing one is renamed to oofa.txt.~2~. And so on. This system is
8608    compatible with the one used by EMACS. Thus over time, if you receive
8609    a lot of files with C-Kermit or edit them with EMACS, backup files can
8610    build up. The new PURGE command lets you clean out accumulated backup
8611    files:
8612
8613    Optional switches include the standard file-selection switches
8614    presented in [471]Section 1.5.4, plus all the switches listed above
8615    for the DELETE command, plus:
8616
8617    /KEEP:n
8618           Retains the n most recent (highest-numbered) backup files for
8619           each file. For example, if oofa.txt, oofa.txt.~1~,
8620           oofa.txt.~2~, oofa.txt.~10~, oofa.txt.~12~, and oofa.txt.~100~
8621           exist, "purge /keep:2 oofa.txt" deletes oofa.txt.~1~,
8622           oofa.txt.~2~, and oofa.txt.~10~, and keeps oofa.txt,
8623           oofa.txt.~12~, and oofa.txt.~100~. If /KEEP is given without a
8624           number, one (the highest numbered) backup file is kept.
8625
8626    CAUTION: The PURGE command should be used only when *.~*~ files truly
8627    are backup files. This is the case for EMACS, and it is the DEFAULT
8628    for C-Kermit. However, if C-Kermit's FILE COLLISION has been set to
8629    RENAME, newly received files will look like backup files. In that
8630    case, don't use the PURGE command or you'll be removing new files
8631    rather than old ones. (Use SHOW FILE to find the FILE COLLISION
8632    setting.)
8633
8634    The PURGE command is presently available only in UNIX. The command
8635    succeeds if it deleted any files, or if it deleted no files but there
8636    were no errors. It fails if it deleted no files and there were errors
8637    (i.e. deletion was attempted but failed). In VMS, backup file versions
8638    are handled automatically by the OS, and a PURGE command can be used
8639    at the VMS prompt to clean them up.
8640
8641    If you want certain switches to be supplied automatically with each
8642    DELETE or PURGE command, you can set them with SET OPTIONS
8643    ([472]Section 1.5.5) and you can display any such settings with SHOW
8644    OPTIONS. Of course you can override them on a per-command basis by
8645    including switches in your PURGE or DELETE command.
8646
8647    Also see SET FILE COLLISION, SHOW FILE, SEND /NOBACKUP, SET SEND
8648    BACKUP, and DIRECTORY /[NO]BACKUP.
8649      _________________________________________________________________
8650
8651   4.6. Starting the Remote Kermit Server Automatically
8652
8653    As noted on pages 275-276 of [473]Using C-Kermit 2nd edition, you can
8654    have Kermit send "kermit receive" commands automatically when it is in
8655    local mode and you give a SEND or similar command, to start the remote
8656    Kermit receiver in case it is not already started. The "kermit
8657    receive" commands are specified by:
8658
8659   SET PROTOCOL KERMIT binary-receive-command text-receive-command
8660
8661    As of version 7.0, a Kermit protocol option has been added to send a
8662    string to the host in advance of any Kermit packets when you give a
8663    GET-class or REMOTE command. This will switch the remote C-Kermit into
8664    the appropriate mode or, if the remote system is at a system command
8665    (shell) prompt, execute the string on the remote system. The new
8666    syntax of the SET PROTOCOL KERMIT command is:
8667
8668   SET PROTOCOL KERMIT [ s1 [ s2 [ s3 ] ] ]
8669
8670    where:
8671
8672        Default         Meaning
8673   s1  {kermit -ir}     Remote "kermit receive in binary mode" command.
8674   s2  {kermit -r}      Remote "kermit receive in text mode" command.
8675   s3  {kermit -x}      Remote "start kermit server" command.
8676
8677    NOTE: If the remote Kermit is 6.0, the following are recommended for
8678    fast startup and high-performance file transfer (see Appendix I in
8679    [474]Using C-Kermit, second Edition, for command-line options):
8680
8681   s1   kermit -YQir   (Kermit receive binary, skip init file, fast.)
8682   s2   kermit -YQTr   (Kermit receive text, skip init file, fast.)
8683   s3   kermit -YQx    (Kermit server, skip init file, fast.)
8684
8685    If the remote is C-Kermit 7.0 or later, change the -x option (enter
8686    server mode) to -O (uppercase letter O), which means "enter server
8687    mode for One transaction only); this way, it is not stuck in server
8688    after the transfer. Also note that the Q is redundant in version 7.0,
8689    since fast Kermit protocol settings are now the default.
8690
8691    Note that in case the C-Kermit executable is called "wermit" or
8692    "ckermit" you can change "kermit" in the strings above to "wermit" or
8693    "ckermit" and C-Kermit 7.0 or later will recognize these as synonyms
8694    for "kermit", in case it is at its command prompt when one of these
8695    strings is sent to it.
8696      _________________________________________________________________
8697
8698   4.7. File-Transfer Command Switches
8699
8700    Over the years, various new methods of transferring a file have
8701    accumulated, until we had, in addition to the SEND command, also MOVE
8702    (send and then delete), MAIL (send as email), REMOTE PRINT (send to be
8703    printed), CSEND (send the output of a command), PSEND (send a part of
8704    a file), BSEND (send in binary mode), RESEND (resume an interrupted
8705    SEND), etc etc. Similarly: GET, REGET, CGET, RETRIEVE, and so on.
8706
8707    Not only is it confusing to have different names for these commands,
8708    many of which are not real words, but this also does not allow all
8709    combinations, like "send a file as mail, then delete it".
8710
8711    In C-Kermit 7.0, the SEND, GET, and RECEIVE commands were restructured
8712    to accept modifier switches (switches are explained in [475]Section
8713    1.5).
8714      _________________________________________________________________
8715
8716     4.7.1. SEND Command Switches
8717
8718    Without switches, the SEND command still works exactly as before:
8719
8720   send oofa.txt      ; send a single file
8721   send oofa.*        ; send multiple files
8722   send oofa.txt x.x  ; send oofa.txt as x.x (tell receiver its name is x.x)
8723   send               ; send from SEND-LIST
8724
8725    But now the following modifier switches may be included between "send"
8726    and the filename. Zero, one, two, or more switches may be included in
8727    any combination that makes sense. Switch names (such as /BINARY) can
8728    be abbreviated, just like any other keywords. Most of these switches
8729    work only when using Kermit protocol (/TEXT and /BINARY are the
8730    exceptions).
8731
8732    /AFTER:date-time
8733           Specifies that only those files modified (or, in VMS, created)
8734           after the given date-time (see [476]Section 1.6) are to be
8735           sent. Examples:
8736
8737   send /text /after:{2-Feb-1997 10:28:30} *.txt
8738   send /text /after:\fdate(oofa.txt) *.txt
8739
8740           Synonym: /SINCE.
8741
8742    /ARRAY:arrayname
8743           Specifies that instead of sending a file, C-Kermit is to send
8744           the contents of the given array. Since an array does not have a
8745           filename, you should include an /AS-NAME switch to specify the
8746           name under which the array is to be sent (if you do not, the
8747           name "_array_x_" is used, where 'x' is replaced by the array
8748           designator). See [477]section 7.10 for array-name syntax. As
8749           noted in that section, you can also include a range to have a
8750           segment of the array sent, rather than the whole thing; for
8751           example: "send /array:&a[100:199]". It is strongly recommended
8752           that you accompany the /ARRAY switch with a /TEXT or /BINARY
8753           switch to force the desired transfer mode, since otherwise the
8754           various automatic mechanisms might switch to binary mode when
8755           you really wanted text, or vice versa. In text mode a line
8756           terminator is added to the end of each array element, but not
8757           in binary mode. For details and examples see [478]Section
8758           7.10.11.
8759
8760    /AS-NAME:text
8761           Specifies "text" as the name to send the file under. You can
8762           also still specify the as-name as the second filename on the
8763           SEND command line. The following two commands are equivalent:
8764
8765   send oofa.txt oofa.new
8766   send /as:oofa.new oofa.txt
8767
8768    /BEFORE:date-time
8769           Specifies that only those files modified (or, in VMS, created)
8770           before the given date-time ([479]Section 1.6) are to be sent.
8771
8772    /BINARY
8773           Performs this transfer in binary mode without affecting the
8774           global transfer mode, overriding not only the FILE TYPE and
8775           TRANSFER MODE settings, but also the FILE PATTERN setting, but
8776           for this SEND command only. In other words, SEND /BINARY means
8777           what it says: send the file in binary mode, regardless of any
8778           other settings. Example:
8779
8780   set file type text      ; Set global transfer mode to text
8781   send /binary oofa.zip   ; Send a file in binary
8782   send oofa.txt           ; This one is sent in text mode
8783
8784    /COMMAND
8785           SEND /COMMAND is equivalent to CSEND ([480]Section 4.2.2) -- it
8786           says to send the output from a command, rather than the
8787           contents of a file. The first "filename" on the SEND command
8788           line is interpreted as the name of a command; the second (if
8789           any) is the as-name. Examples:
8790
8791   send /command {grep Sunday oofa.txt} sunday.txt
8792   send /as-name:sunday.txt /command {grep Sunday oofa.txt}
8793   send /bin /command {tar cf - . | gzip -c} {!gunzip -c | tar xf -}
8794
8795    /DELETE
8796           Deletes the file (or each file in the group) after it has been
8797           sent successfully (but does not delete it if it was not sent
8798           successfully). SEND /DELETE is equivalent to MOVE. Has no
8799           effect when used with /COMMAND. Example:
8800
8801   send /delete *.log
8802
8803    /DOTFILES
8804           (UNIX and OS-9 only) Normally files whose names begin with "."
8805           are skipped when matching wildcards that do not also beging
8806           with ".". Include /DOTFILES to force these files to be included
8807           too.
8808
8809    /RECURSIVE
8810           Descend the through the directory tree when locating files to
8811           send. Automatically sets /PATHNAMES:RELATIVE. Explained in
8812           [481]Section 4.11 .
8813
8814    /EXCEPT:pattern
8815           See [482]Section 1.5.4.
8816
8817    /NOBACKUP
8818           This means to skip backup files when sending, even if they
8819           match the SEND file specification. This is equivalent to using
8820           SEND /EXCEPT and including *.~[0-9]*~ in the exception list (or
8821           *.~*~ if Kermit was built without pattern-matching support; see
8822           [483]Section 4.9.1). Including this switch is equivalent to
8823           giving SET SEND BACKUP OFF ([484]Section 4.0.6) prior to SEND,
8824           except its effect is local to the SEND command with which it
8825           was given.
8826
8827    /NODOTFILES
8828           The opposite of /DOTFILES (q.v.)
8829
8830    /FILENAMES:{CONVERTED,LITERAL}
8831           Use this switch to override the current global SET FILE NAMES
8832           setting for this transfer only.
8833
8834    /FILTER:command
8835           This specifies a filter to pass the file through before sending
8836           it. See the [485]section on file-transfer pipes and filters.
8837           The /FILTER switch applies only to the file-transfer command it
8838           is given with; it does not affect the global SEND FILTER
8839           setting, if any.
8840
8841    /IMAGE
8842           VMS: Sends in image mode. Non-VMS: same as /BINARY.
8843
8844    /LABELED
8845           VMS and OS/2 only: Sends in labeled mode.
8846
8847    /LARGER-THAN:number
8848           Specifies that only those files that are longer than the given
8849           number of bytes are to be sent.
8850
8851    /LISTFILE:filename
8852           Specifies that the files to be sent are listed in a file with
8853           the given filename. The file contains one filename per line.
8854           These filenames are not checked in any way; each filename is
8855           taken and does not use or depend on any Kermit-specific syntax.
8856           In particular, backslashes are not treated specially, leading
8857           and trailing spaces are not stripped, etc. However, if a
8858           filename contains wildcards, they are expanded. Example: If a
8859           file named files.txt contains the following lines:
8860
8861   blah.txt
8862   oofa*
8863   x.x
8864
8865           (but without leading or trailing spaces), then the C-Kermit
8866           command "send /listfile:files.txt" will send the files
8867           blah.txt, x.x, and all files whose names start with "oofa",
8868           assuming the files exist and are readable. The /LISTFILE
8869           switch, can, of course, be used with other switches when it
8870           makes sense, for example, /EXCEPT, /BINARY, /AFTER, /SMALLER,
8871           /MOVE-TO, /DELETE, /AS-NAME with a template, etc.
8872
8873    /MAIL:address
8874           Sends the file as e-mail to the given address or addresses.
8875           "send /mail:address filename" is equivalent to "mail filename
8876           address". You can include multiple addresses separated by
8877           commas. Examples:
8878
8879   send /mail:kermit-support@columbia.edu packet.log
8880   send /mail:cmg,fdc,jrd oofa.txt
8881
8882           As with any switch argument, if the address or address list
8883           contains any spaces, you must enclose it in braces. The format
8884           of the addresses must agree with that understood by the
8885           mail-sending program on the receiver's computer.
8886
8887    /MOVE-TO:directory-name
8888           Specifies that after each (or the only) source file is sent
8889           successfully, and ONLY if it is sent successfully, it should be
8890           moved to the named directory. If the directory name contains
8891           spaces, enclose it in braces. If the directory does not exist,
8892           it is created if possible; if it can't be created, the command
8893           fails and an error message is printed. Example:
8894
8895   send /text /move-to:/users/olga/backup/ *.txt
8896
8897    /NOT-AFTER:date-time
8898           Specifies that only those files modified at or before the given
8899           date and time are to be sent.
8900
8901    /NOT-BEFORE:date-time
8902           Specifies that only those files modified at or after the given
8903           date and time are to be sent.
8904
8905    /PATHNAMES:{OFF,ABSOLUTE,RELATIVE}
8906           Use this switch to override the current global SET SEND
8907           PATHNAMES setting for this transfer only. /PATHNAMES:ABSOLUTE
8908           or RELATIVE also sets /FILENAMES:LITERAL (also for this
8909           transfer only) since pathnames are not sent otherwise.
8910
8911    /RENAME-TO:text
8912           Specifies that after the (or each) source file is sent
8913           successfully, and ONLY if it is sent successfully, it should be
8914           renamed to the name given. If the name contains spaces, enclose
8915           it in braces. If a file group is being sent, then the "text"
8916           must contain a variable reference such as \v(filename) (see
8917           [486]Section 4.1). Example:
8918
8919   send /rename-to:ok_\v(filename) *.*
8920
8921           This sends each file in the current directory and if it was
8922           sent successfully, changes its name to begin with "ok_".
8923
8924    /SMALLER-THAN:number
8925           Specifies that only those files that are smaller than the given
8926           number of bytes are to be sent.
8927
8928    /SUBJECT:text
8929           Subject for email. Actually, this is just a synonym for
8930           /AS-NAME. If the text includes spaces, you must enclose it in
8931           braces. If you don't specify a subject (or as-name), the name
8932           of the file is used as the subject. Example:
8933
8934   send /mail:kermit-support@columbia.edu /subj:{As requested} packet.log
8935
8936    /PRINT:options
8937           Sends the file to be printed, optionally specifying options for
8938           the printer. Equivalent to REMOTE PRINT filename options.
8939           Examples:
8940
8941   send /print oofa.txt              ; No options.
8942   send /print:/copies=3 oofa.txt    ; "/copies=3" is a VMS PRINT switch.
8943   send /print:-#3 oofa.txt          ; "-#3" is a UNIX lpr switch.
8944
8945    /PROTOCOL:name
8946           Uses the given protocol to send the file (Kermit, Zmodem, etc)
8947           for this transfer without changing global protocol. Only
8948           available in Kermit 95, UNIX, and OS-9. Example:
8949
8950   set protocol kermit               ; Set global protocol
8951   send /proto:zmodem /bin oofa.zip  ; Send just this file with Zmodem
8952   send oofa.txt                     ; This file is sent with Kermit
8953
8954    /QUIET
8955           When sending in local mode, this suppresses the file-transfer
8956           display.
8957
8958    /RECOVER
8959           Used to recover from a previously interrupted transfer; SEND
8960           /RECOVER is equivalent to RESEND. Recovery only works in binary
8961           mode; SEND /RECOVER and RESEND include an implied /BINARY
8962           switch. Even then, recovery will successful only if (a) the
8963           original (interrupted) transfer was also in binary mode, or (b)
8964           if it was in text mode, the two Kermit programs run on
8965           platforms where text-mode transfers are not length-changing.
8966
8967    /STARTING:number
8968           Starts sending the file from the given byte position. SEND
8969           /STARTING:n filename is equivalent to PSEND filename n.
8970
8971    /TEXT
8972           Performs this transfer in text mode without affecting the
8973           global transfer mode, overriding not only the FILE TYPE and
8974           TRANSFER MODE settings, but also the FILE PATTERN setting, for
8975           this SEND command only. In other words, SEND /TEXT really send
8976           the file in text mode, regardless of any other settings or
8977           negotiations.
8978
8979    About mail... Refer to [487]Section 4.7.1. The same rules apply as for
8980    file transfer. If you are mailing multiple files, you can't use an
8981    as-name (in this case, a subject) unless it contains replacement
8982    variables like \v(filenum). For example, if you:
8983
8984   send /mail:somebody@xyz.com *.txt
8985
8986    Then each file will arrive as a separate email message with its name
8987    as the subject. But if you:
8988
8989   send /mail:somebody@xyz.com /subject:{Here is a file} *.txt
8990
8991    Then each file message will have the same subject, which is probably
8992    not what you want. You can get around this with constructions like:
8993
8994   send /mail:somebody@xyz.com /subject:{Here is \v(filename)} *.txt
8995
8996    which embed the filename in the subject.
8997
8998    The MOVE, CSEND, MAIL, and RESEND commands now also accept the same
8999    switches. And the switches are also operative when sending from a
9000    SEND-LIST (see [488]Using C-Kermit, 2nd Ed, pp.191-192), so, for
9001    example, it is now possible to SEND /PRINT or SEND /MAIL from a
9002    SEND-LIST.
9003
9004    The MSEND and MMOVE commands also take switches, but not all of them.
9005    With these commands, which take an arbitrary list of filespecs, you
9006    can use /BINARY, /DELETE, /MAIL, /PRINT, /PROTOCOL, /QUIET, /RECOVER,
9007    and /TEXT (and /IMAGE or /LABELED, depending on the platform). MMOVE
9008    is equivalent to MSEND /DELETE. (If you want to send a group of files,
9009    but in mixed transfer modes with per-file as-names, use ADD SEND-LIST
9010    and then SEND.)
9011
9012    The MSEND/MMOVE switches come before the filenames, and apply to all
9013    of them:
9014
9015   msend /print /text *.log oofa.txt /etc/motd
9016
9017    If you type any of these commands (SEND, CSEND, MSEND, etc) followed
9018    by a question mark (?), you will see a list of the switches you can
9019    use. If you want to see a list of filenames, you'll need to type
9020    something like "send ./?" (UNIX, OS/2, Windows, etc), or "send []?"
9021    (VMS), etc. Of course, you can also type pieces of a filename
9022    (anything that does not start with "/") and then "?" to get a list of
9023    filenames that start that way; e.g. "send x.?" still works as before.
9024
9025    In UNIX, where "/" is also the directory separator, there is usually
9026    no ambiguity between a fully-specified pathname and a switch, except
9027    when a file in the root directory has the same name as a switch (as
9028    noted in [489]Section 1.5):
9029
9030   send /etc/motd                        ; Works as expected
9031   send /command                         ; ???
9032
9033    The second example interprets "/command" as a switch, not a filename.
9034    To send a file actually called "command" in the root directory, use:
9035
9036   send {/command}
9037
9038    or other system-dependent forms such as //command, /./command,
9039    c:/command, etc, or cd to / and then "send command".
9040      _________________________________________________________________
9041
9042     4.7.2. GET Command Switches
9043
9044    Without switches, the GET command still works about the same as
9045    before:
9046
9047   get oofa.txt                          ; GET a single file
9048   get oofa.*                            ; GET multiple files
9049
9050    However, the mechanism for including an "as-name" has changed.
9051    Previously, in order to include an as-name, you were required to use
9052    the "multiline" form of GET:
9053
9054   get
9055   remote-filespec
9056   local-name
9057
9058    This was because the remote filespec might contain spaces, and so
9059    there would be no good way of telling where it ended and where the
9060    local name began, e.g:
9061
9062   get profile exec a foo
9063
9064    But now since we can use {braces} for grouping, we don't need the
9065    multiline GET form any more, and in fact, support for it has been
9066    removed. If you give a GET command by itself on a line, it fails and
9067    an error message is printed. The new form is:
9068
9069    GET [ switches... ] remote-name [ local-name ]
9070           Ask the server to send the file whose name is remote-name. If
9071           the optional local-name is given, store it locally under this
9072           name. If the remote-name or local-name contains spaces, they
9073           must be enclosed in braces:
9074
9075   get {profile exec a} foo
9076   get oofa.txt {~/My Files/Oofa text}
9077
9078    If you want to give a list of remote file specifications, use the MGET
9079    command:
9080
9081    MGET [ switches... ] remote-name [ remote-name [ remote-name ... ] ]
9082           Ask the server to send the files whose names are given.
9083
9084    Now you can also include modifier switches between GET or MGET and the
9085    remote-name; most of the same switches as SEND:
9086
9087    /AS-NAME:text
9088           Specifies "text" as the name to store the incoming file under.
9089           (This switch is not available for MGET.) You can also still
9090           specify the as-name as the second filename on the GET command
9091           line. The following two commands are equivalent:
9092
9093   get oofa.txt oofa.new
9094   get /as:oofa.new oofa.txt
9095
9096    /BINARY
9097           Tells the server to send the given file(s) in binary mode
9098           without affecting the global transfer mode. Example:
9099
9100   set file type text      ; Set global transfer mode to text
9101   get /binary oofa.zip    ; get a file in binary mode
9102   get oofa.txt            ; This one is transferred in text mode
9103
9104           Or, perhaps more to the point:
9105
9106   get /binary foo.txt     ; where "*.txt" is a text-pattern
9107
9108           This has the expected effect only if the server is C-Kermit 7.0
9109           or later or K95 1.1.19 or later.
9110
9111    /COMMAND
9112           GET /COMMAND is equivalent to CGET ([490]Section 4.2.2) -- it
9113           says to receive the file into the standard input of a command,
9114           rather than saving it on disk. The /AS-NAME or the second
9115           "filename" on the GET command line is interpreted as the name
9116           of a command. Examples:
9117
9118   get /command sunday.txt {grep Sunday oofa.txt}
9119   get /command /as-name:{grep Sunday oofa.txt} sunday.txt
9120   get /bin /command {!gunzip -c | tar xf -} {tar cf - . | gzip -c}
9121
9122    /DELETE
9123           Asks the Kermit server to delete the file (or each file in the
9124           group) after it has been transferred successfully (but not to
9125           delete it if it was not sent successfully). GET /DELETE is
9126           equivalent to RETRIEVE. Example:
9127
9128   get /delete *.log
9129
9130    /EXCEPT:pattern
9131           Specifies that any files whose names match the pattern, which
9132           can be a regular filename, or may contain "*" and/or "?"
9133           metacharacters, are to be refused upon arrival. To specify
9134           multiple patterns (up to 8), use outer braces around the group,
9135           and inner braces around each pattern:
9136
9137   /EXCEPT:{{pattern1}{pattern2}...}
9138
9139           See the description of SEND /EXCEPT in [491]Section 4.7.1 for
9140           examples, etc. Refusal is accomplished using the Attribute
9141           Rejection mechanism (reason "name"), which works only when
9142           Attribute packets have been successfully negotiated.
9143
9144    /FILENAMES:{CONVERTED,LITERAL}
9145           Use this switch to override the current global SET FILE NAMES
9146           setting for this transfer only.
9147
9148    /FILTER:command
9149           This specifies a filter to pass the incoming file through
9150           before writing to disk. See the [492]section on file-transfer
9151           pipes and filters. The /FILTER switch applies only to the
9152           file-transfer command it is given with; it does not affect the
9153           global RECEIVE FILTER setting, if any.
9154
9155    /IMAGE
9156           VMS: Transfer in image mode. Non-VMS: same as /BINARY.
9157
9158    /LABELED
9159           VMS and OS/2 only: Specifies labeled transfer mode.
9160
9161    /MOVE-TO:directory
9162           This tells C-Kermit to move each file that is successfully
9163           received to the given directory. Files that are not
9164           successfully received are not moved. By default, files are not
9165           moved.
9166
9167    /PATHNAMES:{OFF,ABSOLUTE,RELATIVE,AUTO}
9168           Use this switch to override the current global SET RECEIVE
9169           PATHNAMES setting for this transfer only. /PATHNAMES:ABSOLUTE
9170           or RELATIVE also sets /FILENAMES:LITERAL (also for this
9171           transfer only) since incoming pathnames would not be treated as
9172           pathnames otherwise. See [493]Section 4.10.
9173
9174    /QUIET
9175           When sending in local mode, this suppresses the file-transfer
9176           display.
9177
9178    /RECOVER
9179           Used to recover from a previously interrupted transfer; GET
9180           /RECOVER is equivalent to REGET. Recovery only works in binary
9181           mode; SEND /RECOVER and RESEND include an implied /BINARY
9182           switch. Even then, recovery will successful only if (a) the
9183           original (interrupted) transfer was also in binary mode, or (b)
9184           if it was in text mode, the two Kermit programs run on
9185           platforms where text-mode transfers are not length-changing.
9186
9187    /RECURSIVE
9188           Tells the server that the GET file specification applies
9189           recursively. This switch also automatically sets
9190           /PATHNAMES:RELATIVE in both the server AND the client. When
9191           used in conjunction with /DELETE, this "moves" a directory tree
9192           from the server's computer to the client's computer (except
9193           that only regular files are deleted from the server's computer,
9194           not directories; thus the original directories will be left,
9195           but will contain no files). Note that all servers that support
9196           /RECURSIVE do not necessarily do so in combination with other
9197           switches, such as /RECOVER. (Servers that do include C-Kermit
9198           7.0 and later, K95 1.1.19 and later.)
9199
9200    /RENAME-TO:string
9201           This tells C-Kermit to rename each file that is successfully
9202           received to the given string. Files that are not successfully
9203           received are not renamed. By default, files are not renamed.
9204           The string can be a literal string, which is appropriate when
9205           only one file is being received, or it can contain one or more
9206           variables that are to be evaluated at the time each file is
9207           received, such as \v(filename), \v(filenumber), \v(ntime),
9208           \v(pid), \v(user), etc. WARNING: if you give a literal string
9209           and more than one file arrives, each incoming file will be
9210           given the same name (but SET FILE COLLISION BACKUP or RENAME
9211           can be used to keep the incoming files from overwriting each
9212           other).
9213
9214    /TEXT
9215           Tells the server to perform this transfer in text mode without
9216           affecting its global transfer mode. See /BINARY for additional
9217           info.
9218
9219    The /MAIL and /PRINT options are not available (as they are for SEND),
9220    but you can use /COMMAND to achieve the same effect, as in these UNIX
9221    examples:
9222
9223   get /command oofa.txt {mail kermit@columbia.edu}
9224   get /command oofa.txt lpr
9225
9226    In OS/2 or Windows, you can GET and print like this:
9227
9228   get oofa.txt prn
9229
9230    The CGET, REGET, RETRIEVE commands also accept the same switches as
9231    GET. CGET automatically sets /COMMAND; REGET automatically sets
9232    /RECOVER and /BINARY, and RETRIEVE automatically sets /DELETE.
9233      _________________________________________________________________
9234
9235     4.7.3. RECEIVE Command Switches
9236
9237    Without switches, the RECEIVE command still works as before:
9238
9239   receive            ; Receives files under their own names
9240   receive /tmp       ; Ditto, but into the /tmp directory
9241   r                  ; Same as "receive"
9242   receive foo.txt    ; Receives a file and renames to foo.txt
9243
9244    Now you can also include modifier switches may be included between
9245    "receive" and the as-name; most of the same switches as GET:
9246
9247    /AS-NAME:text
9248           Specifies "text" as the name to store the incoming file under.
9249           You can also still specify the as-name as a filename on the
9250           command line. The following two commands are equivalent:
9251
9252   r oofa.new
9253   r /as:oofa.new
9254
9255    /BINARY
9256           Performs this transfer in binary mode without affecting the
9257           global transfer mode. NOTE: This does not override the incoming
9258           filetype (as it does with GET), so this switch is useful only
9259           if ATTRIBUTE TYPE is OFF, or if the other Kermit does not send
9260           a TYPE (text or binary) attribute. In any case, it has no
9261           affect whatsoever on the file sender.
9262
9263    /COMMAND
9264           RECEIVE /COMMAND is equivalent to CRECEIVE ([494]Section 4.2.2)
9265           -- it says to receive the file into the standard input of a
9266           command, rather than saving it on disk. The /AS-NAME or the
9267           "filename" on the RECEIVE command line is interpreted as the
9268           name of a command.
9269
9270   r /command {grep Sunday oofa.txt}
9271   r /command /as-name:{grep Sunday oofa.txt}
9272   r /bin /command {tar cf - . | gzip -c}
9273
9274    /EXCEPT:pattern
9275           Specifies that any files whose names match the pattern, which
9276           can be a regular filename, or may contain "*" and/or "?"
9277           metacharacters, are to be refused upon arrival. To specify
9278           multiple patterns (up to 8), use outer braces around the group,
9279           and inner braces around each pattern:
9280
9281   /EXCEPT:{{pattern1}{pattern2}...}
9282
9283           See the description of SEND /EXCEPT in [495]Section 4.7.1 for
9284           examples, etc. Refusal is accomplished using the Attribute
9285           Rejection mechanism (reason "name"), which works only when
9286           Attribute packets have been successfully negotiated.
9287
9288    /FILENAMES:{CONVERTED,LITERAL}
9289           Use this switch to override the current global SET FILE NAMES
9290           setting for this transfer only.
9291
9292    /FILTER:command
9293           This specifies a filter to pass the incoming file through
9294           before writing to disk. See the [496]section on file-transfer
9295           pipes and filters. The /FILTER switch applies only to the
9296           file-transfer command it is given with; it does not affect the
9297           global RECEIVE FILTER setting, if any.
9298
9299    /IMAGE
9300           VMS: Transfer in image mode. Non-VMS: same as /BINARY. See
9301           comments under RECEIVE /BINARY.
9302
9303    /LABELED
9304           VMS and OS/2 only: Specifies labeled transfer mode. See
9305           comments under RECEIVE /BINARY.
9306
9307    /MOVE-TO:directory
9308           This tells C-Kermit to move each file that is successfully
9309           received to the given directory. Files that are not
9310           successfully received are not moved. By default, files are not
9311           moved.
9312
9313    /PATHNAMES:{ABSOLUTE,RELATIVE,OFF,AUTO}
9314           Use this switch to override the current global SET RECEIVE
9315           PATHNAMES setting for this transfer only. See [497]Section
9316           4.10.
9317
9318    /RECURSIVE
9319           When used with the RECEIVE command, /RECURSIVE is simply a
9320           synonym for /PATHNAMES:RELATIVE.
9321
9322    /RENAME-TO:string
9323           This tells C-Kermit to rename each file that is successfully
9324           received to the given string. Files that are not successfully
9325           received are not renamed. By default, files are not renamed.
9326           The string can be a literal string, which is appropriate when
9327           only one file is being received, or it can contain one or more
9328           variables that are to be evaluated at the time each file is
9329           received, such as \v(filename), \v(filenumber), \v(ntime),
9330           \v(pid), \v(user), etc. WARNING: if you give a literal string
9331           and more than one file arrives, each incoming file will be
9332           given the same name (but SET FILE COLLISION BACKUP or RENAME
9333           can be used to keep the incoming files from overwriting each
9334           other).
9335
9336    /QUIET
9337           When receiving in local mode, this suppresses the file-transfer
9338           display.
9339
9340    /TEXT
9341           Receives in text mode without affecting the global transfer
9342           mode. See comments under RECEIVE /BINARY.
9343
9344    The /MAIL and /PRINT options are not available, but you can use
9345    /COMMAND to achieve the same effect, as in these UNIX examples:
9346
9347   r /command {mail kermit@columbia.edu}
9348   r /command lpr
9349
9350    In OS/2 or Windows, you can RECEIVE and print like this:
9351
9352   receive prn
9353
9354    The CRECEIVE command now also accepts the same switches.
9355      _________________________________________________________________
9356
9357   4.8. Minor Kermit Protocol Improvements
9358
9359     4.8.1. Multiple Attribute Packets
9360
9361    C-Kermit 7.0 now sends more than one Attribute packet if a file's
9362    attributes do not fit into a single packet of the negotiated length.
9363    If a particular attribute (such as file creation date-time) does not
9364    fit within the negotiated length (which will only happen when the
9365    negotiated length is around 20 or less), that attribute is not sent at
9366    all.
9367
9368     4.8.2. Very Short Packets
9369
9370    There are certain situations where extremely short packets must be
9371    used; 20 or 30 bytes at most. This can happen when one or more devices
9372    along the communication path have very small buffers and lack an
9373    effective means of flow control. Examples are sometimes cited
9374    involving radio modems.
9375
9376    When the maximum packet length is shorter than certain packets that
9377    would be sent, those packets are either truncated or else broken up
9378    into multiple packets. Specifically:
9379
9380     1. Parameter negotiation packets (I, S, and their ACKs) are truncated
9381        to the negotiated length. Any parameters that do not fit are reset
9382        to their default values. There is no provision in the Kermit
9383        protocol for fragmentation and reassembly of parameter strings.
9384     2. File header packets (containing the filename) are simply
9385        truncated. There is no provision in the Kermit protocol for
9386        fragmentation and reassembly of filenames.
9387     3. Attribute packets are fragmented and reassembled as described in
9388        4.8.1 without loss of data, except in case a field will not fit at
9389        all in the negotiated length (the longest attribute is usually the
9390        date and time of file creation/modification) because of the rule
9391        that attributes may not be broken across packets.
9392     4. Data packets and other packets are unaffected -- they can be as
9393        short as they need to be, within reason.
9394      _________________________________________________________________
9395
9396   4.9. Wildcard / File Group Expansion
9397
9398    "Wildcard" refers to the notation used in filenames to specify a group
9399    of files by pattern matching.
9400
9401     4.9.1. In UNIX C-Kermit
9402
9403    Prior to C-Kermit 7.0, C-Kermit was capable of expanding wildcard
9404    strings containing only the "metacharacters" '*' and '?':
9405
9406    *
9407           Matches any sequence of zero or more characters. For example:
9408           "ck*.c" matches all files whose names start with "ck" and end
9409           with ".c", including "ck.c".
9410
9411    ?
9412           Matches any single character. For example, "ck?.c" matches all
9413           files whose names are exactly 5 characters long and start with
9414           "ck" and end with ".c". When typing commands at the prompt, you
9415           must precede any question mark to be used for matching by a
9416           backslash (\) to override the normal function of question mark,
9417           which is providing menus and file lists.
9418
9419    C-Kermit 7.0 adds the additional features that users of ksh, csh, and
9420    bash are accustomed to:
9421
9422    [abc]
9423           Square brackets enclosing a list of characters matches any
9424           single character in the list. Example: ckuusr.[ch] matches
9425           ckuusr.c and ckuusr.h.
9426
9427    [a-z]
9428           Square brackets enclosing a range of characters; the hyphen
9429           separates the low and high elements of the range. For example,
9430           [a-z] matches any character from a to z.
9431
9432    [acdm-z]
9433           Lists and ranges may be combined. This example matches a, c, d,
9434           or m through z.
9435
9436    {string1,string2,...}
9437           Braces enclose a list of strings to be matched. For example:
9438           ck{ufio,vcon,cmai}.c matches ckufio.c, ckvcon.c, or ckcmai.c.
9439           The strings may themselves contain metacharacters, bracket
9440           lists, or indeed, other lists of strings, but (when matching
9441           filenames) they may not contain directory separators.
9442
9443           Thus, the metacharacters in filenames (and in any other field
9444           that can be a pattern, such as the IF MATCH pattern, SEND or
9445           GET exception lists, etc) are:
9446
9447  * ? [ {
9448
9449           And within braces only, comma (,) is a metacharacter.
9450
9451    To include a metacharacter in a pattern literally, precede it with a
9452    backslash '\' (or two if you are passing the pattern to a macro).
9453    Examples:
9454
9455   send a*b      ; Send all files whose names start with 'a' and end with 'b'.
9456   send a?b      ; Ditto, but the name must be exactly three characters long.
9457   send a[a-z]b  ; Ditto, but the second character must be a lowercase letter.
9458   send a[x\-z]b ; Ditto, except the second character must be 'x', '-', or 'y'.
9459   send a[ghi]b  ; Ditto, except the second character must be 'g', 'h', or 'i'.
9460   send a[?*]b   ; Ditto, except the second character must be '?' or '*'.
9461   send a[\?\*]b ; Same as previous.
9462   send *?[a-z]* ; All files with names containing at least one character
9463                 ; that is followed by a lowercase letter.
9464
9465    Or, more practically:
9466
9467   send ck[cuw]*.[cwh]  ; Send the UNIX C-Kermit source files.
9468
9469    To refer to the C-Kermit sources files and makefile all in one
9470    filespec:
9471
9472   {{makefile,ck[cuw]*.[cwh]}}
9473
9474    (NOTE: if the entire pattern is a {stringlist}, you must enclose it it
9475    TWO pairs of braces, since the SEND command strips the outer brace
9476    pair, because of the "enclose in braces if the filename contains
9477    spaces" rule).
9478
9479    If the makefile is called ckuker.mak:
9480
9481   ck[cuw]*.{[cwh],mak}
9482
9483    (NOTE: double braces are not needed here since the pattern does not
9484    both begin and end with a brace.)
9485
9486    To add in all the C-Kermit text files:
9487
9488   ck[cuw]*.{[cwh],mak,txt}
9489
9490    All of these features can be used anywhere you would type a filename
9491    that is allowed to contain wildcards.
9492
9493    When you are typing at the command prompt, an extra level of quoting
9494    is required for the '?' character to defeat its regular function of
9495    producing a list of files that match what you have typed so far, for
9496    example:
9497
9498   send ck[cu]?
9499
9500    lists all the files whose names start with ckc and cku. If you quote
9501    the question mark, it is used as a pattern-matching character, for
9502    example:
9503
9504   send ck\?[ft]io.c
9505
9506    sends all the file and communications i/o modules for all the
9507    platforms: ckufio.c, ckutio.c, ckvfio.c, ckvtio.c, etc.
9508
9509    If, however, a filename actually contains a question mark and you need
9510    to refer to it on the command line, you must use three (3)
9511    backslashes. For example, if the file is actually called ck?fio.c, you
9512    would use:
9513
9514   send ck\\\?fio.c
9515
9516    Further notes on quoting:
9517
9518      * A single backslash is sufficient for quoting a special character
9519        at the command prompt or in a command file. However, when passing
9520        patterns to macros you'll need double backslashes, and when
9521        referring to these patterns within the macro, you'll need to use
9522        \fcontents(\%1) (see [498]Section 1.11.5). You should enclose
9523        macro argument references in braces in case grouped arguments were
9524        passed. Example:
9525  define ismatch {
9526      if match {\fcont(\%1)} {\fcont(\%2)} {
9527          end 0 MATCH
9528      } else {
9529          end 1 NO MATCH
9530      }
9531  }
9532  ismatch ab*yz a*\\**z           ; Backslash must be doubled
9533  ismatch {abc def xyz} *b*e*y*   ; Braces must be used for grouping
9534      * Watch out for possible conflicts between {} in filename patterns
9535        and {} used for grouping multiple words into a single field, when
9536        the pattern has outer braces. For example, in:
9537      if match {abc xyz} {a* *z} echo THEY MATCH
9538        braces must be used to group "abc xyz" into a single string.
9539        Kermit strips off the braces before comparing the string with the
9540        pattern. Therefore:
9541  if match makefile {makefile,Makefile} echo THEY MATCH
9542        does not work, but:
9543  if match makefile {{makefile,Makefile}} echo THEY MATCH
9544        does.
9545      * If you use a pattern that has outer braces, like {*.txt,*.doc}, in
9546        a field that accepts a pattern list (like SEND /EXCEPT:xxx),
9547        you'll need to add two extra sets of outer braces:
9548  send /except:{{{*.txt,*.doc}}} *.*
9549
9550    C-Kermit's new pattern matching capabilities are also used when
9551    C-Kermit is in server mode, so now you can send requests such as:
9552
9553   get ck[cuw]*.[cwh]
9554
9555    to a C-Kermit server without having to tell it to SET WILD SHELL
9556    first. Previously this would have required:
9557
9558   mget ckc*.c ckc*.w ckc*.h cku*.c cku*.w cku*.h ckw*.c ckw*.w ckw*.h
9559
9560    The new pattern matching features make SET WILD SHELL redundant, and
9561    barring any objections, it will eventually be phased out. (One
9562    possible reason for retaining it would be as an escape mechanism when
9563    Kermit does not understand the underlying file system.)
9564
9565    By the way, patterns such as these are sometimes referred to as
9566    "regular expressions", but they are not quite the same. In a true
9567    regular expression (for example), "*" means "zero or more repetitions
9568    of the previous item", so (for example), "([0-9]*)" would match zero
9569    or more digits in parentheses. In Kermit (and in most shells), this
9570    matches one digit followed by zero or more characters, within
9571    parentheses. Here are some hints:
9572
9573      * Although you can't match any sequence of digits (or letters, etc),
9574        you can match (say) 1, 2, or 3 of them in row. For example, the
9575        following pattern matches Kermit backup files (with backup numbers
9576        from 1 to 999):
9577  *.~{[1-9],[1-9][0-9],[1-9][0-9][0-9]}~
9578      * There is presently no NOT operator, so no way to match any
9579        character or string EXCEPT the one(s) shown.
9580
9581    In other wildcarding news...
9582
9583      * You may now "send xxx" where "xxx" is a directory name, and this
9584        will send all the files from the directory xxx, as if you had
9585        typed "send xxx/*". You can also use the special shorthand "send
9586        ." to send all the files from the current directory.
9587      * To easily skip over backup files (the ones whose names end like
9588        .~22~) when sending, you can use SEND /NOBACKUP (see [499]Section
9589        4.0.6 for details).
9590      * When choosing Kermit to expand wildcards, rather than the shell,
9591        you can choose whether "dot files" -- files whose names begin with
9592        ".", which are normally "invisible" -- should be matched:
9593  SET WILD KERMIT /NO-MATCH-DOT-FILES (this is the default)
9594  SET WILD KERMIT /MATCH-DOT-FILES    (this allows matching of "." files)
9595        or include the /DOTFILES or /NODOTFILES switch on the command you
9596        are using, such as SEND or DIRECTORY.
9597      * Commands such as DIRECTORY and SEND allow recursive directory
9598        traversal. There are also new functions for this to use in
9599        scripts. See [500]Section 4.11 for details.
9600
9601    When building file lists in UNIX, C-Kermit follows symbolic links.
9602    Because of this, you might encounter any or all of the following
9603    phenomena:
9604
9605      * Multiple copies of the same file; e.g. one from its real directory
9606        and others from links to its real directory, if both the real
9607        directory and the links to it are in the wildcard expansion list.
9608      * A command might unexpectedly "hang" for a long time because an NFS
9609        link might not be responding, or the directory you are looking at
9610        contains a link to a huge directory tree (example: "directory
9611        /recursive /etc" when /etc/spool is a symlink to /var/spool, which
9612        is a large organization's incoming email directory, containing
9613        tens of thousands of subdirectories).
9614
9615    The size of the file list that Kermit can build is limited in most
9616    C-Kermit implementations. The limit, if any, depends on the
9617    implementation. Use the SHOW FEATURES command and look in the
9618    alphabetized options list for MAXWLD to see the value.
9619
9620     4.9.2. In Kermit 95
9621
9622    Kermit 95 1.1.19 and later uses the same pattern matching syntax as in
9623    UNIX, but (as always) you will encounter numerous difficulties if you
9624    use backslash (\) as the directory separator. In any command where K95
9625    parses filenames itself (that is, practically any file-oriented
9626    command except RUN), you can use forward slash (/) as the directory
9627    separator to avoid all the nasty conflicts.
9628
9629     4.9.3. In VMS, AOS/VS, OS-9, VOS, etc.
9630
9631    Platforms other than UNIX, Windows 95/98/NT, and OS/2 have their own
9632    filename matching capabilities that are, in general, different from
9633    Kermit's built-in ones and in any case might conflict with them. For
9634    example, [] encloses directory names in VMS.
9635
9636    Nevertheless you can still use all the pattern-matching capabilities
9637    described in [501]Section 4.9.1 by loading a file list into an array
9638    (e.g. with \ffiles(*,&a), see [502]Section 4.11.3) and then using IF
9639    MATCH on the members.
9640      _________________________________________________________________
9641
9642   4.10. Additional Pathname Controls
9643
9644    In version 6.0 and earlier, C-Kermit's SET { SEND, RECEIVE } PATHNAMES
9645    command had only ON and OFF as options. In version 7.0, there are more
9646    choices:
9647
9648    SET SEND PATHNAMES OFF
9649           When sending a file, strip all disk/directory information from
9650           the name. Example: "send /usr/olga/letters/oofa.txt" sends the
9651           file as "oofa.txt". This applies to actual filenames, not to
9652           any as-name you might specify.
9653
9654    SET SEND PATHNAMES RELATIVE
9655           When sending a file, leave the pathname on as given. For
9656           example, if your current directory is /usr/olga, "send
9657           letters/oofa.txt" sends the file as "letters/oofa.txt", not
9658           "/usr/olga/letters/oofa.txt" or "letters.txt".
9659
9660    SET SEND PATHNAMES ABSOLUTE
9661           When sending a file, convert its name to the full, absolute
9662           local pathname. For example, if your current directory is
9663           /usr/olga, "send letters/oofa.txt" sends the file as
9664           "/usr/olga/letters/oofa.txt". NOTE: Even with this setting,
9665           device and/or node names are not included. For example, in VMS,
9666           any node or device name is stripped; in Windows or OS/2, any
9667           disk letter is stripped.
9668
9669    SET RECEIVE PATHNAMES OFF
9670           When receiving a file, strip all disk/directory information
9671           from the name before attempting to store it. This applies to
9672           incoming filename, not to any as-name you might specify.
9673           Example: If a file arrives under the name
9674           "/usr/olga/letters/oofa.txt" it is stored simply as "oofa.txt"
9675           in your download directory or, if no download directory has
9676           been specified, in your current directory.
9677
9678    SET RECEIVE PATHNAMES RELATIVE
9679           When receiving a file, leave the pathname on as it appears in
9680           the incoming name, but if the incoming name appears to be
9681           absolute, make it relative to your current or download
9682           directory. Examples:
9683
9684           + "oofa.txt" is stored as "oofa.txt".
9685           + "letters/oofa.txt" is stored as "letters/oofa.txt"; the
9686             "letters" subdirectory is created if it does not already
9687             exist.
9688           + "/usr/olga/letters/oofa.txt" is stored as
9689             "usr/olga/letters/oofa.txt" in your current or download
9690             directory, and the "usr", "usr/olga", etc, directories are
9691             created if they do not exist.
9692
9693    SET RECEIVE PATHNAMES ABSOLUTE
9694           The incoming filename is used as given. Thus it cannot be
9695           stored unless the given path (if any) already exists or can be
9696           created. In this case, node, device, or disk designations are
9697           NOT stripped, since they most likely were given explicitly by
9698           the user as an as-name, meant to be used as given.
9699
9700    SET RECEIVE PATHNAMES AUTO
9701           This is the default, and means RELATIVE if the sender tells me
9702           it is a recursive transfer, OFF otherwise.
9703
9704    Set FILE NAMES CONVERTED now also affects pathnames too. When
9705    PATHNAMES are RELATIVE or ABSOLUTE and FILE NAMES are CONVERTED, the
9706    file sender converts its native directory-name format to UNIX format,
9707    and the file receiver converts from UNIX format to its native one;
9708    thus UNIX format is the common intermediate representation for
9709    directory hierarchies, as it is in the ZIP/UNZIP programs (which is
9710    why ZIP archives are transportable among, UNIX, DOS, and VMS).
9711
9712    Here's an example in which a file is sent from Windows to UNIX with
9713    relative pathnames and FILE NAMES CONVERTED:
9714
9715   Source name                Intermediate name      Destination Name
9716   C:\K95\TMP\OOFA.TXT        K95/TMP/OOFA.TXT       k95/tmp/oofa.txt
9717
9718    In a more complicated example, we send the same file from Windows to
9719    VMS:
9720
9721   Source name                Intermediate name      Destination Name
9722   C:\K95\TMP\OOFA.TXT        K95/TMP/OOFA.TXT       [.K95.TMP]OOFA.TXT
9723
9724    (Note that disk letters and device designations are always stripped
9725    when pathnames are relative).
9726
9727    As you can imagine, as more and more directory formats are considered,
9728    this approach keeps matters simple: on each platform, Kermit must know
9729    only its own local format and the common intermediate one. In most
9730    cases, the receiver can detect which format is used automatically.
9731      _________________________________________________________________
9732
9733   4.11. Recursive SEND and GET: Transferring Directory Trees
9734
9735    C-Kermit 7.0 in selected versions (UNIX, VMS, VOS, AOS/VS, Windows,
9736    and OS/2 at this writing) now permits the SEND command to traverse
9737    directories "recursively" if you ask it to; that is, to send files
9738    from the current or specified directory and all of its subdirectories
9739    too, and their subdirectories, etc. (Some other commands can do this
9740    too, including DIRECTORY.)
9741
9742    This feature is new to UNIX, Windows, VOS, and OS/2. VMS and AOS/VS
9743    have always included "wildcard" or "template" characters that allow
9744    this, and in this case, recursive directory traversal could happen
9745    behind Kermit's back, i.e. Kermit does not have to do it itself (in
9746    VMS, the notation is "[...]" or "[directory...]"; in AOS/VS is "#").
9747    In C-Kermit 7.0, however, SEND /RECURSIVE is supported by C-Kermit
9748    itself for VMS.
9749      _________________________________________________________________
9750
9751     4.11.1. Command-Line Options
9752
9753    To descend a directory tree when sending files, use the -L
9754    command-line option to indicate that the send operation is to be
9755    recursive, and include a name or pattern to be sent. When giving a
9756    pattern, you should enclose it in quotes to prevent the shell from
9757    expanding it. Examples:
9758
9759   $ kermit -Ls "/usr/olga/*" # send all of Olga's files in all her directories
9760   $ kermit -Ls foo.txt       # send all foo.txt files in this directory tree
9761   $ kermit -Ls "*.txt"       # send all .txt files in this directory tree
9762   $ kermit -Ls "letters/*"   # send all files in the letters directory tree
9763   $ kermit -Ls letters       # send all files in the letters directory tree
9764   $ kermit -Ls "*"           # send all files in this directory tree
9765   $ kermit -Ls .             # UNIX only: send all files in this directory tree
9766   $ kermit -s .              # UNIX only: a filename of . implies -L
9767
9768    If you let the shell expand wildcards, Kermit only sends files whose
9769    names match files in the current or given directory, because the shell
9770    replaces an unquoted wildcard expression with the list of matching
9771    files -- and the shell does not build recursive lists. Note that the
9772    "." notation for the tree rooted at the current directory is allowed
9773    only in UNIX, since in Windows and OS/2, it means "*.*"
9774    (nonrecursive).
9775      _________________________________________________________________
9776
9777     4.11.2. The SEND /RECURSIVE Command
9778
9779    If you include the /RECURSIVE switch in a SEND (or MOVE, or similar)
9780    command, it means to descend the current or specified directory tree
9781    searching for files whose names match the given name or pattern. Since
9782    this is not terribly useful unless you also include pathnames with the
9783    outbound files, the /RECURSIVE switch also includes an implicit
9784    /PATHNAMES:RELATIVE switch (which you can undo by including an
9785    explicit /PATHNAMES switch after the /RECURSIVE switch).
9786
9787    Examples:
9788
9789    SEND /RECURSIVE *
9790           Sends all of the files in the current directory and all the
9791           files in all of its subdirectories, and all of their
9792           subdirectories, etc, including their relative pathnames. Empty
9793           directories are not sent.
9794
9795    SEND /RECURSIVE /PATHNAMES:ABSOLUTE *
9796           Sends all of the files in the current directory and all the
9797           files in all of its subdirectories, and all of their
9798           subdirectories, etc, including their absolute pathnames.
9799
9800    SEND /RECURSIVE /PATHNAMES:OFF *
9801           Sends all of the files in the current directory and all the
9802           files in all of its subdirectories, and all of their
9803           subdirectories, etc, without pathnames.
9804
9805    SEND /RECURSIVE /usr/olga/*
9806           Sends all of the files in the /usr/olga directory and all the
9807           files in all of its subdirectories, and all of their
9808           subdirectories, etc.
9809
9810    SEND /RECURSIVE /usr/olga (or /usr/olga/)
9811           Same as above. If the name is a directory name (with or without
9812           a trailing slash), its files are sent, and those of its
9813           subdirectories, and their subdirectories, etc (see [503]Section
9814           4.9).
9815
9816    SEND /RECURSIVE /TEXT /usr/olga/*.txt
9817           As above, but only files whose names end with ".txt" are sent,
9818           and they are sent in text mode (as they would be by default
9819           anyway if SET FILE PATTERNS is ON or AUTO).
9820
9821    SEND .
9822           UNIX only: Send all the files in the current directory.
9823
9824    SEND /RECURSIVE .
9825           UNIX only: Sends all of the files in the current directory and
9826           all of its subdirectories, etc ([504]Section 4.9).
9827
9828    The /RECURSIVE switch is different from most other switches in that
9829    its effect is immediate (but still local to the command in which it is
9830    given), because it determines how filenames are to be parsed. For
9831    example, "send *.txt" fails with a parse error ("No files match") if
9832    there are no *.txt files in the current directory, but "send
9833    /recursive *.txt" succeeds if there are ".txt" files anywhere in the
9834    tree rooted at the current directory.
9835
9836    The /RECURSIVE switch also affects the file lists displayed if you
9837    type "?" in a filename field. "send ./?" lists the regular files in
9838    the current directory, but "send /recursive ./?" lists the entire
9839    directory tree rooted at the current directory.
9840      _________________________________________________________________
9841
9842     4.11.3. The GET /RECURSIVE Command
9843
9844    In a client/server setting, the client can also request a recursive
9845    transfer with:
9846
9847    GET /RECURSIVE [ other switches ] remote-filespec [ local-spec ]
9848
9849    In which remote file specification can be a directory name, a
9850    filename, a wildcard, or any combination. If the local-spec is not
9851    given (and PATHNAMES are RELATIVE), incoming files and directories go
9852    into the current local directory. If local-spec is given and is a
9853    directory, it becomes the root of the tree into which the incoming
9854    files and directories are placed. If local-spec has the syntax of a
9855    directory name (e.g. in UNIX it ends with /), C-Kermit creates the
9856    directory and then places the incoming files into it. If local-spec is
9857    a filename (not recommended), then all incoming files are stored with
9858    that name with collisions handled according to the FILE COLLISION
9859    setting.
9860
9861    Again, the normal method for transferring directory trees uses
9862    relative pathnames, and this is the default when the sender has been
9863    given the /RECURSIVE switch. The action at the receiver depends on its
9864    RECEIVE PATHNAMES setting. The default is AUTO, meaning that if the
9865    sender tells it to expect a recursive transfer, then it should
9866    automatically switch to relative pathnames for this transfer only;
9867    otherwise it obeys the RECEIVE PATHNAMES setting of OFF, ABSOLUTE, or
9868    RELATIVE.
9869
9870    What happens if a file arrives that has an absolute pathname, when the
9871    receiver has been told to use only relative pathnames? As a security
9872    precaution, in this case the receiver treats the name as if it was
9873    relative. For example, if a file arrives as:
9874
9875   /usr/olga/oofa.txt
9876
9877    The receiver creates a "usr" subdirectory in its current directory,
9878    and then an "olga" subdirectory under the "usr" subdirectory in which
9879    to store the incoming file.
9880
9881    Suppose, however there is a sequence of directories:
9882
9883   /usr/olga/a/b/c/d/
9884
9885    in which "a" contains nothing but a subdirectory "b", which in turn
9886    contains nothing but a subdirectory "c", which in turn contains
9887    nothing but a subdirectory "d", which contains nothing at all. Thus
9888    there are no files in the "/usr/olga/a/" tree, and so it is not sent,
9889    and therefore it is not reproduced on the target computer.
9890      _________________________________________________________________
9891
9892     4.11.4. New and Changed File Functions
9893
9894    C-Kermit 7.0 adds the following functions:
9895
9896    \ffiles(pattern[,&a])
9897           This function has been changed to match only regular files in
9898           the current or given directory, and to take an optional array
9899           name as a second argument (explained below).
9900
9901    \fdirectories(pattern[,&a])
9902           Returns the number of directories that match the given pattern.
9903           If the pattern does not include a directory, then the search is
9904           performed in the current directory.
9905
9906    \frfiles(pattern[,&a])
9907           Returns the number of files in the current or given directory
9908           and all of its subdirectories, and their subdirectories, etc,
9909           that match the given pattern. Warning -- this one can take
9910           quite some time if performed at the root of a large directory
9911           tree.
9912
9913    \frdirectories(pattern[,&a])
9914           Returns the number of directories in the current or given
9915           directory and all of its subdirectories, and their
9916           subdirectories, etc, that match the given pattern.
9917
9918    Each of these functions builds up a list of files to be returned by
9919    the \fnextfile() function, just as \ffiles() always has done. (This
9920    can also be done with the /ARRAY switch of the DIRECTORY command; see
9921    [505]Sections 4.5.1 and [506]7.10).
9922
9923    Each of these functions can be given an array name as an optional
9924    second argument. If an array name is supplied, the array will contain
9925    the number of files as its 0th element, and the filenames in elements
9926    1 through last. If the array already existed, its previous contents
9927    are lost. For example, if the current directory contains two files,
9928    oofa.txt and foo.bar, then "\ffiles(*,&a)" creates an array \&a[] with
9929    a dimension of 2, containing the following elements:
9930
9931  \&a[0] = 2
9932  \&a[1] = oofa.txt
9933  \&a[2] = foo.bar
9934
9935    If no files match the specification given in the first argument, the
9936    array gets a dimension of 0, which is the same as undeclaring the
9937    array.
9938
9939    Note that the order in which the array is filled (and in which
9940    \fnextfile() returns filenames) is indeterminate (but see [507]Section
9941    7.10.5).
9942
9943    Here's an example that builds and prints a list of all the file whose
9944    names end in .txt in the current directory and all its descendents:
9945
9946   asg \%n \frfiles(*.txt)
9947   declare \&a[\%n]
9948   for \%i 1 \%n 1 {
9949       asg \&a[\%i] \fnextfile()
9950       echo \flpad(\%i,4). "\&a[\%i]"
9951   }
9952
9953    Alternatively, using the array method, and then printing the filenames
9954    in alphabetic order (see [508]Section 7.10.3 and [509]7.10.5):
9955
9956   asg \%n \frfiles(*.txt,&a)
9957   sort &a
9958   for \%i 1 \%n 1 {
9959       echo \flpad(\%i,4). "\&a[\%i]"
9960   }
9961
9962    Or even more simply:
9963
9964   asg \%n \frfiles(*.txt,&a)
9965   sort &a
9966   show array &a
9967
9968    As noted elsewhere, the file lists built by \ffiles(), \frfiles(),
9969    etc, are now "safe" in the sense that SEND and other file-related
9970    commands can reference \fnextfile() without resetting the list:
9971
9972   set send pathnames relative
9973   for \%i 1 \frfiles(*.txt) 1 {
9974       asg \%a \fnextfile()
9975       echo Sending \%a...
9976       send \%a
9977       if fail break
9978   }
9979
9980    Copying to an array (as shown on p.398 of [510]Using C-Kermit 2nd Ed)
9981    is no longer necessary.
9982      _________________________________________________________________
9983
9984     4.11.5. Moving Directory Trees Between Like Systems
9985
9986     4.11.5.1. UNIX to UNIX
9987
9988    Transferring a directory tree from one computer to another replicates
9989    the file sender's arrangement of files and directories on the file
9990    receiver's computer. Normally this is done using relative pathnames,
9991    since the user IDs might not be identical on the two computers. Let's
9992    say both computers are UNIX based, running C-Kermit 7.0 or later. On
9993    the sending computer (leaving out the connection details, etc):
9994
9995   C-Kermit> cd /usr/olga
9996   C-Kermit> send /recursive .
9997
9998    The /RECURSIVE switch tells C-Kermit to descend through the directory
9999    tree and to include relative pathnames on outbound filenames.
10000
10001    On the receiving computer:
10002
10003   C-Kermit> mkdir olgas-files           ; Make a new directory.
10004   C-Kermit> cd olgas-files              ; CD to it.
10005   C-Kermit> receive /recursive          ; = /PATHNAMES:RELATIVE
10006
10007    Each Kermit program recognizes that the other is running under UNIX
10008    and switches to binary mode and literal filenames automatically.
10009    Directories are automatically created on the receiving system as
10010    needed. File dates and permissions are automatically reproduced from
10011    source to destination.
10012
10013     4.11.5.2. VMS to VMS
10014
10015    To send recursively from VMS, simply include the /RECURSIVE switch,
10016    for example at the sender:
10017
10018   $ kermit
10019   C-Kermit> cd [olga]
10020   C-Kermit> send /recursive *.*;0
10021
10022    And at the receiver:
10023
10024   C-Kermit> cd [.olga]
10025   C-Kermit> receive /recursive
10026
10027    The notation "..." within directory brackets in VMS means "this
10028    directory and all directories below it"; the /RECURSIVE switch, when
10029    given to the sender, implies the use of "..." in the file
10030    specification so you don't have to include "..."; but it makes no
10031    difference if you do:
10032
10033   $ kermit
10034   C-Kermit> send /recursive [olga...]*.*;0
10035
10036    And at the receiver:
10037
10038   C-Kermit> cd [.olga]
10039   C-Kermit> receive /recursive
10040
10041    In either case, since both systems recognize each other as VMS, they
10042    switch into LABELED transfer mode automatically.
10043      _________________________________________________________________
10044
10045     4.11.6. Moving Directory Trees Between Unlike Systems
10046
10047    There are several difficulties with recursive transfers between unlike
10048    systems:
10049
10050      * File formats can be different, especially text files character
10051        sets and record formats. This can now be handled by using SET FILE
10052        PATTERN, SET FILE TEXT-PATTERNS, and SET FILE BINARY-PATTERNS
10053        ([511]Section 4.3).
10054      * File naming conventions are different. For example, one system
10055        might allow (and use) longer filenames than the other. You can
10056        tell Kermit how to handle file names with the normal "set file
10057        names" and "set file collision" mechanisms. Most modern Kermits
10058        are fairly tolerant of illegal filenames and should not fail
10059        simply because of an incoming filename; rather, it will do its
10060        best to convert it to a recognizable and unique legal filename.
10061      * Directory notations can be different, e.g. backslashes instead of
10062        slashes, brackets, parentheses, spaces, etc. But this is now
10063        handled by converting pathnames to a standard format during
10064        transfer ([512]Section 4.10).
10065
10066    So now, for the first time, it is possible to send directory trees
10067    among any combination of UNIX, DOS, Windows, OS/2, VMS, AOS/VS, etc.
10068    Here's an example sending files from an HP-UX system (where text files
10069    are encoded in the HP Roman8 character set) to a PC with K95 (where
10070    text files are encoded in CP850):
10071
10072  Sender:
10073   cd xxx                           ; CD to root of source tree
10074   set file type binary             ; Default transfer mode
10075   set file character-set hp-roman8 ; Local character set for text files
10076   set xfer character-set latin1    ; Transfer character set
10077   set file patterns on             ; Enable automatic file-type switching...
10078   set file binary-patterns *.Z *.gz *.o  ; based on these patterns...
10079   set file text-patterns *.txt *.c *.h   ; for binary and text files.
10080   send /recursive *                ; Send all the file in this directory tree
10081
10082  Receiver:
10083   cd yyy                           ; CD to root of destination tree
10084   set file character-set cp850     ; Local character set for text files
10085   receive /pathnames:relative      ; Receive with pathnames
10086
10087    Notes:
10088      * Replace "xxx" and "yyy" with the desired directories.
10089      * Replace the file character sets appropriately.
10090      * Change the patterns as needed (or just use the built-in default
10091        lists).
10092      * SEND /RECURSIVE also implies /PATHNAMES:RELATIVE.
10093      * The file sender tells the file receiver the transfer mode of each
10094        file.
10095      * The file sender tells the file receiver the transfer character
10096        set.
10097      * By default, destination file dates will be the same as on the
10098        source.
10099      * Many of the settings shown might already be set by default.
10100      * See [513]Sections 4.3, [514]4.10, and [515]4.15 for additional
10101        explanation.
10102
10103    If you are refreshing an existing directory on the destination
10104    computer, use "set file collision update" or other appropriate file
10105    collision option to handle filename collisions.
10106      _________________________________________________________________
10107
10108   4.12. Where Did My File Go?
10109
10110    Now that Kermit can be started by clicking on desktop icons (thus
10111    obscuring the concept of "current directory"), and can have a download
10112    directory, and can create directories for incoming files on the fly,
10113    etc, sometimes it is easy to lose a file after transfer. Of course, if
10114    you keep a transaction log:
10115
10116   LOG TRANSACTIONS
10117
10118    it will record the fate and final resting place of each file. But in
10119    case you did not keep a log, the new command:
10120
10121   WHERE
10122
10123    added in C-Kermit 7.0, gives you as much information as it has about
10124    the location of the last files transferred, including the pathname
10125    reported by the receiving Kermit, if any, when C-Kermit is the sender.
10126    This information was also added to SHOW FILE in somewhat less detail.
10127      _________________________________________________________________
10128
10129   4.13. File Output Buffer Control
10130
10131    (UNIX only). The new command SET FILE OUTPUT lets you control how
10132    incoming files are written to disk:
10133
10134    SET FILE OUTPUT BUFFERED [ size ]
10135           Chooses buffered file output; this is the default. UNIX does
10136           its normal sort of disk buffering. The optional size specifies
10137           Kermit's own file output buffer size, and therefore the
10138           frequency of disk accesses (write() system calls) -- the bigger
10139           the size, the fewer the disk accesses.
10140
10141    SET FILE OUTPUT UNBUFFERED [ size ]
10142           This forces each file output write() call to actually commit
10143           the data to disk immediately. Choosing this option will usually
10144           slow file reception down.
10145
10146    SET FILE OUTPUT BLOCKING
10147           Write() calls should not return until they are complete. This
10148           is the normal setting, and it lets Kermit detect disk-write
10149           errors immediately.
10150
10151    SET FILE OUTPUT NONBLOCKING
10152           Write() calls should return immediately. This can speed up file
10153           reception, but also delay the detection of disk-write errors.
10154
10155    Experimentation with these parameters should be harmless, and might
10156    (or might not) have a perceptible, even dramatic, effect on
10157    performance.
10158      _________________________________________________________________
10159
10160   4.14. Improved Responsiveness
10161
10162    In version 7.0, C-Kermit's file-transfer protocol engine has been
10163    tuned for additional speed and responsiveness.
10164
10165      * Binary-mode transfers over 8-bit connections, a very common case,
10166        are now handled in a special way that minimizes overhead.
10167      * SET TRANSFER CRC-CALCULATION is now OFF by default, rather than
10168        ON. (This affects only the overall per-transfer CRC, \v(crc16),
10169        not the per-packet CRCs)
10170      * Connection loss during file transfer is now detected immediately
10171        in most cases on Internet connections and on serial connections
10172        when CARRIER-WATCH is not set to OFF.
10173      _________________________________________________________________
10174
10175   4.15. Doubling and Ignoring Characters for Transparency
10176
10177    The following commands were added in 7.0, primarily to allow
10178    successful file transfer through ARPAnet TACs and with Honeywell DPS6
10179    systems, but can be used in any setting where they might be needed:
10180
10181    SET SEND DOUBLE-CHAR { [ char [ char [ ... ] ] ], NONE }
10182           Tells C-Kermit to double the specified characters (use decimal
10183           notation) in packets that it sends. For example, if you are
10184           sending files through a device that uses @ as an escape
10185           character, but allows you to send a single copy of @ through by
10186           doubling it, use "set send double 64".
10187
10188    SET RECEIVE IGNORE-CHAR [ char [ char [ ... ] ] ]
10189           Tells C-Kermit to ignore the specified character(s) in incoming
10190           packets. Use this, for example, when something between the
10191           sender and receiver is inserting linefeeds for wrapping, NULs
10192           for padding, etc.
10193      _________________________________________________________________
10194
10195   4.16. New File-Transfer Display Formats
10196
10197    SET TRANSFER DISPLAY { BRIEF, CRT, FULLSCREEN, NONE, SERIAL }
10198           Selects the file-transfer display format.
10199
10200    BRIEF is the new one. This writes one line to the screen per file,
10201    showing the file's name, transfer mode, size, the status of the
10202    transfer, and when the transfer is successful, the effective data rate
10203    in characters per second (CPS). Example:
10204
10205   SEND ckcfn3.o (binary) (59216 bytes): OK (0.104 sec, 570206 cps)
10206   SEND ckcfns.o (binary) (114436 bytes): OK (0.148 sec, 772006 cps)
10207   SEND ckcmai.c (text) (79147 bytes): OK (0.180 sec, 438543 cps)
10208   SEND ckcmai.o (binary) (35396 bytes): OK (0.060 sec, 587494 cps)
10209   SEND ckcnet.o (binary) (62772 bytes): REFUSED
10210   SEND ckcpro.o (binary) (121448 bytes): OK (0.173 sec, 703928 cps)
10211   SEND ckcpro.w (text) (63687 bytes): OK (0.141 sec, 453059 cps)
10212   SEND makefile (text) (186636 bytes): OK (0.444 sec, 420471 cps)
10213   SEND wermit (binary) (1064960 bytes): OK (2.207 sec, 482477 cps)
10214
10215    Note that transfer times are now obtained in fractional seconds,
10216    rather than whole seconds, so the CPS figures are more accurate (the
10217    display shows 3 decimal places, but internally the figure is generally
10218    precise to the microsecond).
10219      _________________________________________________________________
10220
10221   4.17. New Transaction Log Formats
10222
10223    The new command:
10224
10225   SET TRANSACTION-LOG { VERBOSE, FTP, BRIEF [ separator ] }
10226
10227    lets you choose the format of the transaction log. VERBOSE (the
10228    default) indicates the traditional format described in the book. BRIEF
10229    and FTP are new. This command must be given prior to the LOG
10230    TRANSACTION command if a non-VERBOSE type is desired.
10231
10232     4.17.1. The BRIEF Format
10233
10234    BRIEF chooses a one-line per file format suitable for direct
10235    importation into databases like Informix, Oracle, or Sybase, in which:
10236
10237      * Each record has 8 fields.
10238      * Fields are separated by a non-alphanumeric separator character.
10239      * The default separator character is comma (,).
10240      * Any field containing the separator character is enclosed in
10241        doublequotes.
10242      * The final field is enclosed in doublequotes.
10243
10244    The fields are:
10245
10246     1. Date in yyyymmdd format
10247     2. Time in hh:mm:ss format
10248     3. Action: SEND or RECV
10249     4. The local filename
10250     5. The size of the file
10251     6. The transfer mode (text, binary, image, labeled)
10252     7. The status of the transfer: OK or FAILED
10253     8. Additional status-dependent info, in doublequotes.
10254
10255    Examples:
10256
10257   20000208,12:08:52,RECV,/u/olga/oofa.txt,5246,text,OK,"0.284sec 18443cps"
10258   20000208,12:09:31,SEND,/u/olga/oofa.exe,32768,binary,OK,"1.243sec 26362cps"
10259   20000208,12:10:02,SEND,"/u/olga/a,b",10130,text,FAILED,"Refused: date"
10260
10261    Note how the filename is enclosed in doublequotes in the final
10262    example, because it contains a comma.
10263
10264    To obtain BRIEF format, you must give the SET TRANSACTION-LOG BRIEF
10265    command before the LOG TRANSACTIONS command. (If you give them in the
10266    opposite order, a heading is written to the log by the LOG command.)
10267      _________________________________________________________________
10268
10269     4.17.2. The FTP Format
10270
10271    SET TRANSACTION-LOG FTP (available only in UNIX) chooses a format that
10272    is compatible with the WU-FTPD (Washington University FTP daemon) log,
10273    and so can be processed by any software that processes the WU-FTPD
10274    log. It logs only transfers in and out, both successful and failed
10275    (but success or failure is not indicated, due to lack of a field in
10276    the WU-FTPD log format for this purpose). Non-transfer events are not
10277    recorded.
10278
10279    Unlike other logs, the FTP-format transaction log is opened in append
10280    mode by default. This allows you to easily keep a record of all your
10281    kermit transfers, and it also allows the same log to be shared by
10282    multiple simultaneous Kermit processes or (permissions permitting)
10283    users. You can, of course, force creation of a new logfile by
10284    specifying the NEW keyword after the filename, e.g.
10285
10286   log transactions oofa.log new
10287
10288    All records in the FTP-style log are in a consistent format. The first
10289    field is fixed-length and contains spaces; subsequent fields are
10290    variable length, contain no spaces, and are separated by one or more
10291    spaces. The fields are:
10292
10293    Timestamp
10294           This is an asctime-style timestamp, example: "Wed Sep 16
10295           20:19:05 1999" It is always exactly 24 characters long, and the
10296           subfields are always in fixed positions.
10297
10298    Elapsed time
10299           The whole number of seconds required to transfer the file, as a
10300           string of decimal digits, e.g. "24".
10301
10302    Connection
10303           The name of the network host to which C-Kermit is connected, or
10304           the name of the serial device through which it has dialed (or
10305           has a direct connection), or "/dev/tty" for transfers in remote
10306           mode.
10307
10308    Bytes transferred
10309           The number of bytes transferred, decimal digits, e.g.
10310           "1537904".
10311
10312    Filename
10313           The name of the file that was transferred, e.g.
10314           "/pub/ftp/kermit/a/README.TXT". If the filename contains any
10315           spaces or control characters, each such character is replaced
10316           by an underscore ('_') character.
10317
10318    Mode
10319           The letter 'b' if the file was transferred in binary mode, or
10320           'a' if it was transferred in text (ASCII) mode.
10321
10322    Options
10323           This field always contains an underscore ('_') character.
10324
10325    Direction
10326           The letter 'o' if the file was transferred Out, and 'i' if the
10327           file was transferred In.
10328
10329    User class
10330           The letter 'r' indicates the file was transferred by a Real
10331           user.
10332
10333    User identification
10334           The ID of the user who transferred the file.
10335
10336    Server identification
10337           The string "kermit". This distinguishes a Kermit transfer log
10338           record from a WU-FTPD record, which contains "ftp" in this
10339           field.
10340
10341    Authentication class
10342           The digit '1' if we know the user's ID on the client system,
10343           otherwise '0'. Currently, always '0'.
10344
10345    Authenticated user
10346           If the authentication class is '1', this is the user's ID on
10347           the client system. Otherwise it is an asterisk ('*'). Currently
10348           it is always an asterisk.
10349
10350    Examples:
10351
10352   Thu Oct 22 17:42:48 1998 0 * 94 /usr/olga/new.x a _ i r olga kermit 0 *
10353   Thu Oct 22 17:51:29 1998 1 * 147899 /usr/olga/test.c a _ o r olga kermit 0 *
10354   Thu Oct 22 17:51:44 1998 1 * 235 /usr/olga/test.o b _ i r olga kermit 0 *
10355   Fri Oct 23 12:10:25 1998 0 * 235 /usr/olga/x.ksc a _ o r olga kermit 0 *
10356
10357    Note that an ftp-format transaction log can also be selected on the
10358    Kermit command line as follows:
10359
10360   kermit --xferfile:filespec
10361
10362    This is equivalent to:
10363
10364   SET TRANSACTION-LOG FTP
10365   LOG TRANSACTIONS filespec APPEND
10366
10367    Conceivably it could be possible to have a system-wide shared Kermit
10368    log, except that UNIX lacks any notion of an append-only file; thus
10369    any user who could append to the log could also delete it (or alter
10370    it). This problem could be worked around using setuid/setgid tricks,
10371    but these would most likely interfere with the other setuid/setgid
10372    tricks C-Kermit must use for getting at dialout devices and UUCP
10373    logfiles.
10374      _________________________________________________________________
10375
10376   4.18. Unprefixing NUL
10377
10378    As of 6.1.193 Alpha.10, C-Kermit can finally send and receive
10379    file-transfer packets in which NUL (ASCII 0) is unprefixed (no more
10380    NUL-terminated packets!). NUL is, of course, extremely prevalent in
10381    binary files such as executables, and this has been a significant
10382    source of packet overhead. For example, when transferring itself (the
10383    SunOS C-Kermit executable) with minimal prefixing and 9000-byte
10384    packets, we see:
10385
10386   File size:                       1064960
10387   Packet chars with 0 prefixed:    1199629  overhead = 12.65%
10388   Packet chars with 0 unprefixed:  1062393  overhead = -0.03%
10389
10390    Transfer rates go up accordingly, not only because of the reduced
10391    amount of i/o, but also because less computation is required on each
10392    end.
10393      _________________________________________________________________
10394
10395   4.19. Clear-Channel Protocol
10396
10397    Now that C-Kermit itself is capable of sending and receiving any byte
10398    at all on a clear channel ([516]Section 4.18), it is, for the first
10399    time, in a position to negotiate a clear channel with the other
10400    Kermit, giving it permission (but not requiring it) to unprefix any
10401    and all characters that it knows are safe. In general this means all
10402    but the Kermit start-of-packet character (normally Ctrl-A), Carriage
10403    Return (not only Kermit's end-of-packet character, but also treated
10404    specially on Telnet NVT links), and IAC (255, also special to Telnet).
10405
10406    By default, C-Kermit will say it has a clear channel only if it has
10407    opened a TCP socket. Since the Kermit program on the far end of a
10408    TCP/IP connection generally does not know it has a TCP/IP connection,
10409    it will not announce a clear channel unless it has been told to do so.
10410    The command is:
10411
10412    SET CLEAR-CHANNEL { ON, OFF, AUTO }
10413
10414    AUTO is the default, meaning that the clear-channel status is
10415    determined automatically from the type of connection. ON means to
10416    announce a clear channel, OFF means not to announce it. Use SHOW
10417    STREAMING ([517]Section 4.20) to see the current CLEAR-CHANNEL status.
10418    Synonym: SET CLEARCHANNEL.
10419
10420    CLEAR-CHANNEL is also set if you start C-Kermit with the -I switch
10421    (see [518]Section 4.20).
10422
10423    Whenever a clear channel is negotiated, the resulting
10424    control-character unprefixing is "sticky"; that is, it remains in
10425    effect after the transfer so you can use SHOW CONTROL to see what was
10426    negotiated.
10427
10428    You can also see whether a clear channel was negotiated in the
10429    STATISTICS /VERBOSE Display.
10430
10431    The advantage of the clear channel feature is that it can make file
10432    transfers go faster automatically. The disadvantage would be
10433    file-transfer failures if the channel is not truly clear, for example
10434    if C-Kermit made a Telnet connection to a terminal server, and then
10435    dialed out from there; or if C-Kermit made an Rlogin connection to
10436    host and then made a Telnet connection from there to another host. If
10437    a file transfer fails on a TCP/IP connection, use SHOW CONTROL to
10438    check whether control characters became unprefixed as a result of
10439    protocol negotiations, and/or SHOW STREAMING ([519]Section 4.20) to
10440    see if "clear-channel" was negotiated. If this happened, use SET
10441    CLEAR-CHANNEL OFF and SET PREFIXING CAUTIOUS (or whatever) to prevent
10442    it from happening again.
10443      _________________________________________________________________
10444
10445   4.20. Streaming Protocol
10446
10447    A new Kermit protocol option called "streaming" was added in C-Kermit
10448    7.0. The idea is that if the two Kermit partners have a reliable
10449    transport (such as TCP/IP or X.25) between them, then there is no need
10450    to send ACKs for Data packets, or NAKs, since a reliable transport
10451    will, by definition, deliver all packets in order and undamaged. On
10452    such a connection, streaming cuts down not only on Kermit program
10453    overhead (switching back and forth between reading and sending
10454    packets), but also tends to make the underlying transport use itself
10455    more efficiently (e.g. by defeating the Nagle algorithm and/or Delayed
10456    ACK stratagem of the TCP layer). Furthermore, it allows transfers to
10457    work smoothly on extremely slow network congestions that would
10458    otherwise cause timeouts and retransmissions, and even failure when
10459    the retry limit was exceeded.
10460
10461    The trick is knowing when we can stream:
10462
10463     1. If C-Kermit has opened a TCP socket or X.25 connection, it offers
10464        stream.
10465     2. If C-Kermit has been started with the -I (uppercase) option, or if
10466        it has been told to SET RELIABLE ON, it offers to stream.
10467     3. If C-Kermit is in remote mode, and has been told to SET RELIABLE
10468        AUTO (or ON), it always offers to stream, and also always agrees
10469        to stream, if the other Kermit offers. Unless you take explicit
10470        actions to override the defaults, this allows the local Kermit
10471        (the one that made the connection, and so knows whether it's
10472        reliable) to control streaming.
10473
10474    (Note that an offer to stream also results in a Clear-Channel
10475    announcement if CLEAR-CHANNEL is set to AUTO; see [520]Section 4.19.)
10476
10477    When BOTH Kermits offer to stream, then they stream; otherwise they
10478    don't. Thus streaming-capable Kermit programs interoperate
10479    automatically and transparently with nonstreaming ones. If the two
10480    Kermits do agree to stream, you'll see the word "STREAMING" on the
10481    fullscreen file-transfer display in the Window Slots field. You can
10482    also find out afterwards with the STATISTICS or SHOW STREAMING
10483    commands.
10484
10485      WARNING: Automatic choice of streaming is based on the assumption
10486      of a "direct" end-to-end network connection; for example, a Telnet
10487      or Rlogin connection from host A to host B, and transferring files
10488      between A and B. However, if your connection has additional
10489      components -- something "in the middle" (B) that you have made a
10490      network connection to, which makes a separate connection to the
10491      destination host (C), then you don't really have a reliable
10492      connection, but C-Kermit has no way of knowing this; transferring
10493      files between A and C will probably fail. In such cases, you'll
10494      need to tell the *local* C-Kermit to "set reliable off" before
10495      transferring files (it does no good to give this command to the
10496      remote Kermit since the local one controls the RELIABLE setting).
10497
10498    Streaming is like using an infinite window size, with no timeouts and
10499    no tolerance for transmission errors (since there shouldn't be any).
10500    It relies on the underlying transport for flow control, error
10501    correction, timeouts, and retransmission. Thus it is very suitable for
10502    use on TCP/IP connections, especially slow or bursty ones, since
10503    Kermit's packet timeouts won't interfere with the transfer -- each
10504    packet takes as long to reach its destination as it takes TCP to
10505    deliver it. If TCP can't deliver the packet within its own timeout
10506    period (over which Kermit has no control), it signals a fatal error.
10507    Just like FTP.
10508
10509    Streaming goes much faster than non-streaming when a relatively small
10510    packet length is used, and it tends to go faster than non-streaming
10511    with even the longest packet lengths. The Kermit window size is
10512    irrelevant to streaming protocol, but still might affect performance
10513    in small ways since it can result in different paths through the code.
10514
10515    The definition of "reliable transport" does not necessarily demand
10516    8-bit and control-character transparency. Streaming can work with
10517    parity and/or control-character prefixing just as well (but not as
10518    fast) as without them; in such cases you can leave RELIABLE set to ON,
10519    but set CLEARCHANNEL and/or PARITY appropriately.
10520
10521    Maximum performance -- comparable to and often exceeding FTP -- is
10522    achieved on socket-to-socket connections (in which the considerable
10523    overhead of the terminal driver and Telnet or Rlogin server is
10524    eliminated) with long packets and the new "brief" file-transfer
10525    display ([521]Section 4.16).
10526      _________________________________________________________________
10527
10528     4.20.1. Commands for Streaming
10529
10530    SET RELIABLE { ON, OFF, AUTO }
10531           SET RELIABLE ON tells Kermit that it has a reliable transport.
10532           SET RELIABLE OFF tells Kermit the transport is not reliable.
10533           SET RELIABLE AUTO tells Kermit that it should SET RELIABLE ON
10534           whenever it makes a reliable connection (e.g. TELNET or SET
10535           HOST on a TCP/IP or X.25 network), and when in remote mode it
10536           should believe the transport is reliable if the other Kermit
10537           says it is during Kermit protocol negotiation.
10538
10539    AUTO is the default; the Kermit program that makes the connection
10540    knows whether it is reliable, and tells the remote Kermit.
10541
10542    The RELIABLE setting has several effects, including:
10543
10544      * It can affect the timeouts used during normal ACK/NAK protocol.
10545      * It can affect the clear-channel announcement.
10546      * It can affect streaming.
10547
10548    If you TELNET or SET HOST somewhere, this includes an implicit SET
10549    RELIABLE ON command. The -I command-line option is equivalent to SET
10550    RELIABLE ON.
10551
10552    Since SET RELIABLE ON (and -I) also implies SET CLEAR CHANNEL ON, you
10553    might find that in certain cases you need to tell Kermit that even
10554    though the connection is reliable, it doesn't have a clear channel
10555    after all:
10556
10557   SET CLEAR-CHANNEL OFF
10558   SET PREFIXING CAUTIOUS ; or whatever...
10559
10560    You can control streaming without affecting the other items with:
10561
10562   SET STREAMING { ON, OFF, AUTO }
10563
10564    AUTO is the default, meaning streaming will occur if Kermit has made a
10565    TCP/IP connection or if RELIABLE is ON (or it was started with the -I
10566    command line option). OFF means don't stream; ON means offer to stream
10567    no matter what.
10568      _________________________________________________________________
10569
10570     4.20.2. Examples of Streaming
10571
10572    Here we look at the use and behavior of streaming on several different
10573    kinds of connections, and compare its performance with non-streaming
10574    transfers.
10575
10576     4.20.2.1. Streaming on Socket-to-Socket Connections
10577
10578    Here we get streaming automatically when both Kermit programs are
10579    capable of it, since they both make socket connections. For example,
10580    on the far end:
10581
10582   C-Kermit> set host * 3000
10583   C-Kermit> server
10584
10585    and on the near end:
10586
10587   C-Kermit> set host foo.bar.xyz.com 3000
10588   (now give SEND and GET command)
10589
10590    All subsequent file transfers use streaming automatically.
10591
10592    Here are the results from 84 trials, run on a production network,
10593    disk-to-disk, in which a 1-MB binary file (the SunOS C-Kermit Sparc
10594    executable) was sent from a Sun Sparc-10 with SunOS 4.1.3 to an IBM
10595    Power Server 850 with AIX 4.1, socket-to-socket, over a 10Mbps 10BaseT
10596    Ethernet, using minimal control-character unprefixing, window sizes
10597    from 10 to 32, and packet sizes from 1450 to 9010:
10598
10599                 Streaming    Nonstreaming
10600   Max CPS         748955        683354
10601   Min CPS         221522        172491
10602   Mean CPS        646134        558680
10603   Median CPS      678043        595874
10604   Std Dev         101424        111493
10605
10606    Correlations:
10607
10608   CPS and window size:   -0.036
10609   CPS and packet length:  0.254
10610   CPS and streaming:      0.382
10611
10612    Note that the relationship between streaming and throughput is
10613    significantly stronger than that between CPS and window size or packet
10614    length.
10615
10616    Also note that this and all other performance measurements in this
10617    section are snapshots in time; the results could be much different at
10618    other times when the load on the systems and/or the network is higher
10619    or lower.
10620
10621    In a similar socket-to-socket trial, but this time over a wide-area
10622    TCP/IP connection (from New York City to Logan, Utah, about 2000
10623    miles), the following results were obtained:
10624
10625                 Streaming    Nonstreaming
10626   Max CPS         338226        318203
10627   Min CPS         191659        132314
10628   Mean CPS        293744        259240
10629   Median CPS      300845        273271
10630   Std Dev          41914         52351
10631
10632    Correlations:
10633
10634   CPS and window size:    0.164
10635   CPS and packet length:  0.123
10636   CPS and streaming:      0.346
10637      _________________________________________________________________
10638
10639     4.20.2.2. Streaming on Telnet Connections
10640
10641    In this case the local copy of Kermit is told to TELNET or SET HOST,
10642    and so it knows it has a reliable connection and -- unless it has been
10643    told not to -- will offer to stream, and the other Kermit program,
10644    since it has STREAMING set to AUTO, agrees.
10645
10646    Since we have a reliable connection, we'll also get control-character
10647    unprefixing automatically because of the new clear-channel protocol
10648    ([522]Section 4.19).
10649
10650    Any errors that occur during streaming are fatal to the transfer. The
10651    message is "Transmission error on reliable link". Should this happen:
10652
10653     1. Check the remote Kermit's flow control setting (SHOW
10654        COMMUNICATIONS). If it is NONE, change it to XON/XOFF, or vice
10655        versa. If it is XON/XOFF (or you just changed it to XOFF/XOFF),
10656        make sure the file sender is prefixing the XON and XOFF
10657        characters. In the most drastic case, use "set prefix all" to
10658        force prefixing of all control characters.
10659     2. The remote Telnet server might chop off the 8th bit. In that case,
10660        tell C-Kermit to "set parity space". Or, you might be able to
10661        force the Telnet to allow eight-bit data by telling C-Kermit to
10662        "set telopt binary request accept" -- that is, request the Telnet
10663        server to enter binary mode, and accept binary-mode bids from the
10664        server.
10665     3. The remote Telnet server might have a buffering limitation. If a
10666        and b don't cure the problem, tell the file receiver to "set
10667        receive packet-length 1000" (or other number -- use the largest
10668        one that works). This too, is no different from the non-streaming
10669        case (more about this in [523]Section 4.20.2.3).
10670
10671    And remember you can continue interrupted binary-mode transfers where
10672    they left off with the RESEND (= SEND /RECOVER) command.
10673
10674    Here are the figures for the same 84 trials between the same Sun and
10675    IBM hosts as in 4.20.2.1, on the same network, but over a Telnet
10676    connection rather than socket-to-socket:
10677
10678                   Streaming    Nonstreaming
10679   Max CPS         350088        322523
10680   Min CPS          95547        173152
10681   Mean CPS        321372        281830
10682   Median CPS      342604        291469
10683   Std Dev          40503         29948
10684
10685    Correlations:
10686
10687   CPS and window size:    0.001
10688   CPS and packet length:  0.152
10689   CPS and streaming:      0.128
10690
10691    Here the effect is not as emphatic as in the socket-to-socket case,
10692    yet on the whole streaming tends to be beneficial.
10693
10694    Additional measurements on HP-UX using C-Kermit 7.0 Beta.06:
10695
10696                   Windowing     Streaming
10697   HP-UX 8->8      not tested       14Kcps
10698   HP-UX 8->9      not tested       76Kcps
10699   HP-UX 8->10      36Kcps          66Kcps
10700   HP-UX 9->9      not tested      190Kcps
10701   HP-UX 9->10     160Kcps         378Kcps
10702      _________________________________________________________________
10703
10704     4.20.2.3. Streaming with Limited Packet Length
10705
10706    The IRIX telnet server (at least the ones observed in IRIX 5.3 and
10707    6.2) does not allow Kermit to send packets longer than 4096 bytes.
10708    Thus when sending from IRIX C-Kermit when it is on the remote end of a
10709    Telnet connection, the packet length must be 4K or less. Trials in
10710    this case (in which packet lengths range from 1450 to 4000) show a
10711    strong advantage for streaming, which would be evident in any other
10712    case where the packet length is restricted, and stronger the shorter
10713    the maximum packet length.
10714
10715                   Streaming    Nonstreaming
10716   Max CPS         426187        366870
10717   Min CPS         407500        276517
10718   Mean CPS        415226        339168
10719   Median CPS      414139        343803
10720   Std Dev           6094         25851
10721
10722    Correlations:
10723
10724   CPS and window size:    0.116
10725   CPS and packet length:  0.241
10726   CPS and streaming:      0.901
10727      _________________________________________________________________
10728
10729     4.20.2.4. Streaming on Dialup Connections
10730
10731    Here "dialup" refers to a "direct" dialup connection, not a SLIP or
10732    PPP connection, which is only a particular kind of TCP/IP connection.
10733
10734    Attempt this at your own risk, and then only if (a) you have
10735    error-correcting modems, and (b) the connections between the modems
10736    and computers are also error-free, perfectly flow-controlled, and free
10737    of interrupt conflicts. Streaming can be used effectively and to
10738    fairly good advantage on such connections, but remember that the
10739    transfer is fatal if even one error is detected (also remember that
10740    should a binary-mode transfer fail, it can be recovered from the point
10741    of failure with RESEND).
10742
10743    To use streaming on an unreliable connection, you must tell both
10744    Kermits that the connection is reliable:
10745
10746   kermit -I
10747
10748    or:
10749
10750   C-Kermit> set reliable on
10751
10752    In this case, it will probably be necessary to prefix some control
10753    characters, for example if your connection is through a terminal
10754    server that has an escape character. Most Cisco terminal servers, for
10755    example, require Ctrl-^ (30, as well as its high-bit equivalent, 158)
10756    to be prefixed. To unprefix these, you'll need to defeat the "clear
10757    channel" feature:
10758
10759   C-Kermit> set reliable on
10760   C-Kermit> set clear-channel off
10761   C-Kermit> set prefixing none
10762   C-Kermit> set control prefix 1 13 30 158 ; and whatever else is necessary
10763
10764    Dialup trials were done using fixed large window and packet sizes.
10765    They compare uploading and downloading of two common types of files,
10766    with and without streaming. Configuration:
10767
10768      HP-9000/715/33 -- 57600bps, RTS/CTS -- USR Courier V.34 --
10769      V.34+V.42, 31200bps -- USR V.34+ Rackmount -- 57600bps, RTS/CTS --
10770      Cisco terminal server -- Solaris 2.5.1. Packet size = 8000, Window
10771      Size = 30, Control Character Unprefixing Minimal (but including the
10772      Cisco escape character).
10773
10774    Since this is not a truly reliable connection, a few trials failed
10775    when a bad packet was received (most likely due to UART overruns); the
10776    failure was graceful and immediate, and the message was informative.
10777    The results of ten successful trials uploading and downloading the two
10778    files with and without streaming are:
10779
10780             Streaming..
10781             Off    On
10782    Upload   5194   5565   txt (= C source code, 78K)
10783             3135   3406   gz  (= gzip file, compressed, 85K)
10784  Download   5194   5565   txt
10785             3041   3406   gz
10786
10787    Each CPS figure is the mean of 10 results.
10788
10789    A brief test was also performed on a LAT-based dialout connection from
10790    a VAX 3100 with VMS 5.5 to a USR Courier V.34 connected to a DECserver
10791    700 at 19200 bps. The 1-MB Sparc executable downloaded from a Sun to
10792    the VAX at 1100cps without streaming and 1900cps with streaming, using
10793    8000-byte packets, 30 window slots, and minimal prefixing in both
10794    cases.
10795      _________________________________________________________________
10796
10797     4.20.2.5. Streaming on X.25 Connections
10798
10799    We have only limited access to X.25 networks. One trial was performed
10800    in which the 1MB Solaris 2.4 Sparc executable was transferred over a
10801    SunLink X.25 connection; nothing is known about the actual physical
10802    connection. With a packet length of 8000 and a window size of 30, the
10803    file transferred at 6400 cps (using a maximum of 6 window slots). With
10804    the same packet length, but with streaming, it transferred without
10805    mishap at 6710 cps, about 5% faster.
10806      _________________________________________________________________
10807
10808     4.20.3. Streaming - Preliminary Conclusions
10809
10810    The results vary with the particular connection, but are good overall.
10811    Although numerous lower-level tricks can be used to improve
10812    performance on specific platforms or connection methods, streaming
10813    occurs at a high, system-independent level of the Kermit protocol and
10814    therefore can apply to all types of platforms and (reliable)
10815    connections transparently.
10816      _________________________________________________________________
10817
10818   4.21. The TRANSMIT Command
10819
10820    Prior to C-Kermit 7.0, the TRANSMIT command transmitted in text or
10821    binary mode according to SET FILE TYPE { TEXT, BINARY }. But now that
10822    binary mode is likely to be the default for protocol transfers, it is
10823    evident that this not also an appropriate default for TRANSMIT, since
10824    binary-mode TRANSMIT is a rather specialized and tricky operation.
10825    Therefore, TRANSMIT defaults to text mode always, regardless of the
10826    FILE TYPE setting.
10827
10828    C-Kermit 7.0 expands the capabilities of the TRANSMIT command by
10829    adding the following switches (see [524]Section 1.5). The new syntax
10830    is:
10831
10832   TRANSMIT [ switches... ] filename
10833
10834    Zero or more switches may be included:
10835
10836    /PIPE
10837           When /PIPE is included, "filename" is interpreted as a system
10838           command or program whose output is to be sent. Synonym:
10839           /COMMAND. Example:
10840
10841   transmit /pipe finger
10842
10843           You may enclose the command in braces, but you don't have to:
10844
10845   xmit /pipe {ls -l | sort -r +0.22 -0.32 | head}
10846
10847    /BINARY
10848           Transmits the file (or pipe output) in binary mode.
10849
10850    /TEXT
10851           Transmits the file (or pipe output) in line-oriented text mode.
10852           Current FILE CHARACTER-SET and TERMINAL CHARACTER-SET
10853           selections govern translation. Default.
10854
10855    /TRANSPARENT
10856           Specifies text mode without character-set translation, no
10857           matter what the FILE and TERMINAL CHARACTER-SET selections are.
10858
10859    /NOWAIT
10860           This is equivalent to SET TRANSMIT PROMPT 0, but for this
10861           TRANSMIT command only. Applies only to text mode; it means to
10862           not wait for any kind of echo or turnaround character after
10863           sending a line before sending the next line. (Normally Kermit
10864           waits for a linefeed.)
10865
10866    When TRANSMIT ECHO is ON, C-Kermit tries to read back the echo of each
10867    character that is sent. Prior to C-Kermit 7.0, 1 second was allowed
10868    for each echo to appear; if it didn't show up in a second, the
10869    TRANSMIT command would fail. Similarly for the TRANSMIT PROMPT
10870    character. However, with today's congested Internet connections, etc,
10871    more time is often needed:
10872
10873    SET TRANSMIT TIMEOUT number
10874    Specifies the number of seconds to wait for an echo or the prompt
10875    character when TRANSMIT PROMPT is nonzero; the default wait is 1
10876    second. If you specify 0, the wait is indefinite. When a timeout
10877    interval of 0 is specified, and a desired echo or prompt does not show
10878    up, the TRANSMIT command will not terminate until or unless you
10879    interrupt it with Ctrl-C; use SET TRANSMIT TIMEOUT 0 with caution.
10880
10881    Note: to blast a file out the communications connection without any
10882    kind of synchronization or timeouts or other manner of checking, use:
10883
10884   SET TRANSMIT ECHO OFF
10885   SET TRANSMIT PROMPT 0 (or include the /NOWAIT switch)
10886   SET TRANSMIT PAUSE 0
10887   TRANSMIT [ switches ] filename
10888
10889    In this case, text-file transmission is not-line oriented and large
10890    blocks can be sent, resulting in a significant performance improvement
10891    over line-at-at-time transmission. Successful operation depends (even
10892    more than usual for the TRANSMIT command!) on a clean connection with
10893    effective flow control.
10894
10895    For details on TRANSMIT and character sets, see [525]Section 6.6.5.4.
10896      _________________________________________________________________
10897
10898   4.22. Coping with Faulty Kermit Implementations
10899
10900    Kermit protocol has been implemented in quite a few third-party
10901    commercial, shareware, and freeware software packages, with varying
10902    degrees of success. In most cases operation is satisfactory but slow
10903    -- only the bare minimum subset of the protocol is available -- short
10904    packets, no sliding windows, no attributes, etc. In other cases, the
10905    implementation is incorrect, resulting in failures at the initial
10906    negotiation stage or corrupted files.
10907
10908    C-Kermit 7.0 and Kermit 95 1.1.19 include some new defense mechanisms
10909    to help cope with the most common situations. However, bear in mind
10910    there is only so much we can do in such cases -- the responsibility
10911    for fixing the problem lies with the maker of the faulty software.
10912      _________________________________________________________________
10913
10914     4.22.1. Failure to Accept Modern Negotiation Strings
10915
10916    The published Kermit protocol specification states that new fields can
10917    be added to the parameter negotiation string. These are to be ignored
10918    by any Kermit implementation that does not understand them; this is
10919    what makes the Kermit protocol extensible. Unfortunately, some Kermit
10920    implementations become confused (or worse) when receiving a
10921    negotiation string longer than the one they expect. You can try
10922    working around such problems by telling Kermit to shorten its
10923    negotiation string (and thus disable the corresponding new features):
10924
10925   SET SEND NEGOTIATION-STRING-MAX-LENGTH number
10926
10927    Try a number like 10. If that doesn't work, try 9, 8, 7, 6, and so on.
10928      _________________________________________________________________
10929
10930     4.22.2. Failure to Negotiate 8th-bit Prefixing
10931
10932    The published Kermit protocol specification states that 8th-bit
10933    prefixing (which allows transfer of 8-bit data over a 7-bit
10934    connection) occurs if the file sender puts a valid prefix character
10935    (normally "&") in the 8th-bit-prefix field of the negotiation string,
10936    and the receiver puts either a letter "Y" or the same prefix
10937    character. At least one faulty Kermit implementation exists that does
10938    not accept the letter "Y". To force C-Kermit / K-95 to reply with the
10939    other Kermit's prefix character rather than a "Y", give the following
10940    (invisible) command:
10941
10942   SET Q8FLAG ON
10943
10944    Use SET Q8FLAG OFF to restore the normal behavior.
10945      _________________________________________________________________
10946
10947     4.22.3. Corrupt Files
10948
10949    Refer to [526]Section 4.22.2. Some Kermit implementations mistakenly
10950    interpret the "Y" as a prefix character. Then, whenever a letter Y
10951    appears in the data, the Y and the character that follows it are
10952    replaced by a garbage character. At this writing, we are not sure if
10953    there is any solution, but try "set send negotiation-string-max-length
10954    6" and/or "set q8flag on".
10955
10956    File corruption can also occur when control characters within the file
10957    data are sent without prefixing, as at least some are by default in
10958    C-Kermit 7.0 and K-95. Some Kermit implementations do not handle
10959    incoming "bare" control characters. To work around, "set prefixing
10960    all".
10961      _________________________________________________________________
10962
10963     4.22.4. Spurious Cancellations
10964
10965    The Kermit protocol specification states that if an ACK to a Data
10966    packet contains X in its data field, the transfer of the current file
10967    is canceled, and if it contains a Z, the entire transfer is canceled.
10968    At least one overzealous Kermit implementation applies this rule to
10969    non-Data packets as well, the typical symptom being that any attempt
10970    to transfer a file whose name begins with X or Z results in
10971    cancellation. This is because the file receiver typically sends back
10972    the name under which it stored the file (which might not be the same
10973    as the name it was sent with) in the ACK to the File Header packet.
10974    This is information only and should not cause cancellation. To work
10975    around the problem, use:
10976
10977   SET F-ACK-BUG { ON, OFF }
10978
10979    ON tells Kermit not to send back the filename in the ACK to the file
10980    header packet as it normally would do (OFF puts Kermit back to normal
10981    after using ON).
10982
10983    A variation on the this bug occurs in an obscure Kermit program for
10984    MUMPS: When this Kermit program sends a file called (say) FOO.BAR, it
10985    requires that the ACK to its F packet contain exactly the same name,
10986    FOO.BAR. However, C-Kermit likes to send back the full pathname,
10987    causing the MUMPS Kermit to fail. SET F-ACK-BUG ON doesn't help here.
10988    So a separate command has been added to handle this situation:
10989
10990   SET F-ACK-PATH { ON, OFF }
10991
10992    Normally it is ON (regardless of the SET SEND PATHNAMES setting). Use
10993    SET F-ACK-PATH OFF to instruct Kermit to send back only the filename
10994    without the path in the ACK to the F packet.
10995      _________________________________________________________________
10996
10997     4.22.5. Spurious Refusals
10998
10999    Some Kermit implementations, notably PDP-11 Kermit 3.60 and earlier,
11000    have bugs in their handling of Attribute packets that can cause
11001    unwarranted refusal of incoming files, e.g. based on date or size.
11002    This can be worked around by telling one or both of the Kermit
11003    partners to:
11004
11005   SET ATTRIBUTES OFF
11006      _________________________________________________________________
11007
11008     4.22.6. Failures during the Data Transfer Phase
11009
11010    This can be caused by control-character unprefixing ([527]Section
11011    4.22.3 ), and fixed by:
11012
11013   SET PREFIXING ALL
11014
11015    It can also have numerous other causes, explained in Chapter 10 of
11016    [528]Using C-Kermit: the connection is not 8-bit transparent (so use
11017    "set parity space" or somesuch), inadequate flow control, etc. Consult
11018    the manual.
11019      _________________________________________________________________
11020
11021     4.22.7. Fractured Filenames
11022
11023    At least one well-known PC-based communications package negotiates
11024    data compression, which (according to the protocol specification)
11025    applies to both the filename and the file data, but then fails to
11026    decompress the filename. Example: C-Kermit sends a file called
11027    R000101.DAT (where 000101 might be non-Y2K-wise YYMMDD notation), and
11028    the package in question stores the files as R~#0101.DAT. Workaround:
11029    Tell C-Kermit to SET REPEAT COUNTS OFF.
11030      _________________________________________________________________
11031
11032     4.22.8. Bad File Dates
11033
11034    At least one well-known PC-based communications package negotiates the
11035    passing of file timestamps from sender to receiver, but when it is
11036    sending files, it always gives them a timestamp of 1 February 1970.
11037    Workaround: tell C-Kermit to SET ATTRIBUTE DATE OFF. You don't get the
11038    file's real date, but you also don't get 1 Feb 1970; instead the file
11039    gets the current date and time.
11040      _________________________________________________________________
11041
11042   4.23. File Transfer Recovery
11043
11044    Prior to C-Kermit 7.0, RESEND (SEND /RECOVER) and REGET (GET /RECOVER)
11045    refused to work if FILE TYPE was not BINARY or the /BINARY switch was
11046    not included. Now these commands include an implied /BINARY switch,
11047    meaning they set the file type to binary for the duration of the
11048    command automatically.
11049
11050    In the client/server arrangement, this also forces the server into
11051    binary mode (if it is C-Kermit 7.0 or greater, or K95 1.1.19 or
11052    greater) so the recovery operation proceeds, just as you asked and
11053    expected.
11054
11055    BUT... Just as before, the results are correct only under the
11056    following conditions:
11057
11058      * If the prior interrupted transfer was also in binary mode; or:
11059      * If the prior transfer was in text mode and the other computer was
11060        a "like platform" (e.g. UNIX-to-UNIX, Windows-to-Windows,
11061        DOS-to-Windows) AND there was no character-set translation (i.e.
11062        TRANSFER CHARACTER-SET was TRANSPARENT).
11063
11064    Note that these circumstances are more likely to obtain in C-Kermit
11065    7.0, in which:
11066
11067      * The default FILE TYPE in C-Kermit 7.0 is BINARY.
11068      * The default FILE INCOMPLETE setting is AUTO, which means KEEP if
11069        the transfer is in binary mode, DISCARD otherwise.
11070      * C-Kermit 7.0, Kermit 95 1.1.17, and MS-DOS Kermit 3.15 and later
11071        can recognize "like platforms" and switch into binary mode
11072        automatically. Transfers between like platforms are always binary
11073        unless character-set translation has been requested, and then is
11074        still binary for all files whose names match a binary pattern,
11075        unless the automatic mechanisms have been disabled (with a /TEXT
11076        switch, or with SET TRANSFER MODE MANUAL).
11077      * SEND /BINARY and GET /BINARY always force binary-mode transfers,
11078        even when FILE TYPE is TEXT, even when TRANSFER MODE is AUTOMATIC,
11079        even when PATTERNS are ON and the file's name matches a text
11080        pattern.
11081
11082    But also note that the automatic client/server transfer-mode
11083    adjustments do not work with versions of C-Kermit prior to 7.0 or K95
11084    prior to 1.1.16.
11085
11086    If the prior transfer was in text mode:
11087
11088      * If text-mode transfers between the two platforms are
11089        "length-changing" (as they are between UNIX -- which terminates
11090        text lines with LF -- and DOS or Windows -- which terminates text
11091        lines with CRLF), the recovered file will be corrupt.
11092      * If text-mode transfers between the two platforms are not
11093        length-changing, but character-set translation was active in the
11094        prior transfer, the result will be a file in which the first part
11095        has translated characters and the second part does not.
11096
11097    But in C-Kermit 7.0 and K95 1.1.19 and later, incompletely transferred
11098    text files are not kept unless you change the default. But if you have
11099    done this, and you have an incompletely transferred text file, you'll
11100    need to:
11101
11102      * Transfer the whole file again in text mode, or:
11103      * Use SEND /STARTING-AT: to recover the transfer at the correct
11104        point; but you have to find out what that point is, as described
11105        in the manual.
11106
11107    Kermit has no way of knowing whether the previous transfer was in text
11108    or binary mode so it is your responsibility to choose the appropriate
11109    recovery method.
11110
11111    If you use C-Kermit to maintain parallel directories on different
11112    computers, using SET FILE COLLISION to transfer only those files that
11113    changed since last time, and the files are big enough (or the
11114    connection slow enough) to require SEND /RECOVER to resume interrupted
11115    transfers, you should remember that SEND /RECOVER (RESEND) overrides
11116    all FILE COLLISION settings. Therefore you should use SEND /RECOVER
11117    (RESEND) only on the file that was interrupted, not the file group.
11118    For example, if the original transfer was initiated with:
11119
11120   SEND *
11121
11122    and was interrupted, then after reestablishing your connection and
11123    starting the Kermit receiver with SET FILE COLLISION UPDATE on the
11124    remote end, use the following sequence at the sender to resume the
11125    transfer:
11126
11127   SEND /RECOVER name-of-interrupted-file
11128
11129    and then:
11130
11131   SEND *
11132
11133    (In C-Kermit 7.0 and later, \v(filename) contains the name of the file
11134    most recently transferred, as long you have not EXITed from Kermit or
11135    changed directory, etc.
11136      _________________________________________________________________
11137
11138   4.24. FILE COLLISION UPDATE Clarification
11139
11140    In UNIX, file modification dates are used when comparing the file date
11141    with the date in the attribute packet. In VMS, however, the file
11142    creation date is used. These two policies reflect the preferences of
11143    the two user communities.
11144
11145    Also, remember that the file date/time given in the attribute packet
11146    is the local time at the file sender. At present, no timezone
11147    conversions are defined in or performed by the Kermit protocol. This
11148    is primarily because this feature was designed at a time when many of
11149    the systems where Kermit runs had no concept of timezone, and
11150    therefore would be unable to convert (say, to/from GMT or UTC or Zulu
11151    time).
11152
11153    As a consequence, some unexpected results might occur when
11154    transferring files across timezones; e.g. commands on the target
11155    system that are sensitive to file dates might work (UNIX "make",
11156    backups, etc).
11157
11158    Timezone handling is deferred for a future release.
11159      _________________________________________________________________
11160
11161   4.25. Autodownload Improvements
11162
11163    Refer to pages 164-165 of [529]Using C-Kermit about the hazards of
11164    autodownload when C-Kermit is "in the middle". As of C-Kermit 7.0, no
11165    more hazards. If C-Kermit has TERMINAL AUTODOWNLOAD ON and it detects
11166    a packet of the current protocol type (Kermit or Zmodem), it "erases"
11167    the visual aspect of the packet that would be seen by the terminal
11168    (or, more to the point, the emulator, such as K95). This way, only
11169    C-Kermit goes into RECEIVE mode, and not also the terminal emulator
11170    through which C-Kermit is accessed. And therefore, it is no longer
11171    necessary to SET TERMINAL AUTODOWNLOAD OFF to prevent multiple Kermits
11172    from going into receive mode at once, but of course it is still
11173    necessary to ensure that, when you have multiple Kermits in a chain,
11174    that the desired one receives the autodownload.
11175
11176    The defaults have not been changed; Kermit 95 still has autodownload
11177    ON by default, and C-Kermit has it OFF by default.
11178      _________________________________________________________________
11179
11180   5. CLIENT/SERVER
11181
11182   5.0. Hints
11183
11184    If you use SET SERVER GET-PATH to set up your server, and the GET-PATH
11185    does not include the server's current directory, clients can become
11186    quite confused. For example, "remote dir oofa.txt" shows a file named
11187    oofa.txt, but "get oofa.txt" fails. In this situation, you should
11188    either DISABLE DIR or make your GET-PATH include the current
11189    directory.
11190      _________________________________________________________________
11191
11192   5.1. New Command-Line Options
11193
11194    The -G command-line option is like -g (GET), except the incoming file
11195    is sent to standard output rather than written to disk.
11196
11197    The -I option ("Internet") is used to tell a remote C-Kermit program
11198    that you are coming in via Internet Telnet or Rlogin and therefore
11199    have a reliable connection. The -I option is equivalent to SET
11200    RELIABLE ON and SET FLOW NONE.
11201
11202    The -O option ("Only One") tells C-Kermit to enter server mode but
11203    then exit after the first client operation.
11204
11205    See [530]Section 9.3 for details.
11206      _________________________________________________________________
11207
11208   5.2. New Client Commands
11209
11210    BYE and FINISH no longer try to do anything if a connection is not
11211    active. Thus a sequence like "hangup" followed by "bye" or "finish"
11212    will no longer get stuck in a long timeout-and-retransmission cycle,
11213    nor will it try to open a new connection.
11214
11215    REMOTE EXIT
11216           Similar to FINISH, except it ensures that the Kermit server
11217           program exits back to the operating system or shell prompt.
11218           (FINISH would return it to its interactive prompt if it was
11219           started in interactive mode, and would cause it to exit if it
11220           entered server mode via command-line option.) When C-Kermit is
11221           to be the server, you can use { ENABLE, DISABLE } EXIT to
11222           control the client's access to this feature.
11223
11224    REMOTE MKDIR directory-name
11225           Tells the client to ask the server to create a directory with
11226           the given name, which can be absolute or relative. The syntax
11227           of the directory name depends on the Kermit server (see
11228           [531]next section); in all cases, it can be in the syntax of
11229           the system where the server is running (UNIX, VMS, DOS, etc)
11230           but newer servers also accept UNIX syntax, no matter what the
11231           underlying platform. The server will not execute this command
11232           if (a) it does not understand it, (b) a DISABLE MKDIR command
11233           has been given, or (c) a DISABLE CWD command has been given;
11234           otherwise, the command is executed, but will fail if the
11235           directory can not be created, in which cases most servers will
11236           attempt to return a message giving the reason for failure. The
11237           REMOTE MKDIR command succeeds if the remote directory is
11238           created, or if it already exists and therefore does not need to
11239           be created, and fails otherwise.
11240
11241    REMOTE RMDIR directory-name
11242           Tells the client to ask the server to remove (delete) a
11243           directory with the given name. The same considerations apply as
11244           for REMOTE MKDIR.
11245
11246    REMOTE SET FILE INCOMPLETE { DISCARD, KEEP, AUTO }
11247           Previously this was only available in its earlier form, REMOTE
11248           SET INCOMPLETE (no FILE). The earlier form is still available,
11249           but invisible. Also, AUTO was added, meaning KEEP if in binary
11250           mode, DISCARD otherwise.
11251
11252    REMOTE SET TRANSFER MODE { AUTOMATIC, MANUAL }
11253           Tells the client to ask the server to set the given
11254           file-transfer mode. Automatic means (roughly): if the client
11255           and the server are running on the same kind of computer (e.g.
11256           both are on UNIX), then use binary mode automatically; if the
11257           system types are different, use some other method to
11258           automatically determine text or binary mode, such as filename
11259           pattern matching. MANUAL means, in this context, obey the
11260           client's FILE TYPE setting (TEXT or BINARY). Synonym: REMOTE
11261           SET XFER MODE.
11262
11263    [ REMOTE ] QUERY KERMIT function(args...)
11264           Prior to C-Kermit 7.0, the arguments were not evaluated
11265           locally. Thus it was not possible to have the server run the
11266           function with client-side variables as arguments. Now:
11267
11268   define \%a oofa.*
11269   remote query kermit files(\%a)    ; Client's \%a
11270   remote query kermit files(\\%a)   ; Server's \%a
11271
11272    [ REMOTE ] LOGIN [ user [ password ] ]
11273           LOGIN is now a synonym for REMOTE LOGIN.
11274
11275    LOGOUT
11276           This command, when given in local mode, is equivalent to REMOTE
11277           LOGOUT. When given at the IKSD prompt, it logs out the IKSD.
11278           When given at the C-Kermit prompt when it has no connection, it
11279           does nothing.
11280
11281    Note that in C-Kermit 7.0, the REMOTE (or R) prefix is not required
11282    for QUERY, since there is no local QUERY command. The new top-level
11283    QUERY command does exactly what REMOTE QUERY (RQUERY) does.
11284
11285    All REMOTE commands now have single-word shortcuts:
11286
11287  Shortcut   Full Form
11288   RASG       REMOTE ASSIGN
11289   RCD        REMOTE CD
11290   RCOPY      REMOTE COPY
11291   RDEL       REMOTE DELETE
11292   RDIR       REMOTE DIRECTORY
11293   REXIT      REMOTE EXIT
11294   RHELP      REMOTE HELP
11295   RHOST      REMOTE HOST
11296   RPWD       REMOTE PWD
11297   RSET       REMOTE SET
11298   etc.
11299
11300    The R prefix is not applied to LOGIN because there is already an
11301    RLOGIN command with a different meaning. It is not applied to LOGOUT
11302    either, since LOGOUT knows what to do in each case, and for symmetry
11303    with LOGIN.
11304      _________________________________________________________________
11305
11306     5.2.1. Remote Procedure Definitions and Calls
11307
11308    This is nothing new, but it might not be obvious... REMOTE ASSIGN and
11309    REMOTE QUERY may be used to achieve remote procedure execution. The
11310    remote procedure can be defined locally or remotely.
11311
11312    A remote procedure call is accomplished as noted in the previous
11313    section:
11314
11315   [ remote ] query kermit function-name(args...)
11316
11317    This invokes any function that is built in to the Kermit server, e.g.:
11318
11319   [ remote ] query kermit size(foo.bar)
11320
11321    returns the size of the remote file, foo.bar.
11322
11323    Now note that C-Kermit includes an \fexecute() function, allowing it
11324    to execute any macro as if it were a built-in function. So suppose
11325    MYMACRO is the name of a macro defined in the server. You can execute
11326    it from the client as follows (the redundant "remote" prefix is
11327    omitted in the remaining examples):
11328
11329   query kermit execute(mymacro arg1 arg2...)
11330
11331    The return value, if any, is the value of the RETURN command that
11332    terminated execution of the macro, for example:
11333
11334   define addtwonumbers return \feval(\%1+\%2)
11335
11336    The client invocation would be:
11337
11338   query kermit execute(addtwonumbers 3 4)
11339   7
11340
11341    The result ("7" in this case) is also assigned to the client's
11342    \v(query) variable.
11343
11344    To execute a remote system command or command procedure (shell script,
11345    etc) use:
11346
11347   query kermit command(name args...)
11348
11349    Finally, suppose you want the client to send a macro to the server to
11350    be executed on the server end. This is done as follows:
11351
11352   remote assign macroname definition
11353   query kermit execute(macroname arg1 arg2...)
11354
11355    Quoting is required if the definition contains formal parameters.
11356      _________________________________________________________________
11357
11358   5.3. New Server Capabilities
11359
11360     5.3.1. Creating and Removing Directories
11361
11362    The C-Kermit 7.0 server responds to REMOTE MKDIR and REMOTE RMDIR
11363    commands. The directory name may be in either the native format of the
11364    server's computer, or in UNIX format. For example, a server running on
11365    VMS with a current directory of [IVAN] can accept commands from the
11366    client like:
11367
11368   remote mkdir olga         ; Makes [IVAN.OLGA] (nonspecific format)
11369   remote mkdir .olga        ; Makes [IVAN.OLGA] (VMS format without brackets)
11370   remote mkdir olga/        ; Makes [IVAN.OLGA] (UNIX relative format)
11371   remote mkdir /ivan/olga   ; Makes [IVAN.OLGA] (UNIX absolute format)
11372   remote mkdir [ivan.olga]  ; Makes [IVAN.OLGA] (VMS absolute format)
11373   remote mkdir [.olga]      ; Makes [IVAN.OLGA] (VMS relative format)
11374
11375     5.3.1.1. Creating Directories
11376
11377    If a directory name is given that contains more than one segment that
11378    does not exist, the server attempts to create all the segments. For
11379    example, if the client says:
11380
11381   REMOTE MKDIR letters/angry
11382
11383    a "letters" subdirectory is created in the server's current directory
11384    if it does not already exist, and then an "angry" subdirectory is
11385    created beneath it, if it does not already have one. This can repeated
11386    to any reasonable depth:
11387
11388   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
11389
11390     5.3.1.2. Removing Directories
11391
11392    When attempting to execute a REMOTE RMDIR, the server can remove only
11393    a single directory, not an entire sequence or tree. The system service
11394    that is called to remove the directory generally requires not only
11395    that the server process has write delete access, but also that the
11396    directory contain no files.
11397
11398    In the future, a REMOTE RMDIR /RECURSIVE command (and the accompanying
11399    protocol) might be added. For now, use the equivalent REMOTE HOST
11400    command(s), if any.
11401      _________________________________________________________________
11402
11403     5.3.2. Directory Listings
11404
11405    Directory listings are generated by C-Kermit itself, rather than by
11406    running the underlying system's directory command. Some control over
11407    the listing format can be obtained with the SET OPTIONS DIRECTORY
11408    command ([532]Section 4.5.1). The following options affect listings
11409    sent by the server: /[NO]HEADING, /[NO]DOTFILES, and /[NO]BACKUP. In
11410    UNIX and VMS, the listing is always sorted by filename. There is, at
11411    present, no protocol defined for the client to request listing options
11412    of the server; this might be added in the future.
11413
11414    The server's directory listings are in the following format:
11415
11416    Protection or permissions:
11417           In UNIX and OS-9, this is a 10-character field, left adjusted.
11418           In VMS it is a 22-character field, left-adjusted. In each case,
11419           the protection / permission codes are shown in the server
11420           platform's native format. In other operating systems, this
11421           field is not shown.
11422
11423    Size in bytes:
11424           This is always a 10-character field. The file's size is shown
11425           as a decimal number, right adjusted in the field. If the file
11426           is a directory and its size can not be obtained, the size is
11427           shown as "<DIR>". Two blanks follow this field.
11428
11429    Date:
11430           Always in yyyy-mm-dd hh:mm:ss numeric format, and therefore 19
11431           characters long. If the file's date/time can't be obtained,
11432           zeros (0) are shown for all the digits. This field is followed
11433           by two blanks.
11434
11435    Filename:
11436           This field extends to the end of the line. Filenames are shown
11437           relative to the server's current directory. In UNIX, symbolic
11438           links are shown as they are in an "ls -l" listing as "linkname
11439           -> filename".
11440
11441    In UNIX and VMS, listings are returned by the server in alphabetical
11442    order of filename. There are presently no other sort or selection
11443    options.
11444
11445    However, since these are fixed-field listings, all fields can be used
11446    as sort keys by external sort programs. Note, in particular, that the
11447    format used for the date allows a normal lexical on that field to
11448    achieve the date ordering. For example, let's assume we have a UNIX
11449    client and a UNIX server. In this case, the server's listing has the
11450    date in columns 22-40, and thus could be sorted by the UNIX sort
11451    program using "sort +0.22 -0.40" or in reverse order by "sort +0.22
11452    -0.40r".
11453
11454    Since the UNIX client can pipe responses to REMOTE commands through
11455    filters, any desired sorting can be accomplished this way, for
11456    example:
11457
11458 C-Kermit> remote directory | sort +0.22 -0.40
11459
11460    You can also sort by size:
11461
11462   C-Kermit> remote directory | sort +0.11 -0.19
11463
11464    You can use sort options to select reverse or ascending order. "man
11465    sort" (in UNIX) for more information. And of course, you can pipe
11466    these listings through any other filter of your choice, such as grep
11467    to skip unwanted lines.
11468      _________________________________________________________________
11469
11470   5.4. Syntax for Remote Filenames with Embedded Spaces
11471
11472    C-Kermit and K95, when in server mode, assume that any spaces in the
11473    file specification in an incoming GET command are filename separators.
11474    Thus if the client gives a command like:
11475
11476   get {oofa.txt oofa.bin}
11477
11478    or, equivalently:
11479
11480   mget oofa.txt oofa.bin
11481
11482    the server tries to send the two files, oofa.txt and oofa.bin. But
11483    what if you want the server to send you a file named, say:
11484
11485   D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL
11486
11487    How does the server know this is supposed to be one file and not
11488    seven? In this case, you need to the send file name to the server
11489    enclosed in either curly braces:
11490
11491   {D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL}
11492
11493    or ASCII doublequotes:
11494
11495   "D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL"
11496
11497    The method for doing this depends on your client. If your client is
11498    C-Kermit 7.0, any recent version of Kermit 95, or MS-DOS Kermit 3.16,
11499    then you have to enclose the name in braces just so the client can
11500    parse it, so to send braces or doublequotes to the server, you must
11501    put them inside the first, outside pair of braces. And you also need
11502    to double the backslashes to prevent them from being interpreted:
11503
11504   get {{D:\\HP OfficeJet 500\\Images\\My Pretty Picture Dot PCL}}
11505   get {"D:\\HP OfficeJet 500\\Images\\My Pretty Picture Dot PCL"}
11506
11507    To get around the requirement to double backslashes in literal
11508    filenames, of course you can also use:
11509
11510   set command quoting off
11511   get {{D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL}}
11512   get {"D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL"}
11513   set command quoting on
11514
11515    If you are giving a "kermit" command to the UNIX shell, you have to
11516    observe the shell's quoting rules, something like this:
11517
11518   kermit -ig "{D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL}"
11519
11520    Here, the quotes go on the outside so UNIX will pass the entire
11521    filename, spaces, braces, and all, as a single argument to Kermit, and
11522    the backslashes are not doubled because (a) the UNIX shell ignores
11523    them since they are in a quoted string, and (b) Kermit ignores them
11524    since the interactive command parser is not activated in this case.
11525      _________________________________________________________________
11526
11527   5.5. Automatic Orientation Messages upon Directory Change
11528
11529    C-Kermit 7.0, when acting as a server, can send an orientation message
11530    to the client whenever the server directory changes. For example, when
11531    the client gives a REMOTE CD command, the server sends the contents of
11532    the new directory's "Read Me" file to the client's screen. The
11533    following commands govern this feature:
11534
11535    SET SERVER CD-MESSAGE FILE name
11536           Given to the servr, allows the message-file name to be
11537           specified at runtime. A list of names to look for can be given
11538           in the following format:
11539
11540   {{name1}{name2}{name3}{...}}
11541
11542           e.g. SET SERVER CD-MESSAGE FILE
11543           {{./.readme}{README.TXT}{READ.ME}}
11544
11545    REMOTE SET SERVER CD-MESSAGE { ON, OFF }
11546           Given to the client, lets the client control whether the server
11547           sends automatic CD messages.
11548
11549    SHOW SERVER
11550           Given to server, includes CD-Message status.
11551
11552    The default CD message file name is system dependent. SHOW CD or SHOW
11553    SERVER displays the list. Also see [533]Section 4.5.2.
11554      _________________________________________________________________
11555
11556   5.6. New Server Controls
11557
11558    DISABLE ENABLE
11559           Allows the server to configured such that DISABLEd features can
11560           not be re-enabled by any means -- e.g. if the client is somehow
11561           able to get the server into command mode. Once DISABLEd, ENABLE
11562           can not be re-ENABLEd.
11563
11564    SET SERVER IDLE-TIMEOUT seconds
11565           This was available previously in Kermit 95 only. Now it can be
11566           used in C-Kermit also to specify a maximum number of seconds
11567           the server is allowed to be idle before exiting server mode. 0
11568           seconds means no idle timeout. In C-Kermit (but not K-95), SET
11569           SERVER TIMEOUT and SET SERVER IDLE-TIMEOUT are mutually
11570           exclusive -- you can have one or the other (or neither), but
11571           not both. (Server timeouts are for the benefit of primitive
11572           Kermit clients that are not capable of timing out on their own;
11573           to our knowledge, no such clients are still in circulation.)
11574
11575    SET SERVER KEEPALIVE { ON, OFF }
11576           (See next section).
11577      _________________________________________________________________
11578
11579   5.7. Timeouts during REMOTE HOST Command Execution
11580
11581    Prior to C-Kermit 7.0, the C-Kermit server would block waiting for
11582    output from a system command invoked via REMOTE HOST from the client.
11583    If the system command took a long time to execute, the client would
11584    time out and send NAK packets. If the command took too long, the
11585    client would reach its retry limit and give up. Even if it didn't, the
11586    NAKs would cause unnecessary retransmissions.
11587
11588    In version 7.0, the C-Kermit server (VMS and select()-capable UNIX
11589    versions only), sends "keepalive packets" (empty data packets) once
11590    per second while waiting for the system command to complete. This
11591    procedure should be entirely transparent to the Kermit client, and
11592    should prevent the unwanted timeouts and NAKs. When C-Kermit 7.0
11593    itself (or K95 1.1.19) is the client, it prints dots to show the
11594    keepalive packets.
11595
11596    The keepalive feature can be turned off and on with:
11597
11598   SET SERVER KEEPALIVE { ON, OFF }
11599
11600    Normally it should be on. Turn it off it if causes trouble with the
11601    client, or if it seems to slow down the server (as it might on some
11602    platforms under certain circumstances).
11603      _________________________________________________________________
11604
11605   6. INTERNATIONAL CHARACTER SETS
11606
11607    Support for several new single-byte character sets was added in
11608    C-Kermit 7.0. Unicode / ISO 10646 is not yet supported, but is a high
11609    priority for forthcoming releases.
11610
11611   6.0. ISO 8859-15 Latin Alphabet 9
11612
11613    To accommodate the Euro currency symbol, and to correct several other
11614    longstanding problems with ISO Latin Alphabet 1, ISO 8859-15 Latin
11615    Alphabet 9 was issued in May 1998. It is supported by C-Kermit 7.0 as
11616    a transfer character set, a file character set, and a terminal
11617    character set. Translations that preserve the new characters are
11618    available between Latin-9 and several other sets including:
11619
11620   PC Code Page 858         (Western European languages, similar to CP850)
11621   Windows Code Page 1252   (Western European languages, similar to Latin-1)
11622   Windows Code Page 1250   (Eastern European languages, similar to Latin-2)
11623
11624    The Latin-9 transfer character set also allows for the OE digraph
11625    character, used primarily in French, to be preserved in transfers
11626    involving the DEC MCS or NeXT character sets.
11627
11628    The Euro character is also present in the Universal Character Set,
11629    described in [534]Section 6.6.
11630
11631   6.1. The HP-Roman8 Character Set
11632
11633    The HP-Roman8 character set is supported in C-Kermit 6.0 and later but
11634    was omitted from Table VII-4 in the 2nd Edition of Using C-Kermit due
11635    to lack of space. It is listed in [535]Appendix III.
11636
11637   6.2. Greek Character Sets
11638
11639    Greek character sets were added in 6.1:
11640
11641   SET FILE CHARACTER-SET { CP869, ELOT927, GREEK-ISO }
11642   SET TRANSFER CHARACTER-SET { GREEK-ISO }
11643
11644    GREEK-ISO is ISO 8859-7, which the same as ELOT 928.
11645
11646    The new Greek character sets are listed in [536]Appendix III.
11647
11648   6.3. Additional Latin-2 Character Sets
11649
11650    The following have been added as FILE and TERMINAL CHARACTER-SETs:
11651
11652    MAZOVIA-PC
11653           A PC code page used in Poland, equivalent to CP437, but with 18
11654           substitutions needed for Polish.
11655
11656    CP1250
11657           The Windows Latin 2 Code Page. Equivalent to ISO 8859-2, but
11658           with different encoding.
11659
11660   6.4. Additional Cyrillic Character Sets
11661
11662    The following have been added as FILE and TERMINAL CHARACTER-SETs:
11663
11664    BULGARIA-PC
11665           This is the Cyrillic PC code page used in Bulgaria, where it is
11666           called Code Page 856. It is attributed to a company called
11667           DATEC, Inc, but CP856 is not a proper designation, since it
11668           refers to a Hebrew Code Page (see the IBM Registry).
11669
11670    CP855
11671           This PC Code Page contains all the Cyrillic letters that are
11672           also in ISO 8859-5, and is therefore useful for non-Russian
11673           Cyrillic text (Ukrainian, Belorussian, etc), unlike CP866,
11674           which has a smaller repertoire of Cyrillic letters.
11675
11676    CP1251
11677           The Windows Cyrillic Code Page. Equivalent to CP855, but with
11678           different encoding.
11679
11680    KOI8R
11681           An extension to "Old KOI-8" that adds upper and lower case
11682           Cyrillic letter Io (looks like Roman E with diaeresis) plus a
11683           selection of box-drawing characters to columns 8 through 11,
11684           which are vacant in original Old KOI-8. KOI8-R is used for the
11685           Russian language. It is specified in [537]RFC 1489.
11686
11687    KOI8U
11688           A similar extension of Old KOI-8, but for Ukrainian. It is
11689           specified in [538]RFC 2319.
11690      _________________________________________________________________
11691
11692   6.5. Automatic Character-Set Switching
11693
11694    Prior to version 7.0, C-Kermit's file character-set always had to be
11695    set explicitly. In 7.0 and later, it is set automatically when:
11696
11697     1. This feature is enabled (as it is unless you disable it).
11698     2. An incoming text-mode transfer includes a transfer-character-set
11699        announcer and you have not previously given a SET FILE
11700        CHARACTER-SET command. In this case, C-Kermit switches to an
11701        appropriate file character set. For example, on an HP-UX
11702        workstation, an incoming Latin-1 file automatically selects
11703        HP-Roman8 for the local copy of the file; in Data General AOS/VS,
11704        it would select DG International.
11705     3. You give a SET TRANSFER CHARACTER-SET command without having
11706        previously specified a FILE CHARACTER-SET. An appropriate file
11707        character-set is chosen automatically.
11708
11709    In addition, when you give a SET FILE CHARACTER-SET command, the
11710    appropriate transfer character-set is automatically chosen, to be used
11711    when you are sending files (but this does not override the one
11712    announced by the sender when you are receiving files).
11713
11714    You might not agree about what is "appropriate", so of course you can
11715    disable or change all of the above actions.
11716
11717    You can disable (or re-enable) the new automatic character-set
11718    switching feature in each direction separately:
11719
11720    SET RECEIVE CHARACTER-SET-SELECTION { AUTOMATIC, MANUAL }
11721           AUTOMATIC is the default, causing the behavior described above
11722           when an incoming file arrives. Choose MANUAL to defeat this
11723           behavior and force your current FILE CHARACTER-SET setting to
11724           be used, no matter what it is. Note that SET RECEIVE
11725           CHARACTER-SET MANUAL does not disable recognition of the
11726           incoming transfer character-set announcer, and translation from
11727           the corresponding character-set to your current file
11728           character-set. To disable that, use SET ATTRIBUTE CHARACTER-SET
11729           OFF.
11730
11731    SET SEND CHARACTER-SET-SELECTION { AUTOMATIC, MANUAL }
11732           Again AUTOMATIC is the default, causing the behavior described
11733           above when you give a SET { FILE, TRANSFER } CHARACTER-SET
11734           command. Use MANUAL to allow you to specify the transfer and
11735           file character-sets independently.
11736
11737    SHOW CHARACTER-SETS
11738           Tells settings of { SEND, RECEIVE } CHARACTER-SET-SELECTION.
11739
11740    Normally, however, it is more convenient to leave automatic switching
11741    active, and change any associations that are not appropriate for your
11742    application, area, or country. The commands are:
11743
11744    SHOW ASSOCIATIONS
11745           This command lists all the associations in each direction: for
11746           each possible transfer character-set, it lists the associated
11747           file character-set, and vice versa. These are two separate and
11748           independent lists.
11749
11750    ASSOCIATE TRANSFER-CHARACTER-SET name1 [ name2 ]
11751           Changes the association for the transfer character-set name1 to
11752           be the file character-set name2. If name2 is omitted, automatic
11753           switching is disabled for this transfer character-set only.
11754
11755    ASSOCIATE FILE-CHARACTER-SET name1 [ name2 ]
11756           Changes the association for the file character-set name1 to be
11757           the transfer character-set name2. If name2 is omitted,
11758           automatic switching is disabled for this file character-set
11759           only.
11760      _________________________________________________________________
11761
11762   6.6. UNICODE
11763
11764    C-Kermit 7.0 adds support for Unicode, the Universal Character Set,
11765    for:
11766
11767      * File Transfer (SEND, RECEIVE, GET, etc)
11768      * Terminal connection (CONNECT)
11769      * Unguarded file capture (LOG SESSION)
11770      * Unguarded file transmission (TRANSMIT)
11771      * Local file character-set conversion (TRANSLATE)
11772
11773    C-Kermit is not, however, a "Unicode application" in the sense that
11774    its commands, messages, or user interface are Unicode. Rather, it is
11775    "Unicode aware" in its ability to handle and convert Unicode text in
11776    the course of file transfer and terminal connection, and you can also
11777    use Kermit to convert local files between Unicode and other character
11778    sets. TLA's:
11779
11780   BMP - Base Multilingual Plane
11781   BOM - Byte Order Mark
11782   CJK - Chinese, Japanese, and Korean
11783   ISO - International Standards Organization
11784   TLA - Three-Letter Acronym
11785   UCS - Universal Character Set
11786   UTF - UCS Transformation Format
11787
11788    Unicode and ISO 10646 are the coordinated and compatible corporate and
11789    international standards for the Universal Character Set (UCS). Unlike
11790    single-byte and even most multibyte character sets, the UCS can
11791    represent all characters in every existing writing system. A flat
11792    plain-text file encoded in some form of UCS can contain any mixture of
11793    English, Spanish, Italian, German, Hebrew, Arabic, Greek, Russian,
11794    Armenian, Georgian, Japanese, Chinese, Korean, Vietnamese, Tibetan,
11795    Hindi, Bengali, Tamil, Thai, Ethiopic, and so on, plus scientific and
11796    mathematical notation, as well as texts in Runes, Ogham, Glagolitic,
11797    and other historic scripts.
11798
11799    The UCS already covers these scripts and many more, but it's an
11800    evolving standard with efforts underway to accommodate even more
11801    languages and writing systems. Support is growing for native UCS use
11802    on many platforms and in many applications. The goal of the framers of
11803    the UCS is for it to replace ASCII, the ISO Latin Alphabets, ISCII,
11804    VISCII, the Chinese, Japanese, and Korean (CJK) multibyte sets, etc,
11805    as well as the many private character sets in use today, in other
11806    words to become *the* Universal Character Set.
11807
11808    Until that time, however, conversions between existing sets and the
11809    UCS will be necessary when moving text between platforms and
11810    applications. Now Kermit can help.
11811      _________________________________________________________________
11812
11813     6.6.1. Overview of Unicode
11814
11815    For a more complete picture, please visit:
11816
11817   [539]http://www.unicode.org/
11818
11819    and access the various online introductions, FAQs, technical reports,
11820    and other information. For greater depth, order the latest version of
11821    the published Unicode Standard. The following overview contains a
11822    great many oversimplifications and perhaps an opinion or two.
11823
11824    At present, the UCS is a 16-bit (2-byte) character set, but with
11825    provisions to grow to a 4-byte set. UCS-2 refers to the two-byte set,
11826    also called the Base Multilingual Plane (BMP), in which each character
11827    has 16 bits, and therefore there are 2^16 = 65536 possible characters.
11828    The first 128 characters are the same as US ASCII (C0 control
11829    characters and DEL included), the next 32 are the C1 control
11830    characters of ISO 6429, and the next 96 are the Right Half of ISO
11831    8859-1 Latin Alphabet 1. The remaining tens of thousands of characters
11832    are arranged newly for the UCS, usually (but not always) in sections
11833    corresponding to existing standards, such as ISO Latin/Cyrillic, often
11834    plus additional characters not appearing in the existing standards due
11835    to lack of space (or other reasons).
11836
11837    ISO 10646 allows for additional planes, e.g. for Egyptian
11838    hieroglyphics or ancient (or other esoteric) CJK characters, but these
11839    planes are not yet defined and so we will say nothing more about them
11840    here, except that their use will require the 4-byte form of UCS,
11841    called UCS-4, in some form (more about "forms" in [540]Section 6.6.2).
11842
11843    Unicode and ISO 10646 are constantly under revision, mainly to add new
11844    characters. The Unicode revision is denoted by a version number, such
11845    as 1.0, 1.1, 2.0, 3.0. The ISO 10646 standard revision is identified
11846    by Edition (such as ISO 10646-1 1993), plus reference to any
11847    amendments. The first versions of these standards included encodings
11848    for Korean Hangul syllables (Jamos); these encodings were changed in
11849    version 1.1 of Unicode and by Amendment 5 to ISO 10646-1. The Unicode
11850    Technical Committee and the ISO acknowledge that this was a bad thing
11851    to do, and promise never change encodings or character names again,
11852    since this poses serious problems for conformance and data
11853    interchange.
11854
11855    A UCS-2 value is customarily written like this:
11856
11857   U+xxxx
11858
11859    where "xxxx" represents four hexadecimal digits, 0-9 and A-F. For
11860    example, U+0041 is "A", U+00C1 is A-acute, U+042F is uppercase
11861    Cyrillic "Ya", U+FB4F is Hebrew Ligature Alef Lamed, and U+FFFD is the
11862    special character that means "not a character".
11863
11864    Most characters from widely-used alphabetic writing systems such as
11865    the West European ones, Cyrillic, Greek, Hebrew, Vietnamese, etc, are
11866    available in "precomposed" form; for example Uppercase Latin Letter A
11867    with Acute Accent is a single character (as it is in Latin-1).
11868    However, the UCS also permits composition of a base character with one
11869    or more nonspacing diacritics. This means the same character can be
11870    represented in more than one way, which can present problems in many
11871    application areas, including transfer and character-set conversion of
11872    text.
11873
11874    Conversion from ASCII or Latin-1 to UCS-2 text is "trivial": simply
11875    insert a NUL (0) byte before each ASCII or Latin-1 byte. Converting in
11876    the reverse direction (provided the UCS-2 file contains only U+0000 to
11877    U+00FF) is equally simple (if we ignore the issue of composition):
11878    remove every second (NUL) byte. Conversion of other character sets to
11879    and from UCS, however, requires tables or algorithms specific to each
11880    set. Nevertheless, the relatively transparent upwards compatibility
11881    from ASCII and Latin-1, in which a very large share of the world's
11882    textual data is encoded, gives the UCS an entree onto existing
11883    platforms.
11884
11885    But the 2-byte format and the preponderance of NUL and other control
11886    bytes in UCS-2 text pose problems for current applications and
11887    transmission methods. And to make matters worse, different hardware
11888    platforms store UCS-2 characters in different byte order. Thus a UCS-2
11889    file transferred by FTP (or accessed via NFS, etc) between two
11890    computers with different architecture might have its bytes in the
11891    wrong order (or worse; see [541]Section 6.6.5.1 ).
11892      _________________________________________________________________
11893
11894     6.6.2. UCS Byte Order
11895
11896    Consider the number 1. In an 8-bit byte, this would be represented by
11897    the following series of 0- and 1-bits:
11898
11899   +-----------------+
11900   | 0 0 0 0 0 0 0 1 |
11901   +-----------------+
11902
11903    Therefore in a 16-bit "word" the representation might be:
11904
11905   +-----------------+-----------------+
11906   | 0 0 0 0 0 0 0 0 | 0 0 0 0 0 0 0 1 |
11907   +-----------------+-----------------+
11908
11909    Now consider the number 256, which is 2 to the 8th power. The binary
11910    representation is 100000000 (1 followed by 8 zeros). 256 would go into
11911    a 16-bit word like this:
11912
11913   +-----------------+-----------------+
11914   | 0 0 0 0 0 0 0 1 | 0 0 0 0 0 0 0 0 |
11915   +-----------------+-----------------+
11916
11917    When a computer works this way, it is said to be Big Endian, meaning
11918    it puts the most significant (biggest) byte first (on the "left") in a
11919    16-bit word, and the least significant byte second (on the right).
11920
11921    However, some other computers have the opposite arrangement, called
11922    Little Endian, in which 1 is:
11923
11924   +-----------------+-----------------+
11925   | 0 0 0 0 0 0 0 1 | 0 0 0 0 0 0 0 0 |
11926   +-----------------+-----------------+
11927
11928    and 256 is:
11929
11930   +-----------------+-----------------+
11931   | 0 0 0 0 0 0 0 0 | 0 0 0 0 0 0 0 1 |
11932   +-----------------+-----------------+
11933
11934    Computers such as Sparc, MIPS, PA-RISC, and PowerPC are Big Endian,
11935    whereas the PC and the Alpha are Little Endian. Endianness has never
11936    been an issue with 7- or 8-bit characters, but it is with UCS
11937    characters. It can be a tricky business to share or transfer a UCS-2
11938    file between two different kinds of computers.
11939
11940    To alleviate (but not entirely solve) the problem, UCS-2 files are
11941    supposed to begin with the Unicode character U+FEFF, Zero-Width
11942    No-Break Space (ZWNBS). This is a kind of "no-op" (note: any such
11943    assertion must normally be qualified with many "but ifs" and "excepts"
11944    which are omitted here in the interest of brevity). If the bytes are
11945    reversed the ZWNBS becomes U+FFFE, which is not (and never will be) a
11946    defined UCS character. U+FEFF at the beginning of a UCS file is
11947    therefore called a Byte Order Mark, or BOM.
11948
11949    Any application that creates a UCS-2 (or UTF-16, or UCS-4) file should
11950    include a BOM, and any application that reads one should test for a
11951    BOM, and if one is found, infer the byte order from it. This is a
11952    convention, however -- not a standard or a requirement -- and
11953    applications vary in their ability to handle BOMs and "backwards"
11954    UCS-2 files.
11955
11956    Note that a BOM is useful only at the beginning of a file. If you
11957    append one UCS-2 file to another, and both have BOMs, the internal BOM
11958    is no longer a BOM. And if the byte orders of the two files differ,
11959    then either the first part or the second will be backwards. (Various
11960    other undesirable effects might also occur, not discussed here.)
11961      _________________________________________________________________
11962
11963     6.6.2. UCS Transformation Formats
11964
11965    UCS textual data can be modified in various ways for transmission or
11966    storage. Any officially sanctioned method of doing this is called a
11967    UCS Transformation Format, or UTF. One such method, called UTF-16, is
11968    essentially identical with UCS-2 except that it designates certain
11969    code values as "escape sequences" (called surrogate pairs) to access
11970    characters in other planes without having to use full UCS-4. We won't
11971    discuss UTF-16 further here, since at the moment there are no other
11972    planes. Several other UTF's (such as UTF-1, UTF-2, and UTF-7) have
11973    fallen into disuse and are not discussed here. The most important
11974    transformation format today is UTF-8.
11975
11976    UTF-8, so called because it "serializes" UCS-2 data into a stream of
11977    8-bit bytes, is designed to allow the UCS to work with present-day
11978    communications gear, computers, and software. The most important
11979    properties of UTF-8 are that byte order is constant (no byte swapping)
11980    and all (7-bit) ASCII characters represent themselves. Therefore
11981    conversion between ASCII and UTF-8 is no conversion at all, and
11982    applications or platforms (such as Plan 9 from Bell Labs) that use
11983    UTF-8 "for everything" can still run traditional ASCII-only
11984    applications and be accessed from them. In particular, unlike UCS-2,
11985    ASCII characters are not padded with NUL bytes. But also unlike UCS-2,
11986    there is no transparency for Latin-1 or any other non-ASCII character
11987    set. Every non-ASCII UCS-2 character is represented by a sequence of 2
11988    or 3 UTF-8 bytes. Thus UTF-8 is more compact than UCS-2 for text
11989    containing a preponderance of ABC's (or other ASCII characters), about
11990    the same as UCS-2 for other alphabetic scripts (Cyrillic, Roman,
11991    Greek, etc), and larger than UCS-2 for Chinese, Japanese, and Korean.
11992
11993    The UTF-8 uncoding of the UCS has been adopted by the Internet as the
11994    preferred character set for new applications, and is gradually being
11995    retrofitted into traditional applications like FTP ([542]RFC 2640).
11996      _________________________________________________________________
11997
11998     6.6.3. Conformance Levels
11999
12000    Although the Unicode and ISO 10646 standards both describe the same
12001    character set, these standards differ in many ways, including their
12002    stated requirements for conformance and their classification of
12003    conformance levels.
12004
12005    Kermit has always abided by ISO character-set standards, including ISO
12006    character-set designation and invocation methods. In adapting Unicode,
12007    therefore, we had to choose from among the available ISO designations
12008    which, in turn, correspond with ISO 10646 conformance levels. At
12009    present, Kermit claims the lowest conformance level, 1, meaning
12010    (roughly) that it does not handle combining forms and it does not
12011    handle Korean Hangul Jamos (just as, at present, it does not handle
12012    Korean in general). Note that ISO 10646 Conformance Levels 1 and 2
12013    sidestep the issue of the code changes for Korean Hangul by announcing
12014    non-support for Hangul regardless of encoding.
12015
12016    ISO 10646 Conformance Level 1 is approximately equivalent to Unicode
12017    Normalization Form C (described in Unicode Technical Report 15,
12018    incorporated into Unicode 3.0).
12019
12020    As noted in [543]Section 6.6.2, Kermit does not claim to support
12021    UTF-16 at the present time, hence the UCS-2 nomenclature. Kermit
12022    treats surrogates just as if they were any other UCS-2 characters,
12023    rather than as escapes to other planes, which means that (except when
12024    converting between UCS-2 and UTF-8) they are translated to "error"
12025    characters, since (a) no other planes are defined yet (and if they
12026    were, no other character sets supported by Kermit would encode their
12027    characters), and (b) no valid surrogate character corresponds to any
12028    other UCS-2 character.
12029
12030    A minor yet significant aspect of Unicode 3.0 and some recent
12031    perturbation of ISO 10646-1 (probably Amendment 18, "Symbols and Other
12032    Characters") is the addition of the Euro Sign at U+20AC. As noted in
12033    [544]Section 6.0, Kermit's "Euro compliance" includes conversion
12034    between Latin Alphabet 9 and various PC code pages. Text can also be
12035    converted between UCS-2 or UTF-8 and any other Euro-compliant
12036    character set (Latin-9, CP858, CP1250, CP1252) without loss of the
12037    Euro Sign.
12038      _________________________________________________________________
12039
12040     6.6.4. Relationship of Unicode with Kermit's Other Character Sets
12041
12042    Kermit's character sets are divided into two groups: single-byte sets
12043    (such as Roman, Hebrew, Cyrillic, Greek) and multibyte (various
12044    Japanese sets). The two groups are distinct since one normally would
12045    not expect to convert Kanji ideograms to Roman (or other) letters, or
12046    vice versa.
12047
12048    Unicode character-set conversion works with both groups, but obviously
12049    the result depends on the repertoires of the source and destination
12050    character-sets both including the characters in the file. For example,
12051    you can translate a Hungarian text file between Latin-2 and Unicode,
12052    but not between (say) Unicode and Latin/Greek. By the same token you
12053    can convert Japanese text from Shift-JIS or EUC or JIS-7 to Unicode
12054    and back, but you can't convert the same file to (say) Latin-1 if it
12055    contains Japanese characters.
12056
12057      JIS-7 is equivalent to DEC Kanji and ISO-2022-JP except that the
12058      latter two do not support halfwidth Katakana. Kermit treats all
12059      three of these sets the same way, i.e. as JIS-7.
12060
12061    As noted, Kermit presently does not handle combining diacritics, and
12062    so will not correctly convert UCS files that use them into a
12063    single-byte character set. For example, if a UCS file contains Latin
12064    Capital Letter A (U+0041) followed by Combining Acute Accent (U+0301),
12065    the result will be a two-character sequence, A followed by another
12066    character. This is what is meant by Conformance Level 1. (The
12067    situation grows worse with multiple diacritics, since they can occur
12068    in any order.)
12069
12070    A higher level of conformance is possible, in which "canonical
12071    equivalences" are handled via algorithms and databases, at some
12072    (perhaps considerable) cost in performance, since a fair amount of
12073    additional code must be executed for every character during data
12074    transfer (database lookup, sorting of combining sequences into
12075    canonical order, etc). This can be added in future releases if there
12076    is a need (but in many cases, pre- and postpostprocessing might be a
12077    better option).
12078
12079    Within these constraints, Kermit converts between the UCS and its
12080    other character sets. For example, a mixture of Russian and English
12081    (and/or Dutch, or Latin) text can bet converted between the UCS and
12082    ISO Latin/Cyrillic or KOI-8. But since Kermit does not presently
12083    support Arabic character-set conversion, the new availability of UCS
12084    conversion does not mean that Kermit can convert from Arabic UCS text
12085    to some other character set, because Kermit does not support any other
12086    character set that includes Arabic. Ditto for Thai, Armenian,
12087    Georgian, Tibetan, Chinese, Korean, etc. However, Kermit CAN convert
12088    Arabic (or any other script) between UCS-2 and UTF-8.
12089
12090    Considering Cyrillic more carefully, note that the UCS also contains
12091    numerous Cyrillic characters not found in any of the Cyrillic sets
12092    (ISO Latin/Cyrillic, KOI8, CP866, etc) that Kermit supports;
12093    characters needed for Abkhasian, Yakut, Tatar, Bashkir, Altaic, Old
12094    Church Slavonic, etc; UCS text containing any of these historic or
12095    "extended" Cyrillic characters can not be converted to any of Kermit's
12096    current single-byte Cyrillic sets without loss. The situation is
12097    similar for Greek, Hebrew, etc, and even worse for Japanese since
12098    Unicode contains thousands of Kanjis that are lacking from the
12099    Japanese character sets based on JIS X 0208, such as EUC-JP, JIS-7,
12100    and Shift-JIS.
12101
12102    In general, when converting from UCS to a single-byte set, there is
12103    always the possibility of data loss, just as there is when converting
12104    from any larger set to a smaller one. For example, if a UCS file
12105    contains Devanagari characters, these characters will be lost when
12106    converting to (say) Latin-1, just as Roman vowels with acute accents
12107    are lost when converting from Latin-1 (an 8-bit set) to German ISO 646
12108    (a 7-bit set).
12109      _________________________________________________________________
12110
12111     6.6.5. Kermit's Unicode Features
12112
12113    C-Kermit can convert between UCS-2 or UTF-8 and any of its other
12114    character sets, and also between UCS-2 and UTF-8. When converting
12115    between UCS-2 or UTF-8 and a non-Unicode character set (such as
12116    Latin-1), the UCS Line Separator (LS, U+2028) and Paragraph Separator
12117    (PS, U+2029) characters are converted to the appropriate line
12118    terminator (CR, LF, or CRLF). When converting from a non-Unicode set
12119    to UCS-2 or UTF-8, however, line terminators are not converted to LS
12120    or PS. This is in accordance with the recommendations of Unicode
12121    Technical Report #13.
12122
12123    When C-Kermit starts, it tests the native byte order of the computer.
12124    You can see the result in the SHOW FEATURES or SHOW FILE display. It's
12125    also available in the variable \v(byteorder): 0 means Big Endian, 1
12126    means Little Endian.
12127
12128    When UCS-2 is involved in file transfer or translation, the following
12129    commands tell C-Kermit what to do about byte order:
12130
12131    SET FILE UCS BYTE-ORDER { BIG-ENDIAN, LITTLE-ENDIAN }
12132           This is for reading UCS-2 files that don't have a BOM, and also
12133           for writing UCS-2 files. If this command is not given, the
12134           machine's native byte order is used when writing UCS-2 files,
12135           and also when reading UCS-2 files that don't have a BOM.
12136
12137    SET FILE UCS BOM { ON, OFF }
12138           This setting is used when creating UCS-2 files. A BOM is added
12139           at the beginning by default. Use OFF to not add the BOM. This
12140           command has no affect when writing files.
12141
12142    COPY /SWAP-BYTES sourcefile destinationfile
12143           Use this for fixing a UCS-2 file whose bytes are in the wrong
12144           order.
12145
12146    Use SHOW FILE to display the FILE UCS settings.
12147
12148    Please note, again, that C-Kermit's user interface, including its
12149    script language, is not internationalized in any way. String
12150    comparisons, case conversion, and so on, work only for US ASCII
12151    (comparisons for equality work with other sets, but not
12152    lexically-greater-or-less-than or caseless comparisons; even
12153    comparisons for equality can fail when composed characters or byte
12154    order are involved). String functions such as \findex() and
12155    \fsubstring() that reference byte positions do just that; they won't
12156    work with UTF-8 text that contains any non-ASCII characters, and they
12157    will not work with UCS-2 text at all since they use C strings
12158    internally, which are NUL-terminated. These are just a few examples to
12159    illustrate that neither Unicode nor any other character-set beyond
12160    ASCII is supported at the user-interface, command, or scripting level
12161    in this version of C-Kermit.
12162      _________________________________________________________________
12163
12164     6.6.5.1. File Transfer
12165
12166    Kermit supports both UCS-2 and UTF-8 as file and transfer character
12167    sets in text-mode file transfer.
12168
12169    To select UCS-2 or UTF-8 as a file character-set, use:
12170
12171   SET FILE CHARACTER-SET { UCS2, UTF8 }
12172
12173    If you want to send a UCS-2 text file (or save an incoming file in
12174    UCS-2 format), tell Kermit to:
12175
12176   SET FILE CHARACTER-SET UCS2
12177
12178    and if you want to send a UTF-8 text file (or store an incoming file
12179    in UTF-8 format), tell Kermit to:
12180
12181   SET FILE CHARACTER-SET UTF8
12182
12183    When sending UCS-2 files, Kermit determines the byte order from the
12184    BOM, if there is one (and if there is a BOM, it is stripped, i.e. not
12185    sent). If there is no BOM, the byte order is the one specified in the
12186    most recent SET FILE UCS BYTE-ORDER command, if any, otherwise the
12187    computer's native byte order is assumed. When storing incoming files
12188    as UCS-2, the byte order is according SET FILE UCS BYTE-ORDER, if
12189    given, otherwise the native one; a BOM is written according to SET
12190    FILE UCS BOM.
12191
12192    A transfer character-set should be chosen that includes all of the
12193    characters in the source file. So, for example, if you are sending a
12194    UCS-2 file containing only German-language text, your transfer
12195    character-set can be Latin-1, Latin-2, Latin-9, UCS-2, or UTF-8. But
12196    if you are sending a file that contains a combination of Hebrew and
12197    Greek, your transfer character-set must be UCS-2 or UTF-8 if you don't
12198    want to lose one script or the other. Furthermore, the transfer
12199    character-set must be one that is supported by the receiving Kermit
12200    program. Since UCS support is new, it is possible that the other
12201    Kermit program (if it supports character sets at all) does not support
12202    it, but does support single-byte sets such as Latin-1, Latin/Cyrillic,
12203    etc.
12204
12205    To select UCS-2 or UTF-8 as a transfer character-set, use:
12206
12207   SET TRANSFER CHARACTER-SET { UCS2, UTF8 }
12208
12209    It is up to the receiving Kermit program to convert the transfer
12210    format to its own local format, if necessary. If it does not
12211    understand the UTF-8 or UCS-2 transfer character-set, and your file
12212    can not be adequately represented by any single-byte transfer
12213    character-set (such as Latin-1 or Latin/Cyrillic) then, if UTF-8
12214    format is acceptable on the receiving computer, use UTF-8 as the
12215    transfer character-set, with the receiver told to "set unknown-char
12216    keep", or with the sender told to "set attribute char off". If you
12217    want the file to be stored in UCS-2 format at the receiver, send it it
12218    binary mode if the source file is also UCS-2, or else use the
12219    TRANSLATE command (next section) to convert it to UCS-2 first, then
12220    send it in binary mode. You should not use UCS-2 as a transfer
12221    character-set in text-mode transfers to Kermit programs that don't
12222    support it, because they are likely to corrupt the result the same way
12223    FTP would (see the final paragraph of this section).
12224
12225    When UCS-2 is the transfer character set, it always goes into Kermit
12226    packets in Big Endian format, with no BOM. As always, the transfer
12227    character-set is announced by the sender to the receiver. The
12228    announcement for UCS-2 is "I162" (ISO Registration 162 = UCS-2 Level
12229    1) and by definition it is Big Endian (the standards say that when
12230    UCS-2 is serialized into bytes, the order must be Big Endian). The
12231    announcement for UTF-8 is "I190" (UTF-8 Level 1).
12232
12233    When receiving a file whose transfer character-set is UCS-2 or UTF-8,
12234    you must choose the appropriate file character set for the result.
12235    There is no way Kermit can do this for you automatically, since UCS
12236    data can be in any script at all, or any combination.
12237
12238    In general, UTF-8 or UCS-2 should be chosen as a transfer
12239    character-set if the source file is also encoded in some form of UCS
12240    and it contains more than one script. But there are other situations
12241    where where UTF-8 or UCS-2 offer advantages. For example, suppose the
12242    source file is on a NeXTstation and the destination file is on VMS.
12243    Both the NeXT and the DEC Multinational character sets include the
12244    French OE digraph, but Latin-1 does not. Therefore French words
12245    containing this character might not arrive intact when Latin-1 is the
12246    transfer character-set, but will with UTF-8 or UCS-2, since the UCS
12247    includes the OE digraph (but so does Latin-9).
12248
12249    UCS-2 should be chosen as a transfer character-set only for Japanese
12250    text files that contain a large preponderance of Kanji, since in this
12251    case (and only this case) UCS-2 (two bytes per Kanji) is more
12252    efficient than UTF-8 (three bytes per Kanji). The same will be true
12253    for Chinese and Korean when they are supported by Kermit. UCS-2 should
12254    never be used as a transfer character-set with a transfer partner that
12255    does not support UCS-2 since this can cause file corruption (see last
12256    paragraph in this section).
12257
12258    Note that Kermit's repeat-count compression is 100% ineffective for
12259    UCS-2, and is also ineffective for multibyte characters in UTF-8 and
12260    EUC-JP; this is because repeat-compression is a transport-level
12261    mechanism that operates on a per-byte basis; it has no knowledge of
12262    the distinction between a byte and a character.
12263
12264    When C-Kermit starts, it sets up associations ([545]Section 6.5) for
12265    incoming files whose transfer character sets are UCS-2 or UTF-8
12266    appropriately for the platform so that the file character-set for the
12267    incoming file is UCS-2 in Windows and UTF-8 elsewhere. Otherwise,
12268    C-Kermit does not make any default associations for UCS-2 or UTF-8,
12269    but of course you may add or change associations to suit your needs
12270    and preferences by including the appropriate ASSOCIATE commands in
12271    your Kermit startup file. For example, if you are a PC user and deal
12272    only with text written in Greek and English, you can:
12273
12274   ASSOCIATE TRANSFER-CHARACTER-SET UTF8 CP869
12275   ASSOCIATE TRANSFER-CHARACTER-SET UCS2 CP869
12276   ASSOCIATE FILE-CHARACTER-SET CP869 UTF8
12277
12278    Note that when file transfer involves conversion between a single-byte
12279    character set and UCS-2 or UTF-8, the file-transfer thermometer and
12280    estimated time left might be inaccurate, since they are based on the
12281    source file size, not the transfer encoding. This is purely a cosmetic
12282    issue and does not effect the final result. (And is not, strictly
12283    speaking, a bug; Kermit protocol presently includes no method for the
12284    sender to furnish an "estimated transfer size" to the receiver, and in
12285    any case any such guess could be as far off as the file size, given
12286    the many other factors that come into play, such as compression and
12287    prefixing).
12288
12289    A caution about FTP and UCS-2. As noted previously, if you transfer a
12290    UCS-2 file with FTP in binary mode between two computers with opposite
12291    Endianness, the result will have its bytes in the wrong order.
12292    However, if you use FTP to transfer a UCS-2 file in "ascii" (text)
12293    mode to ANY computer, even if it is identical to yours, the result
12294    will be corrupted because FTP's line-terminator conversions do not
12295    account for UCS-2. The same holds when sending from a UCS-aware Kermit
12296    program to an older Kermit program in text mode with a transfer
12297    character-set of UCS-2. So use UCS-2 as a transfer character-set ONLY
12298    with a UCS-2-aware Kermit partner.
12299      _________________________________________________________________
12300
12301     6.6.5.2. The TRANSLATE Command
12302
12303    In Kermit versions that have Unicode support included, TRANSLATE now
12304    always goes through Unicode; that is, the source set is converted to
12305    UCS-2 and thence to the target set. This is a major improvement, since
12306    in prior releases, C-Kermit had to pick the "most appropriate"
12307    transfer character-set as the intermediate set, and this would result
12308    in the loss of any characters that the source and target sets had in
12309    common but were lacking from the intermediate set (for example the OE
12310    digraph when translating from NeXT to DEC MCS through Latin-1). This
12311    never happens when Unicode is the intermediate set because Unicode is
12312    a superset of all other character sets supported by Kermit. A more
12313    dramatic example would be translation between Cyrillic PC code page
12314    866 and KOI8-R ([546]Section 6.4); formerly all the line- and
12315    box-drawing characters would be lost (since ISO 8859-5 does not have
12316    any); now the ones that these two sets have in common are preserved.
12317
12318    UCS-2 and UTF-8 are now both supported as source-file and
12319    destination-file character sets by C-Kermit's TRANSLATE command, for
12320    example:
12321
12322   translate oofa.txt ucs2 latin1 oofa-l1.txt
12323
12324    translates oofa.txt from UCS-2 to Latin-1, storing the result as
12325    oofa-l1.txt. Similarly:
12326
12327   translate oofa.txt utf8 latin1 oofa-l1.txt
12328   translate oofa.txt latin1 ucs2 oofa-ucs2.txt
12329   translate oofa.txt latin1 utf8 oofa-utf8.txt
12330   translate oofa.txt ucs2 utf8 oofa-utf8.txt
12331   translate oofa.txt utf8 ucs2 oofa-ucs2.txt
12332
12333    Treatment of the UCS-2 BOM is exactly the same as for file transfer.
12334    Note that if a UCS-2 source file is in the "wrong" byte order and
12335    lacks a BOM, and you don't tell Kermit about it with SET FILE UCS
12336    BYTE-ORDER, the result of the translation is total gibberish. Recall
12337    that you can use COPY /SWAP-BYTES to switch the byte order of an
12338    errant UCS-2 file (or any other file for that matter, if you can think
12339    of a reason to). Also note that:
12340
12341   translate oofa.txt ucs2 ucs2 new.txt
12342
12343    Produces a result in the native (or SET FILE UCS) byte-order as long
12344    as oofa.txt has a BOM.
12345
12346    As a side benefit of the Unicode work, the TRANSLATE command now works
12347    for the first time also for all Japanese character sets that Kermit
12348    supports. In other words, if you have a Japanese text file in any of
12349    the following encodings:
12350
12351   EUC-JP
12352   Shift-JIS
12353   JIS-7
12354   UCS-2
12355   UTF-8
12356
12357    You can use the TRANSLATE command to convert to any other encoding
12358    from the same list.
12359      _________________________________________________________________
12360
12361     6.6.5.3. Terminal Connection
12362
12363    The CONNECT command now allows UTF-8 as a local or remote terminal
12364    character-set:
12365
12366   SET TERMINAL CHARACTER-SET { ..., UTF8 } { ..., UTF8 }
12367   SET TERMINAL REMOTE-CHARACTER-SET { ..., UTF8 }
12368   SET TERMINAL LOCAL-CHARACTER-SET { ..., UTF8 }
12369
12370    (Recall that Kermit's terminal character-set has two "ends" -- the set
12371    used on the host to which Kermit is connected, and the set used on the
12372    local keyboard and screen.)
12373
12374    UCS-2 is not supported as a terminal character-set (either end) since
12375    (a) it is not used that way anywhere to our knowledge, and (b) the
12376    problems of Endianness and the high likelihood of loss of
12377    synchronization make it impractical. (Telecommunications is
12378    byte-oriented; if one byte, or any odd number of bytes, is lost
12379    because of buffer overruns, circuit resets, etc (or likewise if a
12380    burst of noise appears that takes the guise of an odd number of
12381    bytes), the byte order of the subsequent data stream will be
12382    backwards; unlike UTF-8 and traditional byte-based character sets,
12383    UCS-2 is not "self synchronizing".)
12384
12385    UTF-8 does not have byte-order or synchronization problems and is
12386    growing in popularity as a terminal character set as well as in other
12387    application areas. It allows a single terminal session to use multiple
12388    scripts (Roman, Cyrillic, Greek, etc) without ISO 2022 character-set
12389    switching (which terminal emulators like Kermit 95 can handle but few
12390    host applications understand or use), and meshes nicely with the
12391    Unicode screen fonts that are beginning to appear.
12392
12393    UTF-8 was first used in Plan 9 and soon will be available in Linux. It
12394    will probably spread from there (Unicode in some form is, of course,
12395    also used in Windows NT, but only internally -- not for access from
12396    outside).
12397
12398    To use UTF-8 or any other character set that uses 8-bit bytes in your
12399    terminal session, be sure to tell C-Kermit to:
12400
12401   SET TERMINAL BYTESIZE 8
12402   SET COMMAND BYTESIZE 8
12403   SET PARITY NONE
12404
12405    (or use the shortcut command, EIGHTBIT, which does all three at once).
12406
12407    In a setup where your local Kermit program uses a single-byte
12408    character set such as PC Code Page 850 and the remote host uses UTF-8:
12409
12410   SET TERM CHAR UTF8 CP850
12411
12412    or:
12413
12414   SET TERM REMOTE CHAR UTF8
12415   SET TERM LOCAL CHAR CP850
12416
12417    all works as expected. UTF-8 text on the remote displays correctly on
12418    your screen, and when you type CP850 characters, they are translated
12419    to UTF-8 sequences for transmission, and the echo from the host is
12420    translated from UTF-8 back to CP850. Telnet negotiations and
12421    autodownload take place before any character-set translation and work
12422    as before. The session log (if text mode was selected for it) contains
12423    only the local terminal character-set. And so on.
12424
12425    Kermit merely supplies translations from UTF-8 to your local terminal
12426    character-set (this includes treating UTF-8 Line Separator and
12427    Paragraph separator as CRLF). However, Kermit does does not, at
12428    present, perform "canonicalization" of composed sequences, nor does it
12429    automatically execute bidirectionality algorithms for display of
12430    mixed-direction text (e.g. Hebrew and English). Such presentation
12431    issues, like all others in the terminal-host regime, are left to the
12432    host.
12433
12434    By the way, C-Kermit also allows UTF-8 to be the local end of the
12435    terminal character-set, but so far this code is not tested, since we
12436    don't have a UTF-8 console or terminal to work with. However, it can
12437    be stated without doubt that C-Kermit's key mapping will not work for
12438    UTF-8 values, since (a) the key map is indexed by 8-bit byte values
12439    and (b) C-Kermit reads keystrokes a byte at a time (these comments do
12440    not apply to K95, which has direct access to the keyboard and can read
12441    "wide" keycodes and uses them to index a "wide" keymap).
12442
12443    Restrictions: As noted, the CONNECT command does not support UCS-2 as
12444    a REMOTE TERMINAL character-set. Neither does it support the Japanese
12445    sets EUC-JP, JIS-7, and Shift-JIS. Support for the Japanese sets (and
12446    possibly Chinese and Korean too) might be added in a future release.
12447    Since the TRANSMIT command (next section) uses the same REMOTE
12448    TERMINAL character-sets as the CONNECT command, it has the same
12449    restrictions.
12450      _________________________________________________________________
12451
12452     6.6.5.4. The TRANSMIT Command
12453
12454    As described in Chapter 15 of [547]Using C-Kermit and [548]Section
12455    4.21 of this document, the TRANSMIT command can be used to upload a
12456    file without protocol, more or less as if you were typing it on your
12457    keyboard while connected to the host. When TRANSMITting in text mode,
12458    the file's character set is converted to the host's unless you have
12459    SET TERMINAL CHARACTER-SET TRANSPARENT, or you include the new
12460    TRANSMIT switch, /TRANSPARENT.
12461
12462    Before C-Kermit 7.0, the file character-set was assumed to be the same
12463    as the local end of the terminal character-set, and the TRANSMIT
12464    command used the same translations as the CONNECT command, ignoring
12465    the file character-set.
12466
12467    In C-Kermit 7.0, that assumption (a poor one to begin with) can no
12468    longer be made, since UCS-2 can be a file character-set but not a
12469    terminal character-set. So now the file's character-set is given by
12470    your most recent SET FILE CHARACTER-SET command. The host's character
12471    set is the remote end of your most recent SET TERMINAL CHARACTER-SET
12472    command:
12473
12474   SET TERMINAL CHARACTER-SET remote-set [ local-set ]
12475
12476    or:
12477
12478   SET TERMINAL REMOTE-CHARACTER-SET remote-set
12479
12480    The TRANSMIT command converts each source-file character from the FILE
12481    character-set to the REMOTE TERMINAL character-set, and then transmits
12482    the translated characters according to your SET TRANSMIT preferences
12483    (Chapter 15).
12484
12485    If you have SET TRANSMIT ECHO ON, and the host is echoing the
12486    transmitted characters, the echos are converted from the remote
12487    terminal character-set to the local terminal character-set.
12488
12489   [ A picture would help... ]
12490
12491    Confused? Let's work through an example. Suppose your local computer
12492    is a NeXTstation, on which text files are encoded in the NeXT
12493    character set, and that the remote computer is a Data General AViiON,
12494    which uses the Data General International character set. Further
12495    suppose that you are logged in to the NeXT from a VT220 terminal which
12496    uses the DEC Multinational character set.
12497
12498    You need to convert the file from NeXT encoding to DG encoding and
12499    convert the echoes from DG encoding to DEC encoding. So on the NeXT,
12500    tell C-Kermit to:
12501
12502   eightbit
12503   set file character-set next
12504   set term character-set dg-international dec-mcs
12505   transmit /text nextdata.txt
12506
12507    (This assumes you have some sort of collection process already set up
12508    on the Data General, such as a text editor or the venerable "cat >
12509    foo". The EIGHTBIT command is equivalent to SET TERMINAL BYTESIZE 8,
12510    SET COMMAND BYTESIZE 8, SET PARITY NONE.)
12511
12512    To further complicate matters, suppose your local terminal character
12513    set is the same as the remote one, so you don't need terminal
12514    character-set translation, but you need to TRANSMIT a file that is in
12515    a different character set and you want it translated to the host set.
12516    In this case, use SET TERM CHARACTER-SET to actually specify the
12517    character set used on each end, rather than specifying TRANSPARENT:
12518
12519   eightbit
12520   set file character-set ucs2
12521   set term character-set latin1 latin1
12522   transmit /text ucs2data.txt
12523
12524    The distinction between:
12525
12526   SET TERMINAL CHARACTER-SET xxx yyy
12527
12528    (where xxx and yyy are the same set) and:
12529
12530   SET TERMINAL CHARACTER-SET TRANSPARENT
12531
12532    is new to C-Kermit 7.0, but affects only the TRANSMIT command.
12533
12534    The TRANSMIT command currently does nothing special with UCS-2/UTF-8
12535    Line and Paragraph Separator characters; more experience is required
12536    to find out how these behave in a genuine Unicode terminal-host
12537    setting.
12538
12539    Restrictions: As noted, the TRANSMIT command translates from the FILE
12540    character-set to the REMOTE TERMINAL character-set. This rules out
12541    translations to any character set that is not supported as a REMOTE
12542    TERMINAL character-set, such as UCS-2, EUC-JP, JIS-7, and Shift-JIS.
12543      _________________________________________________________________
12544
12545     6.6.5.5. Summary of Kermit Unicode Commands
12546
12547    Specifying file character-set and byte order:
12548           SET FILE CHARACTER-SET { ..., UCS2, UTF8 }
12549           REMOTE SET FILE CHARACTER-SET { ..., UCS2, UTF8 } (See next
12550           section)
12551           SET FILE UCS BOM { ON, OFF }
12552           SET FILE UCS BYTE-ORDER { BIG-ENDIAN, LITTLE-ENDIAN }
12553
12554    Specifying the transfer character-set:
12555           SET TRANSFER CHARACTER-SET { ..., UCS-2, UTF-8 }
12556           REMOTE SET TRANSFER CHARACTER-SET { ..., UCS-2, UTF-8 }
12557
12558    Specifying the terminal character-set:
12559           SET TERMINAL CHARACTER-SET { ..., UTF8 } { ..., UTF8 }
12560           SET TERMINAL REMOTE-CHARACTER-SET { ..., UTF8 }
12561           SET TERMINAL LOCAL-CHARACTER-SET { ..., UTF8 }
12562
12563    Displaying settings:
12564           SHOW FILE
12565           SHOW TRANSFER
12566           SHOW TERMINAL
12567           SHOW CHARACTER-SETS
12568
12569    Commands that use these settings include:
12570           SEND, RECEIVE, GET, etc.
12571           CONNECT
12572           TRANSMIT
12573           LOG SESSION
12574
12575    Converting files:
12576           TRANSLATE infile { ..., UCS-2, UTF-8 } { ..., UCS-2, UTF-8 }
12577           outfile
12578           COPY /SWAP-BYTES infile outfile
12579      _________________________________________________________________
12580
12581   6.7. Client/Server Character-Set Switching
12582
12583    A simple mechanism has been added to allow the client to change the
12584    server's FILE CHARACTER-SET:
12585
12586    REMOTE SET FILE CHARACTER-SET name
12587           The client asks the server to change its file character-set to
12588           the one given. The name must match one of the server's file
12589           character-set names. For convenience, C-Kermit uses its own
12590           file character-set keyword list for parsing this command so you
12591           can use ? for help and Tab or Esc for completion. However,
12592           since the server might have a different repertoire (or even use
12593           different names for the same sets), C-Kermit accepts any string
12594           you supply and sends it to the server. The server, if it
12595           supports this command (C-Kermit 7.0 and K95 1.1.19 do), sets
12596           its file character-set as requested, and also disables
12597           automatic character-set switching ([549]Section 6.5). If the
12598           server does not support this command or if it does not support
12599           the given character set, the REMOTE SET FILE CHARACTER-SET
12600           command fails.
12601
12602    Here's an example that sends a Japanese text file encoded in Shift-JIS
12603    to a server using every combination of Kermit's Japanese-capable file
12604    and transfer character sets:
12605
12606   dcl \&x[] = euc ucs2 utf8             ; transfer character-sets
12607   dcl \&y[] = eu uc ut                  ; 2-letter abbreviations for them
12608   dcl \&f[] = shift euc jis7 ucs2 utf8  ; file character-sets
12609   dcl \&g[] = sj eu j7 uc ut            ; 2-letter abbreviations
12610
12611   set file char shift-jis               ; local file character-set is Shift-JIS
12612   for \%i 1 \fdim(&x) 1 {               ; for each transfer character-set...
12613       set xfer char \&x[\%i]            ; set it
12614       for \%j 1 \fdim(&f) 1 {           ; for each remote file character-set...
12615           remote set file char \&f[\%j] ; set it
12616           if fail exit 1 SERVER REJECTED CHARSET
12617           send /text meibo-sj.html meibo-sj-\&y[\%i]-\&g[\%j].txt ; send the fi
12618 le
12619           if fail exit 1 TRANSFER FAILED
12620       }
12621   }
12622
12623    The Kermit-370 server does not support REMOTE SET FILE CHARACTER-SET,
12624    but since it supports REMOTE KERMIT commands, you can get the same
12625    effect with REMOTE KERMIT SET FILE CHARACTER-SET name.
12626      _________________________________________________________________
12627
12628   7. SCRIPT PROGRAMMING
12629
12630    (Also see [550]Section 2.8, Scripting Local Programs.)
12631
12632   7.0. Bug Fixes
12633
12634    The following script programming bugs were fixed in C-Kermit 7.0:
12635
12636      * IF EXIST and IF DIRECTORY were fixed to properly strip braces from
12637        around their arguments, so "if directory {C:\Program Files}", etc,
12638        would work as expected. However, this means that if the file or
12639        directory name is actually enclosed in braces, the braces must be
12640        doubled.
12641      * The READ command did not fail if the READ file wasn't open; now it
12642        does.
12643      * The READ command refused to read the last or only line of a file
12644        if it did not end with a proper line terminator; now it does.
12645      * The END command, when given from within a SWITCH statement, did
12646        not exit from the current macro or command file; instead it just
12647        terminated the SWITCH.
12648      _________________________________________________________________
12649
12650   7.1. The INPUT Command
12651
12652    7.1.1. INPUT Timeouts
12653
12654    The description of the INPUT command on page 422 fails to mention the
12655    following two points about the timeout (which apply to C-Kermit 6.0
12656    and later):
12657
12658     1. "INPUT -1 text" (or "INPUT \%x text", where \%x is any variable
12659        whose value is -1 or less) means "wait forever". This form of the
12660        INPUT command fails only if it is interrupted, since it will never
12661        time out.
12662     2. INPUT 0 performs a nonblocking read of material that has already
12663        arrived but has not yet been read, and succeeds immediately if the
12664        target string is found, or fails immediately if it is not found.
12665
12666    The same points apply to MINPUT. REINPUT ignores its timeout
12667    parameter.
12668      _________________________________________________________________
12669
12670     7.1.2. New INPUT Controls
12671
12672    The following new INPUT controls were added in version 7.0:
12673
12674    SET INPUT AUTODOWNLOAD { ON, OFF }
12675           Explained in [551]Section 7.7.
12676
12677    SET INPUT CANCELLATION { ON, OFF }
12678           This governs whether an INPUT command can be canceled by
12679           "pressing any key" on the keyboard. Normally it can be, in
12680           which case the INPUT command fails immediately and \v(instatus)
12681           is set to 2, indicating interruption. SET INPUT CANCELLATION
12682           OFF disables keyboard cancellations; thus if the search text is
12683           not encountered, the INPUT command will run for its entire
12684           timeout interval. SET INPUT CANCELLATION OFF does not disable
12685           interruption by Ctrl-C, however; every command needs an
12686           emergency exit. (If you really want to disable interruption by
12687           Ctrl-C, use SET COMMAND INTERRUPTION OFF.)
12688
12689    Also see [552]Section 7.2 for any new variables related to INPUT.
12690      _________________________________________________________________
12691
12692     7.1.3. INPUT with Pattern Matching
12693
12694    C-Kermit 7.0 allows INPUT, MINPUT, and REINPUT targets to be a pattern
12695    (explained in [553]Sections 1.19 and [554]4.9). This solves a
12696    long-standing problem illustrated by the following scenario: a certain
12697    company has a bank of TCP/IP modem servers, with hostnames server1,
12698    server2, server3, and so on. Each server's prompt is its name,
12699    followed by a colon (:), for example "Server72:". Without INPUT
12700    patterns, it would be rather difficult to wait for the prompt. The
12701    brute force approach:
12702
12703   minput 20 Server1: Server2: Server3: ... (enumerating each one)
12704
12705    is subject to failure whenever a new server is added. A more subtle
12706    approach:
12707
12708   input 20 Server
12709   if fail ...
12710   input 2 :
12711
12712    is liable to false positives, e.g. "Welcome to the XYZ Corp Modem
12713    Server. Please read the following message:"...
12714
12715    With patterns, you can match the prompt with "Server*:" (which doesn't
12716    solve the "false positives" problem, but certainly is more compact
12717    than the brute force method), or with more specific patterns such as
12718    "Server[1-9]:" and "Server[1-9][0-9]:", or equivalently:
12719
12720   Server{[1-9],[1-9][0-9]}:
12721
12722    meaning the word "Server" followed by a single digit (1-9) or by two
12723    digits representing a number from 1 to 99, followed by a colon.
12724
12725    INPUT pattern matching has been added in a way that does not interfere
12726    with existing scripts. No new commands or switches are used. The
12727    simple rule is: if an INPUT search target is the argument of the (new)
12728    \fpattern() function, it is a pattern. Otherwise it is taken
12729    literally, as before. For example:
12730
12731   input 5 a*b
12732
12733    searches for an 'a' followed by an asterisk ('*'), followed by a 'b'.
12734    But:
12735
12736   input 5 \fpattern(a*b)
12737
12738    searches for an 'a' followed by anything at all up to and including
12739    the first 'b'. This means that any search target to INPUT, MINPUT, or
12740    REINPUT can be a pattern or a literal string, and in particular that
12741    MINPUT can accommodate any mixture of patterns and literal strings.
12742
12743    In selecting patterns, note that:
12744
12745      * A leading '*' is always implied so there is no need to include
12746        one.
12747      * A trailing '*' is meaningless and ignored.
12748      * A '*' by itself matches the first character that arrives.
12749
12750    A syntax note: If your pattern is a selection list, meaning a list of
12751    alternatives separated by commas and enclosed in braces, then the
12752    outer braces will be stripped by various levels of parsers, so you
12753    must include three of each:
12754
12755   input 10 \fpattern({{{abc,mno,xyz}}})
12756
12757    Note that this is equivalent to:
12758
12759   minput 10 abc mno xyz
12760
12761    except for the setting of the \v(minput) variable.
12762
12763    And a caution: INPUT pattern matching has a limitation that you
12764    probably never noticed with literal-string matching, namely that there
12765    is a limit on the size of the match. For example, if the pattern is
12766    "a*b", the match will succeed if the 'a' and 'b' are not separated by
12767    more than (say) 8K bytes, but will fail if they are farther apart than
12768    that. In such cases, it better to use two INPUTs (e.g. "input 10 a"
12769    and then "input 100 b").
12770      _________________________________________________________________
12771
12772     7.1.4. The INPUT Match Result
12773
12774    The result of any INPUT, MINPUT, or REINPUT command, no matter whether
12775    the search targets are patterns or literal strings, is available in
12776    the new \v(inmatch) variable. For example:
12777
12778   minput 10 cat \fpattern([dh]og)
12779   if success echo MINPUT matched "\v(inmatch)"
12780
12781    This is especially useful when a pattern was matched, since it makes
12782    the string that matched the pattern available to Kermit; there would
12783    be no way to get it otherwise.
12784
12785    After an INPUT command, you can view all the INPUT-related variables
12786    by typing "show variables in" (abbreviate as "sho var in"), which
12787    shows the values of all built-in variables whose names start with
12788    "in".
12789      _________________________________________________________________
12790
12791   7.2. New or Improved Built-In Variables
12792
12793    \v(blockcheck)
12794           Current BLOCK-CHECK setting, 1, 2, 3, or 4. 4 is the code for
12795           BLANK-FREE-2.
12796
12797    \v(byteorder)
12798           The machine's byte order: 0 = Big Endian, 1 = Little Endian.
12799
12800    \v(cmdbufsize)
12801           The length of the command buffer, which is the maximum size for
12802           a macro, a command, a variable, or anything else in C-Kermit's
12803           script language.
12804
12805    \v(ctty)
12806           The device name of C-Kermit's controlling (login) terminal.
12807
12808    \v(filename)
12809           Described in [555]Sections 4.1 and [556]4.2.
12810
12811    \v(filenumber)
12812           Described in [557]Sections 4.1 and [558]4.2.
12813
12814    \v(filespec)
12815           As of C-Kermit 7.0, contains fully qualified filenames rather
12816           than (usually) relative ones.
12817
12818    \v(return)
12819           Now holds the END n value of the macro that most recently
12820           returned, in case END was used rather than RETURN.
12821
12822    \v(editor)
12823           Pathname of preferred text editor
12824
12825    \v(editopts)
12826           Command-line options for editor
12827
12828    \v(editfile)
12829           File most recently edited
12830
12831    \v(browser)
12832           Pathname of preferred Web browser
12833
12834    \v(browsopts)
12835           Command-line options for Web browser
12836
12837    \v(browsurl)
12838           URL most recently given to Web browser
12839
12840    \v(dialtype)
12841           Type of call most recently placed (see [559]Section 2.1.11).
12842
12843    \v(kbchar)
12844           The character, if any, that was typed at the keyboard to to
12845           interrupt the most recent PAUSE, SLEEP, WAIT, MSLEEP, or INPUT
12846           command; empty if the most recent such command was not
12847           interrupted from the keyboard.
12848
12849    \v(lockdir)
12850           UNIX only - The name of the UUCP lockfile directory, if known,
12851           otherwise "(unknown)".
12852
12853    \v(lockpid)
12854           UNIX only - PID of process that owns the communication port
12855           that you tried to open with a SET LINE command that failed
12856           because the port was in use, otherwise empty. This variable is
12857           set with every SET LINE command.
12858
12859    \v(cx_time)
12860           If no connection (SET HOST, SET LINE, DIAL, TELNET, etc) is
12861           active, this is 0. If a connection is active, this is the
12862           number of seconds since the connection was made.
12863
12864    \v(hwparity)
12865           If hardware parity is in effect, this variable gives its value,
12866           such as "even" or "odd" (in which case, the \v(parity) variable
12867           will be "none"). Otherwise this variable is empty.
12868
12869    \v(serial)
12870           Current serial port settings in 8N1 format ([560]Section 2.10).
12871
12872    \v(errno)
12873           In UNIX, the current value of the C runtime errno variable,
12874           which is quite volatile (meaning that often an "interesting"
12875           error code can be overwritten by some other library call or
12876           system service that sets errno before you have a chance to look
12877           at it). In VMS, the error code returned by the system or
12878           library call that most recently failed (success codes are not
12879           saved). Not available in other operating systems.
12880
12881    \v(errstring)
12882           The UNIX or VMS system error message that corresponds to
12883           \v(errno). Not available in all OS's. Also see
12884           [561]\ferrstring().
12885
12886    \v(setlinemsg)
12887           The error message, if any, from the most recent SET LINE, SET
12888           PORT, SET HOST, TELNET, or other connection-making command.
12889           This is not necessarily the same as \v(errstring) since these
12890           commands might fail without generating a system error code, for
12891           example (in UNIX) because a lockfile existed indicating the
12892           device was assigned by another user.
12893
12894    \v(exitstatus)
12895           The exit status C-Kermit would return if it exited now.
12896
12897    \v(pexitstat)
12898           The exit status of the inferior process most recently invoked
12899           by C-Kermit (by RUN, !, REDIRECT, SEND /COMMAND, etc). In VMS,
12900           this code can be given to \ferrstring() to get the
12901           corresponding error message (in UNIX, program/command return
12902           codes are not the same as system error codes). Not available in
12903           operating systems other than UNIX and VMS. See [562]Section
12904           4.2.5 for details.
12905
12906    \v(inmatch)
12907           The incoming string of characters, if any, that matched the
12908           most recent INPUT, REINPUT, or MINPUT command.
12909
12910    \v(intime)
12911           The number of milliseconds (thousandths of seconds) it took for
12912           the most recent INPUT command to find its match, or -1 if no
12913           INPUT command has been given yet. If the INPUT command timed
12914           out, the value is approximately equal to 1000 times the INPUT
12915           timeout. If INPUT failed for some other reason, the value is
12916           undefined (\v(instatus) gives INPUT completion status). If your
12917           version of C-Kermit is built without high-precision
12918           floating-point timers, this number will always be a multiple of
12919           1000.
12920
12921    \v(inwait)
12922           The number of seconds specified as the timeout in the most
12923           recent INPUT command.
12924
12925    \v(dialsuffix)
12926           Dialing suffix for use during PDIAL sequence; see [563]Section
12927           2.1.10.
12928
12929    \v(pid)
12930           UNIX, VMS, and K95 only. C-Kermit's primary process ID,
12931           numeric, decimal. If you want to show it in hex, use
12932           \fn2hex(\v(pid)) If you want to show it in octal, use
12933           \fn2octal(\v(pid)).
12934
12935    \v(printer)
12936           Current printer name or SET PRINTER value.
12937
12938    \v(p_ctl)
12939           Control prefix char \v(p_8bit) 8-bit prefix char (if parity not
12940           none)
12941
12942    \v(p_rpt)
12943           Repeat prefix char (if repeat compression enabled)
12944
12945    \v(herald)
12946           Kermit's version herald
12947
12948    \v(test)
12949           Kermit's test version, if any, or 0 if this is not a test
12950           version. Typical values for test versions are "Alpha.03" or
12951           "Beta.14".
12952
12953    \v(sendlist)
12954           The number of entries in the SEND-LIST, 0 if none. Note:
12955           entries do not necessarily correspond to files, since an entry
12956           might contain wildcards. Also note that the value does not go
12957           back to 0 after the files in the list are sent. To reset this
12958           variable, use CLEAR SEND-LIST. The purpose of this variable is
12959           to determine if a SEND command, when given without any
12960           filenames, will be legal. Example:
12961
12962   xif \v(sendlist) { send } else { send oofa.txt }
12963
12964    \v(trigger)
12965           If the most recent CONNECT session was terminated automatically
12966           by a trigger, this variable contains the trigger value.
12967
12968    \v(ty_ln)
12969           TYPE line number (during TYPE)
12970
12971    \v(ty_lc)
12972           TYPE line count (after TYPE)
12973
12974    \v(ty_mc)
12975           TYPE match count (after TYPE)
12976
12977    \v(xferstat)
12978           Status of most recent file transfer:
12979
12980 -1: No transfer yet
12981  0: Succeeded
12982  1: Failed
12983
12984    \v(xfermsg)
12985           If the most recent file transfer failed, this is the reason. If
12986           it succeeded, \v(xfermsg) is an empty string.
12987
12988    \v(tftime)
12989           Total elapsed time of most recent file transfer operation, in
12990           seconds.
12991
12992    \v(textdir)
12993           Directory that holds (or is supposed to hold) Kermit text files
12994           such as installation instructions, release notes, update notes,
12995           read-me files, "beware" files, etc.
12996
12997    \v(name)
12998           The name with which the Kermit program was invoked, e.g.
12999           "kermit", "wermit", "k95", "k2", etc (see [564]Section 9.1).
13000
13001    \v(osname)
13002           Name of operating system on computer where C-Kermit is running,
13003           obtained at runtime (from uname or equivalent).
13004
13005    \v(osversion)
13006           Version of operating system on computer where C-Kermit is
13007           running, obtained at runtime (from uname or equivalent).
13008
13009    \v(osrelease)
13010           Release of operating system on computer where C-Kermit is
13011           running, obtained at runtime (from uname or equivalent).
13012
13013    \v(model)
13014           The specific hardware model of the computer where C-Kermit is
13015           running, if known.
13016
13017    \v(math_pi)
13018           The value of Pi (see [565]Section 7.23)
13019
13020    \v(math_e)
13021           The value of e (see [566]Section 7.23)
13022
13023    \v(math_precision)
13024           How many significant digits in a floating-point number.
13025
13026    \v(f_count)
13027           Result of the most recent FILE COUNT (FCOUNT) command.
13028
13029    \v(f_error)
13030           Numeric error code of most recent FILE command.
13031
13032    \v(f_max)
13033           Maximum number of files open simultaneously.
13034
13035    The math constants are given in the precision of underlying computer's
13036    floating-point arithmetic.
13037
13038    Note the distinction between \v(osname), \v(osversion), and
13039    \v(platform); the latter refers to the platform for which and/or upon
13040    which C-Kermit was built, as opposed to the one on which it is
13041    actually running. Also note that each operating system can, and
13042    probably will, interpret and fill in the os* variables differently, or
13043    not at all.
13044
13045    The SHOW VARIABLES command now accepts a variable name, prefix, or
13046    pattern:
13047
13048   show variables         Shows all variables.
13049   show variables t       Shows all variables that start with "t".
13050   show variables *ver*   Shows all variables whose names contain "ver".
13051   show variables *ver    Ditto (an implied "*" is appended).
13052      _________________________________________________________________
13053
13054   7.3. New or Improved Built-In Functions
13055
13056    The following new file-i/o functions are explained in [567]Section
13057    1.22.
13058
13059   \f_status(channel)           Status of file open on channel
13060   \f_pos(channel)              Read/write (byte) pointer of given file
13061   \f_line(channel)             Current line of file
13062   \f_handle(channel)           Handle of file
13063   \f_eof(channel)              Whether given file is at EOF
13064   \f_getchar(channel)          Read a char from given file
13065   \f_getline(channel)          Read a line from given file
13066   \f_getblock(channel,n)       Read a block from given file
13067   \f_putchar(channel,c)        Write a char to given file
13068   \f_putline(channel,string)   Write a line to given file
13069   \f_putblock(channel,string)  Write a block to given file
13070
13071    The following new date-time-related functions are explained in
13072    [568]Section 1.6:
13073
13074   \fday()                Returns day of week of given date
13075   \fnday()               Returns numeric day of week of given date
13076   \ftime()               Returns time portion of given date-time
13077   \fntime()              Converts time to seconds since midnight
13078   \fn2time()             Converts seconds since midnight to hh:mm:ss
13079   \fcvtdate(date-time)   Converts free-format date to yyyymmdd hh:mm:ss
13080   \fdayofyear(date-time) Converts date to yyyyddd (day-of-year) format
13081   \fdoy(date-time)       Synonym for \fdayofyear()
13082   \fdoy2date(dayofyear)  Converts yyyyddd to yyyymmdd
13083   \fmjd(date-time)       Converts free-format date to Modified Julian Date
13084   \fmjd2date(mjd)        Converts modified Julian date to yyyymmdd
13085
13086    The new floating-point arithmetic functions are explained in
13087    [569]Section 7.23. f1 and f2 are floating-point (real) numbers; d is
13088    the number of decimal places to show:
13089
13090   \ffpabsolute(f1,d)     Absolute value of f1
13091   \ffpadd(f1,f2,d)       f1 + f1
13092   \ffpcosine(f1,d)       Cosine of f1
13093   \ffpdivide(f1,f2,d)    f1 divided by f2
13094   \ffpexp(f1,d)          e to the f1 power
13095   \ffpint(f1)            Integer part of f1
13096   \ffplog10(f1,d)        Log base 10 of f1
13097   \ffplogn(f1,d)         Natural log of f1
13098   \ffpmaximum(f1,f2,d)   Maximum of f1 and f2
13099   \ffpminimum(f1,f2,d)   Minimum of f1 and f2
13100   \ffpmodulus(f1,f2,d)   Modulus of f1 and f2
13101   \ffpmultiply(f1,f2,d)  Product of f1 and f2
13102   \ffpraise(f1,f2,d)     Raise f1 to power f2
13103   \ffpround(f1,d)        Round f1 to d places
13104   \ffpsine(f1,d)         Sine of f1
13105   \ffpsqrt(f1,d)         Square root of f1
13106   \ffpsubtract(f1,f2,d)  f2 - f1
13107   \ffptangent(f1,d)      Tangent of f1
13108
13109    Integer number functions:
13110
13111    \fabsolute(n)
13112           Absolute value of integer n.
13113
13114    \frandom(n)
13115           Returns a random integer between 0 and n-1.
13116
13117    \fradix(s,n1,n2)
13118           If the string s is an integer in radix n1, the result is the
13119           same number expressed in radix n2, where n1 and n2 may be any
13120           number from 2 through 36, expressed as decimal numbers, or
13121           variables (etc) that evaluate to decimal numbers. For the
13122           source and result, the digits of any radix, r, are the first r
13123           characters in the sequence 0-9,a-z (case doesn't matter for the
13124           letters). The string s may have a sign, + or -; if it starts
13125           with a minus (-) sign, the result also has a minus sign.
13126
13127    The \fradix() function does not work with floating-point numbers. It
13128    does not reveal the internal storage format of a number; for example,
13129    \fradix(-1,10,16) is -1, not something like FFFFFFFFFF. If all three
13130    arguments are not given, or if n1 or n2 are not numbers between 2 and
13131    36 inclusive, or s is not a number in radix n1, an error occurs and
13132    the empty string is returned. \fradix() also does not offer
13133    extended-precision arithmetic; number values are limited to those
13134    expressed as a long integer in the architecture of the underlying
13135    computer, usually 32 or 64 bits. If you give it an argument whose
13136    absolute value is larger than can be held in an unsigned long, the
13137    result is -1.
13138
13139    The next four are shorthand functions for decimal/hexadecimal and
13140    decimal/octal number conversion:
13141
13142    \fn2hex(n)
13143           Returns the hexadecimal (base 16) representation of the integer
13144           n. This is different from \fhexify(s), which treats its
13145           argument as a string rather than a number. The result is always
13146           left-padded with 0's to make its length even. Examples:
13147
13148   \n2hex(0)   = "00"                    \fhexify(0)   = "30"
13149   \n2hex(255) = "ff"                    \fhexify(255) = "323535"
13150   \n2hex(256) = "0100"                  \fhexify(256) = "323536"
13151
13152    \fhex2n(x)
13153           Converts hexadecimal number x to decimal equivalent decimal
13154           number. This is the inverse of \fn2hex(). Equivalent to
13155           \fradix(s,16,10).
13156
13157    \fn2octal(n)
13158           Returns the octal (base 8) representation of the number n.
13159           Examples:
13160
13161   \n2octal(0) = "0"
13162   \n2oct(255) = "377"
13163   \n2oct(256) = "400"
13164   Equivalent to \fradix(n,10,8).
13165
13166    \foct2n(n)
13167           Returns the decimal representation of the given octal number,
13168           n. The inverse of \fn2octal(). Equivalent to \fradix(n,8,10).
13169
13170    String functions:
13171
13172    \s(name[n:m])
13173           Equivalent to \fsubstring(\m(name),n,m) ([570]Section 7.24).
13174
13175    \:(name[n:m])
13176           Equivalent to \fsubstring(name,n,m) (where "name" is any
13177           \-quantity) ([571]Section 7.24).
13178
13179    \fleft(s,n)
13180           The leftmost ncharacters of string s; equivalent to
13181           \fsubstring(s,1,n).
13182
13183    \fstripx(string,char)
13184           Returns the part of the string up to the rightmost occurrence,
13185           if any, of the given character. The default character is period
13186           (.) Examples:
13187
13188   \fstripx(foo/bar,/)                 = "foo"
13189   \fstripx(foo/bar/baz,/)             = "foo/bar"
13190   \fstripx(autoexec.bat,.)            = "autoexec"
13191   \fstripx(autoexec.bat)              = "autoexec"
13192   \fstripx(fstripx(foo/bar/baz,/),/)  = "foo"
13193
13194    \flop(string,character)
13195           Returns the portion of the string starting after the first
13196           occurrence of the given character. The default character is
13197           period (.) Examples:
13198
13199   \flop(autoexec.bat)                 = "bat"
13200   \flop(baz.foo/bar)                  = "foo/bar"
13201   \flop(baz.foo/bar,/)                = "bar
13202
13203    \fstripn(string,n)
13204           Returns the string with ncharacters removed from the end.
13205           Example:
13206
13207   \fstripn(12345678,3)                = "12345"
13208
13209           (For more discussion of \fstripx(), \fstripn(), and \flop() see
13210           [572]Section 4.2.3).
13211
13212    \fb64encode(s)
13213           Returns the Base-64 encoding of the string s.
13214
13215    \fb64decode(s)
13216           Returns the decoding of the Base-64 string s. Fails if s is not
13217           a Base-64 string, or if its length is not a multiple of 4. Note
13218           that if any of the result bytes are null (0), the result string
13219           stops there. There is no way to represent strings that contain
13220           null bytes in C-Kermit (the same is true for \funhexify()).
13221
13222    \fword(s1,n,s2,s3)
13223           Extracts word number nfrom string s1. By default, a "word" is
13224           any sequence of ASCII letters or digits; nis 1-based. If nis
13225           omitted, "1" is used. Examples:
13226
13227   \fword(one two three)    = "one"
13228   \fword(one two three,1)  = "one"
13229   \fword(one two three,2)  = "two"
13230   \fword(one two three,3)  = "three"
13231
13232           and:
13233
13234     \fword(\v(dialresult),2) = "31200"
13235
13236           is "31200" if \v(dialresult) is (e.g.) "CONNECT
13237           31200/ARQ/V32/LAPM/V42BIS".
13238
13239           If you include s2, this replaces the default break set. For
13240           example, suppose you have a string \%a whose value is:
13241
13242   $150.00 $300.00 $39.95
13243
13244           and you want each dollar amount to be a word; use:
13245
13246   \fword(\%a,\%n,{ })
13247
13248           This returns dollar amount number \%n, e.g. "$300.00" for \%n =
13249           2. "{ }" denotes a space (you must enclose it in braces,
13250           otherwise it is squeezed out). Note that ASCII control
13251           characters are always included in the break set; you don't have
13252           to specify them (and you can't not specify them).
13253
13254           The optional s3 argument lists characters (even control
13255           characters) that normally would be considered separators that
13256           you want included in words. So the dollars-and-cents example
13257           could also be handled this way:
13258
13259   \fword(\%a,\%n,,$.)
13260
13261           in other words, use the default separator list, but remove "$"
13262           and "." from it so they will be considered part of a word.
13263
13264    \fsplit(s1,&a,s2,s3)
13265           This is like \fword(), except instead of extracting and
13266           returning a particular word from string s1, it counts the words
13267           and optionally assigns them to the array whose identifying
13268           letter, a-z, is given after the "&" in the second argument,
13269           with the first word going into element 1, the second into
13270           element 2, and so on. The rules regarding break and include
13271           lists (s2 and s3) are exactly the same as for \fword().
13272           \fsplit() returns the number of words that were assigned, which
13273           is either the number of words in the string, or the dimension
13274           of the array, whichever is less. If the array is not declared,
13275           \fsplit() creates it and returns a number which is both the
13276           number of words in s1 and the dimension of the new array.
13277           Examples:
13278
13279   declare \&w[20]        ; (Optional.)
13280   ...
13281   read \%s               ; \%s is "This is a sentence with seven words."
13282   ...
13283   echo "\fsplit(\%s)"    ; This would print "7".
13284   echo "\fsplit(\%s,&w)" ; Ditto, and also assigns them to array \&w[].
13285
13286   echo "\&w[7]"          ; This would print "words".
13287
13288           If the line contained fields that were delimited by colon (:),
13289           you would use \fsplit(\%s,&w,:). If the fields were delimited
13290           by comma, then you would use \fsplit(\%s,&w,{,}); in this case
13291           the literal comma must be enclosed in braces to distinguish it
13292           from the comma that separates function arguments. To get a word
13293           count without loading an array, but still specify break and/or
13294           include lists, leave the array argument empty:
13295
13296    echo "\fsplit(\%s,,:)" ; Use colon as the separator.
13297
13298           WARNINGS:
13299
13300          1. If you use the same array repeatedly, \fsplit() leaves any
13301             trailing members undisturbed. For example:
13302   dcl \&w[10]
13303   \fsplit(1 2 3 4 5,&w) ; Sets \&w[1] thru \&w[5].
13304   \fsplit(a b c,&w)     ; Sets \&w[1]-[3] leaving [4]-[5] as they were.
13305          2. If you allow \fsplit to create the array (by not declaring it
13306             first), it is dimensioned to the number of elements it was
13307             created with:
13308   \fsplit(1 2 3,&x)     ; Creates an array \&x[] with 3 elements.
13309   \fsplit(a b c d e,&x) ; This overflows the array.
13310
13311           Thus if you want to use \fsplit() repeatedly on the same array,
13312           either dimension it in advance to the maximum expected size
13313           (and then some -- more efficient), or else destroy it after
13314           each use (to allow for unexpectedly large arguments). Example
13315           using a dynamic array:
13316
13317   fopen /read \%c some-file
13318   if fail ...
13319   set function error on    ; See [573]Section 7.12
13320   while true {
13321       dcl \&w[]            ; Destroy \&[w] each time thru the loop
13322       fread /line \%c \%a
13323       if fail break
13324       asg \%x \fsplit(\%a,&w)
13325       if fail ...
13326       ; (do what you want with \&w[] here...)
13327   }
13328   fclose \%c
13329
13330    \frindex(s1,s2,n)
13331           The "n" argument to \frindex() now works consistently (in
13332           mirror image) with the corresponding \findex() argument. In
13333           each case, the (n-1)-most characters of s2 are ignored in the
13334           search; for findex, this means the starting position of the
13335           search is n (the default nis 1, and 0 is treated like 1). For
13336           \frindex() it means the default starting point is:
13337
13338   length(s2) - length(s1) - n (with the same defaults for n).
13339
13340    \fsearch(pattern,string[,position])
13341           Exactly like \findex(), except with a pattern (see [574]Section
13342           7.9) rather than a literal string.
13343
13344    \frsearch(pattern,string[,position])
13345           Exactly like \frindex(), except with a pattern rather than a
13346           literal string.
13347
13348           File Functions:
13349
13350    \ffiles(), \fnextfile()
13351           It is no longer necessary to copy the file list to an array
13352           before use, as shown on p.398 of [575]Using C-Kermit 2nd
13353           Edition. \ffiles() and friends now make their own safe copies
13354           of the file list. Thus constructions like the following are now
13355           possible:
13356
13357   for \%i 1 \ffiles(*.txt) 1 { send \fnextfile() }
13358
13359           The same is true for the new function \frfiles(),
13360           \fdirectories(), and \frdirectories(), described in
13361           [576]Section 4.11.3.
13362
13363           But note that each reference to \fnextfile() still gets you the
13364           next file. So "if newer \fnextfile() foo.txt send \fnextfile()"
13365           compares one file's age with that of foo.txt, and then sends an
13366           entirely different file. If you're going to refer to the same
13367           file more than once, assign it to a variable:
13368
13369   asg \%f \fnextfile()
13370   if newer \%f foo.txt send \%f
13371
13372           (note: assign, not define).
13373
13374           Also note that \ffiles(), \frfiles(), \fdirectories(), and
13375           \frdirectories() all now accept on optional 2nd argument: the
13376           name of an array to load with the resulting file or directory
13377           list, explained in [577]Section 4.11.3. So you can also load an
13378           array with the filelist when you need to refer to the same file
13379           more than once:
13380
13381   for \%i 1 \ffiles(*,&a) 1 { if newer \&a[\%i] foo.txt send \&a[\%i] }
13382
13383    \fpermissions(file)
13384           Returns the platform-specific permissions string for the file,
13385           such as "-rw-rw-r--" in UNIX or "(RWE,RWE,RE,E)" in VMS.
13386
13387    \fdirname(f)
13388           Given a file specification f, this function returns the
13389           complete pathname of directory the file is in.
13390
13391    Array Functions:
13392
13393    \fdimension(&a)
13394           Returns the dimension declared for the array whose identifying
13395           letter, a-z, or special character "_" or "@", is given after
13396           the "&" in the argument. If the array is not declared, 0 is
13397           returned. Note that when used with the macro argument vector
13398           array, \&_[] (see [578]Section 7.5), the value of this function
13399           is one less than \v(argc), and when used with the C-Kermit
13400           command-line argument vector array, \&@[], it is equal to the
13401           \v(args) variable. Examples:
13402
13403   echo \fdimension(&a)       ; Not declared.
13404   0
13405   declare \&a[12]            ; Now it's declared.
13406   echo \fdim(&a)
13407   12
13408
13409    \farraylook(pattern,arrayname)
13410           Looks in the given array for the pattern and returns the index
13411           of the first element that matches, if any, or -1 if none match.
13412           The arrayname can include a range specifier to restrict to
13413           search to a segment of the array, e.g.
13414           \farraylook(*xyz*,&a[32:63]). For greater detail see
13415           [579]Section 7.10.7.
13416
13417    \ftablelook(keyword,arrayname[,delimiter])
13418           Looks in the given "table", which must be sorted, for the given
13419           keyword. Returns the index of the table element that uniquely
13420           matches the given keyword, or -1 if none match, or -2 if more
13421           than 1 match. For greater detail see [580]Section 7.10.7.
13422
13423    Other new functions:
13424
13425    \fip2hex(s)
13426           Converts a dotted decimal IP address to an 8-digit hexadecimal
13427           number. \fip2hex(128.59.39.2) = 803b2702.
13428
13429    \fhex2ip(x)
13430           Converts an 8-digit hexadecimal IP address to dotted decimal
13431           form, e.g. \fhex2ip(803b2702) = 128.59.39.2. The inverse of
13432           \fip2hex().
13433
13434    \fcommand()
13435    \frawcommand()
13436           These run an external command and return its output; see
13437           [581]Section 4.2.8.4.
13438
13439    \fdialconvert(s)
13440           s is a phone number in either literal or portable format (not a
13441           dialing directory entry name). The function returns the dial
13442           string that would actually be used when dialing from the
13443           current location (after processing country code, area code, and
13444           other SET DIAL values).
13445
13446    \ferrstring(n)
13447           Returns the system error message associated with the (numeric)
13448           error code n. UNIX and VMS only. Use in conjunction with
13449           \v(errno) or \v(pexitstat). See [582]Section 4.2.5 for a usage
13450           example. Note: This function doesn't work in Windows because
13451           there is not a consistent error-code-to-message mapping; error
13452           code "x" means something completely different depending on
13453           whether it comes from the C runtime library, Winsock, a
13454           Windows-32 API, TAPI, etc,
13455
13456    \fpattern(s)
13457           Used in INPUT, REINPUT, and MINPUT commands to denote search
13458           strings that are to be treated as patterns rather than
13459           literally.
13460
13461    Also see [583]Section 7.8 on built-in help for functions.
13462      _________________________________________________________________
13463
13464   7.4. New IF Conditions
13465
13466    IF AVAILABLE feature command
13467           Executes the command if the given feature is available.
13468           Presently used only to determine if specific authentication and
13469           encryption options are available. Type "if available ?" to see
13470           which features may be tested.
13471
13472    IF FLOAT f1 command
13473           Executes command if f1 is a legal floating point number (which
13474           includes integers). Use this to preverify arguments for the
13475           \ffp...() floating-point arithmetic functions, e.g. "if float
13476           \%1 echo \ffpint(\%1)".
13477
13478    IF == n1 n2 command
13479           Synonym for "if =" (numeric equality). Note that as of C-Kermit
13480           7.0, this and all other numeric comparison operators also work
13481           for floating-point numbers.
13482
13483    IF != n1 n2 command
13484           Executes the command if n1 and n2 are both numbers or variables
13485           containing numbers and the value of n1 is not equal to the
13486           value of n2. This is equivalent to "if not = n1 n2".
13487
13488    IF <= n1 n2 command
13489           Executes the command if n1 and n2 are both numbers or variables
13490           containing numbers and the value of n1 is less than or equal to
13491           the value of n2. This is equivalent to "if not > n1 n2".
13492
13493    IF >= n1 n2 command
13494           Executes the command if n1 and n2 are both numbers or variables
13495           containing numbers and the value of n1 is greater than or equal
13496           to the value of n2. Equivalent to "if not < n1 n2".
13497
13498    IF COMMAND word command
13499           Executes the command if word is a built-in C-Kermit command.
13500           Example:
13501
13502   if not command copy define { copy run copy \%1 \%2 }".
13503
13504           This defines a COPY macro that runs an external COPY command if
13505           COPY is not already a built-in command.
13506
13507    IF LOCAL command
13508           Executes the command if Kermit is in local mode, i.e. if it has
13509           a SET LINE, SET PORT, or SET HOST (TELNET, RLOGIN, etc) device
13510           or connection open. Does not execute the command if in remote
13511           mode.
13512
13513    IF MATCH string pattern command
13514           Executes the command if the string matches the pattern. For a
13515           description of the syntax for the pattern, see [584]Section
13516           4.9.1. If you want to test if the string contains pattern, use
13517           IF \fsearch(pattern,string).
13518
13519    IF OPEN { DEBUG-LOG, SESSION-LOG, TRANSACTION-LOG, ... } command
13520           Executes the command if the given file is open, fails if it is
13521           not open. Type IF OPEN ? for a complete list of files that can
13522           be checked (all the files that can be opened with the OPEN or
13523           LOG commands).
13524
13525    IF QUIET command
13526           Executes the command if SET QUIET is ON, and does not execute
13527           it if SET QUIET is OFF. Example: IF NOT QUIET ECHO { This is a
13528           message.}.
13529
13530    IF READABLE name
13531           Succeeds if name is the name of an existing file or directory
13532           that is readable.
13533
13534    IF WRITEABLE name
13535           Succeeds if name is the name of an existing file or directory
13536           that is writeable, e.g.:
13537
13538   if not writeable \v(lockdir) echo Please read installation instructions!
13539
13540    IF FLAG command
13541           This tests a user-settable condition, which can mean anything
13542           you like. SET FLAG ON causes subsequent IF FLAG commands to
13543           succeed; SET FLAG OFF causes them to fail. One way to use it
13544           would be for debugging your scripts; precede any debugging
13545           statements with IF FLAG. Then SET FLAG on to debug your script,
13546           SET FLAG OFF to run it without debugging. Another common use is
13547           for causing an inner loop to cause an outer loop to exit.
13548
13549    IF C-KERMIT command
13550           C-Kermit, but not Kermit 95 or MS-DOS Kermit, executes the
13551           command.
13552
13553    IF K-95 command
13554           Kermit 95, but not C-Kermit or MS-DOS Kermit, executes the
13555           command.
13556
13557    IF MS-KERMIT command
13558           MS-DOS Kermit, but not C-Kermit or Kermit 95, executes the
13559           command.
13560      _________________________________________________________________
13561
13562   7.5. Using More than Ten Macro Arguments
13563
13564    The \v(argc) variable now gives the actual number of arguments, even
13565    if the number is greater than 9:
13566
13567   C-Kermit> define xx echo \v(argc)
13568   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
13569   27
13570
13571    Remember that \v(argc) includes the name of the macro itself, so it is
13572    always at least 1, and is always 1 greater than the actual number of
13573    arguments. As in versions 6.0 and earlier, if more than 9 arguments
13574    are given, only the first nine are assigned to the variables \%1..\%9.
13575
13576    The \&_[] array, discussed on page 353 of [585]Using C-Kermit, 2nd ed,
13577    now holds all the arguments, up to some implementation-dependent limit
13578    (64 or greater), rather than only the first 9. To illustrate: the
13579    following macro tells the number of arguments it was called with and
13580    then prints them:
13581
13582   define show_all_args {
13583       local \%i
13584       echo \&_[0] - Number of arguments: \feval(\v(argc)-1)
13585       for \%i 1 \v(argc)-1 1 { echo \flpad(\%i,3). "\&_[\%i]" }
13586   }
13587
13588    Within a macro \&_[0], like \%0, contains the name of the macro.
13589
13590    At top level, the \&_[] array is filled as follows:
13591
13592      * If the first argument on the C-Kermit command line was a filename,
13593        or C-Kermit was invoked from a "Kerbang" script ([586]Section
13594        7.19), element 0 contains the filename, and elements 1 through
13595        \v(argc)-1 hold the remaining command-line arguments.
13596      * Otherwise the program name goes in element 0, and elements 1
13597        through \v(argc)-1 hold any arguments that were included after
13598        "--" or "="
13599
13600    The new \%* variable, when used within a macro, is replaced by the
13601    text that followed the macro name in the macro invocation. If no
13602    arguments were given, \%* is replaced by the empty string. Examples:
13603
13604   C-Kermit> define xx echo [\%*]
13605   C-Kermit> define \%a oofa
13606   C-Kermit> xx
13607   []
13608   C-Kermit> xx \%a
13609   [oofa]
13610   C-Kermit> xx a
13611   [a]
13612   C-Kermit> xx a b
13613   [a b]
13614   C-Kermit> xx a b c
13615   [a b c]
13616   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
13617   [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]
13618
13619    Note that \%* can not be used at top level, since Kermit does not have
13620    access to the raw command line (only to its elements separately, after
13621    they have been processed by the shell and the C library).
13622
13623    C-Kermit 7.0 also adds a SHIFT command:
13624
13625    SHIFT [ number ]
13626           Shifts the macro arguments (except argument 0) the given number
13627           of places to the left and adjusts \v(argc) accordingly. The
13628           default number is 1.
13629
13630    To illustrate, suppose macro XXX is invoked as follows:
13631
13632   xxx arg1 arg2 arg3
13633
13634    Then inside XXX, \%1 is "arg1", \%2 is "arg2", and \%3 is "arg3".
13635    After a SHIFT command is given inside XXX, then \%1 is "arg2", \%2 is
13636    "arg3", and \%3 is empty. \%0 (the name of the macro) remains
13637    unchanged.
13638
13639    If more than 9 arguments were given, then arguments are shifted into
13640    the \%1..9 variables from the argument vector array.
13641
13642    At top level, the SHIFT command operates on the \&_[] array and \%1..9
13643    variables; the \&@[] array is not affected. See [587]Section 7.16 for
13644    details.
13645
13646    The \%* variable is not affected by the SHIFT command.
13647      _________________________________________________________________
13648
13649   7.6. Clarification of Function Call Syntax
13650
13651    Spaces are normally stripped from the front and back of each function
13652    argument; to prevent this enclose the argument in braces:
13653
13654   \fsplit(\%a,&a,{ })
13655
13656    However, function calls that contain spaces can make trouble when the
13657    function is to be used in a "word" field, since space separates words.
13658    For example:
13659
13660   for \%i 1 \fsplit(\%a,&a,{ }) 1 {
13661     echo \%i. "\&a[\%i]"
13662   }
13663
13664    In most cases, the trouble can be averted by enclosing the function
13665    reference in braces:
13666
13667   for \%i 1 {\fsplit(\%a,&a,{ })} 1 {
13668     echo \%i. "\&a[\%i]"
13669   }
13670
13671    or by replacing spaces with \32 (the ASCII code for space):
13672
13673   for \%i 1 \fsplit(\%a,&a,\32) 1 {
13674     echo \%i. "\&a[\%i]"
13675   }
13676
13677    Braces are also used in function calls to indicate grouping. For
13678    example:
13679
13680   \fsubstring(abcd,2,2) = "bc"
13681
13682    But suppose "abcd" needed to contain a comma:
13683
13684   \fsubstring(ab,cd,2,2)
13685
13686    This would cause an error, since "cd" appears to be the second
13687    argument, when really you want the first "2" to be the second
13688    argument. Braces to the rescue:
13689
13690   \fsubstring({ab,cd},2,2) = "b,"
13691
13692    Similarly, leading and trailing spaces are stripped from each
13693    argument, so:
13694
13695   \fsubstring( abcd ,2,2) = "bc"
13696
13697    but braces preserve them:
13698
13699   \fsubstring({ abcd },2,2) = "ab"
13700
13701    Given these special uses for braces, there is no way to pass literal
13702    braces to the function itself. For example:
13703
13704   \fsubstring(ab{cd,2,2)
13705
13706    causes an error.
13707
13708    So if you need a function to include braces, define a variable
13709    containing the string that has braces. Example:
13710
13711   define \%a ab{cd
13712   \fsubstring(\%a,2,2) = "b{"
13713
13714    If the string is to start with a leading brace and end with a closing
13715    brace, then double braces must appear around the string (which itself
13716    is enclosed in braces):
13717
13718   define \%a {{{foo}}}
13719   \fsubstring(\%a) = "{foo}"
13720
13721    This also works for any other kind of string:
13722
13723   define \%a {{ab{cd}}
13724   echo \fsubstring(\%a) = "ab{cd"
13725      _________________________________________________________________
13726
13727   7.7. Autodownload during INPUT Command Execution
13728
13729    As of 6.1 / 1.1.12, C-Kermit can be told to look for incoming Kermit
13730    (or Zmodem) packets during execution of an INPUT command. By default
13731    (for consistency with earlier releases), this is not done. You can
13732    enable this feature with:
13733
13734   SET INPUT AUTODOWNLOAD ON
13735
13736    (and disable it again with OFF.)
13737
13738    One possible use for this feature is as a server mode with a time
13739    limit:
13740
13741   INPUT 3600 secret-string-to-end-the-INPUT-command
13742
13743    In this example, any GET, SEND, or REMOTE commands received within one
13744    hour (3600 seconds) of when the INPUT command was issued will be
13745    executed. Here's another example, in which we want to stay open until
13746    11:30pm, or until interrupted by seven consecutive Ctrl-C (\3)
13747    characters:
13748
13749   INPUT 23:30:00 \3\3\3\3\3\3\3
13750
13751    The INPUT AUTODOWNLOAD setting is displayed by SHOW SCRIPTS or SHOW
13752    INPUT.
13753      _________________________________________________________________
13754
13755   7.8. Built-in Help for Functions.
13756
13757    Beginning in C-Kermit 7.0, you may obtain a description of the calling
13758    conventions and return values of any built-in function, such as
13759    \fsubstring(), with the new HELP FUNCTION command; give the function's
13760    name without the leading "\f", e.g. "help func substring". You can use
13761    ?, completion, and abbreviation in the normal manner.
13762      _________________________________________________________________
13763
13764   7.9. Variable Assignments
13765
13766     7.9.1. Assignment Operators
13767
13768    Programmers accustomed to languages such as C or Fortran might find
13769    Kermit's method of assigning values to variables unnatural or awkward.
13770    Beginning in C-Kermit 7.0, you can use the following alternative
13771    notation:
13772
13773  .name = value    is equivalent to   DEFINE name value
13774  .name := value   is equivalent to   ASSIGN name value
13775  .name ::= value  is equivalent to   ASSIGN name \feval(value)
13776
13777    When the command begins with a period (.), this indicates an
13778    assignment. The name can be a macro name, a \%{digit,letter} variable,
13779    or an array element. There can be space(s) between "." and the name.
13780    Examples:
13781
13782   .\%a = This is a string  ; Same as "define \%a This is a string"
13783   echo \%a
13784   This is a string
13785
13786   .xxx = \%a               ; Same as "define xxx \%a"
13787   echo \m(xxx)
13788   \%a
13789
13790   .xxx := \%a              ; Same as "assign xxx \%a"
13791   echo \m(xxx)
13792   This is a string
13793
13794   declare \&a[2]           ; Use with arrays...
13795   define \%i 2
13796   .\&a[1] = first
13797   .\&a[\%i] = second
13798
13799    The following sequence illustrates the differences among three levels
13800    of evaluation:
13801
13802   .\%x = 2          ; Define a variable to have a numeric value
13803   .\%y = (3 + \%x)  ; Define another variable as an arithmetic expression
13804
13805   .xxx = 4 * \%y    ; "=" simply copies the right-hand side.
13806   echo \m(xxx)
13807   4 * \%y
13808
13809   .xxx := 4 * \%y   ; ":=" evaluates the variables first, then copies.
13810   echo \m(xxx)
13811   4 * (3 + 2)
13812
13813   .xxx ::= 4 * \%y  ; "::=" evaluates the expression, then copies.
13814   echo \m(xxx)
13815   20
13816
13817    You can also use this syntax to clear (undefine) a variable:
13818
13819   .\%a = oofa       ; Define the variable
13820   echo "\%a"
13821   "oofa"
13822   .\%a              ; Clear the variable
13823   echo "\%a"
13824   ""
13825
13826    Extra credit: Can you guess what happens below when the file "abc"
13827    does not exist?
13828
13829   fopen /read \%c abc
13830   if fail ...
13831      _________________________________________________________________
13832
13833     7.9.2. New Assignment Commands
13834
13835    Recall the DEFINE and ASSIGN commands, and their hidden counterparts,
13836    _DEFINE and _ASSIGN. The former take the variable name literally, the
13837    latter evaluate the variable-name field to form the variable name
13838    dynamically. Examples:
13839
13840   DEFINE \%x foo    ; Sets the value of the variable \%x to "foo".
13841   DEFINE \%a \%x    ; Sets the value of the variable \%a to "\%x".
13842   _DEFINE x_\%a \%x ; Sets the value of the variable x_foo to "\%x".
13843   ASSIGN \%a \%x    ; Sets the value of the variable \%a to the "foo".
13844   _ASSIGN x_\%a \%x ; Sets the value of the variable x_foo to "foo".
13845
13846    This concept has been carried over to the remaining
13847    variable-assignment commands: EVALUATE, INCREMENT, and DECREMENT:
13848
13849    EVALUATE variablename expression
13850           Evaluates the arithmetic expression and assigns its value to
13851           the variable whose name is given. Example: "eval \%a 1+1"
13852           assigns "2" to \%a.
13853
13854    _EVALUATE metaname expression
13855           Evaluates the arithmetic expression and assigns its value to
13856           the variable whose name is computed from the given metaname.
13857           Example: "eval foo<\%a>::\%1 \%2 * (\%3 + \%4)" assigns the
13858           value of "\%2 * (\%3 + \%4)" to the variable whose name is
13859           computed from "foo<\%a>::\%1".
13860
13861    INCREMENT variablename [ expression ]
13862           Evaluates the arithmetic expression and adds its value to the
13863           value of the variable whose name is given. Example: "increment
13864           \%a".
13865
13866    _INCREMENT metaname [ expression ]
13867           Evaluates the arithmetic expression and adds its value to the
13868           value of the variable whose name is computed from the given
13869           metaname. Example: "_increment Words::\%1.count[\%2]".
13870
13871    DECREMENT variablename [ expression ]
13872           Evaluates the arithmetic expression and subtracts its value
13873           from the value of the variable whose name is given.
13874
13875    _DECREMENT metaname [ expression ]
13876           Evaluates the arithmetic expression and subtracts its value
13877           from the value of the variable whose name is computed from the
13878           given metaname.
13879
13880    WARNING: The syntax of the EVALUATE command has changed since C-Kermit
13881    6.0 and K95 1.1.17. Previously, it did not include a variable name,
13882    only an expression. To restore the old behavior, use SET EVALUATE OLD.
13883    To return to the new behavior after restoring the old behavior, use
13884    SET EVALUATE NEW.
13885
13886    NOTE: There are no analogs to the "_" commands for the operators
13887    described in [588]Section 7.9.1; those operators can not be used to
13888    assign values to variables whose names must be computed.
13889      _________________________________________________________________
13890
13891   7.10. Arrays
13892
13893    C-Kermit 7.0 adds lots of new array-related features, and groups them
13894    together under the NEW ARRAY command:
13895
13896    ARRAY { CLEAR, COPY, DECLARE, DESTROY, RESIZE, SHOW, SORT }
13897
13898    In each of the ARRAY commands, wherever an array name is expected,
13899    "short forms" may be used. For example, all of the following are
13900    acceptable:
13901
13902   array show \&a[]  (or SHOW ARRAY...)
13903   array show &a[]
13904   array show a[]
13905   array show &a
13906   array show a
13907
13908    In addition, ranges are accepted in the ARRAY COPY, ARRAY CLEAR, ARRAY
13909    SET, ARRAY SHOW, and ARRAY SORT commands:
13910
13911   array clear \&a[16]     ; Clears 16 thru end
13912   array clear &a[16]      ; Ditto
13913   array clear a[16]       ; Ditto
13914
13915   array clear \&a[16:32]  ; Clears 16 thru 32
13916   array clear &a[16:32]   ; Ditto
13917   array clear a[16:32]    ; Ditto
13918
13919    When using array names as function arguments, you must omit the "\"
13920    and you must include the "&". You may optionally include empty
13921    brackets. Examples:
13922
13923   \fsplit(\%a,a)          ; Bad
13924   \fsplit(\%a,\&a)        ; Bad
13925   \fsplit(\%a,&a[3])      ; Bad
13926
13927   \fsplit(\%a,&a)         ; Good
13928   \fsplit(\%a,&a[])       ; Good
13929      _________________________________________________________________
13930
13931     7.10.1. Array Initializers
13932
13933    Beginning in C-Kermit 7.0, you may initialize an array -- in whole or
13934    in part -- in its declaration:
13935
13936    [ ARRAY ] DECLARE array-name[size] [ = ] [ value1 [ value2 [...] ] ]
13937
13938    For compatibility with versions 5A and 6.0, the ARRAY keyword is
13939    optional. DECLARE can also be spelled DCL.
13940
13941    Initializers are (a) optional, (b) start with element 1, (c) must be
13942    enclosed in braces if they contain spaces, and (d) are evaluated
13943    according to normal rules by the DECLARE command prior to assignment.
13944    Thus the assignments made here are the same as those made by the
13945    ASSIGN command. This allows you to initialize array elements from the
13946    values of other variables. If you actually want to initialize an array
13947    element to variable's name, as opposed to its value, use double
13948    backslashes (as in "\\&a", "\\v(time)", etc).
13949
13950    The size (dimension) of the array is optional. If the size is omitted,
13951    as in "\&a[]", then the array sizes itself to the number of
13952    initializers; if there are no initializers the array is not declared
13953    or, if it was declared previously, it is destroyed. If a size is
13954    given, any extra elements in the initialization list are discarded and
13955    ignored.
13956
13957    NOTE: Unlike in C, the list of initializers is NOT enclosed in braces.
13958    Instead, braces are used to group multiple words together. So:
13959
13960   ARRAY DECLARE \&a[] = { one two three }
13961
13962    would create an array with two elements (0 and 1), with element 1
13963    having the value " one two three ".
13964
13965    Examples:
13966
13967    ARRAY DECLARE \&a[16]
13968           Declares the array \&a with 17 elements (0 through 16), in
13969           which all elements are initially empty. If the array \&a[]
13970           existed before, the earlier copy is destroyed.
13971
13972    ARRAY DECLARE &a[16]
13973    ARRAY DECLARE a[16]
13974    ARRAY DCL \&a[16]
13975    ARRAY DCL &a[16]
13976    ARRAY DCL a[16]
13977    DECLARE \&a[16]
13978    DECLARE &a[16]
13979    DECLARE a[16]
13980    DCL \&a[16]
13981    DCL &a[16]
13982    DCL a[16]
13983           All of the above are the same as the first example.
13984
13985    ARRAY DECLARE \&a[16] = alpha beta {gamma delta}
13986           Declares the array \&a with 17 elements (0 through 16),
13987           initializing \&a[1] to "alpha", \&a[2] to "beta", and \&a[3] to
13988           "gamma delta". The remaining elements are empty.
13989
13990    ARRAY DECLARE \&a[] = alpha beta {gamma delta}
13991           Same as the previous example, but the array is automatically
13992           dimensioned to 3.
13993
13994    ARRAY DECLARE \&a[3] = alpha beta {gamma delta} epsilon zeta
13995           Too many initializers; only the first three are kept.
13996
13997    ARRAY DECLARE \&a[0]
13998    ARRAY DECLARE \&a[]
13999    ARRAY DECLARE &a[]
14000    ARRAY DECLARE &a
14001    ARRAY DECLARE a
14002    DECLARE \&[0]
14003    DECLARE a
14004    DCL a
14005           All of these are equivalent. Each destroys \&a[] if it exists.
14006           Declaring an array with a dimension of 0 is the same as ARRAY
14007           DESTROY arrayname.
14008
14009    ARRAY DECLARE \&a[] = \%1 \%2 \%3
14010           Declares the array \&a with 3 elements (0 through 3),
14011           initializing \&a[1] to the value of \%1, \&a[2] to the value of
14012           \%2, and \&a[3] to the value of \%3. In this case, any
14013           reference to one of these array elements is replaced by the
14014           value of the corresponding \%n variable at the time the
14015           declaration was executed (immediate evaluation; the array
14016           element's value does not change if the initializer variable's
14017           value changes).
14018
14019    ARRAY DECLARE \&a[] = \\%1 \\%2 \\%3
14020           Declares the array \&a with 3 elements (0 through 3),
14021           initializing \&a[1] to the string "\%1", \&a[2] to "\%2", and
14022           \&a[3] to "\%3". In this case any reference to one of these
14023           array elements is replaced by the CURRENT value of the
14024           corresponding \%n variable (deferred evaluation -- the array
14025           element's value follows the value of the initializer variable).
14026
14027    The equal sign (=) preceding the initializer list is optional, but is
14028    recommended for clarity. If you need to initialize element 1 to a
14029    literal equal sign, use two of them, separated by a space, as in this
14030    example:
14031
14032   ARRAY DECLARE \&a[] = = + - * /
14033
14034    Remember, element 0 is not initialized by the DECLARE command. To
14035    initialize element 0, use a regular DEFINE or ASSIGN command:
14036
14037   ARRAY DECLARE \&a[] one two three four five six seven eight nine
14038   DEFINE \&a[0] zero
14039
14040    Finally, remember that every command level has its own local array,
14041    \&_[], containing all the macro arguments (\%0, \%1, ...) for that
14042    level. See [589]Section 7.5 for details.
14043      _________________________________________________________________
14044
14045     7.10.2. Turning a String into an Array of Words
14046
14047    The \fsplit(s1,&a,s2,s3) function assigns the words of string s1 to
14048    successive elements of the array (beginning with element 1) whose
14049    identifying letter, a-z, is given after the "&" in the second
14050    argument, using break and include characters given in s2 and s3. See
14051    [590]Section 7.3 for details.
14052      _________________________________________________________________
14053
14054     7.10.3. Arrays of Filenames
14055
14056    See [591]Section 4.11.3 for news about how \ffiles() and related
14057    functions can assign a list of filenames to an array. To recapitulate
14058    briefly here:
14059
14060   \ffiles(*,&a)
14061
14062    assigns all files that match the first argument to the array denoted
14063    by the second argument. If the array has not been declared, it is
14064    declared automatically, with exactly the number of elements needed to
14065    hold the file list; if it was previously declared, it is destroyed and
14066    reused. The filenames are assigned starting at array element 1.
14067    Element 0 holds the number of files in the list.
14068
14069    The DIRECTORY command ([592]Section 4.5.1) can also create filename
14070    arrays if you give it the /ARRAY: switch; this allows selection
14071    criteria beyond whether the filename matches the given pattern.
14072
14073    All functions and commands that create filename arrays store the
14074    number of filenames, n, as element 0 of the array, and the filenames
14075    as elements 1 through n.
14076      _________________________________________________________________
14077
14078     7.10.4. Automatic Arrays
14079
14080    In a command file or macro, you can now have local (automatic) arrays.
14081    Just give the name followed by empty subscript brackets (no spaces
14082    inside the brackets please) in a LOCAL command, and then declare the
14083    array:
14084
14085   LOCAL \%a \&a[] oofa
14086   ARRAY DECLARE \&a[32] = value1 value2 value3 ...
14087
14088    This declares the scalar variable \%a, the array \&a[], and the macro
14089    name "oofa" to be local, and then declares the new local copy of \&a[]
14090    with 32 elements, perhaps assigning some initial values. When C-Kermit
14091    exits from the command file or macro containing these command, the
14092    previous \&a[] array is restored (and if there was no \&a[] at any
14093    higher level, this will still be true). The process can be repeated to
14094    any level. Thus it is now safe to write scripts or macros containing
14095    arrays without danger of interfering with global arrays of the same
14096    name.
14097
14098    Just as scalars are inherited by lower command levels, so are arrays.
14099    So, for example, if \&a[] is declared at top level, all lower levels
14100    will see it unless they include a "local \&a[]" statement, in which
14101    case all levels at and beneath the level where the LOCAL statement was
14102    executed will see the local copy. This too can be repeated to any
14103    level.
14104
14105    On the other hand, if you DECLARE an array at a lower command level
14106    without also making it LOCAL, this replaces the copy that was declared
14107    at the lowest command level above this one.
14108      _________________________________________________________________
14109
14110     7.10.5. Sorting Arrays
14111
14112    Although arrays can be sorted using FOR loops as shown on page 383 of
14113    Using C-Kermit, 2nd Ed., this involves quite a bit of repetitive
14114    interpretation by the command parser, and so can be slow for large
14115    arrays. For this reason, C-Kermit 7.0 adds a built-in SORT command:
14116
14117    ARRAY SORT [ switches ] array [ array2 ]
14118           Sorts the given array in place. Sorting is strictly lexical
14119           (string based). The array name can be given fully, e.g.
14120           "\&a[]", or the "\" and/or "&" and/or brackets can be omitted,
14121           e.g. "array sort \&a[]", "sort &a", "sort a". Also, a range can
14122           be indicated in the brackets as noted in [593]Section 7.10, to
14123           restrict the sort to a range of elements (equivalent to the
14124           /RANGE switch, described just below), e.g. "array sort
14125           &a[20:30]".
14126
14127    A second array may be specified. If it is, and if it is at least as
14128    big as the first array, it is sorted according to the first array. For
14129    a sample application, see [594]Section 7.10.10.
14130
14131    See [595]Section 1.5 for an explanation of switches. The optional
14132    switches are:
14133
14134    /CASE:{ON,OFF}
14135           /CASE:ON means that alphabetic case is significant in
14136           comparisons; uppercase letters are sorted before lowercase
14137           ones. /CASE:OFF means case is ignored, e.g. "A" is the same as
14138           "a". If this switch is not given, sorting is according the
14139           current SET CASE setting.
14140
14141    /KEY:n
14142           Comparison begins at position n(1-based) in each string. If no
14143           key is given, the entire strings are compared. Only one key can
14144           be given. If an array element is shorter than the key value, n,
14145           that element is considered empty for comparison purposes, and
14146           therefore lexically less than any element at least ncharacters
14147           long.
14148
14149    /NUMERIC
14150           If this switch is included, it means sorting should be numeric,
14151           rather than lexical. The sort key is the string starting at the
14152           key position, skipping any leading blanks or tabs, and then as
14153           much of the string from that point on that fits the definition
14154           of "numeric", terminating at the first character that does not
14155           qualify. A numeric string has an optional sign (+ or -)
14156           followed by one or more digits, and (if your version of Kermit
14157           was built with floating-point support; see [596]Section 7.23 )
14158           zero or one decimal point (period). If both /CASE and /NUMERIC
14159           are given, /NUMERIC takes precedence.
14160
14161    /RANGE:n[:m]
14162           Sort elements nthrough m of the array. By default, the entire
14163           array from element 1 to its dimensioned size is sorted, which
14164           might produce surprising results if the array is not full; see
14165           example in [597]Section 7.10.7. If ":m" is omitted from the
14166           range, the dimensioned size is used. Thus, to sort an entire
14167           array, \&a[], including its 0th element, use "sort /range:0
14168           &a". You can also sort any desired section of an array, e.g.
14169           "sort /range:10:20 &a" or "sort /range:\%i:\%j-1 &b". As noted
14170           above, you can also specify a range in the array-name brackets.
14171           If you specify a range in the array-name brackets AND with a
14172           /RANGE switch, the ones in the brackets take precedence.
14173
14174    /REVERSE
14175           Sort in reverse order. If this switch is not given, the array
14176           is sorted in ascending order.
14177
14178    Remember that numeric switch arguments can be numbers, arithmetic
14179    expressions, or variables whose values are numbers or expressions, as
14180    illustrated in the /RANGE examples above.
14181
14182    A typical sorting application might be to list students' test scores
14183    in descending order. Suppose you had the following records:
14184
14185   olaf      65
14186   olga      98
14187   ivan      83
14188   xena     100
14189
14190    (and so on) stored in array \&s[] (e.g. by reading them from a file as
14191    illustrated in [598]section 7.10.7). In these records, the student's
14192    name is in columns 1-9 and the score in 10-12. So to rearrange the
14193    list in descending order of score:
14194
14195   sort /key:10 /reverse &s
14196
14197    Then to list your top five students:
14198
14199   for \%i 1 5 1 { echo \&s[\%i] }
14200
14201    Or more simply (see next section):
14202
14203   show array a[1:5]
14204
14205    To illustrate the difference between a lexical and a numeric sort,
14206    suppose you have the following records (the lines that are numbered,
14207    starting at column 1) in array \&a[]:
14208
14209     Column   1         2
14210     12345678901234567890
14211
14212    1. Ivan 10.0 2. Olaf 9.95 3. Olga 101.5
14213
14214    ARRAY SORT /KEY:10 &a[] would order them 3,1,2, but ARRAY SORT /KEY:10
14215    /NUMERIC &a[] would order them 2,1,3.
14216      _________________________________________________________________
14217
14218     7.10.6. Displaying Arrays
14219
14220    The SHOW ARRAY command (or ARRAY SHOW) now accepts an optional
14221    array-name argument:
14222
14223   SHOW ARRAY \&a[]
14224
14225    (you can leave off the \, the \&, and/or the []'s if you like; "show
14226    array a" is equivalent to "show array \&a[]"). When an array is
14227    specified, its dimension is shown and all defined (non-empty) elements
14228    are listed.
14229
14230    Example:
14231
14232   assign \%n \ffiles(*,&a)  ; Fill an array with filenames ([599]Section 4.11.3
14233 )
14234   show array \&a[]          ; Show the array we just read
14235   array show \&a[]          ; Same as previous
14236   array sort \&a[]          ; Sort the array
14237   array show \&a[]          ; Show it after sorting
14238   array show \&a            ; Show it again
14239   array show &a             ; Show it again
14240   array show a              ; Show it again
14241
14242    (The final four commands demonstrate the alternative forms that are
14243    accepted for the array name.)
14244
14245    If you SHOW ARRAY without giving an array name, all defined arrays are
14246    listed by name and dimension, but their contents are not shown.
14247
14248    You can also show a piece of an array by including a subscript or
14249    range within the array brackets:
14250
14251   array show \&a[5]         ; Shows \&a[5]
14252   array show &a[3:8]        ; Shows \&a[3] through \&a[8]
14253   array show a[:\%n-1]      ; Shows \&a[0] through \&a[\%n-1]
14254      _________________________________________________________________
14255
14256     7.10.7. Other Array Operations
14257
14258    ARRAY DESTROY arrayname
14259           Destroys and undeclares the named array. Subscripts or ranges
14260           are not accepted in this command.
14261
14262    ARRAY COPY array1 array2
14263           Copies the first array to the second array. If the target array
14264           has not been declared, it is created automatically with the
14265           same size as the first. If it has been declared, it will be
14266           used as declared; if the source array is larger, only as much
14267           of it as will fit is copied to the target array. Syntax for
14268           array1 and array2 is as in ARRAY SHOW (SHOW ARRAY). Example:
14269
14270   .\%n := \ffiles(*,&a)  ; Create and load array A with a file list.
14271   array copy &a &b       ; Copy array A to array B.
14272
14273           The ARRAY COPY command also lets you copy pieces of arrays by
14274           including range specifiers, as in these examples:
14275
14276         ARRAY COPY \&a[4:27] \&b
14277                 This copies \&a[] elements 4-27 to \&b[] elements 1-23,
14278                 creating \&b[] if necessary or, if \&b[] is already
14279                 declared, stopping early if its size is less than 23.
14280
14281         ARRAY COPY \&a[4:27] \&b[12]
14282                 This copies \&a[] elements 4-27 to \&b[] elements 12-35,
14283                 creating \&b[] if necessary or, if \&b[] is already
14284                 declared, stopping early if its size is less than 35.
14285
14286         ARRAY COPY \&a[4:27] \&b[12:14]
14287                 This copies \&a[] elements 4-6 to \&b[] elements 12-14,
14288                 creating \&b[] if necessary or, if \&b[] is already
14289                 declared, stopping early if its size is less than 14.
14290
14291         ARRAY COPY \&a[17] \&b
14292                 This copies all the elements of \&a[] starting with 17
14293                 until the last to \&b[], creating \&b[] if necessary or,
14294                 if \&b[] is already declared, stopping early if \&b[] is
14295                 not big enough.
14296
14297    ARRAY CLEAR arrayname
14298           Sets all the elements of the array to the empty value. You may
14299           also include a range specifier to clear only a selected portion
14300           of the array; for example "array clear \&a[37:214]". If the
14301           range is out of bounds, only the part of the array that is in
14302           bounds is cleared.
14303
14304    ARRAY SET arrayname [ value ]
14305           Sets all the elements of the array to the given value. If no
14306           value is given, the array is cleared. You may also include a
14307           range specifier to set only a selected portion of the array;
14308           for example "array set \&a[1:9] -1". If the range is out of
14309           bounds, only the part of the array that is in bounds is set.
14310
14311    ARRAY RESIZE arrayname size
14312           Resizes the given array. If the size is greater than the
14313           array's current dimension, new empty elements are added to the
14314           end. If the size is less than the current dimension, the extra
14315           elements are discarded. Note: If you have stored the array size
14316           in element 0, ARRAY RESIZE does not change this value.
14317           Alternative notation: ARRAY RESIZE arrayname[size]. For a
14318           practical example, see [600]Section 7.10.11.
14319
14320    \farraylook(pattern,arrayname)
14321           This function returns the index of the first element of the
14322           given array that matches the given pattern (for details about
14323           pattern syntax, see [601]section 4.9). The array name can
14324           include a range specification to restrict the search to a given
14325           segment of the array. If no elements match the pattern, -1 is
14326           returned.
14327
14328    \ftablelook(keyword,arrayname[,delimiter])
14329           Looks in the given "table", which must be sorted, for the given
14330           keyword. The keyword need not be spelled out in full.
14331           Pattern-matching characters should not be included as part of
14332           the keyword. The function returns the index of the table
14333           element that uniquely matches the given keyword, or -1 if none
14334           match, or -2 if more than 1 match.
14335
14336    A "table" is an array that is sorted in lexical order; each of its
14337    elements may contain multiple fields, delimited by the given delimiter
14338    character or, if no delimiter is specified, a colon (:).
14339
14340    The \farraylook() function does exactly what you tell it. If you give
14341    it a pattern that does not include wildcard characters (such as *, ?,
14342    etc), it requires an exact match. For example:
14343
14344   \farraylook(oofa,&a)
14345
14346    searches for the first element of \&a[] whose value is "oofa". But:
14347
14348   \farraylook(oofa*,&a)
14349
14350    finds the first element whose value starts with "oofa", and;
14351
14352   \farraylook(*oofa,&a)
14353
14354    finds the first element whose value ends with "oofa", and;
14355
14356   \farraylook(*oofa*,&a)
14357
14358    finds the first element whose value contains "oofa".
14359
14360    Here's a simple demonstration of looking up patterns in arrays:
14361
14362   local \&a[] \%x \%n
14363   declare \&a[] = zero one two three four five six seven eight nine ten
14364   while true {
14365       .\%x = 1
14366       .\%n = 0
14367       ask \%a { Pattern? }
14368       if not def \%a exit 0 Done.
14369       while <= \%x \fdim(&a) {
14370           .\%x := \farraylook(\%a,&a[\%x])
14371           if ( < \%x 0 ) break
14372           echo \flpad(\%x,3). \&a[\%x]
14373           increment \%x
14374           increment \%n
14375       }
14376       if ( < \%n 1 ) echo Pattern not found - "\%a"
14377   }
14378
14379    The array need not be sorted. When a pattern is given, a search is
14380    performed; if there is a match, the matching element's index and the
14381    element itself are printed, and the search begins again at the next
14382    element. Thus each matching element is printed. If none match, the
14383    "Pattern not found" message is printed. The process repeats for as
14384    many patterns as the user wants to type, and terminates when the user
14385    types an empty pattern.
14386
14387    Now let's build a little command parser, consisting of a keyword
14388    table, and a loop to look up the user's commands in it with
14389    \ftablelook(). In this case the array elements have "fields" separated
14390    by colon (:) -- a keyword and a value. Keyword tables must be sorted
14391    if \tablelook() is to work right, so after declaring and initializing
14392    the table array, we sort it.
14393
14394   local \&k[] \%a \%i \%n
14395
14396   array declare \&k[] = drive:9 do:8 discuss:7 live:6 spend:5 help:4 quit:0
14397
14398   array sort &k                             ; Make sure array is sorted
14399   echo Type "help" for help.                ; Print greeting & instructions
14400
14401   while true {                              ; Loop to get commands
14402       undefine \%a
14403       while not defined \%a {               ; Get a command
14404           ask \%a { Command? }
14405       }
14406       .\%n := \ftablelook(\%a,&k)           ; Look up the command
14407       switch \%n {                          ; Handle errors
14408         :-1, echo Not found - "\%a"         ; Doesn't match
14409              continue
14410         :-2, echo Ambiguous - "\%a"         ; Matches too many
14411              continue
14412       }
14413       switch \fword(\&k[\%n],2) {           ; Dispatch according to value
14414          :9, echo Driving..., break
14415          :8, echo Doing..., break
14416          :7, echo Discussing..., break
14417          :6, echo Living..., break
14418          :5, echo Spending..., break
14419          :4, echo { Commands (may be abbreviated):}
14420              for \%i 1 \fdim(&k) 1 {
14421                 echo {  \%i. \fword(\&k[\%i],1) }
14422              }
14423              break
14424          :0, exit 0 Bye!
14425          :default, stop 1 Internal error
14426       }
14427   }
14428
14429    In this example, keywords are "drive", "do", "discuss", etc, and their
14430    values are unique numbers (values need not be numbers, and there need
14431    not be only one value -- there can be 0, 1, 2, or more of them). The
14432    user types a command, which can be the whole word (like "help") or any
14433    abbreviation (like "hel", "he", or just "h"). If this does not match
14434    any keywords, \ftablelook() returns -1; if it matches more than one
14435    (as would "d"), it returns -2. Otherwise the array index is returned,
14436    1 or higher.
14437
14438    Given the array index \%n, we can get the table values as follows:
14439
14440   \fword(\&k[\%n],1) is the keyword (first field)
14441   \fword(\&k[\%n],2) is the value (second field, in this case a number)
14442
14443    In our example, we use the value (number) as the SWITCH variable. As
14444    noted, \fablelook() expects the array elements to contain multiple
14445    fields separated by colon (:) (or other character that you specify,
14446    e.g. \ftablelook(\%a,&a,^)) and when matching the keyword, ignores the
14447    first delimiter and everything after it.
14448      _________________________________________________________________
14449
14450     7.10.8. Hints for Using Arrays
14451
14452    C programmers are accustomed to out-of-bounds array references causing
14453    core dumps or worse. In C-Kermit:
14454
14455      * A reference to an an out-of-bounds array element returns the empty
14456        string.
14457      * An attempt to set the value of an array element that is out of
14458        bounds or that has not been declared simply fails.
14459
14460    C programmers expect an array of size nto have elements 0 through n-1.
14461    Fortran programmers expect the same array to have elements 1 through
14462    n. C-Kermit accommodates both styles; when you declare an array of
14463    size n, it has n=1 elements, 0 through n, and you can use the array in
14464    your accustomed manner, 0-based or 1-based.
14465
14466    However, note that C-Kermit has certain biases towards 1-based arrays:
14467
14468      * Assignment of file lists starts with element 1 ([602]Section
14469        7.10.3).
14470      * Assignment by \fsplit() starts with element 1 ([603]Section 7.3).
14471      * Array initialization skips the 0th element. To initialize a
14472        0-based array, use something like this:
14473   declare \&a[3] = one two three
14474   .\&a[0] = zero
14475      * The ARRAY SORT command skips the 0th element unless you include
14476        /RANGE:0
14477      * The SHIFT command ignores element 0 of the \&_[] array.
14478
14479    The distinction between an array's dimensioned size and the number of
14480    elements in the array is important when sorting. To illustrate:
14481
14482   declare \&a[100]                  ; Declare array &a with 100 elements
14483   fopen /read \%c oofa.txt          ; Open a file
14484   if fail...
14485   for \%i 1 \fdim(&a) 1 {           ; Read the file into the array
14486       fread \%c \&a[\%i]
14487       if fail break
14488   }
14489   fclose \%c
14490   if > \%i \fdim(&a) end 1 File has too many lines for array.
14491   .\%n ::= \%i - 1
14492   echo File has \%n line(s).
14493
14494    Let's say the file had 95 lines. This leaves elements 96-100 of the
14495    array empty. Now suppose you sort the array and write out the result:
14496
14497   sort &a                           ; Sort the whole array
14498   fopen /write \%o oofa.txt.sorted  ; Open an output file
14499   if fail ...
14500   for \%i 1 \%n 1 {                 ; Write out 95 records
14501       fwrite /line \%o \&a[\%i]
14502       if fail end 1 Write error
14503   }
14504   close write
14505
14506    You might be surprised at the contents of "oofa.txt.sorted" -- five
14507    empty elements, 96-100, floated to the top of the array in the sort,
14508    and since your write loop only had 95 iterations, the final 5 lines of
14509    the sorted file are lost.
14510
14511    Therefore, when dealing with partially filled arrays -- especially
14512    when sorting them -- remember to specify the number of elements. A
14513    handy way of recording an array's "true" size is to put it in the 0th
14514    element. That way, it "travels with the array". To illustrate
14515    (continuing the previous example at the "close read" statement):
14516
14517   close read
14518   if > \%i \fdim(&a) end 1 File has too many lines for array.
14519   .\&a[0] ::= \%i - 1     ; Assign number of lines to \&a[0].
14520   echo File has \&a[0] line(s).
14521   sort /range:1:\&a[0] &a
14522   open write oofa.txt.sorted
14523   if fail ...
14524   for \%i 1 \&a[0] 1 {
14525       writeln file \&a[\%j]
14526       if fail end 1 Write error
14527   }
14528   close write
14529
14530    Note the SORT switch, /RANGE:1:\&a[0]. This keeps the sort 1-based,
14531    and uses element 0 of the array as its size indicator.
14532
14533    Finally, note that even though some commands or functions might put a
14534    size in array element 0, no built-in functions or commands depend on a
14535    size actually being there. Thus you are perfectly free to replace the
14536    size with something else and treat the array as 0-based.
14537      _________________________________________________________________
14538
14539     7.10.9. Do-It-Yourself Arrays
14540
14541    Kermit's \&x[] arrays are nice because of the accompanying built-in
14542    functionality -- ARRAY commands, built-in functions that load and
14543    search arrays, automatic evaluation of arithmetic expressions within
14544    the subscript brackets, and so on. Yet they also have certain
14545    limitations:
14546
14547     1. Except when created by dynamic loading (e.g. by \ffiles()) they
14548        must be declared and dimensioned in advance.
14549     2. Indices must be numeric, positive, and in range.
14550     3. There can be only one dimension. Matrices or other
14551        higher-dimensioned arrays are not available.
14552
14553    But none of this is to say you can't invent any kind of data structure
14554    you like. In [604]Section 7.9.2 you can see some examples. Here's
14555    another (courtesy of Dat Thuc Nguyen), in which a pair of matrices is
14556    created and then added: no dimensioning necessary.
14557
14558   .row = 4
14559   .col = 9
14560
14561   ; MACRO TO PRINT A MATRIX
14562   define PMATRIX {
14563       echo Matrix \%1:
14564       for \%r 1 \m(row) 1 {
14565           for \%c 1 \m(col) 1 {
14566               xecho \flpad(\m(\%1[\%r][\%c]),4)
14567           }
14568           echo
14569       }
14570       echo
14571   }
14572   ; CREATE MATRICES A AND B
14573   for \%r 1 \m(row) 1 {
14574       for \%c 1 \m(col) 1 {
14575           _eval A[\%r][\%c] \%r + \%c
14576           _eval B[\%r][\%c] \%r * \%c
14577       }
14578   }
14579   ; CREATE MATRIX C = SUM OF MATRIX A AND MATRIX B
14580   for \%r 1 \m(row) 1 {
14581       for \%c 1 \m(col) 1 {
14582           _eval C[\%r][\%c] \m(A[\%r][\%c]) + \m(B[\%r][\%c])
14583       }
14584   }
14585   pmatrix A  ; Print Matrix A
14586   pmatrix B  ; Print Matrix B
14587   pmatrix C  ; Print Matrix C
14588
14589    In the example, we use matrix-like notation to create macros with
14590    names like "A[1][1]", "B[3][7]", and so on.
14591      _________________________________________________________________
14592
14593     7.10.10. Associative Arrays
14594
14595    An associative array is a special kind of Do-It-Yourself array. It
14596    differs from a regular array in that its indices need not be numbers
14597    -- they can be anything at all -- words, filenames, names of months,
14598    any character string at all, and that it doesn't have to be (and in
14599    fact can't be) declared. An associative array element is simply a
14600    macro whose name ends with an index enclosed in angle brackets, for
14601    example:
14602
14603   file<oofa.txt>
14604
14605    More formally:
14606
14607   basename<index>
14608
14609    An associative array is a collection of all associative array elements
14610    that have the same basename. Any number of associative arrays, each
14611    with any number of elements, can exist at the same time.
14612
14613    An associative array element can be assigned a value, such as "1",
14614    just like any other macro:
14615
14616   define file<oofa.txt> 1     ; Give "file<oofa.txt>" the value "1".
14617
14618    or:
14619
14620   assign file<oofa.txt> \%a   ; Give it the value of the variable \%a.
14621
14622    However, since an associative array element is a macro, it may not
14623    have an empty (null) value, since assigning an empty value to a macro
14624    undefines the macro.
14625
14626    You can refer to the value of an associative array element using the
14627    familiar notation for macro values:
14628
14629   echo \m(file<oofa.txt>)     ; Echo the value of "file<oofa.txt>".
14630
14631    Associative arrays are most useful, however, when the value of the
14632    index is a variable. In that case, you must use the "hidden" forms of
14633    the DEFINE or ASSIGN commands that evaluate the macro name before
14634    making the assignment (see [605]Using C-Kermit, page 457). Example:
14635
14636   define \%f oofa.txt
14637   _define file<\%f> 1
14638   echo file<\%f> = \m(file<\%f>)
14639
14640    prints:
14641
14642   file<oofa.txt> = 1
14643
14644    and then:
14645
14646   _increment file<\%f>
14647   echo file<\%f> = \m(file<\%f>)
14648
14649    prints:
14650
14651   file<oofa.txt> = 2
14652
14653    What are associative arrays good for? The classic example is "word
14654    counts": finding the number of times each word is used in a text
14655    without knowing in advance what the words are. Without associative
14656    arrays, your program would have to build a table of some kind, and
14657    every time a word was encountered, look it up in the table to find its
14658    position and counter, or add it to the table if it wasn't found -- a
14659    time-consuming and laborious process. Associative arrays, however, let
14660    you use the word itself as the table index and therefore sidestep all
14661    the table building and lookups.
14662
14663    Let's work through a practical example. Suppose you have a
14664    file-transfer log in which each line is composed of a number of
14665    blank-separated fields, and the 9th field is a filename (which happens
14666    to be the format of certain FTP server logs, as well as of C-Kermit's
14667    new FTP-format transaction log, described in [606]Section 4.17.2), for
14668    example:
14669
14670   Wed Jul 14 09:35:31 1999 22 xx.mit.edu 13412 /pub/ftp/mm/intro.txt ....
14671
14672    and you want to find out how many times each file was transferred. The
14673    following code builds an associative array, file<>, containing the
14674    counts for each file:
14675
14676   local name line max \%c \%n          ; Declare local variables
14677   fopen /read \%c /var/log/ftpd.log    ; Open the log file ([607]Section 1.22)
14678   if fail exit 1 Can't open log        ; Check
14679   while true {                         ; Loop for each record
14680       fread /line \%c line             ; Read a line
14681       if fail break                    ; Check for end of file
14682       .name := \fword(\m(line),9,{ })  ; Get 9th field = filename (Sec 7.3)
14683       _increment file<\m(name)>        ; Increment its counter (Sec 7.9.2)
14684   }
14685   fclose \%c                           ; Close file when done.
14686
14687    Note that _INCREMENT (and INCREMENT, and [_]DECREMENT) treat an empty
14688    (i.e. nonexistent) variable as having a value of 0, and therefore
14689    creates the variable with a value of 1.
14690
14691    At this point, if you told Kermit to "show macro file<", it would list
14692    the associative array. But since you don't necessarily know the names
14693    of the files in the array, or even how many elements are in the array,
14694    how can you use it in a script program?
14695
14696    The idea of creating macro names that include character-string indices
14697    enclosed in angle brackets is perfectly arbitrary and doesn't depend
14698    on any Kermit features that weren't already there -- we could just as
14699    easily have used some other notation, such as "file[index]",
14700    "file:index", or "file.index", and the code above would have worked
14701    just as well (with the corresponding syntax adjustments). But to be
14702    able to use an associative array in a program after the array is
14703    built, we need a method of accessing all its elements without knowing
14704    in advance what they are. That's where the chosen notation comes in.
14705
14706    First of all, any macro name that ends with "<xxx>" (where "xxx" is
14707    any string) is case sensitive, unlike all other macro names, which are
14708    case independent. To illustrate, "file<oofa.txt>" and "file<OOFA.TXT>"
14709    are two distinct macros, whereas "OOFA", "Oofa", and "oofa", when used
14710    as macro names, are all the same.
14711
14712    Second, the new \faaconvert() function converts an associative array
14713    (that is, all macros with names of the form "base<index>" that have
14714    the same "base" part) into a pair of regular arrays and returns the
14715    number of elements:
14716
14717   \faaconvert(name,&a[,&b])
14718
14719    "name" is the name of the associative array, without the angle
14720    brackets or index ("file" in our example).
14721
14722    The second argument is the name of a regular array in which to store
14723    the indices of the associative array (filenames in our example); if an
14724    array of this name already exists, it is destroyed unless the array is
14725    LOCAL. The third argument is the name of another regular array in
14726    which to store the values (the counts in our example), with the same
14727    rules about array name collisions. If you care only about the indices
14728    and not the values, you can omit the third argument to \faaconvert().
14729    In any case, the associative array is converted, not copied: its
14730    elements are moved to the specified regular arrays, so after
14731    conversion the original associative array is gone.
14732
14733    As with other array-loading functions, \faaconvert() sets element 0 of
14734    each array to the number of elements in the array.
14735
14736    To continue our example:
14737
14738   .max := 0                                   ; Maximum count
14739   .\%n := \faaconvert(file,&a,&b)             ; Convert
14740   for \%i 1 \%n 1 {                           ; Loop through values
14741       echo \flpad(\%i,3). \&a[\%i]: \&b[\%i]  ; Echo this pair
14742       if ( > \&b[\%i] \m(max) ) {             ; Check for new maximum
14743           .name := \&a[\%i]
14744           .max  := \&b[\%i]
14745       }
14746   }
14747   echo Most popular file: \m(name), accesses: \m(max)
14748
14749    This lists the files and counts and then announces which file has the
14750    highest count.
14751
14752    Now suppose you want to sort the array pair created from an
14753    associative array. In our example, \&a[] contains filenames, and \&b[]
14754    contains the associated counts. Here we take advantage of the ARRAY
14755    SORT command's ability to sort a second array according to the first
14756    one:
14757
14758   array sort /reverse /numeric &b &a          ; Descending sort by count
14759
14760    Now to see the top five files and their counts:
14761
14762   echo The top 5 files are:
14763   for \%i 1 5 1 {                             ; Loop through top 5 values
14764       echo \flpad(\%i,3). \&a[\%i]: \&b[\%i]  ; Echo this pair
14765   }
14766      _________________________________________________________________
14767
14768     7.10.11. Transferring Array Contents to Other Computers
14769
14770    The SEND /ARRAY:arrayname command ([608]Section 4.7.1) allows you to
14771    send the contents of any array, or any contiguous segment of it, in
14772    either text or binary mode to another computer, using Kermit protocol.
14773    When used in conjunction with C-Kermit's other features (the array
14774    features described in this section; the file i/o package from
14775    [609]Section 1.22; its decision-making, pattern-matching, and string
14776    manipulation capabilities, and so on) the possibilities are endless:
14777    extracts of large files, remote database queries, ..., all without
14778    recourse to system-dependent mechanisms such UNIX pipes and filters,
14779    thus ensuring cross-platform portability of scripts that use these
14780    features.
14781
14782    When sending an array in text mode, Kermit appends a line terminator
14783    to each array element, even empty ones, and it also converts the
14784    character set from your current FILE character-set to your current
14785    TRANSFER character-set, if any. No conversions are made or line
14786    terminations added in binary mode. For example, the following array:
14787
14788   dcl \&a[] = One Two Three Four Five Six
14789
14790    is sent as six lines, one word per line, in text mode, and as the bare
14791    unterminated string "OneTwoThreeFourFiveSix" in binary mode.
14792
14793    You should always include a /TEXT or /BINARY switch in any SEND /ARRAY
14794    command to force the desired transfer mode, otherwise you're likely to
14795    be surprised by the effects described in [610]Section 4.3.
14796
14797    Here are some examples:
14798
14799    send /text /array:\&a[]
14800           Sends the entire contents of the array \&a[] in text mode.
14801           Since an as-name is not included, the receiver is told the
14802           filename is _array_a_.
14803
14804    send /text /array:&a[]
14805    send /text /array:a[]
14806    send /text /array:&a
14807    send /text /array:a
14808           These are all equivalent to the previous example.
14809
14810    send /text /array:&a /as-name:foo.bar
14811           As above, but the array is sent under the name foo.bar.
14812
14813    send /text /array:&a[100:199] /as:foo.bar
14814           As above, but only the elements from 100 through 199 are sent.
14815
14816    In text-mode transfers, character sets are translated according to
14817    your current settings, just as for text files. In binary mode, of
14818    course, there is no character-set translation or other conversion of
14819    any kind. But remember that array elements can not contain the NUL
14820    (ASCII 0) character, since they are implemented as NUL-terminated
14821    strings.
14822
14823    Here's an example that shows how to send all the lines (up to 1000 of
14824    them) from a file animals.txt that contain the words "cat", "dog", or
14825    "hog" (see [611]Section 4.9 about pattern matching):
14826
14827   declare \&a[1000]
14828   fopen /read \%c animals.txt
14829   if fail exit 1
14830   .\%i = 0
14831   while true {
14832       fread \%c line
14833       if fail break
14834       if match {\m(line)} {*{cat,[dh]og}*} {
14835           increment \%i
14836           if ( > \%i \fdim(&a) ) break
14837           .\&a[\%i] := \m(line)
14838       }
14839   }
14840   fclose \%c
14841   send /array:a[1:\%i] /text
14842
14843    Note that we are careful to send only the part of the array that was
14844    filled, not the entire array, because there are likely to be lots of
14845    unused elements at the end, and these would be sent as blank lines
14846    otherwise.
14847
14848    This example raises an interesting question: what if we want to send
14849    ALL the matching lines, even if there are more than 1000 of them, but
14850    we don't know the number in advance? Clearly the problem is limited by
14851    Kermit's (and the computer's) memory. If there are a thousand trillion
14852    matching lines, they most likely will not fit in memory, and in this
14853    case the only solution is to write them first to a temporary file on
14854    mass storage and then send the temporary file and delete it
14855    afterwards.
14856
14857    However, when the selection is likely to fit in memory, the
14858    once-familiar technique of initial allocation with extents can be
14859    used:
14860
14861   if match {\m(line)} {*{cat,[dh]og}*} {
14862       increment \%i
14863       if ( > \%i \fdim(&a) ) {
14864           array resize a \fdim(&a)+100
14865           if fail stop 1 MEMORY FULL
14866           echo NEW DIMENSION: \fdim(&a)
14867       }
14868       .\&a[\%i] := \m(line)
14869   }
14870
14871    This grows the array in chunks of 100 as needed.
14872      _________________________________________________________________
14873
14874   7.11. OUTPUT Command Improvements
14875
14876    LINEOUT [ text ]
14877           This command is exactly like OUTPUT, except it supplies a
14878           carriage return at the end of the text. "lineout exit" is
14879           exactly the same as "output exit\13".
14880
14881    SET OUTPUT SPECIAL-ESCAPES { ON, OFF }
14882           This command lets you tell C-Kermit whether to process \N, \L,
14883           and \B specially in an OUTPUT command, as distinct from other \
14884           sequences (such as \%a, \13, \v(time), etc). Normally the
14885           special escapes are handled. Use SET OUTPUT SPECIAL-ESCAPES OFF
14886           to disable them.
14887
14888    Disabling special escapes is necessary in situations when you need to
14889    transmit lines of data and you have no control over what is in the
14890    lines. For example, a file oofa.txt that contains:
14891
14892   This is a file
14893   It has \%a variables in it
14894   And it has \B in it.
14895   And it has \L in it.
14896   And it has \N in it.
14897   And this is the last line.
14898
14899    can be sent like this:
14900
14901   local line
14902   set output special-escapes off
14903   fopen /read \%c oofa.txt
14904   if fail stop 1 Can't open oofa.txt
14905   while success {
14906       fread \%c line
14907       if fail break
14908       ; Add filtering or processing commands here...
14909       output \m(line)\13
14910   }
14911      _________________________________________________________________
14912
14913   7.12. Function and Variable Diagnostics
14914
14915    In C-Kermit 6.0 and earlier, the only diagnostic returned by a failing
14916    function call was an empty value, which (a) could not be distinguished
14917    from an empty value returned by a successful function call; (b) did
14918    not give any indication of the cause of failure; and (c) did not cause
14919    the enclosing statement to fail. C-Kermit 7.0 corrects these
14920    deficiencies.
14921
14922    SET FUNCTION DIAGNOSTICS { ON, OFF }
14923           when ON, allows built-in functions to return diagnostic
14924           messages when improperly referenced, instead of an empty
14925           string. FUNCTION DIAGNOSTICS are ON by default. When OFF,
14926           improperly referenced functions continue to return an empty
14927           string. This command also affects built-in variables; in this
14928           case, an error message is returned only if the variable does
14929           not exist. When FUNCTION DIAGNOSTICS are ON, the error message
14930           is also printed.
14931
14932    For variables, the only message is:
14933
14934   <ERROR:NO_SUCH_VARIABLE:\v(name)>
14935
14936    where "name" is the name of the nonexistent variable.
14937
14938    For functions, the diagnostic message is:
14939
14940   <ERROR:message:\fname()>
14941
14942    where "message" is replaced by a message, and "name" is replaced by
14943    the function name, e.g. <ERROR:ARG_NOT_NUMERIC:\fmod()>. Messages
14944    include:
14945
14946   ARG_BAD_ARRAY       An argument contains a malformed array reference.
14947   ARG_BAD_DATE        An argument contains a malformed date and/or time.
14948   ARG_BAD_PHONENUM    An argument contains a malformed telephone number.
14949   ARG_BAD_VARIABLE    An argument contains a malformed \%x variable.
14950   ARG_INCOMPLETE      An argument is incomplete (e.g. a broken Base64 string).
14951   ARG_EVAL_FAILURE    An argument could not be evaluated (internal error).
14952   ARG_NOT_ARRAY       An argument references an array that is not declared.
14953   ARG_NOT_NUMERIC     An argument that must be integer contains non-digits.
14954   ARG_NOT_FLOAT       An argument has bad floating-point number format.
14955   ARG_NOT_VARIABLE    An argument that must be a variable is not a variable.
14956   ARG_OUT_OF_RANGE    An argument's numeric value is too big or too small,
14957                       or an argument contains illegal characters (e.g. a hex
14958                       or Base-64 string).
14959   ARG_TOO_LONG        An argument's value is too long.
14960   ARRAY_FAILURE       Failure to create an array.
14961   DIVIDE_BY_ZERO      Execution of the function would cause division by zero.
14962   FLOATING_POINT_OP   Execution error in a floating-point operation.
14963   FILE_NOT_FOUND      Filename argument names a file that can't be found.
14964   FILE_NOT_READABLE   Filename argument is not a regular file.
14965   FILE_NOT_ACCESSIBLE Filename argument names a file that is read-protected.
14966   FILE_ERROR          Other error with filename argument.
14967   FILE_NOT_OPEN       A file function was given a channel that is not open.
14968   FILE_ERROR_-n       A file function got error -n ([612]Section 1.22).
14969   LOOKUP_FAILURE      Error looking up function (shouldn't happen).
14970   MALLOC_FAILURE      Failure to allocate needed memory (shouldn't happen).
14971   NAME_AMBIGUOUS      The function is not uniquely identified.
14972   MISSING_ARG         A required argument is missing.
14973   NO_SUCH_FUNCTION    An argument references a function that is not defined.
14974   NO_SUCH_MACRO       An argument references a macro that is not defined.
14975   RESULT_TOO_LONG     The result of a function is too long.
14976   UNKNOWN_FUNCTION    Internal error locating function (shouldn't happen).
14977
14978    Examples:
14979
14980   assign \%m \fmod()
14981   ?<ERROR:MISSING_ARG:\fmod()>
14982   echo "\fcontents(\%m)"
14983   "<ERROR:MISSING_ARG:\fmod()>"
14984   echo \fmod(3,x)
14985   ?<ERROR:ARG_NOT_NUMERIC:\fmod()>
14986   echo \fmod(3,4-2*2)
14987   ?<ERROR:DIVIDE_BY_ZERO:\fmod()>
14988
14989    Notice the use of \fcontents() in echoing the value of a variable that
14990    contains a returned error message. That's because the error message
14991    includes the name of the variable or function that failed, so you must
14992    use \fcontents() to prevent it from being evaluated again -- otherwise
14993    the same error will occur.
14994
14995    The handling of function and variable errors is controlled by:
14996
14997    SET FUNCTION ERROR { ON, OFF }
14998           Tells whether invalid function calls or variable references
14999           should cause command errors. FUNCTION ERROR is ON by default.
15000           When ON, and an error is diagnosed in a built-in function or
15001           variable, the command that includes the function call or
15002           variable reference fails. The failing command can be handled in
15003           the normal way with IF FAILURE / IF SUCCESS, SET TAKE ERROR, or
15004           SET MACRO ERROR.
15005
15006    When FUNCTION DIAGNOSTICS is OFF, there is no error message.
15007
15008    SHOW SCRIPTS displays the current FUNCTION DIAGNOSTICS and ERROR
15009    settings.
15010      _________________________________________________________________
15011
15012   7.13. Return Value of Macros
15013
15014    In C-Kermit 5A and 6.0, there are two ways to return one level from a
15015    macro: RETURN value and END number text. When RETURN is used, the
15016    value, which can be a number or a text string, is assigned to
15017    \v(return). When END was used, however, \v(return) was not set.
15018    SUCCESS/FAILURE was set according to whether the number was zero, and
15019    the text was printed, but the actual value of the number was lost.
15020
15021    In C-Kermit 7.0, the END number is available in the \v(return)
15022    variable.
15023      _________________________________________________________________
15024
15025   7.14. The ASSERT, FAIL, and SUCCEED Commands.
15026
15027    The ASSERT command is just like the IF command, but without a command
15028    to execute. It simply succeeds or fails, and this can be tested by a
15029    subsequent IF SUCCESS or IF FAILURE command. Example:
15030
15031   ASSERT = 1 1
15032   IF SUCCESS echo 1 = 1.
15033
15034    The FAIL command does nothing, but always fails. The SUCCEED command
15035    does nothing, but always succeeds.
15036
15037    These commands are handy in debugging scripts when you want to induce
15038    a failure (or success) that normally would not occur, e.g. for testing
15039    blocks of code that normally are not executed.
15040      _________________________________________________________________
15041
15042   7.15. Using Alarms
15043
15044    Alarms may be set in two ways:
15045
15046    SET ALARM number
15047           Sets an alarm for the given number of seconds "from now", i.e.
15048           in the future, relative to when the SET ALARM command was
15049           given. Examples:
15050
15051   set alarm 60        ; 60 seconds from now
15052   set alarm +60       ; The same as "60"
15053   set alarm -60       ; Not legal - you can't set an alarm in the past.
15054   set alarm 60*60     ; 60 minutes from now.
15055   set alarm \%a+10    ; You can use variables, etc.
15056
15057    SET ALARM hh:mm:ss
15058           Sets an alarm for the specified time. If the given time is
15059           earlier than the current time, the alarm is set for the given
15060           time in the next day. You may give the time in various formats:
15061
15062   set alarm 15:00:00  ; 3:00:00pm
15063   set alarm 3:00:00pm ; 3:00:00pm
15064   set alarm 3:00pm    ; 3:00:00pm
15065   set alarm 3pm       ; 3:00:00pm
15066
15067    SHOW ALARM
15068           Displays the current alarm, if any, in standard date-time
15069           format (see [613]Section 1.6): yyyymmdd hh:mm:ss.
15070
15071    IF ALARM command
15072           Executes the command if an alarm has been set and the alarm
15073           time has passed.
15074
15075    IF ALARM { command-list } [ ELSE { command-list } ]
15076           Executes the command-list if an alarm has been set and the
15077           alarm time has passed. Otherwise, if an ELSE part is given, its
15078           command-list is executed.
15079
15080    CLEAR ALARM
15081           Clears the alarm.
15082
15083    Only one alarm may be set at a time.
15084
15085    Example: Suppose you have a script that is always running, and that
15086    transfers files periodically, and that keeps a transaction log.
15087    Suppose you want to start a new transaction log each day:
15088
15089   log transactions \v(date).log
15090   set alarm 00:00:00                     ; Set an alarm for midnight
15091   while true {                           ; Main script loop
15092       xif alarm {                        ; If the alarm time is past...
15093           close transactions             ; Close current log
15094           log transactions \v(date).log  ; Start new one
15095           pause 1                        ; To make sure 00:00:00 is past
15096           set alarm 00:00:00             ; Set a new alarm
15097       }
15098       ; put the rest of the script here...
15099   }
15100
15101    Note that IF ALARM -- no matter whether it succeeds or fails -- does
15102    NOT clear an expired alarm. Thus, once an alarm has expired, every IF
15103    ALARM will succeed until the alarm is cleared (with the CLEAR ALARM
15104    command) or reset with a new SET ALARM command.
15105      _________________________________________________________________
15106
15107   7.16. Passing Arguments to Command Files
15108
15109    Beginning in version 7.0, C-Kermit accepts arguments on the TAKE
15110    command line, for example:
15111
15112   C-Kermit> take oofa.ksc one two {this is three} four
15113
15114    This automatically sets the variables \%1 through \%9 to the
15115    arguments, and \%0 to the name of the file, in this case:
15116
15117   \%0 = /usr/olga/oofa.ksc
15118   \%1 = one
15119   \%2 = two
15120   \%3 = this is three
15121   \%4 = four
15122
15123    and \%5..\%9 are undefined (empty). Arguments past the ninth are
15124    available in the \&_[] argument-vector array ( [614]Section 7.5).
15125
15126    The variables are those at the current macro level. Thus, if the TAKE
15127    command is executed from within a macro, the macro's arguments are
15128    replaced by those given on the TAKE command line (but only if at least
15129    one argument is given). The command shown above is exactly equivalent
15130    to:
15131
15132   assign \%0 /usr/olga/oofa.ksc
15133   assign \%1 one
15134   assign \%2 two
15135   assign \%3 this is three
15136   assign \%4 four
15137   assign \%5
15138   assign \%6
15139   assign \%7
15140   assign \%8
15141   assign \%9
15142   take oofa.ksc
15143
15144    Remember, the variables \%0..\%9 are on the macro call stack, and
15145    command files are independent of the macro stack. Thus, if a command
15146    file TAKEs another command file and passes arguments to it, the
15147    variables are changed from that point on for both files, and so forth
15148    for all levels of nested command files without intervening macro
15149    invocations.
15150
15151    It would have been possible to change C-Kermit to use the overall
15152    command stack, rather than the macro stack, for arguments -- this
15153    would have made TAKE work exactly like DO, which is "nicer", but it
15154    would also have broken countless existing scripts. However, the new
15155    SHIFT command ([615]Section 7.5) makes it possible to create an
15156    alternative TAKE command that does indeed save and restore the
15157    argument variables at its own level around execution of a command
15158    file:
15159
15160   define mtake {
15161      local \%f
15162      assign \%f \fcontents(\%1)
15163      shift
15164      take \%f
15165   }
15166
15167    C-Kermit 7.0 also supports a new, easier way to pass arguments to
15168    scripts from the system command line:
15169
15170   kermit filename arg1 arg2 arg3 ...
15171
15172    in which arg1, arg2, arg3 (etc) are arguments for the script (whose
15173    filename is given), and are assigned to \%1, \%2, ... \%9. The
15174    filename is assigned to \%0. This applies equally to "Kerbang" scripts
15175    in UNIX ([616]Section 7.19). For example, suppose you have a file
15176    called "showargs" containing the following lines:
15177
15178   #!/usr/local/bin/kermit +
15179   echo Hello from \%0
15180   show args
15181   exit
15182
15183    (except not indented, since the "#!" line must be on the left margin).
15184    If you give this file execute permission:
15185
15186   chmod +x showargs
15187
15188    then you can run it exactly as you would run a UNIX shell script,
15189    e.g.:
15190
15191   $ showargs one two three
15192   Hello from /usr/olga/showargs
15193   Top-level arguments (\v(argc) = 4):
15194    \&_[0] = /usr/olga/showargs
15195    \&_[1] = one
15196    \&_[2] = two
15197    \&_[3] = three
15198
15199    Furthermore, the \&_[] array now contains the filename, if one was
15200    given as the first command line argument, or it is a "Kerbang" script,
15201    in element 0.
15202
15203    Otherwise element 0 is program name, and elements 1 through \v(argc)-1
15204    contain the command-line arguments, if any, that appear after "--" or
15205    "=", if any. This array is saved and restored around macro calls;
15206    recall that inside macros it contains the macro argument vector
15207    (allowing you to access arguments programmatically, and to have more
15208    than 9 of them).
15209
15210    At top level, notice the difference between the \&@[] and \&_[]
15211    arrays. The former includes C-Kermit options; the latter omits them.
15212      _________________________________________________________________
15213
15214   7.17. Dialogs with Timed Responses
15215
15216    The ASK, ASKQ, GETOK, and GETC commands (let's call them the
15217    "ASK-class commands") let you write scripts that carry on dialogs with
15218    the user, asking them for text, a Yes/No answer, or a character,
15219    respectively. Prior to C-Kermit 7.0, these questions would always wait
15220    forever for an answer. In C-Kermit 7.0, you may specify a time limit
15221    for them with the new command:
15222
15223    SET ASK-TIMER number
15224           Sets a time-limit on ASK-CLASS commands to the given number of
15225           seconds. If the number is 0 or less, there is no time limit and
15226           these commands wait forever for a response. Any timer that is
15227           established by this command remains in effect for all future
15228           ASK-class commands until another SET ASK-TIMER command is given
15229           (e.g. with a value of 0 to disable ASK timeouts).
15230
15231    IF ASKTIMEOUT command
15232           An ASK-class command that times out returns a failure status.
15233           You can test explicitly for a timeout with:
15234      _________________________________________________________________
15235
15236   7.18. Increased Flexibility of SWITCH Case Labels
15237
15238    Prior to C-Kermit 7.0 / K95 1.1.19, the case labels in SWITCH
15239    statements were string constants.
15240
15241    Now case labels can be variables, function calls, or any mixture of
15242    these with each other and/or with regular characters.
15243
15244    Furthermore, after the case label is evaluated, it is treated not as a
15245    string constant, but as a pattern against which the SWITCH variable is
15246    matched ([617]Section 4.9.1).
15247
15248    This introduces a possible incompatibility with previous releases,
15249    since the following characters in case labels are no longer taken
15250    literally:
15251
15252   \ * ? [ {
15253
15254    Any scripts that previously included any of these characters in case
15255    labels must now quote them with backslash (\).
15256      _________________________________________________________________
15257
15258   7.19. "Kerbang" Scripts
15259
15260    In UNIX only, Kermit scripts can be stored in files and run
15261    "directly", without starting Kermit first (as noted on page 467 of the
15262    manual), just as a shell script can be "run" as if it were a program.
15263    This section amplifies on that idea a bit, and presents some new
15264    aspects of version 7.0 that make it easier to write and run Kermit
15265    scripts directly.
15266
15267      NOTE: On non-UNIX platforms, such as VMS or Windows, Kerbang
15268      scripts can be run as "kermit + scriptfilename arg1 arg2 arg3 ...".
15269      Windows 95/98/NT file associations do not allow for the passing of
15270      parameters. In VMS, however, you can achieve the Kerbang effect by
15271      defining a symbol, as in this example:
15272
15273   $ autotelnet :== "$SYS$TOOLS:KERMIT.EXE + AUTOTELNET.KSC"
15274
15275      and then running the script like any other command:
15276
15277   $ autotelnet xyzcorp.com myuserid
15278
15279      See [618]Section 9.3 for an explanation of the "+" symbol.
15280
15281    UNIX shell scripts can specify which shell should run them by
15282    including a "shebang" line at the top, e.g.:
15283
15284   #!/bin/sh
15285
15286    (but not indented; the shebang line must be on the left margin). The
15287    term "shebang" is a contraction of "shell" and "bang". "Bang" is a
15288    slang word for the exclamation mark ("!"); "shebang" itself is an
15289    American slang word used in in the phrase "the whole shebang".
15290
15291    We can run Kermit scripts directly too, by including a "shebang" line
15292    that names Kermit as the "shell"; thus we call these "Kerbang"
15293    scripts. This mechanism has been considerably simplified in C-Kermit
15294    7.0 to facilitate C-Kermit's use a scripting tool just like any of the
15295    UNIX shells or scripting languages. The rules are the same as for
15296    shell scripts:
15297
15298     1. The first line of the Kermit script must begin with "#!"
15299        immediately followed by the full pathname of the program that will
15300        execute the script (in this case, C-Kermit rather than a UNIX
15301        shell), followed by any Kermit command-line options. To suppress
15302        execution of the C-Kermit initialization file and to make command
15303        line arguments available to the script, the final option should be
15304        "+":
15305   #!/usr/local/bin/kermit +
15306        Some users have reported that in some circumstances a space might
15307        be necessary after the plus sign; this depends on your shell -- it
15308        has nothing to do with Kermit. In most cases, no space is needed.
15309     2. The file must have execute permission (granted via "chmod +x
15310        filename").
15311
15312    When C-Kermit is invoked from a Kerbang script (or from the system
15313    prompt with a "+" command-line argument, which amounts to the same
15314    thing), the following special rules apply:
15315
15316     1. The C-Kermit initialization file is NOT executed automatically. If
15317        you want it to be executed, include a TAKE command for it in the
15318        script, e.g. "take \v(home).kermrc". (In previous releases, the
15319        initialization file was always executed, with no way to prevent it
15320        except for the user to include Kermit-specific command line
15321        options which had nothing to do with the script). Many scripts
15322        have no need for the standard Kermit initialization file, which is
15323        quite lengthy and not only delays startup of the script, but also
15324        spews forth numerous messages that are most likely unrelated to
15325        the script.
15326     2. If the initialization file is not executed, neither is your
15327        customization file, since the initialization file is the command
15328        file from which the customization file is TAKEn. Again, you can
15329        include a TAKE command for the initialization file if desired, or
15330        for the customization file by itself, or for any other file.
15331     3. C-Kermit does not process command-line arguments at all. Instead,
15332        it passes all words on the command line after the "+" to the
15333        script as \%0 (the script name), \%1..\%9 (the first nine
15334        arguments), as well as in the argument vector array \&_[]. The
15335        variable \v(argc) is set to the total number of "words" (as passed
15336        by the shell to Kermit) including the script name. Quoting and
15337        grouping rules are those of the shell.
15338     4. At any point where the script terminates, it must include an EXIT
15339        command if you want it to exit back to the shell; otherwise
15340        C-Kermit enters interactive prompting mode when the script
15341        terminates. The EXIT command can include a numeric status to be
15342        returned to the shell (0, 1, etc), plus an optional message.
15343
15344    Here is a simple Kerbang script that prints its arguments:
15345
15346   #/usr/local/bin/kermit +
15347   echo Hello from \%0
15348   for \%i 0 \v(argc)-1 1 {
15349       echo \%i. "\&_[\%i]"
15350   }
15351   exit 0
15352
15353    Save this file as (say) "showargs", then give it execute permission
15354    and run it (the \&_[] array is the same as \%0..\%9, but allows you to
15355    refer to argument variables programmatically; see [619]Section 7.5).
15356    (Yes, you could substitute SHOW ARGUMENTS for the loop.)
15357
15358   $ chmod +x showargs
15359   $ ./showargs one "this is two" three
15360
15361    The script displays its arguments:
15362
15363   Hello from /usr/olga/showargs
15364   0. "/usr/olga/showargs"
15365   1. "one"
15366   2. "this is two"
15367   3. "three"
15368   $
15369
15370    Notice that no banners or greetings are printed and that startup is
15371    instantaneous, just like a shell script. Also notice that grouping of
15372    arguments is determined by *shell* quoting rules, not Kermit ones,
15373    since the command line is parsed by the shell before Kermit ever sees
15374    it.
15375
15376    Of course you can put any commands at all into a Kerbang script. It
15377    can read and write files, make connections, transfer files, anything
15378    that Kermit can do -- because it *is* Kermit. And of course, Kerbang
15379    scripts can also be executed from the Kermit prompt (or from another
15380    script) with a TAKE command; the Kerbang line is ignored since it
15381    starts with "#", which is a comment introducer to Kermit just as it is
15382    to the UNIX shell. In VMS and other non-UNIX platforms, the Kerbang
15383    line has no effect and can be omitted.
15384
15385    It might be desireable for a script to know whether it has been
15386    invoked directly from the shell (as a Kerbang script) or by a TAKE
15387    command given to the Kermit prompt or in a Kermit command file or
15388    macro. This can be done as in this example:
15389
15390   #!/usr/local/bin/kermit +
15391   assign \%m \fbasename(\%0)
15392   define usage { exit 1 {usage: \%m phonenumber message} }
15393   define apage { (definition of APAGE...) } ; (See [620]book pp.454-456)
15394   xif equal "\%0" "\v(cmdfil)" {
15395       if not def \%1 usage
15396       if not def \%2 usage
15397       apage {\%1} {\%2}
15398       exit \v(status)
15399   }
15400
15401    In a Kerbang script, \%0 and \v(cmdfile) are the same; both of them
15402    are the name of the script. When a script is invoked by a Kermit TAKE
15403    command, \%0 is the name of the Kermit program, but \v(cmdfile) is the
15404    name of the script. In the example above, a macro called APAGE is
15405    defined. If the script was invoked directly, the APAGE macro is also
15406    executed. Otherwise, it is available for subsequent and perhaps
15407    repeated use later in the Kermit session.
15408
15409    An especially handy use for Kerbang scripts is to have the
15410    initialization file itself be one. Since the standard initialization
15411    file is rather long and time-consuming to execute, it is often
15412    overkill if you want to start Kermit just to transfer a file. Of
15413    course there are command-line switches to suppress initialization-file
15414    execution, etc, but another approach is to "run" the initialization
15415    file when you want its features (notably the services directory), and
15416    run C-Kermit directly when you don't. A setup like this requires that
15417    (a) the C-Kermit initialization file is configured as a Kerbang script
15418    (has #!/path.../kermit as first line), has execute permission, and is
15419    in your PATH; and (b) that you don't have a .kermrc file in your login
15420    directory.
15421      _________________________________________________________________
15422
15423   7.20. IF and XIF Statement Syntax
15424
15425    The IF command has been improved in two significant ways in C-Kermit
15426    7.0, described in the following subsections. All changes are backwards
15427    compatible.
15428
15429     7.20.1. The IF/XIF Distinction
15430
15431    The distinction between IF and XIF is no longer important as of
15432    C-Kermit 7.0. You should be able to use IF in all cases (and of
15433    course, also XIF for backwards compatibility). In the past, IF was
15434    used for single-command THEN parts, followed optionally by a separate
15435    ELSE command:
15436
15437   IF condition command1    ; THEN part
15438   ELSE command2            ; ELSE part
15439
15440    whereas XIF was required if either part had multiple commands:
15441
15442   XIF condition { command, command, ... } ELSE { command, command, ... }
15443
15444    The syntactic differences were primarily that IF / ELSE was two
15445    commands on two separate lines, whereas XIF was one command on one
15446    line, and that XIF allowed (and in fact required) braces around its
15447    command lists, whereas IF did not allow them.
15448
15449    Furthermore, the chaining or nesting of parts and conditions was
15450    inconsistent. For example, the IF command could be used like this:
15451
15452   IF condition command
15453   ELSE IF condition command
15454   ELSE IF condition command
15455   ELSE IF condition command
15456   ...
15457
15458    but XIF could not. C-Kermit 7.0 accepts the old syntax and executes it
15459    the same as previous versions, but also accepts a new unified and more
15460    convenient syntax:
15461
15462    IF condition command-list [ ELSE command-list ]
15463
15464    or:
15465
15466 IF condition command-list
15467 ELSE command-list
15468
15469    in which the ELSE part is optional, and where command-list can be a
15470    single command (with or without braces around it) or a list of
15471    commands enclosed in braces. Examples:
15472
15473    Example 1:
15474
15475   IF condition { command1, command2 } ELSE { command3, command4 }
15476
15477    Example 2 (same as Example 1):
15478
15479   IF condition {
15480      command1
15481      command2
15482   } ELSE {
15483      command3
15484      command4
15485   }
15486
15487    Example 3 (same as 1 and 2):
15488
15489   IF condition {
15490      command1
15491      command2
15492   }
15493   ELSE { command3, command4 }
15494
15495    Example 4 (same as 1-3):
15496
15497   IF condition {
15498      command1
15499      command2
15500   }
15501   ELSE {
15502      command3
15503      command4
15504   }
15505
15506    Example 5 (ELSE can be followed by another command):
15507
15508   IF condition {
15509      command1
15510      command2
15511   } ELSE IF condition {
15512      command3
15513      command4
15514   } ELSE {
15515      command5
15516      command6
15517   }
15518
15519    Example 5 suggests other possibilities:
15520
15521   IF condition {
15522      command1
15523      command2
15524   } ELSE FOR variable initial final increment {
15525      command3
15526      command4
15527   }
15528
15529    And this too is possible, except for some non-obvious quoting
15530    considerations:
15531
15532   dcl \&a[6] = one two three four five six
15533
15534   IF < \%n 3 {
15535       echo \\%n is too small: \%n
15536   } ELSE FOR \\%i 1 \\%n 1 {
15537       echo \\%i. \\&a[\\%i]
15538   }
15539
15540    (The loop variable must be quoted in this context to prevent premature
15541    evaluation.)
15542      _________________________________________________________________
15543
15544     7.20.2. Boolean Expressions (The IF/WHILE Condition)
15545
15546    Prior to C-Kermit 7.0, the IF and WHILE commands accepted only a
15547    single Boolean ("true or false") assertion, e.g. "if > \%m 0 command"
15548    or "if exist filename command". There was no way to form Boolean
15549    expressions and, in particular, nothing that approached a Boolean OR
15550    function (AND could be simulated by concatenating IF statements: "if
15551    condition1 if condition2..").
15552
15553    C-Kermit 7.0 (and K95 1.1.19) allow grouping of Boolean assertions
15554    using parentheses and combining them using AND (or &&) and OR (or ||).
15555    Each of these operators -- including the parentheses -- is a field and
15556    must be set off by spaces. AND has higher precedence than OR, NOT has
15557    higher precedence than AND, but parentheses can be used to force any
15558    desired order of evaluation. The old syntax is still accepted.
15559
15560    Here are some examples:
15561
15562   define \%z 0                          ; Define some variables
15563   define \%n 1                          ; for use in the examples.
15564
15565   if > \%n \%z echo \%n is greater.     ; Original format - still accepted.
15566   if ( > \%n \%z ) echo \%n is greater. ; Parentheses may be used in 7.0.
15567   if ( > \%n \%z && not = \%z 0 ) ...   ; Two assertions combined with AND.
15568   if ( > \%n \%z and not = \%z 0 ) ...  ; Same as previous ("and" = "&&").
15569   if ( > \%n \%z || not = \%z 0 ) ...   ; Two assertions combined with OR.
15570   if ( > \%n \%z or not = \%z 0 ) ...   ; Same as previous ("or" = "||").
15571   if ( > \%n \%z || != \%z 0 ) ...      ; Ditto ("!=" = "not =").
15572   while ( 1 ) { ... }                   ; Just like C.
15573
15574    Notice the spaces around all operators including the parentheses --
15575    these are required. The following examples show how parentheses can be
15576    used to alter the precedence of the AND and OR operators:
15577
15578   if ( false || false && false || true ) ,..         ; True
15579   if ( false || ( false && false ) || true ) ...     ; Same as previous
15580   if ( ( false || false ) && ( false || true ) ) ... ; False
15581
15582    Similarly for NOT:
15583
15584   if ( not true && false ) ...          ; False (NOT binds to TRUE only)
15585   if ( ( not true ) && false ) ...      ; Same as previous
15586   if ( not ( true && false ) ) ...      ; True (NOT binds to (TRUE && FALSE))
15587
15588    Notes:
15589
15590     1. The syntax of the Boolean expression itself has not changed; each
15591        expression begins with a keyword or token such as "EXIST", ">", or
15592        "=", etc; operators such as "<", "=", and ">" do not go between
15593        their operands but precede them as before; this might be called
15594        "reverse reverse Polish notation"; it allows deterministic
15595        on-the-fly parsing of these expressions at the C-Kermit> prompt as
15596        well as in scripts, and allows ?-help to be given for each item
15597        when IF or WHILE commands are typed at the prompt.
15598     2. Parentheses are required when there is more than one Boolean
15599        assertion.
15600     3. Parentheses are not required, but are allowed, when there is only
15601        one Boolean assertion.
15602     4. Evaluation of Boolean assertions occurs left to right, but the
15603        resulting Boolean expression is evaluated afterwards according to
15604        the rules of precedence. All Boolean assertions are always
15605        evaluated; there is no "early stopping" property and therefore no
15606        question about when or if side effects will occur -- if any
15607        Boolean assertion has side effects, they will always occur.
15608
15609    Constructions of arbitrary complexity are possible, within reason.
15610
15611    Also see [621]Section 7.4 for new IF / WHILE conditions.
15612      _________________________________________________________________
15613
15614   7.21. Screen Formatting and Cursor Control
15615
15616    C-Kermit 7.0 adds a simple way to create formatted screens, the SCREEN
15617    command:
15618
15619    SCREEN { CLEAR, CLEOL, MOVE-TO row [ column ] }
15620           Performs screen-formatting actions. Correct operation of these
15621           commands depends on proper terminal setup on both ends of the
15622           connection -- mainly that the host terminal type is set to
15623           agree with the kind of terminal or the emulation you are
15624           viewing C-Kermit through. The UNIX version uses terminfo or
15625           termcap (not curses); the VMS version uses SMG; K-95 uses its
15626           built in screen manager.
15627
15628    SCREEN CLEAR
15629           Moves the cursor to home position and clears the entire screen.
15630           Synonyms: CLEAR COMMAND-SCREEN ALL (K-95 only), CLS, CLEAR
15631           SCREEN.
15632
15633    SCREEN CLEOL
15634           Clears from the current cursor position to the end of the line.
15635           Synonym: CLEAR COMMAND-SCREEN EOL (K-95 only)
15636
15637    SCREEN MOVE-TO row column
15638           Moves the cursor to the indicated row and column. The row and
15639           column numbers are 1-based, so on a 24x80 screen the home
15640           position is 1 1 and the lower right corner is 24 80. If a row
15641           or column number is given that too large for what Kermit or the
15642           operating system thinks is your screen size, the appropriate
15643           number is substituted.
15644
15645    These escape sequences used by these commands depends on the platform.
15646    In UNIX, your TERM environment variable is used to query the
15647    terminfo/termcap database; if the query fails, ANSI/VT100 sequences
15648    are used. In VMS, the SMG library is used, which sends sequences based
15649    on your VMS terminal type. K95 does its own screen control. On other
15650    platforms (such as AOS/VS, VOS, etc), screen formatting is not
15651    supported, and the SCREEN command does nothing.
15652
15653    The three SCREEN actions can be used in scripts to produce menus,
15654    formatted screens, dynamic displays, etc. Related variables include:
15655
15656   \v(terminal)     The type terminal C-Kermit thinks you have.
15657   \v(rows)         The number of rows C-Kermit thinks your terminal has.
15658   \v(columns)      The number of columns C-Kermit thinks your terminal has.
15659
15660    And functions:
15661
15662   \fscrncurx()     The current X coordinate of the cursor (K-95 only).
15663   \fscrncury()     The current Y coordinate of the cursor (K-95 only).
15664   \fscrnstr(x,y,n) The string of length nat position (x,y) (K-95 only).
15665
15666    And commands:
15667
15668   ECHO string      Writes string + CRLF at the current cursor position.
15669   XECHO string     Writes string at current cursor position; CRLF not supplied.
15670   GETC v prompt    Issues prompt, reads one character into variable v, no echo.
15671
15672    And special characters:
15673
15674   Ctrl-L           At the C-Kermit> command prompt, or in a C-Kermit command,
15675                    works like Return or Enter, but also clears the screen
15676
15677    Example 1: A macro that prints a message \%1 at cursor position
15678    (\%2,\%3):
15679
15680   define MSG {
15681       if not def \%3 def \%3 0             ; Default column to 0
15682       if > \v(argc) 2 screen move \%2 \%3  ; Move to given row/col (if any)
15683       screen cleol                         ; Clear to end of line
15684       if def \%1 xecho \fcontents(\%1)     ; Print message (if any)
15685   }
15686
15687    Example 2: A macro put the cursor on the bottom screen line, left
15688    margin:
15689
15690   define BOT {
15691       screen move \v(rows) 0
15692   }
15693
15694    Example 3: A macro to center message \%1 on line \%2.
15695
15696   define CENTER {
15697       if not def \%2 def \%2 1
15698       .\%x ::= (\v(cols)-\flen(\%1))/2
15699       msg {\%1} {\%2} {\%x}
15700   }
15701
15702    Example 4: A simple menu (building on Examples 1-3):
15703
15704   def \%c 0                             ; Menu choice variable
15705   screen clear                          ; Clear the screen
15706   center {Welcome to This Menu} 2       ; Display the menu
15707   msg {Choices:} 4
15708   msg { 1. File} 6
15709   msg { 2. Edit} 7
15710   msg { 3. Exit} 8
15711   while ( != \%c 3 ) {                  ; Read and verify choice
15712       while true {                      ; Keep trying till we get a good one
15713           screen move 10                ; Move to line 10
15714           screen cleol                  ; Clear this line
15715           getc \%c {Your choice: }      ; Prompt and get and echo 1 character
15716           xecho \%c
15717           if ( not numeric \%c ) { msg {Not numeric - "\%c"} 12, continue }
15718           if ( >= \%c 1 && <= \%c 3 ) break
15719           msg {Out of range - "\%c"} 12
15720       }
15721       switch \%c {                      ; Valid choice - execute it.
15722         :1, msg {Filing... } 12, break
15723         :2, msg {Editing...} 12, break
15724         :3, msg {Exiting...} 12, break
15725       }
15726   }
15727   echo Bye                              ; Exit chosen - say goodbye.
15728   bot                                   ; Leave cursor at screen bottom.
15729   exit                                  ; And exit.
15730
15731    Similar scripts can work over the communication connection; substitute
15732    INPUT and OUTPUT for GETC and ECHO/XECHO.
15733      _________________________________________________________________
15734
15735   7.22. Evaluating Arithmetic Expressions
15736
15737    A new arithmetic operator was added to the list recognized by the
15738    EVALUATE command, the \feval() function, and which can also be used
15739    anywhere else arithmetic expressions are accepted (numeric command
15740    fields, array subscripts, etc):
15741
15742    Prefix "!"
15743           This operator inverts the "truth value" of the number or
15744           arithmetic expression that follows. If the value of the operand
15745           is 0, the result is 1. If the value is nonzero, the result is
15746           0.
15747
15748    Examples:
15749
15750   set eval old
15751   evaluate 0
15752   0
15753
15754   evaluate !0
15755   1
15756
15757   evaluate !3
15758   0
15759
15760   evaluate !(-3)
15761   0
15762
15763   .\%a = 1
15764   .\%b = 0
15765   evaluate !(\%a|\%b)
15766   0
15767
15768   evaluate !(\%a&\%b)
15769   1
15770
15771   evaluate !(!(\%a&\%b))
15772   0
15773
15774    Note the distinction between Prefix ! (invert truth value) and Suffix
15775    ! (factorial). Also the distinction between Prefix ! and Prefix ~
15776    (which inverts all the bits in its operand). Also note that prefix
15777    operators (!, -, and ~) can not be adjacent unless you use parentheses
15778    to separate them, as shown in the final example above.
15779      _________________________________________________________________
15780
15781   7.23. Floating-Point Arithmetic
15782
15783    C-Kermit 7.0 adds limited support for floating-point numbers (numbers
15784    that have fractional parts, like 3.141592653). This support is
15785    provided through a small repertoire of functions and in Boolean
15786    expressions that compare numbers, but does not apply to number parsing
15787    in general, or to expression evaluation, array subscripts, the
15788    INCREMENT and DECREMENT commands, or in any context other than those
15789    listed in this section.
15790
15791    A floating point number has an optional sign (+ or -), followed by a
15792    series of decimal digits containing either zero or one period (.)
15793    character, which is the decimal point. The use of comma or any other
15794    character besides period as a decimal point is not supported.
15795    Scientific notation is not supported either. Examples of legal
15796    floating-point numbers:
15797
15798   0                Integers can be used
15799   1                Ditto
15800   2.               A decimal point without decimal digits
15801   3.0              A decimal point with decimal digits
15802   3.141592653      Ditto
15803  -4.0              A negative sign can be included
15804  +5.0              A positive sign can be included
15805
15806    Examples of notations that are not accepted:
15807
15808   1,000,000        Separators can not be used
15809   1.000.000        Ditto (or multiple decimal points)
15810   6.022137E23      No scientific notation
15811   6.62606868e-34   Ditto
15812   12.5+6.25        No "bare" expressions
15813
15814    You can use IF FLOAT test a string or variable to see if it's in
15815    acceptable floating-point format. Example:
15816
15817   ask \%f { Type a number: }
15818   if not def \%f .\%f = 0.0
15819   if not float \%f stop 1 Invalid floating-point number: "\%f"
15820
15821    C-Kermit's floating-point support, like its support for whole numbers
15822    (integers), relies on the capabilities of the underlying computer.
15823    Your computer has only a limited amount of precision for numbers,
15824    depending on its architecture. Thus floating-point numbers that have
15825    too many digits will not be accurate; adding a very small number to a
15826    very large one might have no effect at all; and so on. For details,
15827    read a text on numerical analysis. Example:
15828
15829   .\%a = 11111111111111111111  ; A long number
15830   .\%b = 22222222222222222222  ; Another one
15831   echo \ffpadd(\%a,\%b)        ; Add them - the result should be all 3's
15832   33333333333333330000.0       ; See the result
15833
15834    In this example, the computer has 16 digits of precision; after that,
15835    the (low-order) digits are set to 0, since the computer doesn't know
15836    what they really are. In fact, the computer returns random digits, but
15837    Kermit sets all digits beyond the computer's precision to 0.
15838
15839    C-Kermit's floating-point functions have names of the form
15840    "\ffpxxx(args)" ("\f" for function, "fp" for floating-point), where
15841    "xxx" is replaced by the name of the function, such as "sqrt", and
15842    "args" is the argument list, consisting of one or two floating-point
15843    numbers (depending on the function), and an optional "d" argument that
15844    says now many decimal places should be shown in the result. Example:
15845
15846   \ffpdiv(10,3,1) returns "3.3"
15847   \ffpdiv(10,3,2) returns "3.33"
15848   \ffpdiv(10,3,3) returns "3.333"
15849
15850    and so on, up to the precision of the computer. If the decimal-places
15851    argument is less than zero, the fractional part of the result is
15852    truncated:
15853
15854   \ffpdiv(10,3,-1) returns "3".
15855
15856    If the decimal-places argument is 0, or is omitted, C-Kermit returns
15857    as many decimal places as are meaningful in the computer's
15858    floating-point precision, truncating any extraneous trailing 0's:
15859
15860   \ffpdiv(10,8) returns "1.25".
15861   \ffpdiv(10,4) returns "2.5".
15862   \ffpdiv(10,2) returns "5.0".
15863   \ffpdiv(10,3) returns "3.333333333333333" (for 16-digit precision).
15864
15865    There is no way to request that a floating-point function return a
15866    decimal point but no decimal places. However, this is easy enough to
15867    accomplish in other ways, for example by supplying it outside the
15868    function call:
15869
15870   echo \ffpadd(\%a,\%b,-1).
15871
15872    Kermit's floating-point functions always round the result for the
15873    requested number of decimal places when the "d" argument is given and
15874    has a value greater than 0 (see the description of \ffpround() just
15875    below).
15876
15877    Floating-point arguments can be constants in floating-point format or
15878    variables whose values are floating-point numbers. If a floating-point
15879    argument is omitted, or is a variable with no value, 0.0 is supplied
15880    automatically. Example:
15881
15882   def \%x 999.999
15883   undef \%y
15884   echo \ffpmin(\%x,\%y)
15885   0.0
15886
15887    Or equivalently:
15888
15889   echo \ffpmin(999.999)
15890   0.0
15891
15892    The floating-point functions are:
15893
15894    \ffpround(f1,d)
15895           Returns f1 rounded to d decimal places. For this function only,
15896           d = 0 (or d omitted) has a special meaning: return the integer
15897           part of f1 rounded according to the fractional part. Examples:
15898
15899   \ffpround(2.74653,-1) returns "2" (fraction truncated, no rounding).
15900   \ffpround(2.74653,0)  returns "3" (integer part is rounded).
15901   \ffpround(2.74653)    returns "3" (d omitted same as d = 0).
15902   \ffpround(2.74653,1)  returns "2.7".
15903   \ffpround(2.74653,2)  returns "2.75".
15904   \ffpround(2.74653,3)  returns "2.747".
15905   \ffpround(2.74653,4)  returns "2.7465", etc.
15906
15907    \ffpadd(f1,f2,d)
15908           Returns the sum of f1 and f2.
15909
15910    \ffpsubtract(f1,f2,d)
15911           Subtracts f2 from f1 and returns the result.
15912
15913    \ffpmultiply(f1,f2,d)
15914           Returns the product of f1 and f2.
15915
15916    \ffpdivide(f1,f2,d)
15917           If f2 is not 0, divides f1 by f2 and returns the quotient.
15918           If f2 is 0, a DIVIDE_BY_ZERO error occurs.
15919
15920    \ffpraise(f1,f2,d)
15921           If f1 = 0 and f2 <= 0, or if f1 < 0 and f2 has a fractional
15922           part, an ARG_OUT_OF_RANGE error occurs; otherwise f1 raised to
15923           the f2 power is returned.
15924
15925    \ffpsqrt(f1,d)
15926           If f1 >= 0, returns the square root of f1; otherwise
15927           ARG_OUT_OF_RANGE.
15928
15929    \ffpabsolute(f1,d)
15930           Returns the absolute value of f1 (i.e. f1 without a sign). This
15931           is the floating-point analog of \fabsolute(n1).
15932
15933    \ffpint(f1)
15934           Returns the integer part of f1. Equivalent to \ffpround(f1,-1).
15935
15936    \ffpexp(f1,d)
15937           The base of natural logarithms, e (2.718282...), raised to the
15938           f1 power.
15939
15940    \ffplogn(f1,d)
15941           The natural logarithm of f1 (the power to which e must be
15942           raised to obtain f1).
15943
15944    \ffplog10(f1,d)
15945           The base-10 logarithm of f1 (the power to which 10 must be
15946           raised to obtain f1).
15947
15948    \ffpmodulus(f1,f2,d)
15949           If f2 is not 0, the remainder after dividing f1 by f2.
15950           If f2 is 0, a DIVIDE_BY_ZERO error occurs.
15951           This is the floating-point analog of \fmod(n1,n2).
15952
15953    \ffpmaximum(f1,f2,d)
15954           Returns the maximum of f1 and f2. This is the floating-point
15955           analog of \fmax(n1,n2).
15956
15957    \ffpminimum(f1,f2,d)
15958           Returns the minimum of f1 and f2. This is the floating-point
15959           analog of \fmin(n1,n2).
15960
15961    \ffpsine(f1,d)
15962           Returns the sine of f1 radians.
15963
15964    \ffpcosine(f1,d)
15965           Returns the cosine of f1 radians.
15966
15967    \ffptangent(f1,d)
15968           Returns the tangent of f1 radians.
15969
15970    Note that all of these functions can be used with integer arguments.
15971    If you want an integer result, specify d = -1 (to truncate) or feed
15972    the result to \ffpround(xxx,0) (to round).
15973
15974    Floating-point numbers (or variables or functions that return them)
15975    can be used in Boolean expressions (see [622]Section 7.20.2) that
15976    compare numbers:
15977
15978   = x y
15979   != x y
15980   < x y
15981   > x y
15982   <= x y
15983   >= x y
15984
15985    In these examples, x and y can be either integers or floating-point
15986    numbers in any combination. In an arithmetic comparison of an integer
15987    and a floating-point number, the integer is converted to
15988    floating-point before the comparison is made. Examples:
15989
15990   .\%t = 3.000000000
15991   .\%f = 3.141592653
15992   .\%i = 3
15993
15994   if > \%f \%i echo Pi is greater.
15995   if = \%t \%i echo "\%i" = "\%t".
15996
15997    A floating-point number can also be used in:
15998
15999   IF number command
16000
16001    where the command is executed if the number is nonzero. If the number
16002    is floating-point, the command is not executed if the number is 0.0,
16003    and is executed otherwise.
16004
16005    Floating-point numbers can be sorted using ARRAY SORT /NUMERIC (see
16006    [623]Section 7.10.5 ).
16007
16008    Two floating-point constants are provided:
16009
16010   \v(math_pi) = Pi (3.141592653...)
16011   \v(math_e)  = e, the base of natural logarithms (2.71828...)
16012
16013    These are given to the computer's precision, e.g. 16 digits. This
16014    number itself is available in a variable:
16015
16016    \v(math_precision)
16017           How many significant digits in a floating-point number.
16018      _________________________________________________________________
16019
16020   7.24. Tracing Script Execution
16021
16022    The TRACE command is handy for debugging scripts.
16023
16024    TRACE [ { /ON, /OFF } ] [ { ASSIGNMENTS, COMMAND-LEVEL, ALL } ]
16025           Selects tracing of the given object.
16026
16027    Optional switches are /ON and /OFF. If no switch is given, /ON is
16028    implied. The trace objects are ASSIGNMENTS, COMMAND-LEVEL, and ALL.
16029    The default object is ALL, meaning to select all trace objects
16030    (besides ALL). Thus TRACE by itself selects tracing of everything, as
16031    does TRACE /ON, and TRACE /OFF turns off all tracing.
16032
16033    When tracing of ASSIGNMENTS is on, every time the value of any
16034    user-defined variable or macro changes, C-Kermit prints one of the
16035    following:
16036
16037    >>> name: "value"
16038           The name of the variable or macro followed by the new value in
16039           quotes. This includes implicit macro-parameter assignments
16040           during macro invocation.
16041
16042    >>> name: (undef)
16043           This indicates that the variable or macro has been undefined.
16044
16045    <<< name: "value"
16046           For RETURN statements: the name of the macro and the return
16047           value.
16048
16049    <<< name: (null)
16050           For RETURN statements that include no value or an empty value.
16051
16052    When tracing of COMMAND-LEVEL is on, C-Kermit prints:
16053
16054    [n] +F: "name"
16055           Whenever a command file is entered, where "n" is the command
16056           level (0 = top); the name of the command file is shown in
16057           quotes.
16058
16059    [n] +M: "name"
16060           Whenever a macro is entered; "n" is the command level. The name
16061           of the macro is shown in quotes.
16062
16063    [n] -F: "name"
16064           Whenever a command file is reentered from below, when a macro
16065           or command file that it has invoked has returned.
16066
16067    [n] -M: "name"
16068           Whenever a macro is reentered from below.
16069
16070    For other debugging tools, see SHOW ARGS, SHOW STACK, SET TAKE, SET
16071    MACRO, and of course, ECHO.
16072      _________________________________________________________________
16073
16074   7.25. Compact Substring Notation
16075
16076    It is often desirable to extract a substring from a string which is
16077    stored in a variable, and for this we have the \fsubstring() function,
16078    which is used like this:
16079
16080   define \%a 1234567890
16081   echo \fsubstring(\%a,3,4) ; substring from 3rd character length 4
16082   3456
16083
16084    or like this with macro-named variables:
16085
16086   define string 1234567890
16087   echo \fsubstring(\m(string),3,4)
16088   3456
16089
16090    C-Kermit 7.0 adds a pair of alternative compact notations:
16091
16092 \:(variablename[start:length])  <-- Substring of variable's value
16093 \s(macroname[start:length])     <-- Substring of macro's definition
16094
16095    These are exactly equivalent to using \fsubstring(), except more
16096    compact to write and also faster since evaluation is in one step
16097    instead of two.
16098
16099    The "\:()" notation can be used with any Kermit variable, that is,
16100    almost anything that starts with a backslash:
16101
16102   \:(\%a[2:6])      <-- equivalent to \fsubstring(\%a,2,6)
16103   \:(\&x[1][2:6])   <-- equivalent to \fsubstring(\&x[1],2,6)
16104   \:(\m(foo)[2:6])  <-- equivalent to \fsubstring(\m(foo),2,6)
16105   \:(\v(time)[2:6]) <-- equivalent to \fsubstring(\v(time),2,6)
16106   \:(\$(TERM)[2:6]) <-- equivalent to \fsubstring(\$(TERM),2,6)
16107   \:(ABCDEFGH[2:6]) <-- equivalent to \fsubstring(ABCDEFGH,2,6)
16108
16109    Whatever appears between the left parenthesis and the left bracket is
16110    evaluated and then the indicated substring of the result is returned.
16111
16112    The "\s()" notation is the same, except after evaluating the variable,
16113    the result is treated as a macro name and is looked up in the macro
16114    table. Then the indicated substring of the macro definition is
16115    returned. Example:
16116
16117   define testing abcdefghijklmnopqrstuvwxyz
16118   define \%a testing
16119
16120   \s(testing[2:6])  -->  bcdefg
16121   \:(testing[2:6])  -->  esting
16122   \:(\%a[2:6])      -->  esting
16123   \s(\%a[2:6])      -->  bcdefg
16124
16125    Note that the following two examples are equivalent:
16126
16127   \:(\m(foo)[2:6])
16128   \s(foo[2:6])
16129
16130    The first number in the brackets is the 1-based starting position. If
16131    it is omitted, or less than 1, it is treated as 1. If it is greater
16132    than the length of the string, an empty string is returned.
16133
16134    The second number is the length of the desired substring. If the
16135    second number is omitted, is less than 0, or would be past the end of
16136    the string, then "through the end of the string" is assumed. If it is
16137    0, the empty string is returned.
16138
16139    If the brackets are empty or omitted, the original string is returned.
16140
16141    The starting position and length need not be literal numbers; they can
16142    also be variables, functions, arithmetic expressions, or even other
16143    \s() or \:() quantities; anything that evaluates to a number, for
16144    example:
16145
16146   \s(block[1025:\fhex2n(\s(block[\%b:\%n+4]))/2])
16147
16148    Syntactically, \m(name) and \s(name) differ only in that the sequence
16149    [*] at the end of the name (where * is any sequence of 0 or more
16150    characters) is treated as substring notation in \s(name), but is
16151    considered part of the name in \m(name) (to see why, see [624]Section
16152    7.10.9).
16153      _________________________________________________________________
16154
16155   7.26. New WAIT Command Options
16156
16157    The WAIT command has been extended to allow waiting for different
16158    kinds of things (formerly it only waited for modem signals). Now it
16159    also can wait for file events.
16160
16161     7.26.1. Waiting for Modem Signals
16162
16163    The previous syntax:
16164
16165   WAIT time { CD, DSR, RTS, RI, ... }
16166
16167    has changed to:
16168
16169   WAIT time MODEM-SIGNALS { CD, DSR, RTS, RI, ... }
16170
16171    However, the previous syntax is still accepted. The behavior is the
16172    same in either case.
16173      _________________________________________________________________
16174
16175     7.26.2. Waiting for File Events
16176
16177    The new WAIT option:
16178
16179   WAIT time FILE { CREATION, DELETION, MODIFICATION } filename
16180
16181    lets you tell Kermit to wait the given amount of time (or until the
16182    given time of day) for a file whose name is filename to be created,
16183    deleted, or modified, respectively. The filename may not contain
16184    wildcards. If the specified event does not occur within the time
16185    limit, or if WAIT CANCELLATION is ON and you interrupt from the
16186    keyboard before the time is up, the WAIT command fails. If the event
16187    is MODIFICATION and the file does not exist, the command fails.
16188    Otherwise, if the given event occurs within the time limit, the
16189    command succeeds. Examples:
16190
16191    WAIT 600 FILE DELETION oofa.tmp
16192           Wait up to 10 minutes for file oofa.tmp to disappear.
16193
16194    WAIT 23:59:59 FILE MOD orders.db
16195           Wait until just before midnight for the orders.db file to be
16196           changed.
16197
16198    Example: Suppose you want to have the current copy of /etc/motd on
16199    your screen at all times, and you want to hear a bell whenever it
16200    changes:
16201
16202   def \%f /etc/motd                      ; The file of interest.
16203   while 1 {                              ; Loop forever...
16204       cls                                ; Clear the screen.
16205       echo \%f: \v(date) \v(time)...     ; Print 2-line heading...
16206       echo
16207       if ( not exist \%f ) {             ; If file doesn't exist,
16208           echo \%f does not exist...     ; print message,
16209           wait 600 file creat \%f        ; and wait for it to appear.
16210           continue
16211       }
16212       beep                               ; Something new - beep.
16213       type /head:\v(rows-2) \%f          ; Display the file
16214       if fail exit 1 \%f: \ferrstring()  ; (checking for errors).
16215       wait 999 file mod \%f              ; Wait for it to change.
16216   }
16217
16218    This notices when the file is created, deleted, or modified, and acts
16219    only then (or when you interrupt it with); the time shown in the
16220    heading is the time of the most recent event (including when the
16221    program started).
16222
16223    See [625]Section 1.10, where the \v(kbchar) variable is explained.
16224    This lets you modify a loop like the one above to also accept
16225    single-character commands, which interrupt the WAIT, and dispatch
16226    accordingly. For example:
16227
16228   wait 999 file mod \%f              ; Wait for the file to change.
16229   if defined \v(kbchar) {            ; Interrupted from keyboard?
16230       switch \v(kbchar) {            ; Handle the keystroke...
16231         :q, exit                     ; Q to Quit
16232         :h, echo blah blah, break    ; H for Help
16233         :default, beep, continue     ; Anything else beep and ignore
16234       }
16235   }
16236
16237    This lets you write event-driven applications that wait for up to
16238    three events at once: a file or modem event, a timeout, and a
16239    keystroke.
16240      _________________________________________________________________
16241
16242   7.27. Relaxed FOR and SWITCH Syntax
16243
16244    For consistency with the extended IF and WHILE syntax, the FOR and
16245    SWITCH control lists may (but need not be) enclosed in parentheses:
16246
16247   FOR ( \%i 1 \%n 1 ) { command-list... }
16248   SWITCH ( \%c ) { command-list... }
16249
16250    In the FOR command, the increment item can be omitted if the control
16251    list is enclosed in parentheses, in which case the increment defaults
16252    appropriately to 1 or -1, depending on the values of the first two
16253    variables.
16254
16255    As with IF, the parentheses around the FOR-command control list must
16256    be set off by spaces (in the SWITCH command, the spaces are not
16257    required since the SWITCH expression is a single arithmetic
16258    expression).
16259
16260    Also, outer braces around the command list are supplied automatically
16261    if you omit them, e.g.:
16262
16263   FOR ( \%i 1 %n 1 ) echo \%i
16264      _________________________________________________________________
16265
16266   8. USING OTHER FILE TRANSFER PROTOCOLS
16267
16268    In C-Kermit 7.0, alternative protocols can be selected using switches.
16269    Switches are described in [626]Section 1.5; the use of
16270    protocol-selection switches is described in [627]Section 4.7.1.
16271    Example:
16272
16273   send /binary /protocol:zmodem x.tar.gz
16274
16275    Note that file transfer recovery works only with Kermit and Zmodem
16276    protocols. With Zmodem, recovery can be initiated only by the sender.
16277
16278    Only pre-1988 versions of the publicly-distributed sz/rz programs use
16279    Standard I/O; those released later than that do not use Standard I/O
16280    and therefore do not work with REDIRECT. However, Omen Technology does
16281    offer an up-to-date redirectable version called crzsz, which must be
16282    licensed for use:
16283
16284      "Unix Crz and Csz support XMODEM, YMODEM, and ZMODEM transfers when
16285      called by dial-out programs such as Kermit and certain versions of
16286      cu(1). They are clients designed for this use.
16287
16288      "Crz and Csz are Copyrighted shareware programs. Use of these
16289      programs beyond a brief evaluation period requires registration.
16290      Please print the "mailer.rz" file, fill out the form and return
16291      same with your registration."
16292
16293    To use the crzsz programs as your external XYZMODEM programs in
16294    C-Kermit, follow the instructions in the book, but put a "c" before
16295    each command, e.g.:
16296
16297   set protocol zmodem {csz %s} {csz -a %s} crz crz crz crz
16298
16299    To use Zmodem protocol over Telnet or other non-transparent
16300    connections, you might need to add the -e (Escape) option:
16301
16302   set protocol zmodem {csz -e %s} {csz -e -a %s} crz crz crz crz
16303      _________________________________________________________________
16304
16305   9. COMMAND-LINE OPTIONS
16306
16307   9.0. Extended-Format Command-Line Options
16308
16309    Standard UNIX command line options are a single letter. C-Kermit has
16310    run out of letters, so new options are in a new extended format:
16311
16312  --word[:arg]
16313
16314    where a keyword (rather than a single letter) specifies the function,
16315    and if an argument is to be included, it is separated by a colon (or
16316    equal sign). Most of the new extended-format command-line options are
16317    only for use with the Internet Kermit Service Daemon; see the
16318    [628]IKSD Administration Guide for details. However, several of them
16319    are also general in nature:
16320
16321    --nointerrupts
16322           Disables keyboard interrupts that are normally enabled, which
16323           are usually Ctrl-C (to interrupt a command) and Ctrl-Z (UNIX
16324           only, to suspend C-Kermit).
16325
16326    --help
16327           Lists the extended command-line options that are available in
16328           your version of C-Kermit. If any options seem to be missing,
16329           that is because your copy of C-Kermit was built with
16330           compile-time options to deselect them.
16331
16332    --helpfile:filename
16333           Specifies the name of a file to be displayed if the user types
16334           HELP (not followed by a specific command or topic), in place of
16335           the built-in top-level help text. The file need not fit on one
16336           screen; more-prompting is used if the file is more than one
16337           screen long if COMMAND MORE-PROMPTING is ON, as it is by
16338           default.
16339
16340    --bannerfile:filename
16341           The name of a file containing a message to be printed after the
16342           user logs in, in place of the normal message (Copyright notice,
16343           "Type HELP or ? for help", "Default transfer mode is...", etc).
16344
16345    --cdmessage:{on,off,0,1,2}
16346           For use in the Server-Side Server configuration; whenever the
16347           client tells the server to change directory, the server sends
16348           the contents of a "read me" file to the client's screen. This
16349           feature is On by default, and operates only in client/server
16350           mode when ON or 1. If set to 2 or higher, it also operates when
16351           the CD command is given at the IKSD> prompt. Synonym: --cdmsg.
16352
16353    --cdfile:filename
16354           When cdmessage is on, this is the name of the "read me" file to
16355           be sent. Normally you would specify a relative (not absolute)
16356           name, since the file is opened using the literal name you
16357           specified, after changing to the new directory. Example:
16358
16359   --cdfile:READ.ME
16360
16361           You can also give a list of up to 8 filenames by (a) enclosing
16362           each filename in braces, and (b) enclosing the entire list in
16363           braces. Example:
16364           --cdfile:{{./.readme}{READ.ME}{aaareadme.txt}{README}{read-this
16365           -first}} When a list is given, it is searched from left to
16366           right and the first file found is displayed. The default list
16367           for UNIX is:
16368
16369   {{./.readme}{README.TXT}{READ.ME}}
16370      _________________________________________________________________
16371
16372   9.1. Command Line Personalities
16373
16374    Beginning in version 7.0, if the C-Kermit binary is renamed to
16375    "telnet" (or TELNET.EXE, telnet.pr, etc, depending on the platform),
16376    it accepts the Telnet command line:
16377
16378   telnet [ host [ port ] ]
16379
16380    In Unix, you can achieve the same effect with a symlink:
16381
16382   cd /usr/bin
16383   mv telnet oldtelnet
16384   ln -ls /usr/local/bin/kermit telnet
16385
16386    When installed in this manner, C-Kermit always reads its
16387    initialization file. If no host (and therefore no port) is given,
16388    C-Kermit starts in interactive prompting mode. If a host is given as
16389    the first command-line argument, C-Kermit makes a connection to it.
16390    The host argument can be an IP host name or address, or the name of a
16391    TCP/IP entry in your C-Kermit network directory.
16392
16393    If a port is given, it is used. If a port is not given, then if the
16394    hostname was found in your network directory and port was also listed
16395    there, then that port is used. Otherwise port 23 (the Telnet port) is
16396    used.
16397
16398    When C-Kermit is called "telnet" and it is invoked with a hostname on
16399    the command line, it exits automatically when the connection is
16400    closed. While the connection is open, however, you may escape back and
16401    forth as many times as you like, transfer files, etc.
16402
16403    An rlogin personality is also available, but it is less useful, at
16404    least in UNIX and VMS, where the Rlogin TCP port is privileged.
16405
16406    The new variable \v(name) indicates the name with which C-Kermit was
16407    invoked ("kermit", "wermit", "k95", "telnet", etc).
16408      _________________________________________________________________
16409
16410   9.2. Built-in Help for Command Line Options
16411
16412    "kermit -h", given from the system prompt, lists as many command-line
16413    options as will fit on a standard 24x80 screen. For more comprehensive
16414    help, use the interactive HELP OPTIONS command that was added in
16415    C-Kermit 7.0:
16416
16417    HELP OPTIONS
16418    Explains how command-line options work, their syntax, etc.
16419
16420    HELP OPTIONS ALL
16421    Lists all command-line options and gives brief help about each one.
16422
16423    HELP OPTION x
16424    Gives brief help about option "x".
16425
16426    HELP EXTENDED-OPTIONS
16427    Lists the available extended-format command-line options.
16428
16429    HELP EXTENDED-OPTION xxx
16430    Gives help for the specified extended option.
16431      _________________________________________________________________
16432
16433   9.3. New Command-Line Options
16434
16435    Command-line options added since C-Kermit 6.0 are:
16436
16437    +
16438           (plus sign by itself): The next argument is the name of a
16439           script to execute; all subsequent arguments are ignored by
16440           C-Kermit itself, but passed to the script as top-level copies
16441           of \%1, \%2, etc; the \&_[] is also set accordingly. \%0 and
16442           \&_[0] become the name of the script file, rather than the
16443           pathname of the C-Kermit program, which is its normal value.
16444           Primarily for use in the top line of "Kerbang" scripts in UNIX
16445           (see [629]Section 7.19). Example from UNIX command line:
16446
16447   $ kermit [ regular kermit args ] + filename
16448
16449           Sample first line of Kerbang script:
16450
16451   #!/usr/local/bin/kermit +
16452
16453    --
16454           (two hyphens surrounded by whitespace) Equivalent to "=", for
16455           compatibility with UNIX getopt(1,3).
16456
16457    -G
16458           GET (like -g), but send the incoming file to standard output.
16459           Example: "kermit -G oofa.txt | lpr" retrieves a file from your
16460           local computer (providing it is running a Kermit program that
16461           supports the autodownload feature and has it enabled) and
16462           prints it.
16463
16464    -O
16465           equivalent to -x (start up in server mode), but exits after the
16466           first client command has been executed (mnemonic: O = Only
16467           One). This one is handy replacing "kermit -x" in the
16468           "automatically start Kermit on the other end" string:
16469
16470   set protocol kermit {kermit -ir} {kermit -r} {kermit -x}
16471
16472           since -x leaves the remote Kermit in server mode after the
16473           transfer, which can be confusing, whereas -O makes it go away
16474           automatically after the transfer.
16475
16476    -L
16477           Recursive, when used in combination with -s (mnemonic: L =
16478           Levels). In UNIX or other environments where the shell expands
16479           wildcards itself, the -s argument, if it contains wildcards,
16480           must be quoted to prevent this, e.g.:
16481
16482   kermit -L -s "*.c"
16483
16484           In UNIX only, "kermit -L -s ." means to send the current
16485           directory tree. See [630]Sections 4.10 and [631]4.11 about
16486           recursive file transfer.
16487
16488    -V
16489           Equivalent to SET FILE PATTERNS OFF ([632]Section 4.3) and SET
16490           TRANSFER MODE MANUAL. In other words, take the FILE TYPE
16491           setting literally. For example, "kermit -VT oofa.bin" means
16492           send the file in Text mode, no matter what its name is and no
16493           matter whether a kindred spirit is recognized at the other end
16494           of the connection.
16495
16496    -0
16497           (digit zero) means "be 100% transparent in CONNECT mode". This
16498           is equivalent to the following series of commands: SET PARITY
16499           NONE, SET COMMAND BYTESIZE 8, SET TERMINAL BYTESIZE 8, SET FLOW
16500           NONE, SET TERM ESCAPE DISABLED, SET TERM CHAR TRANSPARENT, SET
16501           TERM AUTODOWNLOAD OFF, SET TERM APC OFF, SET TELOPT KERMIT
16502           REFUSE REFUSE.
16503      _________________________________________________________________
16504
16505   10. C-KERMIT AND G-KERMIT
16506
16507    Every multifunctioned and long-lived software program grows in
16508    complexity and size over time to meet the needs and requests of its
16509    users and the demands of the underlying technology as it changes.
16510
16511    Eventually users begin to notice how big the application has grown,
16512    how much disk space it occupies, how long it takes to load, and they
16513    start to long for the good old days when it was lean and mean. Not
16514    long after that they begin asking for a "light" version that only does
16515    the basics with no frills.
16516
16517    And so it is with C-Kermit. A "light" version of Kermit was released
16518    (for UNIX only) in December 1999 under the GNU General Public License;
16519    thus it is called G-Kermit (for GNU Kermit). All it does is send and
16520    receive files, period. You can find it at:
16521
16522   [633]http://www.columbia.edu/kermit/gkermit.html
16523
16524    Where the C-Kermit 7.0 binary might be anywhere from 1 to 3 million
16525    bytes in size, the G-Kermit binary ranges from 30K to 100K, depending
16526    on the underlying architecture (RISC vs CISC, etc).
16527
16528    G-Kermit and C-Kermit may reside side-by-side on the same computer.
16529    G-Kermit does not make connections; it does not have a script
16530    language; it does not translate character sets. G-Kermit may be used
16531    instead of C-Kermit when:
16532
16533      * It is on the remote end.
16534      * Files are to be transferred in binary mode or in text mode without
16535        character-set translation.
16536      * File timestamps don't need to be preserved.
16537
16538    In such cases G-Kermit might be preferred since it generally starts up
16539    faster, and yet transfers files just as fast on most (but not
16540    necessarily all) kinds of connections; for example, it supports
16541    streaming ([634]Section 4.20).
16542
16543    G-Kermit is also handy for bootstrapping. It is easier to load on a
16544    new computer than C-Kermit -- it fits on a floppy diskette with plenty
16545    of room to spare. Thus if you have (say) an old PC running (say) SCO
16546    Xenix and no network connection, you can download the Xenix version of
16547    G-Kermit to (say) a DOS or Windows PC, copy it to diskette, read the
16548    diskette on Xenix with "dosread", and then use G-Kermit to receive
16549    C-Kermit (which does not fit on a diskette). If diskettes aren't an
16550    option, other bootstrapping methods are possible too -- see the
16551    [635]G-Kermit web page for details.
16552      _________________________________________________________________
16553
16554 III. APPENDICES
16555
16556   III.1. Character Set Tables
16557
16558     III.1.1. The Hewlett Packard Roman8 Character Set
16559
16560 dec col/row oct hex  description
16561 160  10/00  240  A0  (Undefined)
16562 161  10/01  241  A1  A grave
16563 162  10/02  242  A2  A circumflex
16564 163  10/03  243  A3  E grave
16565 164  10/04  244  A4  E circumflex
16566 165  10/05  245  A5  E diaeresis
16567 166  10/06  246  A6  I circumflex
16568 167  10/07  247  A7  I diaeresis
16569 168  10/08  250  A8  Acute accent
16570 169  10/09  251  A9  Grave accent
16571 170  10/10  252  AA  Circumflex accent
16572 171  10/11  253  AB  Diaeresis
16573 172  10/12  254  AC  Tilde accent
16574 173  10/13  255  AD  U grave
16575 174  10/14  256  AE  U circumflex
16576 175  10/15  257  AF  Lira symbol
16577 176  11/00  260  B0  Top bar (macron)
16578 177  11/01  261  B1  Y acute
16579 178  11/02  262  B2  y acute
16580 179  11/03  263  B3  Degree Sign
16581 180  11/04  264  B4  C cedilla
16582 181  11/05  265  B5  c cedilla
16583 182  11/06  266  B6  N tilde
16584 183  11/07  267  B7  n tilde
16585 184  11/08  270  B8  Inverted exclamation mark
16586 185  11/09  271  B9  Inverted question mark
16587 186  11/10  272  BA  Currency symbol
16588 187  11/11  273  BB  Pound sterling symbol
16589 188  11/12  274  BC  Yen symbol
16590 189  11/13  275  BD  Paragraph
16591 190  11/14  276  BE  Florin (Guilder) symbol
16592 191  11/15  277  BF  Cent symbol
16593 192  12/00  300  C0  a circumflex
16594 193  12/01  301  C1  e circumflex
16595 194  12/02  302  C2  o circumflex
16596 195  12/03  303  C3  u circumflex
16597 196  12/04  304  C4  a acute
16598 197  12/05  305  C5  e acute
16599 198  12/06  306  C6  o acute
16600 199  12/07  307  C7  u acute
16601 200  12/08  310  C8  a grave
16602 201  12/09  311  C9  e grave
16603 202  12/10  312  CA  o grave
16604 203  12/11  313  CB  u grave
16605 204  12/12  314  CC  a diaeresis
16606 205  12/13  315  CD  e diaeresis
16607 206  12/14  316  CE  o diaeresis
16608 207  12/15  317  CF  u diaeresis
16609 208  13/00  320  D0  A ring
16610 209  13/01  321  D1  i circumflex
16611 210  13/02  322  D2  O with stroke
16612 211  13/03  323  D3  AE digraph
16613 212  13/04  324  D4  a ring
16614 213  13/05  325  D5  i acute
16615 214  13/06  326  D6  o with stroke
16616 215  13/07  327  D7  ae digraph
16617 216  13/08  330  D8  A diaeresis
16618 217  13/09  331  D9  i grave
16619 218  13/10  332  DA  O diaeresis
16620 219  13/11  333  DB  U diaeresis
16621 220  13/12  334  DC  E acute
16622 221  13/13  335  DD  i diaeresis
16623 222  13/14  336  DE  German sharp s
16624 223  13/15  337  DF  O circumflex
16625 224  14/00  340  E0  A acute
16626 225  14/01  341  E1  A tilde
16627 226  14/02  342  E2  a tilde
16628 227  14/03  343  E3  Icelandic Eth
16629 228  14/04  344  E4  Icelandic eth
16630 229  14/05  345  E5  I acute
16631 230  14/06  346  E6  I grave
16632 231  14/07  347  E7  O acute
16633 232  14/08  350  E8  O grave
16634 233  14/09  351  E9  O tilde
16635 234  14/10  352  EA  o tilde
16636 235  14/11  353  EB  S caron
16637 236  14/12  354  EC  s caron
16638 237  14/13  355  ED  U acute
16639 238  14/14  356  EE  Y diaeresis
16640 239  14/15  357  EF  y diaeresis
16641 240  15/00  360  F0  Icelandic Thorn
16642 241  15/01  361  F1  Icelandic thorn
16643 242  15/02  362  F2  Middle dot
16644 243  15/03  363  F3  Greek mu
16645 244  15/04  364  F4  Pilcrow sign
16646 245  15/05  365  F5  Fraction 3/4
16647 246  15/06  366  F6  Long dash, horizontal bar
16648 247  15/07  367  F7  Fraction 1/4
16649 248  15/08  370  F8  Fraction 1/2
16650 249  15/09  371  F9  Feminine ordinal
16651 250  15/10  372  FA  Masculine ordinal
16652 251  15/11  373  FB  Left guillemot
16653 252  15/12  374  FC  Solid box
16654 253  15/13  375  FD  Right guillemot
16655 254  15/14  376  FE  Plus or minus sign
16656 255  15/15  377  FF  (Undefined)
16657      _________________________________________________________________
16658
16659     III.1.2. Greek Character Sets
16660
16661     III.1.2.1. The ISO 8859-7 Latin / Greek Alphabet = ELOT 928
16662
16663 dec col/row oct hex  description
16664 160  10/00  240  A0  No-break space
16665 161  10/01  241  A1  Left single quotation mark
16666 162  10/02  242  A2  right single quotation mark
16667 163  10/03  243  A3  Pound sign
16668 164  10/04  244  A4  (UNUSED)
16669 165  10/05  245  A5  (UNUSED)
16670 166  10/06  246  A6  Broken bar
16671 167  10/07  247  A7  Paragraph sign
16672 168  10/08  250  A8  Diaeresis (Dialytika)
16673 169  10/09  251  A9  Copyright sign
16674 170  10/10  252  AA  (UNUSED)
16675 171  10/11  253  AB  Left angle quotation
16676 172  10/12  254  AC  Not sign
16677 173  10/13  255  AD  Soft hyphen
16678 174  10/14  256  AE  (UNUSED)
16679 175  10/15  257  AF  Horizontal bar (Parenthetiki pavla)
16680 176  11/00  260  B0  Degree sign
16681 177  11/01  261  B1  Plus-minus sign
16682 178  11/02  262  B2  Superscript two
16683 179  11/03  263  B3  Superscript three
16684 180  11/04  264  B4  Accent (tonos)
16685 181  11/05  265  B5  Diaeresis and accent (Dialytika and Tonos)
16686 182  11/06  266  B6  Alpha with accent
16687 183  11/07  267  B7  Middle dot (Ano Teleia)
16688 184  11/08  270  B8  Epsilon with accent
16689 185  11/09  271  B9  Eta with accent
16690 186  11/10  272  BA  Iota with accent
16691 187  11/11  273  BB  Right angle quotation
16692 188  11/12  274  BC  Omicron with accent
16693 189  11/13  275  BD  One half
16694 190  11/14  276  BE  Upsilon with accent
16695 191  11/15  277  BF  Omega with accent
16696 192  12/00  300  C0  iota with diaeresis and accent
16697 193  12/01  301  C1  Alpha
16698 194  12/02  302  C2  Beta
16699 195  12/03  303  C3  Gamma
16700 196  12/04  304  C4  Delta
16701 197  12/05  305  C5  Epsilon
16702 198  12/06  306  C6  Zeta
16703 199  12/07  307  C7  Eta
16704 200  12/08  310  C8  Theta
16705 201  12/09  311  C9  Iota
16706 202  12/10  312  CA  Kappa
16707 203  12/11  313  CB  Lamda
16708 204  12/12  314  CC  Mu
16709 205  12/13  315  CD  Nu
16710 206  12/14  316  CE  Ksi
16711 207  12/15  317  CF  Omicron
16712 208  13/00  320  D0  Pi
16713 209  13/01  321  D1  Rho
16714 210  13/02  322  D2  (UNUSED)
16715 211  13/03  323  D3  Sigma
16716 212  13/04  324  D4  Tau
16717 213  13/05  325  D5  Upsilon
16718 214  13/06  326  D6  Phi
16719 215  13/07  327  D7  Khi
16720 216  13/08  330  D8  Psi
16721 217  13/09  331  D9  Omega
16722 218  13/10  332  DA  Iota with diaeresis
16723 219  13/11  333  DB  Upsilon with diaeresis
16724 220  13/12  334  DC  alpha with accent
16725 221  13/13  335  DD  epsilon with accent
16726 222  13/14  336  DE  eta with accent
16727 223  13/15  337  DF  iota with accent
16728 224  14/00  340  E0  upsilon with diaeresis and accent
16729 225  14/01  341  E1  alpha
16730 226  14/02  342  E2  beta
16731 227  14/03  343  E3  gamma
16732 228  14/04  344  E4  delta
16733 229  14/05  345  E5  epsilon
16734 230  14/06  346  E6  zeta
16735 231  14/07  347  E7  eta
16736 232  14/08  350  E8  theta
16737 233  14/09  351  E9  iota
16738 234  14/10  352  EA  kappa
16739 235  14/11  353  EB  lamda
16740 236  14/12  354  EC  mu
16741 237  14/13  355  ED  nu
16742 238  14/14  356  EE  ksi
16743 239  14/15  357  EF  omicron
16744 240  15/00  360  F0  pi
16745 241  15/01  361  F1  rho
16746 242  15/02  362  F2  terminal sigma
16747 243  15/03  363  F3  sigma
16748 244  15/04  364  F4  tau
16749 245  15/05  365  F5  upsilon
16750 246  15/06  366  F6  phi
16751 247  15/07  367  F7  khi
16752 248  15/08  370  F8  psi
16753 249  15/09  371  F9  omega
16754 250  15/10  372  FA  iota with diaeresis
16755 251  15/11  373  FB  upsilon with diaeresis
16756 252  15/12  374  FC  omicron with diaeresis
16757 253  15/13  375  FD  upsilon with accent
16758 254  15/14  376  FE  omega with accent
16759 255  15/15  377  FF  (UNUSED)
16760      _________________________________________________________________
16761
16762     III.1.2.2. The ELOT 927 Character Set
16763
16764 dec col/row oct hex  description
16765  32  02/00   40  20  SPACE
16766  33  02/01   41  21  EXCLAMATION MARK
16767  34  02/02   42  22  QUOTATION MARK
16768  35  02/03   43  23  NUMBER SIGN
16769  36  02/04   44  24  DOLLAR SIGN
16770  37  02/05   45  25  PERCENT SIGN
16771  38  02/06   46  26  AMPERSAND
16772  39  02/07   47  27  APOSTROPHE
16773  40  02/08   50  28  LEFT PARENTHESIS
16774  41  02/09   51  29  RIGHT PARENTHESIS
16775  42  02/10   52  2A  ASTERISK
16776  43  02/11   53  2B  PLUS SIGN
16777  44  02/12   54  2C  COMMA
16778  45  02/13   55  2D  HYPHEN, MINUS SIGN
16779  46  02/14   56  2E  PERIOD, FULL STOP
16780  47  02/15   57  2F  SOLIDUS, SLASH
16781  48  03/00   60  30  DIGIT ZERO
16782  49  03/01   61  31  DIGIT ONE
16783  50  03/02   62  32  DIGIT TWO
16784  51  03/03   63  33  DIGIT THREE
16785  52  03/04   64  34  DIGIT FOUR
16786  53  03/05   65  35  DIGIT FIVE
16787  54  03/06   66  36  DIGIT SIX
16788  55  03/07   67  37  DIGIT SEVEN
16789  56  03/08   70  38  DIGIT EIGHT
16790  57  03/09   71  39  DIGIT NINE
16791  58  03/10   72  3A  COLON
16792  59  03/11   73  3B  SEMICOLON
16793  60  03/12   74  3C  LESS-THAN SIGN, LEFT ANGLE BRACKET
16794  61  03/13   75  3D  EQUALS SIGN
16795  62  03/14   76  3E  GREATER-THAN SIGN, RIGHT ANGLE BRACKET
16796  63  03/15   77  3F  QUESTION MARK
16797  64  04/00  100  40  COMMERCIAL AT SIGN
16798  65  04/01  101  41  CAPITAL LETTER A
16799  66  04/02  102  42  CAPITAL LETTER B
16800  67  04/03  103  43  CAPITAL LETTER C
16801  68  04/04  104  44  CAPITAL LETTER D
16802  69  04/05  105  45  CAPITAL LETTER E
16803  70  04/06  106  46  CAPITAL LETTER F
16804  71  04/07  107  47  CAPITAL LETTER G
16805  72  04/08  110  48  CAPITAL LETTER H
16806  73  04/09  111  49  CAPITAL LETTER I
16807  74  04/10  112  4A  CAPITAL LETTER J
16808  75  04/11  113  4B  CAPITAL LETTER K
16809  76  04/12  114  4C  CAPITAL LETTER L
16810  77  04/13  115  4D  CAPITAL LETTER M
16811  78  04/14  116  4E  CAPITAL LETTER N
16812  79  04/15  117  4F  CAPITAL LETTER O
16813  80  05/00  120  50  CAPITAL LETTER P
16814  81  05/01  121  51  CAPITAL LETTER Q
16815  82  05/02  122  52  CAPITAL LETTER R
16816  83  05/03  123  53  CAPITAL LETTER S
16817  84  05/04  124  54  CAPITAL LETTER T
16818  85  05/05  125  55  CAPITAL LETTER U
16819  86  05/06  126  56  CAPITAL LETTER V
16820  87  05/07  127  57  CAPITAL LETTER W
16821  88  05/08  130  58  CAPITAL LETTER X
16822  89  05/09  131  59  CAPITAL LETTER Y
16823  90  05/10  132  5A  CAPITAL LETTER Z
16824  91  05/11  133  5B  LEFT SQUARE BRACKET
16825  92  05/12  134  5C  REVERSE SOLIDUS, BACKSLASH
16826  93  05/13  135  5D  RIGHT SQUARE BRACKET
16827  94  05/14  136  5E  CIRCUMFLEX ACCENT
16828  95  05/15  137  5F  UNDERSCORE
16829  96  06/00  140  60  ACCENT GRAVE
16830  97  06/01  141  61  GREEK LETTER ALPHA
16831  98  06/02  142  62  GREEK LETTER BETA
16832  99  06/03  143  63  GREEK LETTER GAMMA
16833 100  06/04  144  64  GREEK LETTER DELTA
16834 101  06/05  145  65  GREEK LETTER EPSILON
16835 102  06/06  146  66  GREEK LETTER ZETA
16836 103  06/07  147  67  GREEK LETTER ETA
16837 104  06/08  150  68  GREEK LETTER THETA
16838 105  06/09  151  69  GREEK LETTER IOTA
16839 106  06/10  152  6A  GREEK LETTER KAPPA
16840 107  06/11  153  6B  GREEK LETTER LAMDA
16841 108  06/12  154  6C  GREEK LETTER MU
16842 109  06/13  155  6D  GREEK LETTER NU
16843 110  06/14  156  6E  GREEK LETTER KSI
16844 111  06/15  157  6F  GREEK LETTER OMICRON
16845 112  07/00  160  70  GREEK LETTER PI
16846 113  07/01  161  71  GREEK LETTER RHO
16847 114  07/02  162  72  GREEK LETTER SIGMA
16848 115  07/03  163  73  GREEK LETTER TAU
16849 116  07/04  164  74  GREEK LETTER UPSILON
16850 117  07/05  165  75  GREEK LETTER FI
16851 118  07/06  166  76  GREEK LETTER XI
16852 119  07/07  167  77  GREEK LETTER PSI
16853 120  07/08  170  78  GREEK LETTER OMEGA
16854 121  07/09  171  79  SPACE
16855 122  07/10  172  7A  SPACE
16856 123  07/11  173  7B  LEFT CURLY BRACKET, LEFT BRACE
16857 124  07/12  174  7C  VERTICAL LINE, VERTICAL BAR
16858 125  07/13  175  7D  RIGHT CURLY BRACKET, RIGHT BRACE
16859 126  07/14  176  7E  TILDE
16860 127  07/15  177  7F  RUBOUT, DELETE
16861      _________________________________________________________________
16862
16863     III.1.2.3. PC Code Page 869
16864
16865    (to be filled in...)
16866      _________________________________________________________________
16867
16868     III.2. Updated Country Codes
16869
16870    Date: Mon, 7 Apr 1997 23:23:49 EDT
16871    From: Dave Leibold <dleibold@else.net>
16872    Newsgroups: comp.dcom.telecom
16873    Subject: Ex-USSR Country Codes Profile
16874    Organization: TELECOM Digest
16875
16876    Ex-USSR Country Codes Profile
16877    4 April 1997
16878
16879    Below is a summary of the country codes that have formed in the wake
16880    of the USSR dissolution, along with some updated findings and reports.
16881    Additional or corrected information on any of these nations would be
16882    welcome (c/o dleibold@else.net).
16883      * Kyrgyz Republic country code 996 will take effect, at least in
16884        Canada, effective 1 May 1997, according to CRTC Telecom Order
16885        97-464, based on Stentor Tariff Notice 433. There is no indication
16886        whether there will be a permissive dialing period involved or for
16887        how long such a permissive operation would remain.
16888      * Country code 992 was reported as a recent assignment for
16889        Tajikistan, which will be moving from country code 7 at some
16890        unknown time.
16891      * Uzbekistan has its own country code assignment, but I have no
16892        information if this is in service yet or what implementation dates
16893        have been set.
16894      * Kazakstan does not have a known separate country code assignment
16895        at present. It remains in country code 7 for the time being.
16896      * Russia seems destined to keep country code 7.
16897      * Recent news reports speak of some agreements forming between
16898        Russia and Belarus. While there is no outright reunification yet,
16899        there is expected to be much closer ties between the two nations.
16900        Whether this will lead to a reunification of telephone codes
16901        remains to be seen.
16902
16903    In the table, "Effective" means the date at which the country code
16904    began service (which could vary according to the nation). "Mandatory"
16905    means the date at which the country code 7 is invalid for calls to
16906    that nation. There are a number of question marks since exact dates
16907    have not been collected in all cases.
16908
16909 CC  Nation            Effective     Mandatory    Notes
16910
16911 370 Lithuania         1993?         ???          Announced Jan 1993
16912 371 Latvia            1993?         ???
16913 372 Estonia           1 Feb 1993?   March 1993?
16914 373 Moldova           1993?         ???          Announced Jan 1993
16915 374 Armenia           1 May 1995    1 July 1995  Announced Jan 1995 (ITU)
16916 375 Belarus           16 Apr 1995   1997?
16917 380 Ukraine           16 Apr 1995   Oct 1995?
16918 7   Kazakstan         (no known changes)
16919 7   Russia            (presumably not changing)
16920 992 Tajikistan        ???           ???          Announced 1996-7?
16921 993 Turkmenistan      3 Jan 1997    3 Apr 1997   Canada as of 29 Nov 1996
16922 994 Azerbaijan        Sept 1994?    ???          Announced 1992
16923 995 Georgia           1994?         ???          ref: Telecom Digest Oct 1994
16924 996 Kyrgyz Republic   1 May 1997    ???          ref: Stentor Canada/CRTC
16925 998 Uzbekistan        ???           ???          Announced 1996? (ITU)
16926
16927    Details courtesy Toby Nixon, ITU, Stentor (Canada), CRTC (Canada),
16928    TELECOM Digest (including information collected for the country code
16929    listings).
16930      _________________________________________________________________
16931
16932 IV. ERRATA & CORRIGENDA
16933
16934    The following errors in [636]Using C-Kermit, Second Edition, first
16935    printing, have been noted.
16936
16937    First, some missing acknowledgements for C-Kermit 6.0: JE Jones of
16938    Microware for help with OS-9, Nigel Roles for his help with Plan 9,
16939    Lucas Hart for help with VMS and Digital UNIX, Igor Kovalenko for his
16940    help with QNX. And later, to Susan Kleinmann for her help with Debian
16941    Linux packaging; Patrick Volkerding for his help with Slackware Linux
16942    packaging; Jim Knoble for his help with Red Hat Linux packaging; and
16943    to dozens of others for sending individual C-Kermit binaries for
16944    varied and diverse platforms.
16945
16946    Thanks to James Spath for both binaries and reporting many of the
16947    typos noted below. Also to Dat Thuc Nguyen for spotting several typos.
16948
16949 PAGE    REMARKS
16950 COVER   "COS" is a misprint.  There is no COS.  Pretend it says "SCO" or "VOS".
16951         (This is fixed in the second printing.)
16952  xxi    Second line: Fred Smith's affiliation should be Computrition.
16953  83     Change "commands other" to "commands as other" (1st paragraph)
16954  87     Change "The the" to "The" (2nd paragraph)
16955  92     "set modem-type user-defined supra" should be "set modem type ..."
16956  95     Change "VI" to "vi" (1st paragraph)
16957  96     Change "it it" to "it is" (1st paragraph)
16958  97     Change "advantage a literal" to "advantage of a literal" (2nd
16959         paragraph)
16960 102     The call-waiting example would be better as SET DIAL PREFIX *70W
16961         (rather than "*70,") because the former will not cause an incorrect
16962         call to be placed with pulse dialing.
16963 123     Third paragraph from bottom: "..otherwise if a your local username.."
16964         should be "..otherwise your local username..".
16965 160     Delete the "it" between "and" and "to" (2nd paragraph)
16966 185     In "When TRANSFER DISPLAY is OFF, C-Kermit skips the display...",
16967         "OFF" should be "NONE".
16968 187     The last paragraph says the "A command" is ignored, should be "S".
16969 194     Change "it known" to "it is known" (4th paragraph).
16970 235     In C-Kermit 7.0, the syntax of the GET command changed.  MGET now
16971         must be used to get a list of files and there is no more multiline
16972         GET command.
16973 268     Last paragraph: "effect" should be "affect".
16974 275     In the SET PROTOCOL KERMIT description, the following sentence is
16975         incorrect and should be removed: 'If you omit the commands, the
16976         default ones are restored: "kermit -ir" and "kermit -r" respectively".
16977         The correct information is given at the bottom of page 281.
16978 279     9th line.  The decimal value of ST is 156, not 155.
16979 295     In the stepping stones, skip ahead to Chapter 17 on p. 327.
16980 298     Table 16-2, Portuguese entry.  Column 4/00 should show section sign,
16981         not acute accent.
16982 316     Other languages written in the Hebrew alphabet include Karaim (a Turkic
16983         language spoken in Lithuania and Poland), Judeo-Kurdish, and Judeo-
16984         Georgian.
16985 332     UNDEFINE definition, change "This just" to "This is just".
16986 344     It might be necessary to set the modem's pulse generation rate when
16987         sending numeric pages; most Hayes compatible modems use the S11
16988         register for this.
16989 350     Delete "is" from between "It" and "ceases" (4th paragraph)
16990 351     Top - both occurrences of "print \%a" should be "echo \%a".
16991 364     \v(input) and \v(query) out of alphabetical order.
16992 378     In the MYSEND macro, "if not \m(rc) goto bad" should be:
16993         "if \m(rc) goto bad" (remove the "not").
16994 382-383 It should be stated that the loop control variable must be of the \%a
16995         type, or else an array element; macro names can not be used for this.
16996 383     In line 3, "\%f[\%i]" should be "\&f[\%i]".
16997 383     In the sort example, it should be stated that the array is 1-based.
16998 387     Change "You can list" to "You can get a list" (5th paragraph)
16999 393     \Fverify() description.  The 3rd sentence could be stated more clearly
17000         as "If all characters in string2 are also in string1, 0 is returned."
17001 398     Copying \ffiles() results to an array before is not required as of
17002         C-Kermit 7.0 (see [637]Section 7.3).
17003 403     In "(\%a + 3) * (\%b  5)", a minus sign is missing between b and 5.
17004 407     C-Kermit 7.0 no longer supports multiline GET.  Change
17005         "get, \%1, \%2" to "get {\%1} {\%2}" or "get /as:{\%2} {\%1}".
17006 409     READ example while loop should be:
17007         while success { echo \m(line), read line }
17008 409     "WRITE file" should be "WRITE keyword" (you can't put a filename there)
17009         (The same applies to WRITE-LINE / WRITELN).
17010 414     \Funhexify() missing from Table 18-3.
17011 425     MINPUT definition, change 2nd "text2" to "text3".
17012 436     Several lines are missing from the UNIXLOGIN macro listing.
17013         After the "xif fail" block, insert:
17014
17015           out \%1\13                    ; Send username, carriage return
17016           inp 5 Password:               ; Wait 5 sec for this prompt
17017           if fail end 1 No password prompt
17018           pause                         ; Wait a sec
17019           out \%2\13                    ; Send password
17020
17021 440     Change "set terminal byteszie" to "set terminal bytesize".
17022         Change "input Password:" to "input 10 Password".
17023 448     Franchise script: "access line" should be "access \m(line)".
17024 453     There are two incorrectly coded IF statements in the DELIVER macro
17025         definition.  Replace both occurrences of "if > \%1 \%3 {" with
17026         "xif > \%i \%3 {" (replace "if" by "xif" and "\%1" with "\%i").
17027 453     "the the" (last paragraph) should be "the".
17028 454     EOT (last paragraph) is End of Transmission, not End of Text.
17029 457     _DEFINE definition: "name constructed" should be "name is constructed".
17030 457     "macro for and" (last paragraph) should be "macro and".
17031 459     Should explain that \v(user) is a legal abbreviation of \v(userid).
17032 480     Figure II-2 is backwards; the least-significant bit is transmitted
17033         first, then up to the highest, and the parity bit last.
17034 534     The VMS Appendix section on Odd Record Lengths no longer applies;
17035         C-Kermit 7.0 handles odd record lengths as well as even ones.
17036 559     Table VIII-3, Portuguese entry.  Column 4/00 should show section sign,
17037         not acute accent.
17038 560-563 HP-Roman8 missing from Table VII-4; there wasn't room to squeeze it in.
17039         It is listed in section II(6).
17040 565     "d stroke" in Table VII-5 has the wrong appearance; the stem should
17041         be upright.  The letter shown in the table is actually a lowercase
17042         Icelandic eth, which has a curved stem.
17043 601-604 BeBox, BeOS, Plan 9, and probably others not listed in trademarks.
17044 604     The words "SCRIBE TEXT FORMATTER" appear at the end of the last
17045         sentence of the first paragraph of the Colophon.  They should have
17046         been in the Index.
17047 Index:  Missing entries: SET { SEND, RECEIVE } PATHNAMES, Call waiting, ...
17048         \F()            Page 605, add also 413-414
17049         \Fbreak         389
17050         \Fcapitalize    390
17051         \Fchecksum      414
17052         \Fcrc16         414
17053         \Fexecute       414
17054         \Fhexify        390
17055         \Fltrim         391
17056         \Frepeat        392
17057         \Fspawn         392
17058         \Ftod2secs      399
17059         \v() built_in   Page 606, add also 361-364
17060         \v(_line)       354, 361
17061         \v(apcactive)   361
17062         \v(charset)     362
17063         \v(cpu)         362
17064         \v(crc16)       357, 362
17065         \v(d$xxx)       add page 362
17066         \v(dialnumber)  362
17067         \v(dialresult)  362
17068         \v(errno)       362
17069         \v(errstring)   362
17070         \v(exedir)      362
17071         \v(inidir)      363
17072         \v(ipaddress)   363
17073         \v(keyboard)    363
17074         \v(macro)       363
17075         \v(minput)      363
17076         \v(m_xxx)       94, 363
17077         \v(password)    364
17078         \v(query)       364
17079         \v(prompt)      364
17080         \v(speed)       356, 364
17081         \v(startup)     364
17082         \v(status)      364
17083         \v(sysid)       364
17084         \v(system)      364
17085         \v(fsize)       at lower half page 606 should read \v(tfsize)
17086         \v(xversion)    364
17087         BEEP Command    40
17088         SET FLOW        62, 212
17089
17090    Figure II-5 on page 493. The pin assignments of the Mini Din-8
17091    connector are not described anywhere. As noted in the text, these tend
17092    to vary from vendor to vendor. One common arrangement is:
17093
17094   1. HSKout (Handshake out -- definition depends on software)
17095   2. HSKin  (Handshake in or external clock)
17096   3. TxD-
17097   4. Not used
17098   5. RxD-
17099   6. TxD+
17100   7. Not used
17101   8. RxD+
17102
17103    Note the "balanced pairs" for Receive Data (RxD) and Transmit Data
17104    (TxD), and the utter lack of modem signals. These connectors follow
17105    the RS-423 standard, rather than RS-232. In some arrangements, Pin 1
17106    is used for DTR and Pin 2 for CD; in others Pin 1 is RTS and Pin 2 is
17107    CTS.
17108
17109    Please send reports of other errors to the authors, as well as
17110    suggestions for improvements, additional index entries, and any other
17111    comments:
17112
17113    [638]kermit@columbia.edu
17114      _________________________________________________________________
17115
17116 APPENDIX V. ADDITIONAL COPYRIGHT NOTICES
17117
17118    The following copyrights cover some of the source code used in the
17119    development of C-Kermit, Kermit 95, or Kermit 95 support libraries.
17120
17121 /*****************************************************************************/
17122 /*                                                                           */
17123 /*              Copyright (c) 1995 by Oy Online Solutions Ltd.               */
17124 /*                                                                           */
17125 /*   Distribution of this source code is strictly forbbidden. Use of this    */
17126 /*   source code is granted to the University of Columbia C-Kermit project   */
17127 /*   to be distributed in binary format only. Please familiarize yourself    */
17128 /*   with the accompanying LICENSE.P file.                                   */
17129 /*                                                                           */
17130 /*****************************************************************************/
17131
17132    used for Xmodem, Ymodem, and Zmodem protocol in Kermit 95 (p95.dll,
17133    p2.dll)
17134      _________________________________________________________________
17135
17136    Copyright (c) 1997 Stanford University
17137
17138    The use of this software for revenue-generating purposes may require a
17139    license from the owners of the underlying intellectual property.
17140    Specifically, the SRP-3 protocol may not be used for
17141    revenue-generating purposes without a license.
17142
17143    Within that constraint, permission to use, copy, modify, and
17144    distribute this software and its documentation for any purpose is
17145    hereby granted without fee, provided that the above copyright notices
17146    and this permission notice appear in all copies of the software and
17147    related documentation.
17148
17149    THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
17150    EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
17151    WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
17152
17153    IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
17154    INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
17155    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
17156    ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
17157    ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
17158    SOFTWARE.
17159
17160    Used for Secure Remote Password (TM) protocol (SRP) in C-Kermit,
17161    Kermit 95 (k95.exe, k2.exe, k95crypt.dll, k2crypt.dll)
17162      _________________________________________________________________
17163
17164    Copyright 1990 by the Massachusetts Institute of Technology. All
17165    Rights Reserved.
17166
17167    Export of this software from the United States of America may require
17168    a specific license from the United States Government. It is the
17169    responsibility of any person or organization contemplating export to
17170    obtain such a license before exporting.
17171
17172    WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
17173    distribute this software and its documentation for any purpose and
17174    without fee is hereby granted, provided that the above copyright
17175    notice appear in all copies and that both that copyright notice and
17176    this permission notice appear in supporting documentation, and that
17177    the name of M.I.T. not be used in advertising or publicity pertaining
17178    to distribution of the software without specific, written prior
17179    permission. M.I.T. makes no representations about the suitability of
17180    this software for any purpose. It is provided "as is" without express
17181    or implied warranty.
17182
17183    Used for Telnet Authentication Option, Telnet Encryption Option, and
17184    Kerberos (TM) authentication in C-Kermit, Kermit 95 (k95.exe, k2.exe,
17185    k95crypt.dll, k2crypt.dll)
17186      _________________________________________________________________
17187
17188    Copyright (c) 1991, 1993 The Regents of the University of California.
17189    All rights reserved.
17190
17191    Redistribution and use in source and binary forms, with or without
17192    modification, are permitted provided that the following conditions are
17193    met:
17194     1. Redistributions of source code must retain the above copyright
17195        notice, this list of conditions and the following disclaimer.
17196     2. Redistributions in binary form must reproduce the above copyright
17197        notice, this list of conditions and the following disclaimer in
17198        the documentation and/or other materials provided with the
17199        distribution.
17200     3. All advertising materials mentioning features or use of this
17201        software must display the following acknowledgement:
17202
17203      This product includes software developed by the University of
17204      California, Berkeley and its contributors.
17205     4. Neither the name of the University nor the names of its
17206        contributors may be used to endorse or promote products derived
17207        from this software without specific prior written permission.
17208
17209    THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
17210    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17211    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17212    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
17213    BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17214    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
17215    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17216    BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
17217    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
17218    OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
17219    IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17220
17221    Used for Telnet Authentication Option, Telnet Encryption Option, and
17222    Kerberos (TM) authentication in C-Kermit, Kermit 95 (k95.exe, k2.exe,
17223    k95crypt.dll, k2crypt.dll)
17224      _________________________________________________________________
17225
17226    Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) All rights
17227    reserved.
17228
17229    This package is an DES implementation written by Eric Young
17230    (eay@cryptsoft.com). The implementation was written so as to conform
17231    with MIT's libdes.
17232
17233    This library is free for commercial and non-commercial use as long as
17234    the following conditions are aheared to. The following conditions
17235    apply to all code found in this distribution.
17236
17237    Copyright remains Eric Young's, and as such any Copyright notices in
17238    the code are not to be removed. If this package is used in a product,
17239    Eric Young should be given attribution as the author of that the SSL
17240    library. This can be in the form of a textual message at program
17241    startup or in documentation (online or textual) provided with the
17242    package.
17243
17244    Redistribution and use in source and binary forms, with or without
17245    modification, are permitted provided that the following conditions are
17246    met:
17247     1. Redistributions of source code must retain the copyright notice,
17248        this list of conditions and the following disclaimer.
17249     2. Redistributions in binary form must reproduce the above copyright
17250        notice, this list of conditions and the following disclaimer in
17251        the documentation and/or other materials provided with the
17252        distribution.
17253     3. All advertising materials mentioning features or use of this
17254        software must display the following acknowledgement: This product
17255        includes software developed by Eric Young (eay@cryptsoft.com)
17256
17257    THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR
17258    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17259    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17260    DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
17261    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17262    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
17263    GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17264    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
17265    IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
17266    OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
17267    ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17268
17269    The license and distribution terms for any publically available
17270    version or derivative of this code cannot be changed. i.e. this code
17271    cannot simply be copied and put under another distrubution license
17272    [including the GNU Public License.]
17273
17274    The reason behind this being stated in this direct manner is past
17275    experience in code simply being copied and the attribution removed
17276    from it and then being distributed as part of other packages. This
17277    implementation was a non-trivial and unpaid effort.
17278
17279    Used DES encryption in Kermit 95 (k95crypt.dll, k2crypt.dll)
17280      _________________________________________________________________
17281
17282  * This is version 1.1 of CryptoLib
17283  *
17284  * The authors of this software are Jack Lacy, Don Mitchell and Matt Blaze
17285  *              Copyright (c) 1991, 1992, 1993, 1994, 1995 by AT&T.
17286  * Permission to use, copy, and modify this software without fee
17287  * is hereby granted, provided that this entire notice is included in
17288  * all copies of any software which is or includes a copy or
17289  * modification of this software and in all copies of the supporting
17290  * documentation for such software.
17291  *
17292  * NOTE:
17293  * Some of the algorithms in cryptolib may be covered by patents.
17294  * It is the responsibility of the user to ensure that any required
17295  * licenses are obtained.
17296  *
17297  *
17298  * SOME PARTS OF CRYPTOLIB MAY BE RESTRICTED UNDER UNITED STATES EXPORT
17299  * REGULATIONS.
17300  *
17301  *
17302  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
17303  * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY
17304  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
17305  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
17306
17307    Used for Big Number library in Kermit 95 (k95crypt.dll, k2crypt.dll).
17308
17309    [ [639]Top ] [ [640]C-Kermit ] [ [641]Kermit Home ]
17310      _________________________________________________________________
17311
17312    CKERMIT70.HTM / The Kermit Project / Columbia University / 8 Feb 2000
17313
17314 References
17315
17316    1. http://www.columbia.edu/kermit/ckermit70.html#contents
17317    2. http://www.columbia.edu/kermit/ckermit.html
17318    3. http://www.columbia.edu/kermit/index.htm
17319    4. mailto:kermit-support@columbia.edu
17320    5. http://www.columbia.edu/kermit/
17321    6. http://www.kermit-project.org/
17322    7. http://www.columbia.nyc.ny.us/kermit/
17323    8. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT
17324    9. ftp://kermit.columbia.edu/kermit/f/ckcmai.c
17325   10. http://www.columbia.edu/kermit/ckermit70.html#xv
17326   11. http://www.columbia.edu/kermit/ckb2.htm
17327   12. ftp://kermit.columbia.edu/kermit/f/ckcbwr.txt
17328   13. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
17329   14. ftp://kermit.columbia.edu/kermit/f/ckvbwr.txt
17330   15. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
17331   16. ftp://kermit.columbia.edu/kermit/f/ckermit70.txt
17332   17. ftp://kermit.columbia.edu/kermit/f/security.txt
17333   18. http://www.columbia.edu/kermit/security.htm
17334   19. ftp://kermit.columbia.edu/kermit/f/iksd.txt
17335   20. http://www.columbia.edu/kermit/iksd.htm
17336   21. http://www.columbia.edu/kermit/cuiksd.htm
17337   22. ftp://kermit.columbia.edu/kermit/f/telnet.txt
17338   23. http://www.columbia.edu/kermit/telnet.htm
17339   24. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT
17340   25. http://www.columbia.edu/kermit/k95.html
17341   26. http://www.opensource.org/
17342   27. http://www.columbia.edu/kermit/ckb2.htm
17343   28. http://www.columbia.edu/kermit/ckermit70.html#xi
17344   29. http://www.columbia.edu/kermit/ckermit70.html#xii
17345   30. http://www.columbia.edu/kermit/ckermit70.html#x0
17346   31. http://www.columbia.edu/kermit/ckermit70.html#x1
17347   32. http://www.columbia.edu/kermit/ckermit70.html#x1.0
17348   33. http://www.columbia.edu/kermit/ckermit70.html#x1.1
17349   34. http://www.columbia.edu/kermit/ckermit70.html#x1.2
17350   35. http://www.columbia.edu/kermit/ckermit70.html#x1.3
17351   36. http://www.columbia.edu/kermit/ckermit70.html#x1.4
17352   37. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17353   38. http://www.columbia.edu/kermit/ckermit70.html#x1.5.1
17354   39. http://www.columbia.edu/kermit/ckermit70.html#x1.5.2
17355   40. http://www.columbia.edu/kermit/ckermit70.html#x1.5.3
17356   41. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
17357   42. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5
17358   43. http://www.columbia.edu/kermit/ckermit70.html#x1.6
17359   44. http://www.columbia.edu/kermit/ckermit70.html#x1.7
17360   45. http://www.columbia.edu/kermit/ckermit70.html#x1.8
17361   46. http://www.columbia.edu/kermit/ckermit70.html#x1.9
17362   47. http://www.columbia.edu/kermit/ckermit70.html#x1.10
17363   48. http://www.columbia.edu/kermit/ckermit70.html#x1.11
17364   49. http://www.columbia.edu/kermit/ckermit70.html#x1.11.1
17365   50. http://www.columbia.edu/kermit/ckermit70.html#x1.11.2
17366   51. http://www.columbia.edu/kermit/ckermit70.html#x1.11.3
17367   52. http://www.columbia.edu/kermit/ckermit70.html#x1.11.4
17368   53. http://www.columbia.edu/kermit/ckermit70.html#x1.11.5
17369   54. http://www.columbia.edu/kermit/ckermit70.html#x1.11.6
17370   55. http://www.columbia.edu/kermit/ckermit70.html#x1.11.7
17371   56. http://www.columbia.edu/kermit/ckermit70.html#x1.12
17372   57. http://www.columbia.edu/kermit/ckermit70.html#x1.13
17373   58. http://www.columbia.edu/kermit/ckermit70.html#x1.14
17374   59. http://www.columbia.edu/kermit/ckermit70.html#x1.15
17375   60. http://www.columbia.edu/kermit/ckermit70.html#x1.16
17376   61. http://www.columbia.edu/kermit/ckermit70.html#x1.17
17377   62. http://www.columbia.edu/kermit/ckermit70.html#x1.18
17378   63. http://www.columbia.edu/kermit/ckermit70.html#x1.19
17379   64. http://www.columbia.edu/kermit/ckermit70.html#x1.20
17380   65. http://www.columbia.edu/kermit/ckermit70.html#x1.21
17381   66. http://www.columbia.edu/kermit/ckermit70.html#x1.22
17382   67. http://www.columbia.edu/kermit/ckermit70.html#x1.22.1
17383   68. http://www.columbia.edu/kermit/ckermit70.html#x1.22.2
17384   69. http://www.columbia.edu/kermit/ckermit70.html#x1.22.3
17385   70. http://www.columbia.edu/kermit/ckermit70.html#x1.22.4
17386   71. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5
17387   72. http://www.columbia.edu/kermit/ckermit70.html#x1.22.6
17388   73. http://www.columbia.edu/kermit/ckermit70.html#x1.22.7
17389   74. http://www.columbia.edu/kermit/ckermit70.html#x1.22.8
17390   75. http://www.columbia.edu/kermit/ckermit70.html#x1.23
17391   76. http://www.columbia.edu/kermit/ckermit70.html#x1.24
17392   77. http://www.columbia.edu/kermit/ckermit70.html#x2
17393   78. http://www.columbia.edu/kermit/ckermit70.html#x2.0
17394   79. http://www.columbia.edu/kermit/ckermit70.html#x2.1
17395   80. http://www.columbia.edu/kermit/ckermit70.html#x2.1.1
17396   81. http://www.columbia.edu/kermit/ckermit70.html#x2.1.2
17397   82. http://www.columbia.edu/kermit/ckermit70.html#x2.1.3
17398   83. http://www.columbia.edu/kermit/ckermit70.html#x2.1.4
17399   84. http://www.columbia.edu/kermit/ckermit70.html#x2.1.5
17400   85. http://www.columbia.edu/kermit/ckermit70.html#x2.1.6
17401   86. http://www.columbia.edu/kermit/ckermit70.html#x2.1.7
17402   87. http://www.columbia.edu/kermit/ckermit70.html#x2.1.8
17403   88. http://www.columbia.edu/kermit/ckermit70.html#x2.1.9
17404   89. http://www.columbia.edu/kermit/ckermit70.html#x2.1.10
17405   90. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11
17406   91. http://www.columbia.edu/kermit/ckermit70.html#x2.1.12
17407   92. http://www.columbia.edu/kermit/ckermit70.html#x2.1.13
17408   93. http://www.columbia.edu/kermit/ckermit70.html#x2.1.14
17409   94. http://www.columbia.edu/kermit/ckermit70.html#x2.1.15
17410   95. http://www.columbia.edu/kermit/ckermit70.html#x2.1.16
17411   96. http://www.columbia.edu/kermit/ckermit70.html#x2.2
17412   97. http://www.columbia.edu/kermit/ckermit70.html#x2.2.1
17413   98. http://www.columbia.edu/kermit/ckermit70.html#x2.2.2
17414   99. http://www.columbia.edu/kermit/ckermit70.html#x2.3
17415  100. http://www.columbia.edu/kermit/ckermit70.html#x2.3.0
17416  101. http://www.columbia.edu/kermit/ckermit70.html#x2.3.1
17417  102. http://www.columbia.edu/kermit/ckermit70.html#x2.3.2
17418  103. http://www.columbia.edu/kermit/ckermit70.html#x2.3.3
17419  104. http://www.columbia.edu/kermit/ckermit70.html#x2.3.4
17420  105. http://www.columbia.edu/kermit/ckermit70.html#x2.3.5
17421  106. http://www.columbia.edu/kermit/ckermit70.html#x2.3.6
17422  107. http://www.columbia.edu/kermit/ckermit70.html#x2.4
17423  108. http://www.columbia.edu/kermit/ckermit70.html#x2.5
17424  109. http://www.columbia.edu/kermit/ckermit70.html#x2.6
17425  110. http://www.columbia.edu/kermit/ckermit70.html#x2.7
17426  111. http://www.columbia.edu/kermit/ckermit70.html#x2.7.0
17427  112. http://www.columbia.edu/kermit/ckermit70.html#x2.7.1
17428  113. http://www.columbia.edu/kermit/ckermit70.html#x2.7.2
17429  114. http://www.columbia.edu/kermit/ckermit70.html#x2.7.3
17430  115. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4
17431  116. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.1
17432  117. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.2
17433  118. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.3
17434  119. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.4
17435  120. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.5
17436  121. http://www.columbia.edu/kermit/ckermit70.html#x2.8
17437  122. http://www.columbia.edu/kermit/ckermit70.html#x2.9
17438  123. http://www.columbia.edu/kermit/ckermit70.html#x2.9.1
17439  124. http://www.columbia.edu/kermit/ckermit70.html#x2.9.2
17440  125. http://www.columbia.edu/kermit/ckermit70.html#x2.10
17441  126. http://www.columbia.edu/kermit/ckermit70.html#x2.11
17442  127. http://www.columbia.edu/kermit/ckermit70.html#x2.12
17443  128. http://www.columbia.edu/kermit/ckermit70.html#x2.13
17444  129. http://www.columbia.edu/kermit/ckermit70.html#x2.14
17445  130. http://www.columbia.edu/kermit/ckermit70.html#x2.15
17446  131. http://www.columbia.edu/kermit/ckermit70.html#x3
17447  132. http://www.columbia.edu/kermit/ckermit70.html#x3.1
17448  133. http://www.columbia.edu/kermit/ckermit70.html#x3.2
17449  134. http://www.columbia.edu/kermit/ckermit70.html#x3.3
17450  135. http://www.columbia.edu/kermit/ckermit70.html#x3.4
17451  136. http://www.columbia.edu/kermit/ckermit70.html#x4
17452  137. http://www.columbia.edu/kermit/ckermit70.html#x4.0
17453  138. http://www.columbia.edu/kermit/ckermit70.html#x4.1
17454  139. http://www.columbia.edu/kermit/ckermit70.html#x4.1.1
17455  140. http://www.columbia.edu/kermit/ckermit70.html#x4.1.2
17456  141. http://www.columbia.edu/kermit/ckermit70.html#x4.1.3
17457  142. http://www.columbia.edu/kermit/ckermit70.html#x4.2
17458  143. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1
17459  144. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.1
17460  145. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.2
17461  146. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.3
17462  147. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
17463  148. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2.1
17464  149. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2.2
17465  150. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3
17466  151. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3.1
17467  152. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3.2
17468  153. http://www.columbia.edu/kermit/ckermit70.html#x4.2.4
17469  154. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5
17470  155. http://www.columbia.edu/kermit/ckermit70.html#x4.2.6
17471  156. http://www.columbia.edu/kermit/ckermit70.html#x4.2.7
17472  157. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8
17473  158. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.1
17474  159. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.2
17475  160. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.3
17476  161. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.4
17477  162. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17478  163. http://www.columbia.edu/kermit/ckermit70.html#x4.3.1
17479  164. http://www.columbia.edu/kermit/ckermit70.html#x4.3.2
17480  165. http://www.columbia.edu/kermit/ckermit70.html#x4.3.3
17481  166. http://www.columbia.edu/kermit/ckermit70.html#x4.3.4
17482  167. http://www.columbia.edu/kermit/ckermit70.html#x4.4
17483  168. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1
17484  169. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1.1
17485  170. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1.2
17486  171. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2
17487  172. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1
17488  173. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1.1
17489  174. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1.2
17490  175. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.2
17491  176. http://www.columbia.edu/kermit/ckermit70.html#x4.5
17492  177. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
17493  178. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2
17494  179. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2.1
17495  180. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2.2
17496  181. http://www.columbia.edu/kermit/ckermit70.html#x4.5.3
17497  182. http://www.columbia.edu/kermit/ckermit70.html#x4.5.4
17498  183. http://www.columbia.edu/kermit/ckermit70.html#x4.6
17499  184. http://www.columbia.edu/kermit/ckermit70.html#x4.7
17500  185. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17501  186. http://www.columbia.edu/kermit/ckermit70.html#x4.7.2
17502  187. http://www.columbia.edu/kermit/ckermit70.html#x4.7.3
17503  188. http://www.columbia.edu/kermit/ckermit70.html#x4.8
17504  189. http://www.columbia.edu/kermit/ckermit70.html#x4.8.1
17505  190. http://www.columbia.edu/kermit/ckermit70.html#x4.8.2
17506  191. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17507  192. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17508  193. http://www.columbia.edu/kermit/ckermit70.html#x4.9.2
17509  194. http://www.columbia.edu/kermit/ckermit70.html#x4.9.3
17510  195. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17511  196. http://www.columbia.edu/kermit/ckermit70.html#x4.11
17512  197. http://www.columbia.edu/kermit/ckermit70.html#x4.11.1
17513  198. http://www.columbia.edu/kermit/ckermit70.html#x4.11.2
17514  199. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
17515  200. http://www.columbia.edu/kermit/ckermit70.html#x4.11.4
17516  201. http://www.columbia.edu/kermit/ckermit70.html#x4.11.5
17517  202. http://www.columbia.edu/kermit/ckermit70.html#x4.11.6
17518  203. http://www.columbia.edu/kermit/ckermit70.html#x4.12
17519  204. http://www.columbia.edu/kermit/ckermit70.html#x4.13
17520  205. http://www.columbia.edu/kermit/ckermit70.html#x4.14
17521  206. http://www.columbia.edu/kermit/ckermit70.html#x4.15
17522  207. http://www.columbia.edu/kermit/ckermit70.html#x4.16
17523  208. http://www.columbia.edu/kermit/ckermit70.html#x4.17
17524  209. http://www.columbia.edu/kermit/ckermit70.html#x4.17.1
17525  210. http://www.columbia.edu/kermit/ckermit70.html#x4.17.2
17526  211. http://www.columbia.edu/kermit/ckermit70.html#x4.18
17527  212. http://www.columbia.edu/kermit/ckermit70.html#x4.19
17528  213. http://www.columbia.edu/kermit/ckermit70.html#x4.20
17529  214. http://www.columbia.edu/kermit/ckermit70.html#x4.20.1
17530  215. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2
17531  216. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.1
17532  217. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.2
17533  218. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.3
17534  219. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.4
17535  220. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.5
17536  221. http://www.columbia.edu/kermit/ckermit70.html#x4.20.3
17537  222. http://www.columbia.edu/kermit/ckermit70.html#x4.21
17538  223. http://www.columbia.edu/kermit/ckermit70.html#x4.22
17539  224. http://www.columbia.edu/kermit/ckermit70.html#x4.22.1
17540  225. http://www.columbia.edu/kermit/ckermit70.html#x4.22.2
17541  226. http://www.columbia.edu/kermit/ckermit70.html#x4.22.3
17542  227. http://www.columbia.edu/kermit/ckermit70.html#x4.22.4
17543  228. http://www.columbia.edu/kermit/ckermit70.html#x4.22.5
17544  229. http://www.columbia.edu/kermit/ckermit70.html#x4.22.6
17545  230. http://www.columbia.edu/kermit/ckermit70.html#x4.22.7
17546  231. http://www.columbia.edu/kermit/ckermit70.html#x4.22.8
17547  232. http://www.columbia.edu/kermit/ckermit70.html#x4.23
17548  233. http://www.columbia.edu/kermit/ckermit70.html#x4.24
17549  234. http://www.columbia.edu/kermit/ckermit70.html#x4.25
17550  235. http://www.columbia.edu/kermit/ckermit70.html#x5
17551  236. http://www.columbia.edu/kermit/ckermit70.html#x5.0
17552  237. http://www.columbia.edu/kermit/ckermit70.html#x5.1
17553  238. http://www.columbia.edu/kermit/ckermit70.html#x5.2
17554  239. http://www.columbia.edu/kermit/ckermit70.html#x5.3
17555  240. http://www.columbia.edu/kermit/ckermit70.html#x5.3.1
17556  241. http://www.columbia.edu/kermit/ckermit70.html#x5.3.2
17557  242. http://www.columbia.edu/kermit/ckermit70.html#x5.4
17558  243. http://www.columbia.edu/kermit/ckermit70.html#x5.5
17559  244. http://www.columbia.edu/kermit/ckermit70.html#x5.6
17560  245. http://www.columbia.edu/kermit/ckermit70.html#x5.7
17561  246. http://www.columbia.edu/kermit/ckermit70.html#x6
17562  247. http://www.columbia.edu/kermit/ckermit70.html#x6.0
17563  248. http://www.columbia.edu/kermit/ckermit70.html#x6.1
17564  249. http://www.columbia.edu/kermit/ckermit70.html#x6.2
17565  250. http://www.columbia.edu/kermit/ckermit70.html#x6.3
17566  251. http://www.columbia.edu/kermit/ckermit70.html#x6.4
17567  252. http://www.columbia.edu/kermit/ckermit70.html#x6.5
17568  253. http://www.columbia.edu/kermit/ckermit70.html#x6.6
17569  254. http://www.columbia.edu/kermit/ckermit70.html#x6.6.1
17570  255. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
17571  256. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
17572  257. http://www.columbia.edu/kermit/ckermit70.html#x6.6.3
17573  258. http://www.columbia.edu/kermit/ckermit70.html#x6.6.4
17574  259. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5
17575  260. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.1
17576  261. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.2
17577  262. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.3
17578  263. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.4
17579  264. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.5
17580  265. http://www.columbia.edu/kermit/ckermit70.html#x6.7
17581  266. http://www.columbia.edu/kermit/ckermit70.html#x7
17582  267. http://www.columbia.edu/kermit/ckermit70.html#x7.0
17583  268. http://www.columbia.edu/kermit/ckermit70.html#x7.1
17584  269. http://www.columbia.edu/kermit/ckermit70.html#x7.1.1
17585  270. http://www.columbia.edu/kermit/ckermit70.html#x7.1.2
17586  271. http://www.columbia.edu/kermit/ckermit70.html#x7.1.3
17587  272. http://www.columbia.edu/kermit/ckermit70.html#x7.1.4
17588  273. http://www.columbia.edu/kermit/ckermit70.html#x7.2
17589  274. http://www.columbia.edu/kermit/ckermit70.html#x7.3
17590  275. http://www.columbia.edu/kermit/ckermit70.html#x7.4
17591  276. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17592  277. http://www.columbia.edu/kermit/ckermit70.html#x7.6
17593  278. http://www.columbia.edu/kermit/ckermit70.html#x7.7
17594  279. http://www.columbia.edu/kermit/ckermit70.html#x7.8
17595  280. http://www.columbia.edu/kermit/ckermit70.html#x7.9
17596  281. http://www.columbia.edu/kermit/ckermit70.html#x7.9.1
17597  282. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2
17598  283. http://www.columbia.edu/kermit/ckermit70.html#x7.10
17599  284. http://www.columbia.edu/kermit/ckermit70.html#x7.10.1
17600  285. http://www.columbia.edu/kermit/ckermit70.html#x7.10.2
17601  286. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3
17602  287. http://www.columbia.edu/kermit/ckermit70.html#x7.10.4
17603  288. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
17604  289. http://www.columbia.edu/kermit/ckermit70.html#x7.10.6
17605  290. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
17606  291. http://www.columbia.edu/kermit/ckermit70.html#x7.10.8
17607  292. http://www.columbia.edu/kermit/ckermit70.html#x7.10.9
17608  293. http://www.columbia.edu/kermit/ckermit70.html#x7.10.10
17609  294. http://www.columbia.edu/kermit/ckermit70.html#x7.11
17610  295. http://www.columbia.edu/kermit/ckermit70.html#x7.12
17611  296. http://www.columbia.edu/kermit/ckermit70.html#x7.13
17612  297. http://www.columbia.edu/kermit/ckermit70.html#x7.14
17613  298. http://www.columbia.edu/kermit/ckermit70.html#x7.15
17614  299. http://www.columbia.edu/kermit/ckermit70.html#x7.16
17615  300. http://www.columbia.edu/kermit/ckermit70.html#x7.17
17616  301. http://www.columbia.edu/kermit/ckermit70.html#x7.18
17617  302. http://www.columbia.edu/kermit/ckermit70.html#x7.19
17618  303. http://www.columbia.edu/kermit/ckermit70.html#x7.20
17619  304. http://www.columbia.edu/kermit/ckermit70.html#x7.20.1
17620  305. http://www.columbia.edu/kermit/ckermit70.html#x7.20.2
17621  306. http://www.columbia.edu/kermit/ckermit70.html#x7.21
17622  307. http://www.columbia.edu/kermit/ckermit70.html#x7.22
17623  308. http://www.columbia.edu/kermit/ckermit70.html#x7.23
17624  309. http://www.columbia.edu/kermit/ckermit70.html#x7.24
17625  310. http://www.columbia.edu/kermit/ckermit70.html#x7.25
17626  311. http://www.columbia.edu/kermit/ckermit70.html#x7.26
17627  312. http://www.columbia.edu/kermit/ckermit70.html#x7.26.1
17628  313. http://www.columbia.edu/kermit/ckermit70.html#x7.26.2
17629  314. http://www.columbia.edu/kermit/ckermit70.html#x7.27
17630  315. http://www.columbia.edu/kermit/ckermit70.html#x8
17631  316. http://www.columbia.edu/kermit/ckermit70.html#x9
17632  317. http://www.columbia.edu/kermit/ckermit70.html#x9.0
17633  318. http://www.columbia.edu/kermit/ckermit70.html#x9.1
17634  319. http://www.columbia.edu/kermit/ckermit70.html#x9.2
17635  320. http://www.columbia.edu/kermit/ckermit70.html#x9.3
17636  321. http://www.columbia.edu/kermit/ckermit70.html#x10
17637  322. http://www.columbia.edu/kermit/ckermit70.html#xiii
17638  323. http://www.columbia.edu/kermit/ckermit70.html#xiii.1
17639  324. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.1
17640  325. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2
17641  326. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2.1
17642  327. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2.2
17643  328. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2.3
17644  329. http://www.columbia.edu/kermit/ckermit70.html#xiii.2
17645  330. http://www.columbia.edu/kermit/ckermit70.html#xiv
17646  331. http://www.columbia.edu/kermit/ckermit70.html#xv
17647  332. http://www.columbia.edu/kermit/ckb2.htm
17648  333. http://www.columbia.edu/kermit/ckbreviews.html
17649  334. http://www.bhusa.com/
17650  335. http://www.columbia.edu/kermit/manuals.html#ckde
17651  336. http://www.columbia.edu/kermit/manuals.html#ktb
17652  337. http://www.columbia.edu/kermit/news.html
17653  338. news:comp.protocols.kermit.announce
17654  339. news:comp.protocols.kermit.misc
17655  340. http://www.columbia.edu/kermit/ckb2.htm
17656  341. http://www.columbia.edu/kermit/ckermit70.html#x4
17657  342. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17658  343. http://www.columbia.edu/kermit/ckermit70.html#x4.23
17659  344. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
17660  345. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17661  346. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17662  347. http://www.columbia.edu/kermit/ckermit70.html#x4.9.
17663  348. http://www.columbia.edu/kermit/ckb2.htm
17664  349. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2
17665  350. http://www.columbia.edu/kermit/ckermit70.html#x2.15
17666  351. http://www.columbia.edu/kermit/ckermit70.html#x9.1
17667  352. http://www.columbia.edu/kermit/ckermit70.html#x1.6
17668  353. http://www.columbia.edu/kermit/ckermit70.html#x7.4
17669  354. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17670  355. http://www.columbia.edu/kermit/ckermit70.html#mjd
17671  356. http://www.columbia.edu/kermit/ckermit70.html#mjd
17672  357. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17673  358. http://www.columbia.edu/kermit/ckb2.htm
17674  359. http://www.columbia.edu/kermit/ckb2.htm
17675  360. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17676  361. http://www.columbia.edu/kermit/ckermit70.html#x2.12
17677  362. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17678  363. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17679  364. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5
17680  365. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17681  366. http://www.columbia.edu/kermit/ckermit70.html#x7.18
17682  367. http://www.columbia.edu/kermit/ckermit70.html#x7.4
17683  368. http://www.columbia.edu/kermit/ckermit70.html#x1.15
17684  369. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17685  370. http://www.columbia.edu/kermit/ckermit70.html#x7.3
17686  371. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
17687  372. http://www.columbia.edu/kermit/ckermit70.html#x7.1
17688  373. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17689  374. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
17690  375. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
17691  376. http://www.columbia.edu/kermit/ckermit70.html#x1.22.4
17692  377. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5
17693  378. http://www.columbia.edu/kermit/ckb2.htm
17694  379. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5
17695  380. http://www.columbia.edu/kermit/ckermit70.html#x7.12
17696  381. http://www.columbia.edu/kermit/ckermit70.html#x2.1.16
17697  382. http://www.columbia.edu/kermit/ckermit70.html#x2.7
17698  383. http://www.columbia.edu/kermit/ckermit70.html#x2.3.5
17699  384. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17700  385. http://www.telefonica.es/cambiodenumeracion/
17701  386. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17702  387. http://www.columbia.edu/kermit/ckb2.htm
17703  388. http://www.columbia.edu/kermit/ckermit70.html#x2.2.2
17704  389. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11
17705  390. http://www.columbia.edu/kermit/ckermit70.html#x2.1.13
17706  391. http://www.columbia.edu/kermit/ckermit70.html#x2.1.12
17707  392. http://www.columbia.edu/kermit/ckb2.htm
17708  393. http://www.columbia.edu/kermit/ckermit70.html#x2.1.1
17709  394. http://www.columbia.edu/kermit/ckb2.htm
17710  395. http://www.columbia.edu/kermit/ckb2.htm
17711  396. http://www.columbia.edu/kermit/ckermit70.html#x2.1.7
17712  397. http://www.columbia.edu/kermit/ckermit70.html#x2.1.6
17713  398. http://www.columbia.edu/kermit/ckb2.htm
17714  399. ftp://kermit.columbia.edu/kermit/f/telnet.txt
17715  400. http://www.columbia.edu/kermit/telnet.htm
17716  401. ftp://kermit.columbia.edu/kermit/f/telnet.txt
17717  402. http://www.columbia.edu/kermit/telnet.htm
17718  403. ftp://ftp.isi.edu/in-notes/rfc1572.txt
17719  404. ftp://ftp.isi.edu/in-notes/rfc779.txt
17720  405. http://www.columbia.edu/kermit/ckb2.htm
17721  406. http://www.columbia.edu/kermit/ckermit70.html#x2.10
17722  407. http://www.columbia.edu/kermit/ckermit70.html#x2.8
17723  408. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17724  409. http://www.columbia.edu/kermit/ckermit70.html#x4.20
17725  410. http://www.psy.uq.oz.au/~ftp/Crypto/
17726  411. http://www.columbia.edu/kermit/security.htm
17727  412. http://srp.stanford.edu/srp/
17728  413. http://www.columbia.edu/kermit/ckermit70.html#x2.7.1,
17729  414. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
17730  415. http://www.columbia.edu/kermit/security.htm
17731  416. http://www.columbia.edu/kermit/ckb2.htm
17732  417. http://www.columbia.edu/kermit/ckermit70.html#x2.7
17733  418. http://www.columbia.edu/kermit/ckermit70.html#x2.0
17734  419. ftp://kermit.columbia.edu/kermit/f/ckuins.txt
17735  420. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
17736  421. ftp://kermit.columbia.edu/kermit/f/ckuins.txt
17737  422. http://www.columbia.edu/kermit/iksd.html#x4.2
17738  423. http://www.columbia.edu/kermit/iksd.html
17739  424. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.1
17740  425. ftp://ftp.isi.edu/in-notes/rfc1945.txt
17741  426. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17742  427. http://www.columbia.edu/kermit/ckermit70.html#x3.2
17743  428. http://www.columbia.edu/kermit/ckermit70.html#x3.2
17744  429. http://www.columbia.edu/kermit/ckb2.htm
17745  430. http://www.columbia.edu/kermit/ckb2.htm
17746  431. http://www.columbia.edu/kermit/ckermit70.html#x5.4
17747  432. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
17748  433. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17749  434. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17750  435. http://www.columbia.edu/kermit/ckermit70.html#x4.7.3
17751  436. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17752  437. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17753  438. http://www.columbia.edu/kermit/ckermit70.html#x4.11
17754  439. http://www.columbia.edu/kermit/ckermit70.html#x4.15
17755  440. http://www.columbia.edu/kermit/ckermit70.html#x4.2.4
17756  441. http://www.columbia.edu/kermit/ckermit70.html#x4.7
17757  442. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3
17758  443. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.3
17759  444. http://www.columbia.edu/kermit/ckb2.htm
17760  445. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
17761  446. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17762  447. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.2
17763  448. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17764  449. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17765  450. http://www.columbia.edu/kermit/ckermit70.html#x4.11
17766  451. http://www.columbia.edu/kermit/ckermit70.html#x4.15
17767  452. http://www.telstra.com.au/docs/PGP/
17768  453. http://www.telstra.com.au/docs/PGP/pgpdoc2/pgpdoc2_17.html
17769  454. http://www.columbia.edu/kermit/security.htm
17770  455. http://www.columbia.edu/kermit/ckermit70.html#x2.7
17771  456. http://www.columbia.edu/kermit/ckb2.htm
17772  457. http://www.columbia.edu/kermit/ckermit70.html#x2.14
17773  458. http://www.columbia.edu/kermit/ckermit70.html#x1.23
17774  459. http://www.columbia.edu/kermit/ckermit70.html#x4.7
17775  460. http://www.columbia.edu/kermit/ckb2.htm
17776  461. http://www.columbia.edu/kermit/ckb2.htm
17777  462. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17778  463. http://www.columbia.edu/kermit/ckb2.htm
17779  464. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
17780  465. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17781  466. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5
17782  467. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17783  468. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17784  469. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
17785  470. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17786  471. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
17787  472. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5
17788  473. http://www.columbia.edu/kermit/ckb2.htm
17789  474. http://www.columbia.edu/kermit/ckb2.htm
17790  475. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17791  476. http://www.columbia.edu/kermit/ckermit70.html#x1.6
17792  477. http://www.columbia.edu/kermit/ckermit70.html#x7.10
17793  478. http://www.columbia.edu/kermit/ckermit70.html#x7.10.11
17794  479. http://www.columbia.edu/kermit/ckermit70.html#x1.6
17795  480. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
17796  481. http://www.columbia.edu/kermit/ckermit70.html#x4.11
17797  482. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
17798  483. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17799  484. http://www.columbia.edu/kermit/ckermit70.html#x4.0.6
17800  485. http://www.columbia.edu/kermit/ckermit70.html#x4.2
17801  486. http://www.columbia.edu/kermit/ckermit70.html#x4.1
17802  487. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17803  488. http://www.columbia.edu/kermit/ckb2.htm
17804  489. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17805  490. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
17806  491. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17807  492. http://www.columbia.edu/kermit/ckermit70.html#x4.2
17808  493. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17809  494. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
17810  495. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17811  496. http://www.columbia.edu/kermit/ckermit70.html#x4.2
17812  497. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17813  498. http://www.columbia.edu/kermit/ckermit70.html#x1.11.5
17814  499. http://www.columbia.edu/kermit/ckermit70.html#x4.0.6
17815  500. http://www.columbia.edu/kermit/ckermit70.html#x4.11
17816  501. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17817  502. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
17818  503. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17819  504. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17820  505. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
17821  506. http://www.columbia.edu/kermit/ckermit70.html#x7.10
17822  507. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
17823  508. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3
17824  509. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
17825  510. http://www.columbia.edu/kermit/ckb2.htm
17826  511. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17827  512. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17828  513. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17829  514. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17830  515. http://www.columbia.edu/kermit/ckermit70.html#x4.15
17831  516. http://www.columbia.edu/kermit/ckermit70.html#x4.18
17832  517. http://www.columbia.edu/kermit/ckermit70.html#x4.20
17833  518. http://www.columbia.edu/kermit/ckermit70.html#x4.20
17834  519. http://www.columbia.edu/kermit/ckermit70.html#x4.20
17835  520. http://www.columbia.edu/kermit/ckermit70.html#x4.19
17836  521. http://www.columbia.edu/kermit/ckermit70.html#x4.16
17837  522. http://www.columbia.edu/kermit/ckermit70.html#x4.19
17838  523. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.3
17839  524. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17840  525. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.4
17841  526. http://www.columbia.edu/kermit/ckermit70.html#x4.22.2
17842  527. http://www.columbia.edu/kermit/ckermit70.html#x4.22.3
17843  528. http://www.columbia.edu/kermit/ckb2.htm
17844  529. http://www.columbia.edu/kermit/ckb2.htm
17845  530. http://www.columbia.edu/kermit/ckermit70.html#x9.3
17846  531. http://www.columbia.edu/kermit/ckermit70.html#x5.2.1
17847  532. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
17848  533. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2
17849  534. http://www.columbia.edu/kermit/ckermit70.html#x6.6
17850  535. http://www.columbia.edu/kermit/ckermit70.html#xiii
17851  536. http://www.columbia.edu/kermit/ckermit70.html#xiii
17852  537. ftp://ftp.isi.edu/in-notes/rfc1489.txt
17853  538. ftp://ftp.isi.edu/in-notes/rfc2319.txt
17854  539. http://www.unicode.org/
17855  540. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
17856  541. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.1
17857  542. ftp://ftp.isi.edu/in-notes/rfc2640.txt
17858  543. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
17859  544. http://www.columbia.edu/kermit/ckermit70.html#x6.0
17860  545. http://www.columbia.edu/kermit/ckermit70.html#x6.5
17861  546. http://www.columbia.edu/kermit/ckermit70.html#x6.4
17862  547. http://www.columbia.edu/kermit/ckb2.htm
17863  548. http://www.columbia.edu/kermit/ckermit70.html#x4.21
17864  549. http://www.columbia.edu/kermit/ckermit70.html#x6.5
17865  550. http://www.columbia.edu/kermit/ckermit70.html#x2.8
17866  551. http://www.columbia.edu/kermit/ckermit70.html#x7.7
17867  552. http://www.columbia.edu/kermit/ckermit70.html#x7.2
17868  553. http://www.columbia.edu/kermit/ckermit70.html#x1.19
17869  554. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17870  555. http://www.columbia.edu/kermit/ckermit70.html#x4.1
17871  556. http://www.columbia.edu/kermit/ckermit70.html#x4.2
17872  557. http://www.columbia.edu/kermit/ckermit70.html#x4.1
17873  558. http://www.columbia.edu/kermit/ckermit70.html#x4.2
17874  559. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11
17875  560. http://www.columbia.edu/kermit/ckermit70.html#x2.10
17876  561. http://www.columbia.edu/kermit/ckermit70.html#ferrstring
17877  562. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5
17878  563. http://www.columbia.edu/kermit/ckermit70.html#x2.1.10
17879  564. http://www.columbia.edu/kermit/ckermit70.html#x9.1
17880  565. http://www.columbia.edu/kermit/ckermit70.html#x7.23
17881  566. http://www.columbia.edu/kermit/ckermit70.html#x7.23
17882  567. http://www.columbia.edu/kermit/ckermit70.html#x1.22
17883  568. http://www.columbia.edu/kermit/ckermit70.html#x1.6
17884  569. http://www.columbia.edu/kermit/ckermit70.html#x7.23
17885  570. http://www.columbia.edu/kermit/ckermit70.html#x7.24
17886  571. http://www.columbia.edu/kermit/ckermit70.html#x7.24
17887  572. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3
17888  573. http://www.columbia.edu/kermit/ckermit70.html#x7.12
17889  574. http://www.columbia.edu/kermit/ckermit70.html#x7.9
17890  575. http://www.columbia.edu/kermit/ckb2.htm
17891  576. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
17892  577. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
17893  578. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17894  579. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
17895  580. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
17896  581. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.4
17897  582. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5
17898  583. http://www.columbia.edu/kermit/ckermit70.html#x7.8
17899  584. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17900  585. http://www.columbia.edu/kermit/ckb2.htm
17901  586. http://www.columbia.edu/kermit/ckermit70.html#x7.19
17902  587. http://www.columbia.edu/kermit/ckermit70.html#x7.16
17903  588. http://www.columbia.edu/kermit/ckermit70.html#x7.9.1
17904  589. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17905  590. http://www.columbia.edu/kermit/ckermit70.html#x7.3
17906  591. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
17907  592. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
17908  593. http://www.columbia.edu/kermit/ckermit70.html#x7.10
17909  594. http://www.columbia.edu/kermit/ckermit70.html#x7.10.10
17910  595. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17911  596. http://www.columbia.edu/kermit/ckermit70.html#x7.23
17912  597. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
17913  598. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
17914  599. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
17915  600. http://www.columbia.edu/kermit/ckermit70.html#x7.10.11
17916  601. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17917  602. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3
17918  603. http://www.columbia.edu/kermit/ckermit70.html#x7.3
17919  604. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2
17920  605. http://www.columbia.edu/kermit/ckb2.htm
17921  606. http://www.columbia.edu/kermit/ckermit70.html#x4.17.2
17922  607. http://www.columbia.edu/kermit/ckermit70.html#x1.22
17923  608. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17924  609. http://www.columbia.edu/kermit/ckermit70.html#x1.22
17925  610. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17926  611. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17927  612. http://www.columbia.edu/kermit/ckermit70.html#x1.22
17928  613. http://www.columbia.edu/kermit/ckermit70.html#x1.6
17929  614. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17930  615. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17931  616. http://www.columbia.edu/kermit/ckermit70.html#x7.19
17932  617. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17933  618. http://www.columbia.edu/kermit/ckermit70.html#x9.3
17934  619. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17935  620. http://www.columbia.edu/kermit/ckb2.htm
17936  621. http://www.columbia.edu/kermit/ckermit70.html#x7.4
17937  622. http://www.columbia.edu/kermit/ckermit70.html#x7.20.2
17938  623. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
17939  624. http://www.columbia.edu/kermit/ckermit70.html#x7.10.9
17940  625. http://www.columbia.edu/kermit/ckermit70.html#x1.10
17941  626. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17942  627. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17943  628. http://www.columbia.edu/kermit/iksd.html
17944  629. http://www.columbia.edu/kermit/ckermit70.html#x7.19
17945  630. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17946  631. http://www.columbia.edu/kermit/ckermit70.html#x4.11
17947  632. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17948  633. http://www.columbia.edu/kermit/gkermit.html
17949  634. http://www.columbia.edu/kermit/ckermit70.html#x4.20
17950  635. http://www.columbia.edu/kermit/gkermit.html
17951  636. http://www.columbia.edu/kermit/ckb2.htm
17952  637. http://www.columbia.edu/kermit/ckermit70.html#x7.3
17953  638. mailto:kermit@columbia.edu
17954  639. http://www.columbia.edu/kermit/ckermit70.html#top
17955  640. http://www.columbia.edu/kermit/ckermit.html
17956  641. http://www.columbia.edu/kermit/index.html