Annotation of researchv10dc/lbin/kermit/ckuker.doc, revision 1.1

1.1     ! root        1: 
        !             2: UNIX KERMIT
        !             3: 
        !             4: ********
        !             5: This document is formatted as an ordinary, plain text ASCII disk file.  Typeset
        !             6: copies are available  in  the  Kermit  User  Guide  from  Columbia  University.
        !             7: Changes should be made to CKUKER.MSS.
        !             8: ********
        !             9: 
        !            10: Program:    Frank  da  Cruz,  Bill Catchings, Jeff Damens, Columbia University;
        !            11:             Herm Fischer, Encino CA; contributions by many others.
        !            12: Language:   C
        !            13: Documentation:
        !            14:             Frank da Cruz, Herm Fischer
        !            15: Version:    4E(068)
        !            16: Date:       January 24, 1988
        !            17: 
        !            18: C-Kermit is an implementation of Kermit, written modularly and transportably in
        !            19: C. The protocol state transition table is written in wart, a  (non-proprietary)
        !            20: lex-like  preprocessor for C. System-dependent primitive functions are isolated
        !            21: into separately compiled modules so that the program should be easily  portable
        !            22: among  Unix systems and also to non-Unix systems that have C compilers, such as
        !            23: VAX/VMS, Data General AOS/VS, Apollo Aegis, the Apple Macintosh, and  the  Com-
        !            24: modore  Amiga.   This document applies to Unix implementations of C-Kermit, and
        !            25: in most ways also to the VMS, Data General, and other implementations.
        !            26: 
        !            27: 
        !            28: Unix Kermit Capabilities At A Glance:
        !            29: 
        !            30:   Local operation:                   Yes
        !            31:   Remote operation:                  Yes
        !            32:   Login scripts:                     Yes (UUCP style)
        !            33:   Transfer text files:               Yes
        !            34:   Transfer binary files:             Yes
        !            35:   Wildcard send:                     Yes
        !            36:   File transfer interruption:        Yes
        !            37:   Filename collision avoidance:      Yes
        !            38:   Can time out:                      Yes
        !            39:   8th-bit prefixing:                 Yes
        !            40:   Repeat count prefixing:            Yes
        !            41:   Alternate block checks:            Yes
        !            42:   Terminal emulation:                Yes
        !            43:   Communication settings:            Yes
        !            44:   Transmit BREAK:                    Yes (most versions)
        !            45:   Support for dialout modems:        Yes
        !            46:   IBM mainframe communication:       Yes
        !            47:   Transaction logging:               Yes
        !            48:   Session logging:                   Yes
        !            49:   Debug logging:                     Yes
        !            50:   Packet logging:                    Yes
        !            51:   Act as server:                     Yes
        !            52:   Talk to server:                    Yes
        !            53:   Advanced server functions:         Yes
        !            54:   Local file management:             Yes
        !            55:   Command/Init files:                Yes
        !            56:   UUCP and multiuser line locking:   Yes
        !            57:   Long packets:                      Yes
        !            58:   Sliding Windows:                   No
        !            59:   File attributes packets:           No
        !            60:   Command macros:                    No
        !            61:   Raw file transmit:                 No
        !            62: 
        !            63: All numbers in the C-Kermit documentation are decimal unless noted otherwise.
        !            64: 
        !            65: C-Kermit provides traditional Unix command line operation  as  well  as  inter-
        !            66: active  command  prompting and execution.  The command line options provide ac-
        !            67: cess to a basic subset of C-Kermit's capabilities; the interactive command  set
        !            68: is far richer.
        !            69: 
        !            70: On  systems  with  dialout  modems,  C-Kermit's  command  file and login script
        !            71: facilities provide a counterpart  to  UUCP  for  file  transfer  with  non-UNIX
        !            72: operating  systems, including the use of scheduled (e.g. late night) unattended
        !            73: operation.
        !            74: 
        !            75: 
        !            76: 1.1. The Unix File System
        !            77: 
        !            78: Consult your Unix manual for details about the file system under  your  version
        !            79: of  Unix.  In general, Unix files have lowercase names, possibly containing one
        !            80: or more dots or other special characters.   Unix  directories  are  tree-struc-
        !            81: tured.  Directory levels are separated by slash ("/") characters.  For example,
        !            82: 
        !            83:     /usr/foo/bar
        !            84: 
        !            85: denotes the file bar in the directory /usr/foo.  Alphabetic case is significant
        !            86: in  Unix  file and directory names, i.e. "a" is a different file (or directory)
        !            87: from "A".  Wildcard or "meta" characters allow groups of files to be specified.
        !            88: "*" matches any string; "?" matches any single character.
        !            89: 
        !            90: When  C-Kermit  is  invoked  with  file arguments specified on the Unix command
        !            91: line, the Unix shell (Bourne Shell, C-Shell, K-Shell,  etc)  expands  the  meta
        !            92: characters itself, and in this case a wider variety is available.  For example,
        !            93: 
        !            94:     kermit -s ~/ck[uvm]*.{upd,bwr}]
        !            95: 
        !            96: is expanded by the Berkeley C-Shell into a list of all the files in the  user's
        !            97: home  directory  (~/) that start with the characters "ck", followed by a single
        !            98: character "u", "v", or "m", followed by zero or more characters, followed by  a
        !            99: dot,  followed  by one of the strings "upd" or "bwr".  Internally, the C-Kermit
        !           100: program itself expands only the "*" and "?" meta characters.
        !           101: 
        !           102: Unix files are linear (sequential) streams of 8-bit bytes.  Text files  consist
        !           103: of 7-bit ASCII characters, with the high-order bit off (0), and lines separated
        !           104: by the Unix newline character, which is linefeed (LF, ASCII 10).  This  distin-
        !           105: guishes  Unix text files from those on most other ASCII systems, in which lines
        !           106: are separated by a carriage-return linefeed sequence (CRLF, ASCII 13,  followed
        !           107: by  linefeed,  ASCII  10).  Binary files are likely to contain data in the high
        !           108: bits of the file bytes, and have no particular line or record structure.
        !           109: 
        !           110: When transferring files, C-Kermit will convert between  upper  and  lower  case
        !           111: filenames  and  between LF and CRLF line terminators automatically, unless told
        !           112: to do otherwise.  When binary files must be transferred, the  program  must  be
        !           113: instructed  not  to  perform LF/CRLF conversion (-i on the command line or "set
        !           114: file type binary" interactively; see below).
        !           115: 
        !           116: 
        !           117: 1.2. File Transfer
        !           118: 
        !           119: If C-Kermit is in local mode, the screen (stdout)  is  continously  updated  to
        !           120: show  the  progress  of the file transer.  A dot is printed for every four data
        !           121: packets, other packets are shown by type:
        !           122: 
        !           123:     I Exchange Parameter Information
        !           124:     R Receive Initiate
        !           125:     S Send Initiate
        !           126:     F File Header
        !           127:     G Generic Server Command
        !           128:     C Remote Host Command
        !           129:     N Negative Acknowledgement (NAK)
        !           130:     E Fatal Error
        !           131:     T Indicates a timeout occurred
        !           132:     Q Indicates a damaged, undesired, or illegal packet was received
        !           133:     % Indicates a packet was retransmitted
        !           134: 
        !           135: You may type certain "interrupt" commands during file transfer:
        !           136: 
        !           137:     Control-F:  Interrupt the current File, and go on to the next (if any).
        !           138:     Control-B:  Interrupt the entire Batch of files, terminate the transaction.
        !           139:     Control-R:  Resend the current packet
        !           140:     Control-A:  Display a status report for the current transaction.
        !           141: 
        !           142: These interrupt characters differ from the ones used in other Kermit  implemen-
        !           143: tations  to  avoid conflict with commonly used Unix shell interrupt characters.
        !           144: With Version 7, System III, and System V  implementations  of  Unix,  interrupt
        !           145: commands must be preceeded by the 'connect' escape character (e.g. normally-\).
        !           146: Ctrl-F and Ctrl-B are effective only during the transfer of data  (D)  packets,
        !           147: and cannot be used to interrupt a transfer that has not yet reached that stage.
        !           148: 
        !           149:     CAUTION:  If Control-F or Control-B is used to cancel an incoming file,
        !           150:     and a file of the same name previously existed, and the "file  warning"
        !           151:     feature  is  not  enabled, then the previous copy of the file will dis-
        !           152:     appear.
        !           153: 
        !           154: EMERGENCY EXIT:  When running Unix Kermit in remote mode, if you have started a
        !           155: protocol operation (sending or receiving a file, server command wait, etc), you
        !           156: will not be able to communicate with the terminal in the normal way.   In  par-
        !           157: ticular,  you  cannot  stop  the  protocol  by typing the normal Unix interrupt
        !           158: characters, since the terminal has been put in "raw mode".    If  you  need  to
        !           159: regain  control  quickly  -- for instance, because the protocol is stuck -- you
        !           160: can type two Control-C's directly to the Unix Kermit program  ("connect"  first
        !           161: if necessary):  
        !           162: 
        !           163:     Control-C Control-C
        !           164: 
        !           165: This will cause the program to exit and restore the terminal to normal.
        !           166: 
        !           167: 
        !           168: 1.3. Command Line Operation
        !           169: 
        !           170: The  C-Kermit command line syntax conforms to the Proposed Syntax Standards for
        !           171: Unix System Commands put forth by Kathy Hemenway and Helene  Armitage  of  AT&T
        !           172: Bell Laboratories in Unix/World, Vol.1, No.3, 1984.  The rules that apply are:
        !           173: 
        !           174:    - Command names must be between 2 and 9 characters ("kermit" is 6).
        !           175:    - Command names must include lower case letters and digits only.
        !           176:    - An option name is a single character.
        !           177:    - Options are delimited by '-'.
        !           178:    - Options  with  no  arguments  may  be  grouped  (bundled)  behind one
        !           179:      delimiter.
        !           180:    - Option-arguments cannot be optional.
        !           181:    - Arguments immediately follow options, separated by whitespace.
        !           182:    - The order of options does not matter.
        !           183:    - '-' preceded and followed by whitespace means standard input.
        !           184: 
        !           185: A group of bundled options may end with an option that has an argument.
        !           186: 
        !           187: The following notation is used in command descriptions:
        !           188: 
        !           189: fn      A Unix file specification, possibly containing the  "wildcard"  charac-
        !           190:         ters  `*'  or  `?' (`*' matches all character strings, `?'  matches any
        !           191:         single character).
        !           192: 
        !           193: fn1     A Unix file specification which may not contain `*' or `?'.
        !           194: 
        !           195: rfn     A remote file specification in the remote system's  own  syntax,  which
        !           196:         may denote a single file or a group of files.
        !           197: 
        !           198: rfn1    A remote file specification which should denote only a single file.
        !           199: 
        !           200: n       A decimal number between 0 and 94.
        !           201: 
        !           202: c       A  decimal  number between 0 and 127 representing the value of an ASCII
        !           203:         character.
        !           204: 
        !           205: cc      A decimal number between 0 and 31, or else  exactly  127,  representing
        !           206:         the value of an ASCII control character.
        !           207: 
        !           208: [ ]     Any field in square braces is optional.
        !           209: 
        !           210: {x,y,z} Alternatives are listed in curly braces.
        !           211: 
        !           212: C-Kermit  command  line options may specify any combination of actions and set-
        !           213: tings.  If C-Kermit is invoked with a command line that specifies  no  actions,
        !           214: then  it  will  issue  a  prompt  and begin interactive dialog.  Action options
        !           215: specify either protocol transactions or terminal connection.
        !           216: 
        !           217: -s fn   Send the specified file or files.    If  fn  contains  wildcard  (meta)
        !           218:         characters,  the  Unix shell expands it into a list.  If fn is '-' then
        !           219:         kermit sends from standard input, which may come from a file:  
        !           220: 
        !           221:             kermit -s - < foo.bar
        !           222: 
        !           223:         or a parallel process:  
        !           224: 
        !           225:             ls -l | grep christin | kermit -s -
        !           226: 
        !           227:         You cannot use this mechanism to send terminal typein.  If you want  to
        !           228:         send  a  file  whose  actual name is "-" you can precede it with a path
        !           229:         name, as in 
        !           230: 
        !           231:             kermit -s ./-
        !           232: 
        !           233: -r      Receive a file or files.  Wait passively for files to arrive.
        !           234: 
        !           235: -k      Receive (passively) a file or files, sending them to  standard  output.
        !           236:         This option can be used in several ways:
        !           237: 
        !           238:         kermit -k
        !           239:             Displays the incoming files on your screen;  to  be  used  only  in
        !           240:             "local mode" (see below).
        !           241: 
        !           242:         kermit -k > fn1
        !           243:             Sends the incoming file or files to the named file, fn1.   If  more
        !           244:             than  one  file  arrives,  all  are  concatenated together into the
        !           245:             single file fn1.
        !           246: 
        !           247:         kermit -k | command
        !           248:             Pipes the incoming data (single or multiple files) to the indicated
        !           249:             command, as in 
        !           250: 
        !           251:                 kermit -k | sort > sorted.stuff
        !           252: 
        !           253: -a fn1  If you have specified a file transfer option, you may give an alternate
        !           254:         name for a single file with the -a ("as") option.  For example, 
        !           255: 
        !           256:             kermit -s foo -a bar
        !           257: 
        !           258:         sends  the file foo telling the receiver that its name is bar.  If more
        !           259:         than one file arrives or is sent, only the first file  is  affected  by
        !           260:         the -a option:  
        !           261: 
        !           262:             kermit -ra baz
        !           263: 
        !           264:         stores the first incoming file under the name baz.
        !           265: 
        !           266: -x      Begin server operation.  May be used in either local or remote mode.
        !           267: 
        !           268: Before  proceeding, a few words about remote and local operation are necessary.
        !           269: C-Kermit is "local" if it is running on PC or workstation that  you  are  using
        !           270: directly, or if it is running on a multiuser system and transferring files over
        !           271: an external communication line -- not your job's controlling terminal  or  con-
        !           272: sole.   C-Kermit is remote if it is running on a multiuser system and transfer-
        !           273: ring files over its own controlling  terminal's  communication  line  (normally
        !           274: /dev/tty), connected to your PC or workstation.
        !           275: 
        !           276: If  you  are  running C-Kermit on a PC, it is normally used in local mode, with
        !           277: the "back port" designated for file transfer and terminal connection.   If  you
        !           278: are  running C-Kermit on a multiuser (timesharing) system, it is in remote mode
        !           279: unless you explicitly point it at an external line for file  transfer  or  ter-
        !           280: minal connection.  The following command sets C-Kermit's "mode":
        !           281: 
        !           282: -l dev  Line  --  Specify a terminal line to use for file transfer and terminal
        !           283:         connection, as in 
        !           284: 
        !           285:             kermit -l /dev/ttyi5
        !           286: 
        !           287: When an external line is being used, you will also need some additional options
        !           288: for successful communication with the remote system:
        !           289: 
        !           290: -b n    Baud  --  Specify the baud rate for the line given in the -l option, as
        !           291:         in 
        !           292: 
        !           293:             kermit -l /dev/ttyi5 -b 9600
        !           294: 
        !           295:         This option should always be included with the  -l  option,  since  the
        !           296:         speed of an external line is not necessarily what you expect.
        !           297: 
        !           298: -p x    Parity  --  e,o,m,s,n  (even, odd, mark, space, or none).  If parity is
        !           299:         other than none, then the 8th-bit prefixing mechanism will be used  for
        !           300:         transferring  8-bit  binary  data, provided the opposite Kermit agrees.
        !           301:         The default parity is none.
        !           302: 
        !           303: -t      Specifies half duplex,  line  turnaround  with  XON  as  the  handshake
        !           304:         character.
        !           305: 
        !           306: The  following  commands may be used only with a C-Kermit which is local either
        !           307: by default or else because the -l option has been specified.
        !           308: 
        !           309: -g rfn  Actively request a remote server to send the named file or  files;  rfn
        !           310:         is a file specification in the remote host's own syntax.  If fn happens
        !           311:         to contain any special shell characters, like  space,  '*',  '[',  etc,
        !           312:         these must be quoted, as in 
        !           313: 
        !           314:             kermit -g x\*.\?
        !           315: 
        !           316:         or 
        !           317: 
        !           318:             kermit -g "profile exec"
        !           319: 
        !           320: -f      Send a 'finish' command to a remote server.
        !           321: 
        !           322: -c      Establish  a  terminal  connection  over  the specified or default com-
        !           323:         munication line, before any protocol transaction takes place.  Get back
        !           324:         to   the   local  system  by  typing  the  escape  character  (normally
        !           325:         Control-Backslash) followed by the letter 'c'.
        !           326: 
        !           327: -n      Like -c, but after a protocol transaction takes place; -c  and  -n  may
        !           328:         both  be used in the same command.  The use of -n and -c is illustrated
        !           329:         below.
        !           330: 
        !           331: If the other Kermit is on a remote system, the -l and -b options should also be
        !           332: included with the -r, -k, or -s options.
        !           333: 
        !           334: Several other command-line options are provided:
        !           335: 
        !           336: -i      Specifies that files should be sent or received exactly "as is" with no
        !           337:         conversions.  This option is necessary for transmitting  binary  files.
        !           338:         It may also be used in Unix-to-Unix transfers (it must be given to both
        !           339:         Unix Kermit programs), where it will improve performance by circumvent-
        !           340:         ing  the  normal  text-file conversions, and will allow mixture of text
        !           341:         and binary files in a single file group.
        !           342: 
        !           343: -w      Write-Protect -- Avoid filename collisions for incoming files.
        !           344: 
        !           345: -e n    Extended packet length -- Specify that C-Kermit is allowed  to  receive
        !           346:         packets  up  to length n, where n may be between 10 and some large num-
        !           347:         ber, like 1000, depending on the system.  The  default  maximum  length
        !           348:         for  received  packets is 90.  Packets longer than 94 will be used only
        !           349:         if the other Kermit supports, and agrees  to  use,  the  "long  packet"
        !           350:         protocol extension.
        !           351: 
        !           352: -q      Quiet  --  Suppress screen update during file transfer, for instance to
        !           353:         allow a file transfer to proceed in the background.
        !           354: 
        !           355: -d      Debug -- Record debugging information in the file debug.log in the cur-
        !           356:         rent  directory.    Use  this option if you believe the program is mis-
        !           357:         behaving, and show the resulting log to your local Kermit maintainer.
        !           358: 
        !           359: -h      Help -- Display a brief synopsis of the command line options.
        !           360: 
        !           361: The command line may contain no more than one protocol action option.
        !           362: 
        !           363: Files are sent with their own names, except that lowercase letters  are  raised
        !           364: to upper, pathnames are stripped off, certain special characters like (`~') and
        !           365: (`#') are changed to `X', and if the file name begins with a period, an `X'  is
        !           366: inserted  before  it.    Incoming files are stored under their own names except
        !           367: that uppercase letters are lowered, and, if -w  was  specified,  a  "generation
        !           368: number"  is  appended  to  the name if it has the same name as an existing file
        !           369: which would otherwise be overwritten.  If the -a option is included,  then  the
        !           370: same  rules  apply to its argument.  The file transfer display shows any trans-
        !           371: formations performed upon filenames.
        !           372: 
        !           373: During transmission, files are encoded as follows:
        !           374: 
        !           375:    - Control characters are converted to prefixed printables.
        !           376: 
        !           377:    - Sequences of repeated characters are collapsed via repeat counts,  if
        !           378:      the other Kermit is also capable of repeated-character compression.
        !           379: 
        !           380:    - If  parity  is  being used on the communication line, data characters
        !           381:      with the 8th (parity) bit on are  specially  prefixed,  provided  the
        !           382:      other  Kermit  is  capable of 8th-bit prefixing; if not, 8-bit binary
        !           383:      files cannot be successfully transferred.
        !           384: 
        !           385:    - Conversion is done between Unix newlines and carriage-return-linefeed
        !           386:      sequences unless the -i option was specified.
        !           387: 
        !           388: 
        !           389: Command Line Examples:
        !           390: 
        !           391: 
        !           392:     kermit -l /dev/ttyi5 -b 1200 -cn -r
        !           393: 
        !           394: This command connects you to the system on the other end of ttyi5 at 1200 baud,
        !           395: where you presumably log in and run Kermit with a 'send' command.    After  you
        !           396: escape  back,  C-Kermit  waits  for a file (or files) to arrive.  When the file
        !           397: transfer is completed, you are reconnected to the remote system so that you can
        !           398: logout.
        !           399:     kermit -l /dev/ttyi4 -b 1800 -cntp m -r -a foo
        !           400: 
        !           401: This  command  is like the preceding one, except the remote system in this case
        !           402: uses half duplex communication with mark parity.  The first file  that  arrives
        !           403: is stored under the name foo.
        !           404: 
        !           405: 
        !           406:     kermit -l /dev/ttyi6 -b 9600 -c | tek
        !           407: 
        !           408: This  example  uses  Kermit to connect your terminal to the system at the other
        !           409: end of ttyi6.  The C-Kermit terminal connection does not provide any particular
        !           410: terminal   emulation,   so   C-Kermit's   standard   i/o  is  piped  through  a
        !           411: (hypothetical) program called tek, which performs (say) Tektronix emulation.
        !           412: 
        !           413: 
        !           414:     kermit -l /dev/ttyi6 -b 9600 -nf
        !           415: 
        !           416: This command would be used to shut down a remote server and then connect to the
        !           417: remote system, in order to log out or to make further use of it.  The -n option
        !           418: is invoked after -f (-c would have been invoked before).
        !           419: 
        !           420: 
        !           421:     kermit -l /dev/ttyi6 -b 9600 -qg foo.\* &
        !           422: 
        !           423: This command causes C-Kermit to be invoked in the background, getting  a  group
        !           424: of files from a remote server (note the quoting of the `*' character).  No dis-
        !           425: play occurs on the screen, and the keyboard is  not  sampled  for  interruption
        !           426: commands.    This  allows other work to be done while file transfers proceed in
        !           427: the background.
        !           428: 
        !           429: 
        !           430:     kermit -l /dev/ttyi6 -b 9600 -g foo.\* > foo.log < /dev/null &
        !           431: 
        !           432: This command is like the previous one, except the  file  transfer  display  has
        !           433: been  redirected  to  the  file foo.log.  Standard input is also redirected, to
        !           434: prevent C-Kermit from sampling it for interruption commands.
        !           435: 
        !           436: 
        !           437:     kermit -iwx
        !           438: 
        !           439: This command starts up C-Kermit as a server.  Files  are  transmitted  with  no
        !           440: newline/carriage-return-linefeed conversion; the -i option is necessary for bi-
        !           441: nary file transfer and recommended for Unix-to-Unix transfers.  Incoming  files
        !           442: that have the same names as existing files are given new, unique names.
        !           443: 
        !           444: 
        !           445:     kermit -l /dev/ttyi6 -b 9600
        !           446: 
        !           447: This  command  sets  the  communication  line  and  speed.   Since no action is
        !           448: specified, C-Kermit issues a prompt and enters an interactive dialog with  you.
        !           449: Any  settings  given on the command line remain in force during the dialog, un-
        !           450: less explicitly changed.
        !           451: 
        !           452: 
        !           453:     kermit
        !           454: 
        !           455: This command starts up Kermit interactively with all default settings.
        !           456: 
        !           457: The next example shows how Unix Kermit might be used to send an  entire  direc-
        !           458: tory  tree  from  one Unix system to another, using the tar program as Kermit's
        !           459: standard input and output.  On the orginating system, in this case the  remote,
        !           460: type (for instance):
        !           461: 
        !           462: 
        !           463:     tar cf - /usr/fdc | kermit -is -
        !           464: 
        !           465: This  causes  tar to send the directory /usr/fdc (and all its files and all its
        !           466: subdirectories and all their files...) to standard output instead of to a tape;
        !           467: kermit  receives  this as standard input and sends it as a binary file.  On the
        !           468: receiving system, in this case the local one, type (for instance):
        !           469: 
        !           470: 
        !           471:     kermit -il /dev/ttyi5 -b 9600 -k | tar xf -
        !           472: 
        !           473: Kermit receives the tar archive, and sends it via standard output  to  its  own
        !           474: copy of tar, which extracts from it a replica of the original directory tree.
        !           475: 
        !           476: A  final example shows how a Unix compression utility might be used to speed up
        !           477: Kermit file transfers:
        !           478: 
        !           479:     compress file | kermit -is -     (sender)
        !           480:     kermit -ik | uncompress          (receiver)
        !           481: 
        !           482: 
        !           483: Exit Status Codes:
        !           484: 
        !           485: Unix Kermit returns an exit status of zero, except when a fatal  error  is  en-
        !           486: countered,  where  the  exit  status  is set to one.  With background operation
        !           487: (e.g., `&' at end of invoking command line) driven by scripted interactive com-
        !           488: mands  (redirected  standard  input  and/or take files), any failed interactive
        !           489: command (such as failed dial or script attempt) causes the fatal error exit.
        !           490: 
        !           491: 
        !           492: 1.4. Interactive Operation
        !           493: 
        !           494: C-Kermit's interactive command prompt is "C-Kermit>".    In  response  to  this
        !           495: prompt, you may type any valid interactive C-Kermit command.  C-Kermit executes
        !           496: the command and then prompts you for another command.   The  process  continues
        !           497: until you instruct the program to terminate.
        !           498: 
        !           499: Commands  begin  with a keyword, normally an English verb, such as "send".  You
        !           500: may omit trailing characters from any keyword, so  long  as  you  specify  suf-
        !           501: ficient  characters  to  distinguish  it  from  any other keyword valid in that
        !           502: field.  Certain commonly-used keywords (such as "send",  "receive",  "connect")
        !           503: also  have special non-unique abbreviations ("s" for "send", "r" for "receive",
        !           504: "c" for "connect").
        !           505: 
        !           506: Certain characters have special functions during  typein  of  interactive  com-
        !           507: mands:
        !           508: 
        !           509:     ?   Question  mark, typed at any point in a command, will produce a message
        !           510:         explaining what is possible or expected at that point.    Depending  on
        !           511:         the  context, the message may be a brief phrase, a menu of keywords, or
        !           512:         a list of files.
        !           513: 
        !           514:     ESC (The Escape or Altmode  key)  --  Request  completion  of  the  current
        !           515:         keyword  or filename, or insertion of a default value.  The result will
        !           516:         be a beep if the requested operation fails.
        !           517: 
        !           518:     DEL (The Delete or Rubout key) -- Delete the previous  character  from  the
        !           519:         command.  You may also use BS (Backspace, Control-H) for this function.
        !           520: 
        !           521:     ^W  (Control-W) -- Erase the rightmost word from the command line.
        !           522: 
        !           523:     ^U  (Control-U) -- Erase the entire command.
        !           524: 
        !           525:     ^R  (Control-R) -- Redisplay the current command.
        !           526: 
        !           527:     SP  (Space) -- Delimits fields (keywords, filenames, numbers) within a com-
        !           528:         mand.  HT (Horizontal Tab) may also be used for this purpose.
        !           529: 
        !           530:     CR  (Carriage Return) -- Enters the command for execution.   LF  (Linefeed)
        !           531:         or FF (formfeed) may also be used for this purpose.
        !           532: 
        !           533:     \   (Backslash)  --  Enter  any  of  the above characters into the command,
        !           534:         literally.  To enter a backslash, type two backslashes in a  row  (\\).
        !           535:         A  backslash  at  the  end of a command line causes the next line to be
        !           536:         treated as a continuation line; this is useful for readability in  com-
        !           537:         mand files, especially in the 'script' command.
        !           538: 
        !           539:     ^Z  (Control-Z)  --  On  systems (like Berkeley Unix, Ultrix) with job con-
        !           540:         trol, suspend Kermit, i.e. put it into the  background in  such  a  way
        !           541:         that  it  can  be  brought  back into the foreground (e.g. with an 'fg'
        !           542:         shell command) with all its settings intact.
        !           543: 
        !           544: You may type the editing characters (DEL, ^W, etc) repeatedly,  to  delete  all
        !           545: the  way  back to the prompt.  No action will be performed until the command is
        !           546: entered by typing carriage return, linefeed, or formfeed.  If you make any mis-
        !           547: takes,  you  will receive an informative error message and a new prompt -- make
        !           548: liberal use of `?' and ESC to feel your way through the commands.   One  impor-
        !           549: tant command is "help" -- you should use it the first time you run C-Kermit.
        !           550: 
        !           551: A command line beginning with a percent sign "%" is ignored.  Such lines may be
        !           552: used to include illustrative commentary in Kermit command dialogs.
        !           553: 
        !           554: Interactive C-Kermit accepts commands from files as well as from the  keyboard.
        !           555: When you start C-Kermit, the program looks for the file .kermrc in your home or
        !           556: current directory (first it looks in the home directory, then  in  the  current
        !           557: one)  and  executes any commands it finds there.  These commands must be in in-
        !           558: teractive format, not Unix command-line format (the initialization file is  not
        !           559: processed if you invoke Kermit with command-line action arguments, such that it
        !           560: does not enter interactive dialog).  A "take" command is also provided for  use
        !           561: at any time during an interactive session, to allow interactive-format commands
        !           562: to be executed from a file; command files  may  be  nested  to  any  reasonable
        !           563: depth.
        !           564: 
        !           565: Here is a brief list of C-Kermit interactive commands:
        !           566:               %  Comment
        !           567:               !  Execute a Unix shell command, or start a shell.
        !           568:             bye  Terminate and log out a remote Kermit server.
        !           569:           close  Close a log file.
        !           570:         connect  Establish a terminal connection to a remote system.
        !           571:             cwd  Change Working Directory.
        !           572:            dial  Dial a telephone number.
        !           573:       directory  Display a directory listing.
        !           574:            echo  Display arguments literally.
        !           575:            exit  Exit from the program, closing any open files.
        !           576:          finish  Instruct a remote Kermit server to exit, but not log out.
        !           577:             get  Get files from a remote Kermit server.
        !           578:            help  Display a help message for a given command.
        !           579:             log  Open a log file -- debugging, packet, session, transaction.
        !           580:            quit  Same as 'exit'.
        !           581:         receive  Passively wait for files to arrive.
        !           582:          remote  Issue file management commands to a remote Kermit server.
        !           583:          script  Execute a login script with a remote system.
        !           584:            send  Send files.
        !           585:          server  Begin server operation.
        !           586:             set  Set various parameters.
        !           587:            show  Display values of 'set' parameters.
        !           588:           space  Display current disk space usage.
        !           589:      statistics  Display statistics about most recent transaction.
        !           590:            take  Execute commands from a file.
        !           591: 
        !           592: The 'set' parameters are:
        !           593:     block-check  Level of packet error detection.
        !           594:           delay  How long to wait before sending first packet.
        !           595:          duplex  Specify which side echoes during 'connect'.
        !           596:     escape-character  Prefix for "escape commands" during 'connect'.
        !           597:            file  Set various file parameters.
        !           598:    flow-control  Communication line full-duplex flow control.
        !           599:       handshake  Communication line half-duplex turnaround character.
        !           600:      incomplete  Disposition for incompletely received files.
        !           601:            line  Communication line device name.
        !           602:    modem-dialer  Type of modem-dialer on communication line.
        !           603:          parity  Communication line character parity.
        !           604:          prompt  The C-Kermit program's interactive command prompt.
        !           605:         receive  Parameters for inbound packets.
        !           606:           retry  Packet retransmission limit.
        !           607:            send  Parameters for outbound packets.
        !           608:           speed  Communication line speed.
        !           609:        terminal  Terminal parameters.
        !           610: 
        !           611: The 'remote' commands are:
        !           612:             cwd  Change remote working directory.
        !           613:          delete  Delete remote files.
        !           614:       directory  Display a listing of remote file names.
        !           615:            help  Request help from a remote server.
        !           616:            host  A command to the remote host in its own command language.
        !           617:           space  Display current disk space usage on remote system.
        !           618:            type  Display a remote file on your screen.
        !           619:             who  Display who's logged in, or get information about a user.
        !           620: 
        !           621: Most of these commands are described adequately in the Kermit User Guide or the
        !           622: Kermit book.  Special aspects of certain Unix  Kermit  commands  are  described
        !           623: below.
        !           624: 
        !           625: 
        !           626:                               THE 'SEND' COMMAND
        !           627: 
        !           628: Syntax:  send fn  - or -  send fn1 rfn1
        !           629: 
        !           630: Send  the file or files denoted by fn to the other Kermit, which should be run-
        !           631: ning as a server, or which should be given the 'receive' command.  Each file is
        !           632: sent  under  its own name (as described above, or as specified by the 'set file
        !           633: names' command).  If the second form of the 'send' command is used, i.e.   with
        !           634: fn1 denoting a single Unix file, rfn1 may be specified as a name to send it un-
        !           635: der.  The 'send' command may be abbreviated to 's', even though 's'  is  not  a
        !           636: unique abbreviation for a top-level C-Kermit command.
        !           637: 
        !           638: The wildcard (meta) characters `*' and `?' are accepted in fn.  If `?' is to be
        !           639: included, it must be prefixed by `\' to override its normal function of provid-
        !           640: ing  help.    `*'  matches any string, `?' matches any single character.  Other
        !           641: notations for file groups, like `[a-z]og', are  not  available  in  interactive
        !           642: commands  (though  of  course they are available on the command line).  When fn
        !           643: contains `*' or `?' characters, there is a limit to the number  of  files  that
        !           644: can  be  matched,  which  varies from system to system.  If you get the message
        !           645: "Too many files match" then you'll have to make a more judicious selection.  If
        !           646: fn was of the form 
        !           647: 
        !           648:     usr/longname/anotherlongname/*
        !           649: 
        !           650: then  C-Kermit's  string  space  will  fill  up rapidly -- try doing a cwd (see
        !           651: below) to the path in question and reissuing the command.
        !           652: 
        !           653: Note -- C-Kermit sends only from the current or specified directory.   It  does
        !           654: not traverse directory trees.  If the source directory contains subdirectories,
        !           655: they will be skipped.  By the same token, C-Kermit does not create  directories
        !           656: when  receiving files.  If you have a need to do this, you can pipe tar through
        !           657: C-Kermit, as shown in the example on page 3, or under System III/V Unix you can
        !           658: use cpio.
        !           659: 
        !           660: Another  Note  --  The 'send' command does not skip over "invisible" files that
        !           661: match the file specification; Unix systems  usually  treat  files  whose  names
        !           662: start  with  a  dot (like .login, .cshrc, and .kermrc) as invisible.  Similarly
        !           663: for "temporary" files whose names start with "#".
        !           664: 
        !           665: 
        !           666:                              THE 'RECEIVE' COMMAND
        !           667: 
        !           668: Syntax:  receive  - or -  receive fn1
        !           669: 
        !           670: Passively wait for files to arrive from the other Kermit, which must  be  given
        !           671: the 'send' command -- the 'receive' command does not work in conjunction with a
        !           672: server (use 'get' for that).  If fn1 is specified,  store  the  first  incoming
        !           673: file under that name.  The 'receive' command may be abbreviated to 'r'.
        !           674: 
        !           675: 
        !           676:                               THE 'GET' COMMAND:
        !           677: 
        !           678: Syntax:  get rfn
        !           679: 
        !           680:         or: get
        !           681:                 rfn
        !           682:                 fn1
        !           683: 
        !           684: Request a remote Kermit server to send the named file or files.  Since a remote
        !           685: file specification (or list)  might  contain  spaces,  which  normally  delimit
        !           686: fields  of  a C-Kermit command, an alternate form of the command is provided to
        !           687: allow the inbound file to be given a new name: type 'get' alone on a line,  and
        !           688: you  will  be prompted separately for the remote and local file specifications,
        !           689: for example
        !           690: 
        !           691:     C-Kermit>get
        !           692:      Remote file specification: profile exec
        !           693:      Local name to store it under: profile.exec
        !           694: 
        !           695: As with 'receive', if more than one file arrives as a result of the 'get'  com-
        !           696: mand,  only the first will be stored under the alternate name given by fn1; the
        !           697: remaining files will be stored under their own names if possible.  If a `?'  is
        !           698: to be included in the remote file specification, you must prefix it with `\' to
        !           699: suppress its normal function of providing help.
        !           700: 
        !           701: If you have started a multiline 'get' command, you may escape from  its  lower-
        !           702: level prompts by typing a carriage return in response to the prompt, e.g.
        !           703: 
        !           704:     C-Kermit>get
        !           705:      Remote file specification: foo
        !           706:      Local name to store it under: (Type a carriage return here)
        !           707:     (cancelled)
        !           708:     C-Kermit>
        !           709: 
        !           710: 
        !           711:                              THE 'SERVER' COMMAND:
        !           712: 
        !           713: The 'server' command places C-Kermit in "server mode" on the currently selected
        !           714: communication line.  All further commands must arrive as valid  Kermit  packets
        !           715: from  the  Kermit  on  the  other  end of the line.  The Unix Kermit server can
        !           716: respond to the following commands:
        !           717: 
        !           718: Command                Server Response
        !           719:   get                    Sends files
        !           720:   send                   Receives files
        !           721:   bye                    Attempts to log itself out
        !           722:   finish                 Exits to level from which it was invoked
        !           723:   remote directory       Sends directory lising
        !           724:   remote delete          Removes files
        !           725:   remote cwd             Changes working directory
        !           726:   remote type            Sends files to your screen
        !           727:   remote space           Reports about its disk usage
        !           728:   remote who             Shows who's logged in
        !           729:   remote host            Executes a Unix shell command
        !           730:   remote help            Lists these capabilities
        !           731: 
        !           732: The Unix Kermit server cannot always respond properly to a  BYE  command.    It
        !           733: will  attempt to do so using "kill()", but this will not work on all systems or
        !           734: under all conditions because of the complicated process structures that can  be
        !           735: set up under Unix.
        !           736: 
        !           737: If  the  Kermit  server  is  directed at an external line (i.e. it is in "local
        !           738: mode") then the console may be used for other work if you have 'set  file  dis-
        !           739: play  off'; normally the program expects the console to be used to observe file
        !           740: transfers and enter status queries or interruption commands.  The  way  to  get
        !           741: C-Kermit  into  background operation from interactive command level varies from
        !           742: system to system (e.g. on Berkeley Unix you would halt the program with ^Z  and
        !           743: then  use the C-Shell 'bg' command to continue it in the background).  The more
        !           744: common method is to invoke the program with the desired command line arguments,
        !           745: including "-q", and with a terminating "&".
        !           746: 
        !           747: When  the  Unix  Kermit server is given a 'remote host' command, it executes it
        !           748: using the shell invoked upon login, e.g.  the  Bourne  shell  or  the  Berkeley
        !           749: C-Shell.
        !           750: 
        !           751: 
        !           752:                   THE 'REMOTE', 'BYE', AND 'FINISH' COMMANDS:
        !           753: 
        !           754: C-Kermit  may itself request services from a remote Kermit server.  In addition
        !           755: to 'send' and 'get', the following commands may also be sent from C-Kermit to a
        !           756: Kermit server:
        !           757: 
        !           758:     remote cwd [directory]
        !           759:         If the optional remote directory specification is included, you will be
        !           760:         prompted  on a separate line for a password, which will not echo as you
        !           761:         type it.  If the remote system does not require  a  password  for  this
        !           762:         operation, just type a carriage return.
        !           763: 
        !           764:     remote delete rfn       delete remote file or files.
        !           765:     remote directory [rfn]  directory listing of remote files.
        !           766:     remote host command     command in remote host's own command language.
        !           767:     remote space            disk usage report from remote host.
        !           768:     remote type [rfn]       display remote file or files on the screen.
        !           769:     remote who [user]       display information about who's logged in.
        !           770:     remote help             display remote server's capabilities.
        !           771: 
        !           772:     bye and finish:
        !           773:         When connected to a remote Kermit  server,  these  commands  cause  the
        !           774:         remote  server  to  terminate;  'finish' returns it to Kermit or system
        !           775:         command level (depending on the implementation or how the  program  was
        !           776:         invoked); 'bye' also requests it to log itself out.
        !           777: 
        !           778: 
        !           779:                         THE 'LOG' AND 'CLOSE' COMMANDS:
        !           780: 
        !           781: Syntax: log {debugging, packets, session, transactions} [ fn1 ]
        !           782: 
        !           783: C-Kermit's  progress  may be logged in various ways.  The 'log' command opens a
        !           784: log, the 'close' command closes it.  In addition, all open logs are  closed  by
        !           785: the 'exit' and 'quit' commands.  A name may be specified for a log file; if the
        !           786: name is omitted, the file is created with a default name as shown below.
        !           787: 
        !           788: log debugging
        !           789:     This produces a voluminous log of the internal workings of C-Kermit, of use
        !           790:     to Kermit developers or maintainers in tracking down suspected bugs in  the
        !           791:     C-Kermit  program.   Use of this feature dramatically slows down the Kermit
        !           792:     protocol.  Default name: debug.log.
        !           793: 
        !           794: log packets
        !           795:     This  produces  a  record of all the packets that go in and out of the com-
        !           796:     munication port.  This log is of use to Kermit maintainers who are tracking
        !           797:     down  protocol  problems  in either C-Kermit or any Kermit that C-Kermit is
        !           798:     connected to.  Default name:  packet.log.
        !           799: 
        !           800: log session
        !           801:     This  log  will  contain a copy of everything you see on your screen during
        !           802:     the 'connect' command, except for local messages or interaction with  local
        !           803:     escape commands.  Default name:  session.log.
        !           804: 
        !           805: log transactions
        !           806:     The transaction log is a record of all the files that were sent or received
        !           807:     while  transaction  logging  was  in  effect.   It includes time stamps and
        !           808:     statistics, filename transformations, and records of any  errors  that  may
        !           809:     have occurred.  The transaction log allows you to have long unattended file
        !           810:     transfer sessions without  fear  of  missing  some  vital  screen  message.
        !           811:     Default name:  transact.log.
        !           812: 
        !           813: The 'close' command explicitly closes a log, e.g. 'close debug'.
        !           814: 
        !           815: Note:    Debug  and Transaction logs are a compile-time option; C-Kermit may be
        !           816: compiled without these logs, in which case it will run faster, it will take  up
        !           817: less space on the disk, and the commands relating to them will not be present.
        !           818: 
        !           819: 
        !           820:                         LOCAL FILE MANAGEMENT COMMANDS:
        !           821: 
        !           822: Unix  Kermit  allows some degree of local file management from interactive com-
        !           823: mand level:
        !           824: 
        !           825: directory [fn]
        !           826:     Displays  a listing of the names, modes, sizes, and dates of files matching
        !           827:     fn (which defaults to `*').  Equivalent to `ls -l'.
        !           828: 
        !           829: cwd [directory-name]
        !           830:     Changes  Kermit's  working  directory  to  the one given, or to the default
        !           831:     directory if the directory name is omitted.  This command affects only  the
        !           832:     Kermit process and any processes it may subsequently create.
        !           833: 
        !           834: space
        !           835:     Display information about disk space and/or quota in the current  directory
        !           836:     and device.
        !           837: 
        !           838: ! [command]
        !           839:     The command is executed by the Unix shell.  If  no  command  is  specified,
        !           840:     then  an  interactive  shell  is  started;  exiting from the shell, e.g. by
        !           841:     typing Control-D or 'exit', will return you to C-Kermit command level.  Use
        !           842:     the  `!'  command  to  provide  file  management or other functions not ex-
        !           843:     plicitly provided by C-Kermit  commands.    The  `!'  command  has  certain
        !           844:     peculiarities:
        !           845: 
        !           846:        - C-Kermit attempts to use your preferred, customary (login) shell.
        !           847:        - At least one space must separate the '!' from the shell command.
        !           848:        - A  'cd'  (change  directory) command executed in this manner will
        !           849:          have no effect -- use the C-Kermit 'cwd' command instead.
        !           850: 
        !           851: 
        !           852:                         THE 'SET' AND 'SHOW' COMMANDS:
        !           853: 
        !           854: Since Kermit is designed to allow diverse systems to communicate, it  is  often
        !           855: necessary  to  issue  special  instructions  to  allow  the program to adapt to
        !           856: peculiarities of the another system or the communication path.  These  instruc-
        !           857: tions are accomplished by the 'set' command.  The 'show' command may be used to
        !           858: display current settings.  Here is a brief synopsis of  settings  available  in
        !           859: the current release of C-Kermit:
        !           860: 
        !           861: block-check {1, 2, 3}
        !           862:     Determines the level of per-packet error  detection.    "1"  is  a  single-
        !           863:     character  6-bit  checksum,  folded  to include the values of all bits from
        !           864:     each character.   "2"  is  a  2-character,  12-bit  checksum.    "3"  is  a
        !           865:     3-character,  16-bit  cyclic  redundancy check (CRC).  The higher the block
        !           866:     check, the better the error detection and correction  and  the  higher  the
        !           867:     resulting  overhead.   Type 1 is most commonly used; it is supported by all
        !           868:     Kermit implementations, and it has proven adequate in  most  circumstances.
        !           869:     Types  2  or  3  would  be used to advantage when transferring 8-bit binary
        !           870:     files over noisy lines.
        !           871: 
        !           872: delay n
        !           873:     How  many  seconds  to  wait before sending the first packet after a 'send'
        !           874:     command.  Used in remote mode to give you time to escape back to your local
        !           875:     Kermit and issue a 'receive' command.  Normally 5 seconds.
        !           876: 
        !           877: duplex {full, half}
        !           878:     For use during 'connect'.  Specifies  which  side  is  doing  the  echoing;
        !           879:     'full' means the other side, 'half' means C-Kermit must echo typein itself.
        !           880: 
        !           881: escape-character cc
        !           882:     For use during 'connect' to get C-Kermit's attention.  The escape character
        !           883:     acts  as a prefix to an 'escape command', for instance to close the connec-
        !           884:     tion and return to C-Kermit or Unix  command  level.    The  normal  escape
        !           885:     character  is Control-Backslash (28).  The escape character is also used in
        !           886:     System III/V implementations  to  prefix  interrupt  commands  during  file
        !           887:     transfers.
        !           888: 
        !           889: file {display, names, type, warning}
        !           890:     Establish various file-related parameters:
        !           891: 
        !           892:     display {on, off}
        !           893:         Normally  'on';  when in local mode, display progress of file transfers
        !           894:         on the screen (stdout), and listen to the keyboard (stdin)  for  inter-
        !           895:         ruptions.    If  off (-q on command line) none of this is done, and the
        !           896:         file transfer may proceed in the background oblivious to any other work
        !           897:         concurrently done at the console terminal.
        !           898: 
        !           899:     names {converted, literal}
        !           900:         Normally converted, which  means  that  outbound  filenames  have  path
        !           901:         specifications  stripped, lowercase letters raised to upper, tildes and
        !           902:         extra periods changed to X's, and an X inserted in front  of  any  name
        !           903:         that  starts  with  period.    Incoming  files  have  uppercase letters
        !           904:         lowered.  Literal means that none of these conversions are done; there-
        !           905:         fore,  any  directory  path  appearing in a received file specification
        !           906:         must exist and be write-accessible.  When literal naming is being used,
        !           907:         the  sender  should not use path names in the file specification unless
        !           908:         the same path exists on the target system and is writable.
        !           909: 
        !           910:     type {binary, text} [{7, 8}]
        !           911:         The file type is normally text, which means that conversion is done be-
        !           912:         tween Unix newline  characters  and  the  carriage-return/linefeed  se-
        !           913:         quences  required by the canonical Kermit file transmission format, and
        !           914:         in common use on non-Unix systems.  Binary means to transmit file  con-
        !           915:         tents  without  conversion.   Binary (`-i' in command line notation) is
        !           916:         necessary for binary files, and desirable in  all  Unix-to-Unix  trans-
        !           917:         actions to cut down on overhead.
        !           918: 
        !           919:         The  optional  trailing parameter tells the bytesize for file transfer.
        !           920:         It is 8 by default.  If you specify 7,  the  high  order  bit  will  be
        !           921:         stripped from each byte of sent and received files.  This is useful for
        !           922:         transferring text files that may have extraneous high order bits set in
        !           923:         their  disk  representation  (e.g.   Wordstar or similar word processor
        !           924:         files).
        !           925: 
        !           926:     warning {on, off}
        !           927:         Normally  off,  which means that incoming files will silently overwrite
        !           928:         existing files of the same name.  When on (`-w' on command line) Kermit
        !           929:         will check if an arriving file would overwrite an existing file; if so,
        !           930:         it will construct a new name for the arriving file, of the form  foo~n,
        !           931:         where foo is the name they share and n is a "generation number"; if foo
        !           932:         exists, then the new file will be called foo~1.  If foo and  foo~1  ex-
        !           933:         ist,  the  new file will be foo~2, and so on.  If the new name would be
        !           934:         longer than the maximum length for a filename, then characters would be
        !           935:         deleted  from  the  end first, for instance, thelongestname on a system
        !           936:         with a limit of 14 characters would become thelongestn~1.
        !           937: 
        !           938:             CAUTION:  If Control-F or Control-B is used to cancel an incom-
        !           939:             ing  file,  and a file of the same name previously existed, and
        !           940:             the "file warning" feature is not enabled,  then  the  previous
        !           941:             copy of the file will disappear.
        !           942: 
        !           943: flow-control {none, xon/xoff}
        !           944:     Normally xon/xoff for full duplex flow control.  Should be set to 'none' if
        !           945:     the  other  system cannot do xon/xoff flow control, or if you have issued a
        !           946:     'set handshake' command.  If set to xon/xoff, then handshake should be  set
        !           947:     to  none.    This  setting applies during both terminal connection and file
        !           948:     transfer.  Warning: This command may have no effect on  certain  Unix  sys-
        !           949:     tems,  where Kermit puts the communication line into 'rawmode', and rawmode
        !           950:     precludes flow control.
        !           951: 
        !           952: incomplete {discard, keep}
        !           953:     Disposition for incompletely received files.  If an incoming file is inter-
        !           954:     rupted or an error occurs during transfer, the part that  was  received  so
        !           955:     far  is  normally  discarded.   If you "set incomplete keep" then such file
        !           956:     fragments will be kept.
        !           957: 
        !           958: handshake {xon, xoff, cr, lf, bell, esc, none}
        !           959:     Normally  none.  Otherwise, half-duplex communication line turnaround hand-
        !           960:     shaking is done, which means Unix Kermit will not reply to a  packet  until
        !           961:     it  has received the indicated handshake character or has timed out waiting
        !           962:     for it; the handshake setting applies only during file transfer.    If  you
        !           963:     set handshake to other than none, then flow should be set to none.
        !           964: 
        !           965: line [device-name]
        !           966:     The device name for the communication line to be used for file transfer and
        !           967:     terminal connection, e.g. /dev/ttyi3.  If you specify a device name, Kermit
        !           968:     will be in local mode, and you should remember to issue any other necessary
        !           969:     'set'  commands,  such as 'set speed'.  If you omit the device name, Kermit
        !           970:     will revert to its default mode of operation.   If  you  specify  /dev/tty,
        !           971:     Kermit  will  enter  remote  mode  (useful when logged in through the "back
        !           972:     port" of a system normally used as a local-mode workstation).    When  Unix
        !           973:     Kermit  enters  local  mode, it attempts to synchronize with other programs
        !           974:     (like uucp) that use external communication lines  so  as  to  prevent  two
        !           975:     programs  using  the  same  line  at  once;  before  attempting to lock the
        !           976:     specified line, it will  close  and  unlock  any  external  line  that  was
        !           977:     previously  in  use.   The method used for locking is the "uucp lock file",
        !           978:     explained in more detail later.
        !           979: 
        !           980: modem-dialer {direct, hayes, racalvadic, ventel, ...}
        !           981:     The type of modem dialer on the communication line.  "Direct" indicates ei-
        !           982:     ther there is no dialout modem, or that if the line requires carrier detec-
        !           983:     tion  to  open,  then  'set  line'  will hang waiting for an incoming call.
        !           984:     "Hayes", "Ventel", and the others indicate  that  'set  line'  (or  the  -l
        !           985:     argument)  will  prepare  for  a  subsequent  'dial'  command for the given
        !           986:     dialer.  Support for new dialers is added from time to time, so  type  'set
        !           987:     modem  ?'  for  a  list of those supported in your copy of Kermit.  See the
        !           988:     description of the 'dial' command
        !           989: 
        !           990: parity {even, odd, mark, space, none}
        !           991:     Specify  character  parity for use in packets and terminal connection, nor-
        !           992:     mally none.  If other than none, C-Kermit will  seek  to  use  the  8th-bit
        !           993:     prefixing  mechanism  for transferring 8-bit binary data, which can be used
        !           994:     successfully only if the other Kermit agrees; if  not,  8-bit  binary  data
        !           995:     cannot be successfully transferred.
        !           996: 
        !           997: prompt [string]
        !           998:     The given string will be substituted  for  "C-Kermit>"  as  this  program's
        !           999:     prompt.    If the string is omitted, the prompt will revert to "C-Kermit>".
        !          1000:     If the string is enclosed in doublequotes, the quotes will be stripped  and
        !          1001:     any leading and trailing blanks will be retained.
        !          1002: 
        !          1003: send parameter
        !          1004:     Establish parameters to use when sending packets.  These will be in  effect
        !          1005:     only for the initial packet sent, since the other Kermit may override these
        !          1006:     parameters during the protocol parameter exchange (unless noted below).
        !          1007: 
        !          1008:     end-of-packet cc
        !          1009:         Specifies the control character needed by the other Kermit to recognize
        !          1010:         the end of a packet.  C-Kermit sends this character at the end of  each
        !          1011:         packet.    Normally  13  (carriage return), which most Kermit implemen-
        !          1012:         tations require.  Other Kermits require no  terminator  at  all,  still
        !          1013:         others may require a different terminator, like linefeed (10).
        !          1014: 
        !          1015:     packet-length n
        !          1016:         Specify the maximum packet length to  send.    Normally  90.    Shorter
        !          1017:         packet  lengths  can be useful on noisy lines, or with systems or front
        !          1018:         ends or networks that have small buffers.  The shorter the packet,  the
        !          1019:         higher  the  overhead,  but the lower the chance of a packet being cor-
        !          1020:         rupted by noise, and the less time  to  retransmit  corrupted  packets.
        !          1021:         This  command  overrides the value requested by the other Kermit during
        !          1022:         protocol initiation unless the other Kermit requests a shorter length.
        !          1023: 
        !          1024:     pad-character cc
        !          1025:         Designate  a  character  to send before each packet.  Normally, none is
        !          1026:         sent.  Outbound padding is sometimes necessary for  communicating  with
        !          1027:         slow half duplex systems that provide no other means of line turnaround
        !          1028:         control.  It can also be used to send special characters to  communica-
        !          1029:         tions  equipment  that  needs  to  be put in "transparent" or "no echo"
        !          1030:         mode, when this can be accomplished in by feeding it a certain  control
        !          1031:         character.
        !          1032: 
        !          1033:     padding n
        !          1034:         How many pad characters to send, normally 0.
        !          1035: 
        !          1036:     start-of-packet cc
        !          1037:         The  normal Kermit packet prefix is Control-A (1); this command changes
        !          1038:         the prefix C-Kermit puts on outbound packets.  The  only  reasons  this
        !          1039:         should  ever be changed would be: Some piece of equipment somewhere be-
        !          1040:         tween the two Kermit programs will not pass through  a  Control-A;  or,
        !          1041:         some  piece  of of equipment similarly placed is echoing its input.  In
        !          1042:         the latter case, the recipient of such an echo can  change  the  packet
        !          1043:         prefix for outbound packets to be different from that of arriving pack-
        !          1044:         ets, so that the echoed packets will be ignored.  The  opposite  Kermit
        !          1045:         must also be told to change the prefix for its inbound packets.
        !          1046: 
        !          1047:     timeout n
        !          1048:         Specifies the number of seconds you want the other Kermit to wait for a
        !          1049:         packet before timing it out and requesting retransmission.
        !          1050: 
        !          1051: receive parameter
        !          1052:     Establish parameters to request the other Kermit to use when sending  pack-
        !          1053:     ets.
        !          1054: 
        !          1055:     end-of-packet cc
        !          1056:         Requests the other Kermit to terminate its packets with  the  specified
        !          1057:         character.
        !          1058: 
        !          1059:     packet-length n
        !          1060:         Specify the maximum packet length to that you want the other Kermit  to
        !          1061:         send,  normally  90.  If you specify a length of 95 or greater, then it
        !          1062:         will be used if the other Kermit supports, and agrees to use, the  Ker-
        !          1063:         mit  protocol  extension  for  long packets.  In this case, the maximum
        !          1064:         length depends upon the systems involved, but there would  normally  be
        !          1065:         no  reason for packets to be more than about 1000 characters in length.
        !          1066:         The 'show parameters' command displays C-Kermit's current  and  maximum
        !          1067:         packet lengths.
        !          1068: 
        !          1069:     pad-character cc
        !          1070:         C-Kermit normally does not need to have incoming packets preceded  with
        !          1071:         pad characters.  This command allows C-Kermit to request the other Ker-
        !          1072:         mit to use cc as a pad character.  Default cc is NUL, ASCII 0.
        !          1073: 
        !          1074:     padding n
        !          1075:         How many pad characters to ask for, normally 0.
        !          1076: 
        !          1077:     start-of-packet cc
        !          1078:         Change the prefix C-Kermit looks for on inbound packets  to  correspond
        !          1079:         with what the other Kermit is sending.
        !          1080: 
        !          1081:     timeout n
        !          1082:         Normally, each Kermit partner sets its packet timeout interval based on
        !          1083:         what the opposite Kermit requests.  This command allows you to override
        !          1084:         the normal procedure and specify a timeout interval for Unix Kermit  to
        !          1085:         use  when waiting for packets from the other Kermit.  If you specify 0,
        !          1086:         then no timeouts will occur, and Unix Kermit will wait forever for  ex-
        !          1087:         pected packets to arrive.
        !          1088: 
        !          1089: speed {0, 110, 150, 300, 600, 1200, 1800, 2400, 4800, 9600}
        !          1090:     The baud rate for the external communication line.  This command cannot  be
        !          1091:     used  to  change the speed of your own console terminal.  Many Unix systems
        !          1092:     are set up in such a way that you must give this command after a 'set line'
        !          1093:     command  before  you  can  use  the line.  'set baud' is a synomym for 'set
        !          1094:     speed'.
        !          1095: 
        !          1096: terminal
        !          1097:     Used for specifying terminal parameters.  Currently, 'bytesize' is the only
        !          1098:     parameter provided, and it can be set to 7 or 8.  It's 7 by default.
        !          1099: 
        !          1100: 
        !          1101:                               THE 'SHOW' COMMAND:
        !          1102: 
        !          1103: Syntax: show {parameters, versions}
        !          1104: 
        !          1105: The "show" command with the  default  argument  of  "parameters"  displays  the
        !          1106: values  of  all  the  'set'  parameters  described  above.    If you type "show
        !          1107: versions", then C-Kermit will display the version numbers and dates of all  its
        !          1108: internal  modules.  You should use the "show versions" command to ascertain the
        !          1109: vintage of your Kermit program before reporting problems to Kermit maintainers.
        !          1110: 
        !          1111: 
        !          1112:                            THE 'STATISTICS' COMMAND:
        !          1113: 
        !          1114: The statistics command  displays  information  about  the  most  recent  Kermit
        !          1115: protocol transaction, including file and communication line i/o, timing and ef-
        !          1116: ficiency, as well as what encoding options were  in  effect  (such  as  8th-bit
        !          1117: prefixing, repeat-count compression).
        !          1118: 
        !          1119: 
        !          1120:                         THE 'TAKE' AND 'ECHO' COMMANDS:
        !          1121: 
        !          1122: Syntax: take fn1
        !          1123:      echo [text to be echoed]
        !          1124: 
        !          1125: The  'take' command instructs C-Kermit to execute commands from the named file.
        !          1126: The file may contain any interactive C-Kermit commands, including 'take';  com-
        !          1127: mand  files  may be nested to any reasonable depth, but it may not contain text
        !          1128: to be sent to a remote system during the 'connect' command.  This means that  a
        !          1129: command file like this:
        !          1130: 
        !          1131:     set line /dev/tty17
        !          1132:     set speed 9600
        !          1133:     connect
        !          1134:     login myuserid
        !          1135:     mypassword
        !          1136:     etc
        !          1137: 
        !          1138: will  not  send "login myserid" or any of the following text to the remote sys-
        !          1139: tem.  To carry on a canned dialog, use the 'script' command, described later.
        !          1140: 
        !          1141: The '%' command is useful for including comments in take-command files.  It may
        !          1142: only be used at the beginning of a line.
        !          1143: 
        !          1144: The  'echo'  command  may  be used within command files to issue greetings, an-
        !          1145: nounce progress, ring the terminal bell, etc.  The 'echo' command should not be
        !          1146: confused  with  the  Unix  'echo'  command,  which can be used to show how meta
        !          1147: characters would be expanded.  The Kermit echo command simply displays its text
        !          1148: argument (almost) literally at the terminal; the argument may contain octal es-
        !          1149: capes of the form "\ooo", where o is an octal digit (0-7), and there may be  1,
        !          1150: 2, or 3 such digits, whose value specify an ASCII character, such as "\007" (or
        !          1151: "\07" or just "\7") for beep, "\012" for newline, etc.  Of course,  each  back-
        !          1152: slash  must  be must be entered twice in order for it to be passed along to the
        !          1153: echo command by the Kermit command parser.
        !          1154: 
        !          1155: Take-command files are in exactly the  same  syntax  as  interactive  commands.
        !          1156: Note  that  this  implies  that  if you want to include special characters like
        !          1157: question mark or backslash that you would have to  quote  with  backslash  when
        !          1158: typing  interactive  commands,  you must quote these characters the same way in
        !          1159: command files.  Long lines may be continued by ending them with a single  back-
        !          1160: slash.
        !          1161: 
        !          1162: Command files may be used in lieu of command macros, which have not been imple-
        !          1163: mented in this version of C-Kermit.  For instance, if you commonly connect to a
        !          1164: system  called  'B' that is connected to ttyh7 at 4800 baud, you could create a
        !          1165: file called b containing the commands
        !          1166: 
        !          1167:     % C-Kermit command file to connect to System B thru /dev/ttyh7
        !          1168:     set line /dev/ttyh7
        !          1169:     set speed 4800
        !          1170:     % Beep and give message
        !          1171:     echo \\007Connecting to System B...
        !          1172:     connect
        !          1173: 
        !          1174: and then simply type 'take b' (or 't b' since no other commands begin with  the
        !          1175: letter  't')  whenever  you wish to connect to system B. Note the comment lines
        !          1176: and the beep inserted into the 'echo' command.
        !          1177: 
        !          1178: For connecting to IBM mainframes, a number  of  'set'  commands  are  required;
        !          1179: these, too, can be conveniently collected into a 'take' file like this one:
        !          1180: 
        !          1181:     % Sample C-Kermit command file to set up current line
        !          1182:     % for IBM mainframe communication
        !          1183:     %
        !          1184:     set parity mark
        !          1185:     set handshake xon
        !          1186:     set flow-control none
        !          1187:     set duplex half
        !          1188: 
        !          1189: Note  that no single command is available to wipe out all of these settings and
        !          1190: return C-Kermit to its default startup state; to do that, you can  either  res-
        !          1191: tart the program, or else make a command file that executes the necessary 'set'
        !          1192: commands:
        !          1193: 
        !          1194:     % Sample C-Kermit command file to restore normal settings
        !          1195:     %
        !          1196:     set parity none
        !          1197:     set handshake none
        !          1198:     set flow-control xon/xoff
        !          1199:     set duplex full
        !          1200: 
        !          1201: An implicit 'take' command is executed upon your  .kermrc  file  when  C-Kermit
        !          1202: starts  up,  upon  either  interactive or command-line invocation.  The .kermrc
        !          1203: file should contain 'set' or other commands you want to be  in  effect  at  all
        !          1204: times.   For instance, you might want override the default action when incoming
        !          1205: files have the same names as existing files -- in that case, put the command 
        !          1206: 
        !          1207:     set file warning on
        !          1208: 
        !          1209: in your .kermrc file.  On some non-Unix systems  that  run  C-Kermit,  the  in-
        !          1210: itialization file might have a different name, such as kermit.ini.
        !          1211: 
        !          1212: Errors  encountered during execution of take files (such as failure to complete
        !          1213: dial or script operations) cause termination of the current take file,  popping
        !          1214: to  the  level  that  invoked  it (take file, interactive level, or the shell).
        !          1215: When kermit is executed in the background, errors during execution  of  a  take
        !          1216: file are fatal.
        !          1217: 
        !          1218: Under  Unix,  you  may  also  use  the  shell's  redirection mechanism to cause
        !          1219: C-Kermit to execute commands from a file:  
        !          1220: 
        !          1221:     kermit < cmdfile
        !          1222: 
        !          1223: or you can even pipe commands in from another process:  
        !          1224: 
        !          1225:     cmdprocess | kermit
        !          1226: 
        !          1227: 
        !          1228:                             THE 'CONNECT' COMMAND:
        !          1229: 
        !          1230: The 'connect'  command  ('c'  is  an  acceptable  non-unique  abbreviation  for
        !          1231: 'connect')  links  your terminal to another computer as if it were a local ter-
        !          1232: minal to that computer, through the device specified in the  most  recent  'set
        !          1233: line' command, or through the default device if your system is a PC or worksta-
        !          1234: tion.  All characters you type at your keyboard are sent out the  communication
        !          1235: line  (and  if  you have 'set duplex half', also displayed on your screen), and
        !          1236: all characters arriving at the communication port are displayed on the  screen.
        !          1237: Current  settings  of  speed, parity, duplex, and flow-control are honored, and
        !          1238: the data connection is 7 bits wide unless you have given the command 'set  ter-
        !          1239: minal  bytesize 8'.  If you have issued a 'log session' command, everything you
        !          1240: see on your screen will also be recorded to your session log.  This provides  a
        !          1241: way  to  "capture"  files  from  remote systems that don't have Kermit programs
        !          1242: available.
        !          1243: 
        !          1244: To get back to your own system, you must type the escape  character,  which  is
        !          1245: Control-Backslash  (^\)  unless  you have changed it with the 'set escape' com-
        !          1246: mand,  followed  by  a  single-character  command,  such  as  'c'  for   "close
        !          1247: connection".  Single-character commands include:
        !          1248: 
        !          1249:   c     Close the connection
        !          1250:   b     Send a BREAK signal
        !          1251:   0     (zero) send a null
        !          1252:   s     Give a status report about the connection
        !          1253:   h     Hangup the phone
        !          1254:   ^\    Send  Control-Backslash  itself  (whatever  you have defined the escape
        !          1255:         character to be, typed twice in a row sends one copy of it).
        !          1256: 
        !          1257: Uppercase and control equivalents for (most of)  these  letters  are  also  ac-
        !          1258: cepted.    A  space  typed  after  the  escape character is ignored.  Any other
        !          1259: character will produce a beep.
        !          1260: 
        !          1261: The connect command simply displays incoming characters on the screen.   It  is
        !          1262: assumed  any  screen  control sequences sent by the host will be handled by the
        !          1263: firmware or emulation software in your terminal or PC.    If  special  terminal
        !          1264: emulation is desired, then the 'connect' command can invoked from the Unix com-
        !          1265: mand line (-c or -n), piped through a terminal emulation filter, e.g.  
        !          1266: 
        !          1267:     kermit -l /dev/acu -b 1200 -c | tek
        !          1268: 
        !          1269: 
        !          1270:                               THE 'DIAL' COMMAND:
        !          1271: 
        !          1272: Syntax: dial telephone-number-string
        !          1273: 
        !          1274: This command controls dialout modems; you should have  already  issued  a  "set
        !          1275: line"  and  "set  speed"  command  to  identify the terminal device, and a "set
        !          1276: modem" command to identify the type of modem to be used for dialing.    In  the
        !          1277: "dial"  command, you supply the phone number and the Kermit program feeds it to
        !          1278: the modem in the appropriate format and then interprets dialer return codes and
        !          1279: modem  signals  to  inform  you whether the call was completed.  The telephone-
        !          1280: number-string may contain imbedded modem-dialer commands,  such  as  comma  for
        !          1281: Hayes  pause, or `&' for Ventel dialtone wait and `%' for Ventel pause (consult
        !          1282: your modem manual for details).
        !          1283: 
        !          1284: At the time of this writing, support is included for the following modems:
        !          1285: 
        !          1286:    - AT&T 7300 Internal Modem
        !          1287:    - Cermetek Info-Mate 212A
        !          1288:    - Concord Condor CDS 220
        !          1289:    - DEC DF03-AC
        !          1290:    - DEC DF100 Series
        !          1291:    - DEC DF200 Series
        !          1292:    - General DataComm 212A/ED
        !          1293:    - Hayes Smartmodem 1200 and compatibles
        !          1294:    - Penril
        !          1295:    - Racal Vadic
        !          1296:    - US Robotics 212A
        !          1297:    - Ventel
        !          1298: 
        !          1299: Support for new modems is added to the program from time to time; you can check
        !          1300: the current list by typing "set modem ?".
        !          1301: 
        !          1302: The  device  used  for  dialing out is the one selected in the most recent "set
        !          1303: line" command (or on a workstation, the default line if no "set  line"  command
        !          1304: was  given).   The "dial" command calls locks the path (see the section on line
        !          1305: locking below) and establishes a call on an exclusive basis.  If it is  desired
        !          1306: to  dial  a  call and then return to the shell (such as to do kermit activities
        !          1307: depending on standard in/out redirection), it is necessary to place the  dialed
        !          1308: call  under  one  device  name  (say, "/dev/cua0") and then escape to the shell
        !          1309: within Kermit on a linked device which is separate from the dialed  line  (say,
        !          1310: "/dev/cul0").    This  is the same technique used by uucp (to allow locks to be
        !          1311: placed separately for dialing and conversing).
        !          1312: 
        !          1313: Because modem dialers have strict requirements to override  the  carrier-detect
        !          1314: signal most Unix implementations expect, the sequence for dialing is more rigid
        !          1315: than most other C-Kermit procedures.
        !          1316: 
        !          1317: Example one:
        !          1318: 
        !          1319:     kermit -l /dev/cul0 -b 1200
        !          1320:     C-Kermit>set modem-dialer hayes    hint: abbreviate set m h
        !          1321:     C-Kermit>dial 9,5551212
        !          1322:     Connected!
        !          1323:     C-Kermit>connect                   hint: abbreviate c
        !          1324:     logon, request remote server, etc.
        !          1325:     ^\c                                escape back
        !          1326:     C-Kermit> ...
        !          1327:     C-Kermit>quit                      hint: abbreviate q
        !          1328: 
        !          1329: this disconnects modem, and unlocks line.
        !          1330: 
        !          1331: Example two:
        !          1332: 
        !          1333:     kermit
        !          1334:     C-Kermit>set modem-dialer ventel
        !          1335:     C-Kermit>set line /dev/cul0
        !          1336:     C-Kermit>dial 9&5551212%
        !          1337:     Connected!
        !          1338:     C-Kermit> ...
        !          1339: 
        !          1340: Example three:
        !          1341: 
        !          1342:     kermit
        !          1343:     C-Kermit>take my-dial-procedure
        !          1344:     Connected!
        !          1345: 
        !          1346:     file my-dial-procedure:
        !          1347:     set modem hayes
        !          1348:     set line /dev/tty99
        !          1349:     dial 5551212
        !          1350:     connect
        !          1351: 
        !          1352: In general, C-Kermit requires that the modem provide the "carrier detect"  (CD)
        !          1353: signal  when  a  call is in progress, and remove that signal when the call com-
        !          1354: pletes or the line drops.  If a modem switch setting is available to force  CD,
        !          1355: it  should  normally  not  be in that setting.  C-Kermit also requires (on most
        !          1356: systems) that the modem track the computer's "data terminal ready"  (DTR)  sig-
        !          1357: nal.    If  a  switch  setting is available to simulate DTR asserted within the
        !          1358: modem, then it should normally not be in that setting.    Otherwise  the  modem
        !          1359: will  be unable to hang up at the end of a call or when interrupts are received
        !          1360: by Kermit.
        !          1361: 
        !          1362: For Hayes  dialers, two important switch settings are #1 and  #6.    Switch  #1
        !          1363: should be normally be UP so that the modem can act according to your computer's
        !          1364: DTR signal.  But if your computer, or particular implementation of Kermit, can-
        !          1365: not control DTR, then switch 1 should be DOWN.  Switch #6 should normally be UP
        !          1366: so carrier-detect functions properly (but put it DOWN if you have trouble  with
        !          1367: the  UP  position).    Switches  #2  (English versus digit result codes) and #4
        !          1368: (Hayes echoes modem commands) may be in either position.
        !          1369: 
        !          1370: If you want to interrupt a dial command in progress (for instance, because  you
        !          1371: just  realize  that you gave it the wrong number), type a Control-C to get back
        !          1372: to command level.
        !          1373: 
        !          1374: 
        !          1375:                              THE 'SCRIPT' COMMAND:
        !          1376: 
        !          1377: Syntax: script expect send [expect send] . . .
        !          1378: 
        !          1379: "expect" has the syntax: expect[-send-expect[-send-expect[...]]]
        !          1380: 
        !          1381: The 'script' command carries on a "canned dialog"  with  a  remote  system,  in
        !          1382: which data is sent according to the remote system's responses.  The typical use
        !          1383: is for logging in to a remote system automatically.
        !          1384: 
        !          1385: C-Kermit's script facility operates in a manner similar to that  commonly  used
        !          1386: by  the  Unix UUCP system's "L.sys" file entries.  A login script is a sequence
        !          1387: of the form:  
        !          1388: 
        !          1389:     expect send [expect send] . . .
        !          1390: 
        !          1391: where expect is a prompt or message to be issued by the remote site,  and  send
        !          1392: is  the  string (names, numbers, etc) to return, and expects are separated from
        !          1393: sends by spaces.  The send may also be the keyword EOT, to send  Control-D,  or
        !          1394: BREAK, to send a break signal.  Letters in sends may be prefixed by `~' to send
        !          1395: special characters, including:
        !          1396: 
        !          1397:     ~b  backspace
        !          1398:     ~s  space
        !          1399:     ~q  `?'(trapped by Kermit's command interpreter)
        !          1400:     ~n  linefeed
        !          1401:     ~r  carriage return
        !          1402:     ~t  tab
        !          1403:     ~'  single quote
        !          1404:     ~~  tilde
        !          1405:     ~"  double quote
        !          1406:     ~x  XON (Control-Q)
        !          1407:     ~c  don't append a carriage return
        !          1408:     ~o[o[o]]  an octal character
        !          1409:     ~d  delay approx 1/3 second during send
        !          1410:     ~w[d[d]]  wait specified interval during expect, then time out
        !          1411: 
        !          1412: As with some UUCP systems, sent strings are followed by ~r unless they  have  a
        !          1413: ~c.
        !          1414: 
        !          1415: Only  the last 7 characters in each expect are matched.  A null expect, e.g. ~0
        !          1416: or two adjacent dashes, causes a short delay before proceeding to the next send
        !          1417: sequence.  A null expect always succeeds.
        !          1418: 
        !          1419: As  with  UUCP, if the expect string does not arrive, the script attempt fails.
        !          1420: If you expect that a sequence might not arrive, as with UUCP,  conditional  se-
        !          1421: quences may be expressed in the form:  
        !          1422: 
        !          1423:     -send-expect[-send-expect[...]]
        !          1424: 
        !          1425: where dashed sequences are followed as long as previous expects fail.  Timeouts
        !          1426: for expects can be specified using ~w; ~w with no arguments waits 15 seconds.
        !          1427: 
        !          1428: Expect/send transactions can be easily be  debugged  by  logging  transactions.
        !          1429: This  records  all  exchanges,  both expected and actual.  The script execution
        !          1430: will also be logged in the session log, if that is activated.
        !          1431: 
        !          1432: Note that `\' characters in login scripts, as in any other C-Kermit interactive
        !          1433: commands,  must  be doubled up.  A line may be ended with a single `\' for con-
        !          1434: tinuation.
        !          1435: 
        !          1436: Example one:
        !          1437: 
        !          1438: Using a modem, dial a UNIX host site.   Expect  "login"  (...gin),  and  if  it
        !          1439: doesn't come, simply send a null string with a ~r.  (Some Unixes require either
        !          1440: an EOT or a BREAK instead of the null sequence,  depending  on  the  particular
        !          1441: site's "logger" program.)  After providing user id and password, respond "x" to
        !          1442: a question-mark prompt, expect the Bourne shell "$" prompt (and send return  if
        !          1443: it  doesn't  arrive).   Then cd to directory kermit, and run the program called
        !          1444: "wermit", entering the interactive connect state after wermit is loaded.
        !          1445: 
        !          1446:     set modem ventel
        !          1447:     set line /dev/tty77
        !          1448:     set baud 1200
        !          1449:     dial 9&5551212
        !          1450:     script gin:--gin:--gin: smith ssword: mysecret ~q x $--$ \
        !          1451:      cd~skermit $ wermit
        !          1452:     connect
        !          1453: 
        !          1454: Note that 'set line' is issued after 'set modem',  but  before  'set  baud'  or
        !          1455: other line-related parameters.
        !          1456: 
        !          1457: Example two:
        !          1458: 
        !          1459: Using  a  modem,  dial the Telenet network.  This network expects three returns
        !          1460: with slight delays between them.  These are sent following null expects.    The
        !          1461: single return is here sent as a null string, with a return appended by default.
        !          1462: Four returns are sent to be safe before looking  for  the  prompt.    Then  the
        !          1463: Telenet  id and password are entered.  Then Telenet is instructed to connect to
        !          1464: a host site (c 12345).  The host has a data switch that  asks  "which  system";
        !          1465: the  script responds "myhost" (if the "which system" prompt doesn't appear, the
        !          1466: Telenet connect command is reissued).  The script waits for an "@" prompt  from
        !          1467: the  host,  then  sends  the user ID ("joe") and password ("secret"), looks for
        !          1468: another "@" prompt, runs Kermit, and in response to the Kermit's prompt  (which
        !          1469: ends  in  ">"),  gives  the commands "set parity even" and "server".  Files are
        !          1470: then exchanged.  The commands are in a take file; note the continuation of  the
        !          1471: 'script' command onto several lines using the `\' terminator.
        !          1472: 
        !          1473:     set modem hayes
        !          1474:     set line /dev/acu
        !          1475:     set speed 1200
        !          1476:     set parity mark
        !          1477:     dial 9,5551212
        !          1478:     script ~0 ~0 ~0 ~0 ~0 ~0 ~0 ~0 @--@--@ id~saa001122 = 002211 @ \
        !          1479:         c~s12345 ystem-c~s12345-ystem myhost @ joe~ssecret @ kermit \
        !          1480:         > set~sparity~seven > server
        !          1481:     send some.stuff
        !          1482:     get some.otherstuff
        !          1483:     bye
        !          1484:     quit
        !          1485: 
        !          1486: Since  these  commands may be executed totally in the background, they can also
        !          1487: be scheduled.  A typical shell script, which might be scheduled by cron,  would
        !          1488: be as follows (csh used for this example):
        !          1489: 
        !          1490:     #
        !          1491:     #keep trying to dial and log onto remote host and exchange files
        !          1492:     #wait 10 minutes before retrying if dial or script fail.
        !          1493:     #
        !          1494:     cd someplace
        !          1495:     while ( 1 )
        !          1496:             kermit < /tonight.cmd >> nightly.log &
        !          1497:             if ( ! $status ) break
        !          1498:             sleep 600
        !          1499:     end
        !          1500: 
        !          1501: File  tonight.cmd  might  have two takes in it, for example, one to take a file
        !          1502: with the set modem, set line, set baud, dial, and script, and a second take  of
        !          1503: a  file  with  send/get  commands  for  the  remote  server.  The last lines of
        !          1504: tonight.cmd should be a bye and a quit.
        !          1505: 
        !          1506: 
        !          1507:                               THE 'HELP' COMMAND:
        !          1508: 
        !          1509: Syntax: help
        !          1510:    or: help keyword
        !          1511:    or: help {set, remote} keyword
        !          1512: 
        !          1513: Brief help messages or menus are always available at interactive command  level
        !          1514: by  typing  a question mark at any point.  A slightly more verbose form of help
        !          1515: is available through the 'help' command.  The 'help' command with no  arguments
        !          1516: prints  a  brief  summary of how to enter commands and how to get further help.
        !          1517: 'help' may be followed by one of the top-level C-Kermit command keywords,  such
        !          1518: as  'send', to request information about a command.  Commands such as 'set' and
        !          1519: 'remote' have a further level of help.  Thus you may type 'help',  'help  set',
        !          1520: or  'help  set parity'; each will provide a successively more detailed level of
        !          1521: help.
        !          1522: 
        !          1523: 
        !          1524:                         THE 'EXIT' AND 'QUIT' COMMANDS:
        !          1525: 
        !          1526: These two commands are identical.  Both of them do the following:
        !          1527: 
        !          1528:    - Attempt to insure that the terminal is returned to normal.
        !          1529:    - Relinquish access to any communication line assigned via 'set line'.
        !          1530:    - Relinquish any uucp and multiuser locks on the communications line.
        !          1531:    - Hang up the modem, if the communications line supports data  terminal
        !          1532:      ready.
        !          1533:    - Close any open logs or other files.
        !          1534: 
        !          1535: After  exit  from C-Kermit, your default directory will be the same as when you
        !          1536: started the program.  The 'exit' command is issued implicitly whenever C-Kermit
        !          1537: halts normally, e.g. after a command line invocation, or after certain kinds of
        !          1538: interruptions.
        !          1539: 
        !          1540: 
        !          1541: 1.5. UUCP Lock Files
        !          1542: 
        !          1543: Unix has no standard way of obtaining exclusive  access  to  an  external  com-
        !          1544: munication  line.    When you issue the 'set line' command to Unix Kermit, Unix
        !          1545: would normally grant you access to the line  even  if  some  other  process  is
        !          1546: making  use  of  it.    The  method adopted by most Unix systems to handle this
        !          1547: situation is the "UUCP lock  file".    UUCP,  the  Unix-to-Unix  Copy  program,
        !          1548: creates  a  file  in  its  directory  (usually /usr/spool/uucp, on some systems
        !          1549: /etc/locks) with a name like LCK..name, where name is the device name, for  in-
        !          1550: stance tty07.
        !          1551: 
        !          1552: Unix Kermit uses UUCP lock files in order to avoid conflicts with UUCP, tip, or
        !          1553: other programs that follow this convention.  Whenever you attempt to access  an
        !          1554: external  line using the 'set line' command or `-l' on the command line, Kermit
        !          1555: looks in the UUCP directory for a lock file corresponding to that device.   For
        !          1556: instance, if you 'set line /dev/ttyi6' then Kermit looks for the file 
        !          1557: 
        !          1558:     /usr/spool/uucp/LCK..ttyi6
        !          1559: 
        !          1560: If it finds this file, it gives you an error message and a directory listing of
        !          1561: the file so that you can see who is using it, e.g.
        !          1562: 
        !          1563:     -r--r--r--  1 fdc        4 May  7 13:02 /usr/spool/uucp/LCK..ttyi6
        !          1564: 
        !          1565: In this case, you would look up user fdc to find out how soon the line will be-
        !          1566: come free.
        !          1567: 
        !          1568: This  convention  requires  that  the  uucp  directory be publicly readable and
        !          1569: writable.  If it is not, the program will issue an appropriate warning message,
        !          1570: but will allow you to proceed at your own risk (and the risk of anyone else who
        !          1571: might also be using the same line).
        !          1572: 
        !          1573: If no lock file is found, Unix Kermit will attempt create one, thus  preventing
        !          1574: anyone  who subsequently tries to run Kermit, UUCP, tip, or similar programs on
        !          1575: the same line from gaining access until you release the line.  If Kermit  could
        !          1576: not  create  the  lock  file (for instance because the uucp directory is write-
        !          1577: protected), then you will receive a warning message  but  will  be  allowed  to
        !          1578: proceed  at  your  -- and everyone else's -- risk.  When Kermit terminates nor-
        !          1579: mally, your lock file is removed.
        !          1580: 
        !          1581: Even when the lock directory is writable and readable,  the  locking  mechanism
        !          1582: depends  upon  all  users using the same name for the same device.  If a device
        !          1583: has more than one path associated with it, then a lock can be  circumvented  by
        !          1584: using an alias.
        !          1585: 
        !          1586: When a lock-creating program abruptly terminates, e.g. because it crashes or is
        !          1587: killed via shell  command,  the  lock  file  remains  in  the  uucp  directory,
        !          1588: spuriously  indicating  that  the line is in use.  If the lock file is owned by
        !          1589: yourself, you may remove it.  Otherwise, you'll have to get the  owner  or  the
        !          1590: system manager to remove it, or else wait for a system task to do so; uucp sup-
        !          1591: ports a function (uuclean) which removes these files after a predetermined  age
        !          1592: -- uucp sites tend to run this function periodically via crontab.
        !          1593: 
        !          1594: Locking  is  not needed, or used, if communications occur over the user's login
        !          1595: terminal line (normally /dev/tty).
        !          1596: 
        !          1597: It may be seen that line locking is fraught with peril.  It is included in Unix
        !          1598: Kermit  only because other Unix communication programs rely on it.  While it is
        !          1599: naturally desirable to assure exclusive access  to  a  line,  it  is  also  un-
        !          1600: desirable  to  refuse  access  to a vacant line only because of a spurious lock
        !          1601: file, or because the uucp directory is not appropriately protected.
        !          1602: 
        !          1603: 
        !          1604: 1.6. C-Kermit under Berkeley or System III/V Unix:
        !          1605: 
        !          1606: C-Kermit may be interrupted at command level or during file transfer by  typing
        !          1607: Control-C.    The  program will perform its normal exit function, restoring the
        !          1608: terminal and releasing any lock.  If a protocol transaction was in progress, an
        !          1609: error  packet  will  be  sent  to  the opposite Kermit so that it can terminate
        !          1610: cleanly.
        !          1611: 
        !          1612: C-Kermit may be invoked in the background ("&" on shell commmand line).   If  a
        !          1613: background  process is "killed", the user will have to manually remove any lock
        !          1614: file and may need to restore the modem.    This  is  because  the  kill  signal
        !          1615: (kill(x,9)) cannot be trapped by Kermit.
        !          1616: 
        !          1617: During execution of a system command ('directory', 'cwd', or `!'), C-Kermit can
        !          1618: often be returned to command level by typing a single Control-C.  (With  System
        !          1619: III/V,  the  usual  interrupt  function  (often  the  DEL  key)  is replaced by
        !          1620: Control-C.)
        !          1621: 
        !          1622: Under Berkeley Unix only: C-Kermit may also be interrupted by  ^Z  to  put  the
        !          1623: process  in  the  background.   In this case the terminal is not restored.  You
        !          1624: will have to type Control-J followed by "reset" followed by  another  Control-J
        !          1625: to get your terminal back to normal.
        !          1626: 
        !          1627: Control-C, Control-Z, and Control-\ lose their normal functions during terminal
        !          1628: connection and also during file transfer when the controlling tty line is being
        !          1629: used for packet i/o.
        !          1630: 
        !          1631: If  you are running C-Kermit in "quiet mode" in the foreground, then interrupt-
        !          1632: ing the program with a console interrupt like Control-C will  not  restore  the
        !          1633: terminal  to  normal conversational operation.  This is because the system call
        !          1634: to enable console interrupt traps will cause the program to block if it's  run-
        !          1635: ning  in  the background, and the primary reason for quiet mode is to allow the
        !          1636: program to run in the background without blocking, so that  you  can  do  other
        !          1637: work in the foreground.
        !          1638: 
        !          1639: If C-Kermit is run in the background ("&" on shell commmand line), then the in-
        !          1640: terrupt signal (Control-C) (and System III/V quit signal) are  ignored.    This
        !          1641: prevents  an interrupt signal intended for a foreground job (say a compilation)
        !          1642: from being trapped by a background Kermit session.
        !          1643: 
        !          1644: 
        !          1645: 1.7. C-Kermit on the DEC Pro-3xx with Pro/Venix Version 1
        !          1646: 
        !          1647: The DEC Professional 300 series are PDP-11/23 based personal computers.   Venix
        !          1648: Version  1  is a Unix v7 derivative.  It should not be confused with Venix Ver-
        !          1649: sion 2, which is based on ATT System V; these comments apply to Venix Version 1
        !          1650: only.    C-Kermit  runs in local mode on the Pro-3xx when invoked from the con-
        !          1651: sole; the default device is /dev/com1.dout.  When connected to a remote  system
        !          1652: (using  C-Kermit's  'connect'  command), Pro/Venix itself (not Kermit) provides
        !          1653: VT52 terminal emulation.  Terminal operation at high speeds  (like  9600  baud)
        !          1654: requires  xon/xoff  flow  control, which unfortunately interferes with applica-
        !          1655: tions such as the EMACS that use Control-Q and Control-S as commands.
        !          1656: 
        !          1657: When logging in to a Pro-3xx (or any workstation) through the "back  port",  it
        !          1658: may  be  necessary  to  give  the  command  "set line /dev/tty" in order to get
        !          1659: C-Kermit to function correctly in remote mode (on a system in which it normally
        !          1660: expects to be operating in local mode).
        !          1661: 
        !          1662: 
        !          1663: 1.8. C-Kermit under VAX/VMS
        !          1664: 
        !          1665: C-Kermit  can  be  built using VAX-11 C to run under VMS.  Most of the descrip-
        !          1666: tions in this manual hold true, but it should be noted that as of this  writing
        !          1667: the  VMS  support  is not thoroughly tested, and no explicit support exists for
        !          1668: the various types of VMS files and their attributes.
        !          1669: 
        !          1670: The C-Kermit init file for VMS is called KERMIT.INI.
        !          1671: 
        !          1672: 
        !          1673: 1.9. C-Kermit on the Macintosh and other Systems
        !          1674: 
        !          1675: The "protocol kernel" of C-Kermit is also used by Columbia's Macintosh  Kermit.
        !          1676: The  user  and  system  interface  is  entirely  different, and is covered in a
        !          1677: separate document.
        !          1678: 
        !          1679: There is also a Kermit for the Commodore Amiga based on C-Kermit,  as  well  as
        !          1680: versions for MS-DOS, Data General operating systems, etc.
        !          1681: 
        !          1682: 
        !          1683: 1.10. C-Kermit Restrictions and Known Bugs
        !          1684: 
        !          1685:    1. Editing  characters:    The program's interactive command interrupt,
        !          1686:       delete, and kill characters are Control-C,  Delete  (or  Backspace),
        !          1687:       and  Control-U,  respectively.   There is currently no way to change
        !          1688:       them to suit your taste or match those used by your shell,  in  case
        !          1689:       those are different.
        !          1690: 
        !          1691:    2. Flow control:  C-Kermit attempts to use XON/XOFF flow control during
        !          1692:       protocol operations, but it also puts the  communication  line  into
        !          1693:       "rawmode".   On many systems, rawmode disables flow control, so even
        !          1694:       though you may have "set flow xon/xoff", no  flow  control  will  be
        !          1695:       done.  This is highly system and Unix-version dependent.
        !          1696: 
        !          1697:    3. High  baud  rates:  There's no way to specify baud rates higher than
        !          1698:       9600 baud.  Most Unix systems don't supply symbols for them  (unless
        !          1699:       you  use  EXTA, EXTB), and even when they do, the program has no way
        !          1700:       of knowing whether a specific port's serial i/o controller  supports
        !          1701:       those rates.
        !          1702: 
        !          1703:    4. Modem  controls:   If a connection is made over a communication line
        !          1704:       (rather than on the controlling terminal line), and  that  line  has
        !          1705:       modem  controls,  (e.g.  data  terminal  ready and carrier detection
        !          1706:       implementation), returning to the shell level  will  disconnect  the
        !          1707:       conversation.    In  that case, one should use interactive mode com-
        !          1708:       mands, and avoid use of piped shell-level operation (also  see  'set
        !          1709:       modem-dialer' and 'dial' commands.)
        !          1710: 
        !          1711:    5. Login Scripts:  The present login scripts implementation follows the
        !          1712:       Unix conventions of uucp's "L.sys" file, rather than the normal Ker-
        !          1713:       mit "INPUT/OUTPUT" style.
        !          1714: 
        !          1715:    6. Dial-out  vs  dial-in  communications  lines:    C-Kermit requires a
        !          1716:       dial-out or dedicated line for the "set line" or "-l" options.  Most
        !          1717:       systems  have  some  lines  dedicated  to dial-in, which they enable
        !          1718:       "loggers" on,  and  some  lines  available  for  dial-out.    Recent
        !          1719:       releases  of  Unix (ATT & Berkeley) have mechanisms for changing the
        !          1720:       directionality of a line.
        !          1721: 
        !          1722:    7. Using C-Kermit on Local Area Networks:   C-Kermit  can  successfully
        !          1723:       operate  at  speeds  up to 9600 baud over LANs, provided the network
        !          1724:       buffers are big enough to accommodate Kermit packets.
        !          1725: 
        !          1726:       When computers are connected to LAN's through asynchronous  terminal
        !          1727:       interfaces,  then the connection should be configured to do XON/XOFF
        !          1728:       flow control between the network interface and the computer,  rather
        !          1729:       than  passing  these  signals  through transparently.  This can help
        !          1730:       prevent Kermit from overrunning the LAN's buffers if they are  small
        !          1731:       (or if the LAN is congested), and will can also prevent the LAN from
        !          1732:       overrunning a slow Kermit's buffers.
        !          1733: 
        !          1734:       If the network hardware cannot accept 100 characters at a time,  and
        !          1735:       flow  control  cannot  be done between the network and the computer,
        !          1736:       then Kermit's "set send/receive packet-length" command can  be  used
        !          1737:       to shorten the packets.
        !          1738: 
        !          1739:    8. Resetting terminal after abnormal termination or kill: When C-Kermit
        !          1740:       terminates abnormally (say, for example, by a kill command issued by
        !          1741:       the  operator)  the  user  may need to reset the terminal state.  If
        !          1742:       commands do not seem  to  be  accepted  at  the  shell  prompt,  try
        !          1743:       Control-J  "stty  sane"  Control-J  (use  "reset" on Berkeley Unix).
        !          1744:       That should take the terminal out of "raw  mode"  if  it  was  stuck
        !          1745:       there.
        !          1746: 
        !          1747:    9. Remote  host  commands  may  time-out  on  lengthy  activity:  Using
        !          1748:       "remote host" to instruct the C-Kermit server to invoke  Unix  func-
        !          1749:       tions  (like  "make")  that might take a long time to produce output
        !          1750:       can cause timeout conditions.
        !          1751: 
        !          1752:   10. XOFF deadlocks:  When connecting back to  C-Kermit  after  a  trans-
        !          1753:       action, or after finishing the server, it may be necessary to type a
        !          1754:       Control-Q to clear up an  XOFF  deadlock.    There's  not  much  the
        !          1755:       program can do about this...
        !          1756: 
        !          1757: 
        !          1758: 1.11. How to Build C-Kermit for a Unix System
        !          1759: 
        !          1760: The  C-Kermit  files,  as  distributed from Columbia, all begin with the prefix
        !          1761: "ck".  You should make a directory for these files  and  then  cd  to  it.    A
        !          1762: makefile  is  provided  to  build  C-Kermit for various Unix systems (there are
        !          1763: separate makefiles for VMS and the Macintosh).  As  distributed,  the  makefile
        !          1764: has  the  name  "ckuker.mak".  You should rename it to "makefile" and then type
        !          1765: "make xxx", where xxx is the symbol for your system, for instance "make bsd" to
        !          1766: make  C-Kermit for 4.x BSD Unix.  The result will be a program called "wermit".
        !          1767: You should test this to make sure it works; if it does, then you can rename  it
        !          1768: to "kermit" and install it for general use.  See the makefile for a list of the
        !          1769: systems supported and the corresponding "make" arguments.
        !          1770: 
        !          1771: 
        !          1772: 1.12. Adapting C-Kermit to Other Systems
        !          1773: 
        !          1774: C-Kermit is designed for portability.  The level of portability is indicated in
        !          1775: parentheses  after  the module name: "C" means any system that has a C compiler
        !          1776: that conforms to the description in "The C Programming Language" by Kernighan &
        !          1777: Ritchie  (Prentice-Hall, 1978).  "Cf" is like "C", but also requires "standard"
        !          1778: features like printf and fprintf, argument passing via argv/argc, and so on, as
        !          1779: described in Kernighan & Ritchie.  "Unix" means the module should be useful un-
        !          1780: der any Unix implementation; it requires features such  as  fork()  and  pipes.
        !          1781: Anything  else  means  that  the  module is particular to the indicated system.
        !          1782: C-Kermit file names are of the form:
        !          1783: 
        !          1784: ck<system><what>.<type>
        !          1785: 
        !          1786: where the part before the dot is no more than 6 characters long, the part after
        !          1787: the dot no more than 3 characters long, and:
        !          1788: 
        !          1789: <type> is the file type:
        !          1790: 
        !          1791:   c:    C language source
        !          1792:   h:    Header file for C language source
        !          1793:   w:    Wart preprocessor source, converted by Wart (or Lex) to a C program
        !          1794:   nr:   Nroff/Troff text formatter source
        !          1795:   mss:  Scribe text formatter source
        !          1796:   doc:  Documentation
        !          1797:   hlp:  Help text
        !          1798:   bld:  Instructions for building the program
        !          1799:   bwr:  A "beware" file - list of known bugs
        !          1800:   upd:  Program update log
        !          1801:   mak:  Makefile
        !          1802: 
        !          1803: <system> is a single character to tell what system the file applies to:
        !          1804: 
        !          1805:   a:    Descriptive material, documentation
        !          1806:   c:    All systems with C compilers
        !          1807:   d:    Data General
        !          1808:   h:    Harris computers (reserved)
        !          1809:   i:    Commodore Amiga (Intuition)
        !          1810:   m:    Macintosh
        !          1811:   p:    IBM PC, PC-DOS (reserved)
        !          1812:   u:    Unix
        !          1813:   v:    VAX/VMS
        !          1814:   w:    Wart
        !          1815: 
        !          1816: <what> is mnemonic (up to 3 characters) for what's in the file:
        !          1817: 
        !          1818:   aaa:  A "read-me" file, like this one
        !          1819:   cmd:  Command parsing
        !          1820:   con:  Connect command
        !          1821:   deb:  Debug/Transaction Log formats, Typedefs
        !          1822:   dia:  Modem/Dialer control
        !          1823:   fio:  System-depdendent File I/O
        !          1824:   fns:  Protocol support functions
        !          1825:   fn2:  More protocol support functions
        !          1826:   ker:  General C-Kermit definitions, information, documentation
        !          1827:   mai:  Main program
        !          1828:   pro:  Protocol
        !          1829:   scr:  Script command
        !          1830:   tio:  System-dependent terminal i/o & control and interrupt handing
        !          1831:   usr:  User interface
        !          1832:   us2:  More user interface
        !          1833:   us3:  Still more user interface
        !          1834: 
        !          1835: Examples:
        !          1836: 
        !          1837: ckufio.c        File i/o for Unix
        !          1838: ckmtio.c        Terminal i/o for Macintosh
        !          1839: ckuker.mss      Scribe source for for Kermit User Guide chapter
        !          1840: ckuker.nr       Nroff source file for Unix C-Kermit man page
        !          1841: 
        !          1842: The following material discusses each of the C-Kermit modules briefly.
        !          1843: 
        !          1844: ckcmai.c, ckcker.h, ckcdeb.h (Cf):
        !          1845:     This is the main program.  It contains declarations  for  global  variables
        !          1846:     and a small amount of code to initialize some variables and invoke the com-
        !          1847:     mand parser.  In its distributed form, it assumes  that  command  line  ar-
        !          1848:     guments  are passed to it via argc and argv.  Since this portion of code is
        !          1849:     only several lines long, it should be easy to replace for systems that have
        !          1850:     different  styles of user interaction.  The header files define symbols and
        !          1851:     macros used by the various modules of  C-Kermit.    ckcdeb.h  is  the  only
        !          1852:     header  file  that  is included by all the C-Kermit modules, so it contains
        !          1853:     not only the debug format  definitions,  but  also  any  compiler-dependent
        !          1854:     typedefs.
        !          1855: 
        !          1856: ckwart.c (Cf), ckcpro.w (C):
        !          1857:     The ckcpro module embodies the Kermit protocol state table and the code  to
        !          1858:     accomplish  state switching.  It is written in "wart", a language which may
        !          1859:     be regarded as a subset of the Unix "lex" lexical analyzer generator.  Wart
        !          1860:     implements  enough  of lex to allow the ckprot module to function.  Lex it-
        !          1861:     self was not used because it is proprietary.  The protocol module  ckcpro.w
        !          1862:     is  read by wart, and a system-independent C program is produced.  The syn-
        !          1863:     tax of a Wart program is illustrated  by  ckcpro.w,  and  is  described  in
        !          1864:     ckwart.doc.
        !          1865: 
        !          1866: ckcfns.c (C):
        !          1867:     The module contains all the Kermit protocol  support  functions  --  packet
        !          1868:     formation,  encoding,  decoding, block check calculation, filename and data
        !          1869:     conversion, protocol parameter negotiation, and high-level interaction with
        !          1870:     the communication line and file system.  To accommodate small systems, this
        !          1871:     module has been split into two -- ckcfns.c and ckcfn2.c.
        !          1872: 
        !          1873: ckutio.c:
        !          1874:     This module contains the system-dependent primitives for communication line
        !          1875:     i/o, timers, and interrupts for the various versions of Unix.  Certain  im-
        !          1876:     portant  variables  are  defined  in  this  module, which determine whether
        !          1877:     C-Kermit is by default remote or  local,  what  the  default  communication
        !          1878:     device is, and so forth.  The tio module maintains its own private database
        !          1879:     of file descriptors and modes for the console terminal and the file  trans-
        !          1880:     fer  communication  line so that other modules (like ckcfns or the terminal
        !          1881:     connect module) need not be concerned with them.  The variations among Unix
        !          1882:     implementations  with  respect  to  terminal  control and timers are accom-
        !          1883:     modated via conditional compilation.
        !          1884: 
        !          1885: ckufio.c:
        !          1886:     This  module  contains  system-dependent  primitives for file i/o, wildcard
        !          1887:     (meta character) expansion, file existence and access checking, and  system
        !          1888:     command execution for the various versions of Unix.  It maintains an inter-
        !          1889:     nal database of i/o "channels" (file pointers in this case) for  the  files
        !          1890:     C-Kermit  cares about -- the input file (the file which is being sent), the
        !          1891:     output file (the file being received), the various logs, the screen, and so
        !          1892:     forth.  This module varies little among Unix implementations except for the
        !          1893:     wildcard expansion code; the directory structure of  4.2bsd  Unix  is  dif-
        !          1894:     ferent  from  that of other Unix systems.  Again, variation among Unix sys-
        !          1895:     tems is selected using conditional compilation.
        !          1896: 
        !          1897: ckuusr.h, ckuusr.c, ckuus2.c, ckuus3.c (Unix):
        !          1898:     This is the "user interface" for C-Kermit.  It includes the command parser,
        !          1899:     the screen output functions, and console input functions.  The command par-
        !          1900:     ser comes in two pieces -- the traditional Unix command line decoder (which
        !          1901:     is quite small and compact), and the interactive keyword parser  (which  is
        !          1902:     rather large).  This module is fully replacable; its interface to the other
        !          1903:     modules is very simple, and is explained at the  beginning  of  the  source
        !          1904:     file.    The  ckuusr  module  also  includes  code  to execute any commands
        !          1905:     directly which don't require the Kermit protocol -- local file  management,
        !          1906:     etc.    The  module  is rated "Unix" because it makes occasional use of the
        !          1907:     system() function.
        !          1908: 
        !          1909:     Note that while ckuusr is logically one module, it has been split  up  into
        !          1910:     three C source files, plus a header file for the symbols they share in com-
        !          1911:     mon.  This is to accommodate small systems that cannot handle big  modules.
        !          1912:     ckuusr.c  has  the  command  line and top-level interactive command parser;
        !          1913:     ckuus2.c has the help command and strings; ckuus3 has the  set  and  remote
        !          1914:     commands along with the logging, screen, and "interrupt" functions.
        !          1915: 
        !          1916: ckucmd.c, ckucmd.h (Cf):
        !          1917:     This is an interactive command parsing package developed for C-Kermit.   It
        !          1918:     is written portably enough to be usable on any system that has a C compiler
        !          1919:     that supports functions like printf.    The  file  name  parsing  functions
        !          1920:     depend  upon primitives defined in the fio module; if these primitives can-
        !          1921:     not be supplied for a certain system, then the filename  parsing  functions
        !          1922:     can  be deleted, and the package will still be useful for parsing keywords,
        !          1923:     numbers, arbitrary text strings, and so forth.  The style of interaction is
        !          1924:     the same as that found on the DECSYSTEM-20.
        !          1925: 
        !          1926: ckucon.c (Unix):
        !          1927:     This is the connect module.  As supplied, it should operate in any Unix en-
        !          1928:     vironment,  or  any  C-based environment that provides the fork() function.
        !          1929:     The module requires access to global variables  that  specify  line  speed,
        !          1930:     parity,  duplex,  flow  control,  etc,  and  invokes functions from the tio
        !          1931:     module to accomplish the desired settings and input/output,  and  functions
        !          1932:     from  the  fio module to perform session logging.  No terminal emulation is
        !          1933:     performed, but since standard i/o is used for  the  console,  this  may  be
        !          1934:     piped  through a terminal emulation filter.  The ckucon function may be en-
        !          1935:     tirely replaced, so long as the global settings are honored by its replace-
        !          1936:     ment.    PC implementations of C-Kermit may require the ck?con module to do
        !          1937:     screen control, escape sequence interpretation, etc, and may also  wish  to
        !          1938:     write special code to get the best possible performance.
        !          1939: 
        !          1940: ckudia.c (Unix):
        !          1941:     This is the dialer module.  As supplied, it handles Hayes, Ventel,  Penril,
        !          1942:     Racal-Vadic, and several other modems.
        !          1943: 
        !          1944: ckuscr.c (Unix):
        !          1945:     This is the login script  module.    As  supplied,  it  handles  uucp-style
        !          1946:     scripts.
        !          1947: 
        !          1948: Moving C-Kermit to a new system entails:
        !          1949: 
        !          1950:    1. Creating  a  new ck?tio module in C, assembler, or whatever language
        !          1951:       is most appropriate for system programming on the new  system.    If
        !          1952:       the  system  is  Unix-like,  then  support  may  be added within the
        !          1953:       ckutio.c module itself using conditional compilation.
        !          1954: 
        !          1955:    2. Creating a new ck?fio module, as above.
        !          1956: 
        !          1957:    3. If the system is not Unix-like, then a new ckuusr module may be  re-
        !          1958:       quired, as well as a different invocation of it from ckcmai.
        !          1959: 
        !          1960:    4. If  the  distributed connect module doesn't work or performs poorly,
        !          1961:       then it may be replaced.  For instance, interrupt-driven i/o may  be
        !          1962:       required, especially if the system doesn't have forks.
        !          1963: 
        !          1964: Those  who  favor  a  different  style  of  user/program  interaction from that
        !          1965: provided in ckuusr.c may replace the entire module, for instance with one  that
        !          1966: provides a mouse/window/icon environment, a menu/function-key environment, etc.
        !          1967: 
        !          1968: A few guidelines should be followed to maintain portability:
        !          1969: 
        !          1970:    - Keep  variable and function names to 6 characters or less.  Don't use
        !          1971:      identifiers that are distinguished  from  one  another  only  by  al-
        !          1972:      phabetic case.
        !          1973: 
        !          1974:    - Keep  modules  small.    For instance, on a PDP-11 it is necessary to
        !          1975:      keep the code segment of each module below 8K in order to  allow  the
        !          1976:      segment  mapping  to  occur which is necessary to run programs larger
        !          1977:      than 64K on a non-I-and-D-space machine.
        !          1978: 
        !          1979:    - Keep strings short; many compilers have restrictive maximum  lengths;
        !          1980:      128  is the smallest maximum string constant length we've encountered
        !          1981:      so far.
        !          1982: 
        !          1983:    - Keep (f,s)printf formats short.  If these exceed  some  compiler  de-
        !          1984:      pendent maximum (say, 128) memory will be overwritten and the program
        !          1985:      will probably core dump.
        !          1986: 
        !          1987:    - Do not introduce system dependencies into ckcpro.w or ckcfn*.c.
        !          1988: 
        !          1989:    - If a variable is a character, declare as CHAR, not  int,  to  prevent
        !          1990:      the  various sign extension and byte swapping foulups that occur when
        !          1991:      characters are placed in integer variables.
        !          1992: 
        !          1993:    - Remember that different systems may use different  length  words  for
        !          1994:      different  things.  Don't assume an integer can be used as a pointer,
        !          1995:      etc.
        !          1996: 
        !          1997:    - Don't declare static functions; these can wreak  havoc  with  systems
        !          1998:      that do segment mapping.
        !          1999: 
        !          2000:    - In  conditional  compilations expressions, use #ifdef and #ifndef and
        !          2001:      not #if, which is not supported by some compilers.  Also,  don't  use
        !          2002:      any  operators  in these expressions; many compilers will fail to un-
        !          2003:      derstand expressions like #ifdef FOO | BAR.  Also, don't put trailing
        !          2004:      tokens on #else's or #endif's (use /* comments */).
        !          2005: 
        !          2006:    - Don't define multiline macros.
        !          2007: 
        !          2008: In  general,  remember that this program will have to be compilable by old com-
        !          2009: pilers and runnable on small systems.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.