home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / g / README < prev    next >
Text File  |  2020-01-01  |  45KB  |  1,024 lines

  1. G-Kermit  --  GNU Kermit                                          -*- text -*-
  2.  
  3. Version 1.00 : 25 December 1999
  4.  
  5. Author:
  6.   Frank da Cruz
  7.   The Kermit Project
  8.   Columbia University
  9.   612 West 115th Street
  10.   New York NY 10025-7799  USA
  11.   fdc@columbia.edu
  12.  
  13.  
  14. CONTENTS...
  15.  
  16.    1. OVERVIEW
  17.    2. INVOKING G-KERMIT
  18.    3. COMMAND-LINE OPTIONS
  19.    4. THE MECHANICS OF FILE TRANSFER
  20.    5. INTERRUPTING FILE TRANSFER
  21.    6. TEXT AND BINARY TRANSFER MODE
  22.    7. PATHNAMES
  23.    8. FILENAME CONVERSION
  24.    9. FILENAME COLLISIONS
  25.   10. KERMIT PROTOCOL DETAILS
  26.   11. PROBLEMS, BUGS, ERRORS
  27.   12. BUILDING G-KERMIT
  28.   13. INSTALLING G-KERMIT
  29.   14. DESIGN AND IMPLEMENTATION NOTES
  30.  
  31.  
  32. 1. OVERVIEW
  33.  
  34. G-Kermit is a Unix program for uploading and downloading files with the
  35. Kermit protocol.  G-Kermit is a product of Kermit Project at Columbia
  36. University.  It is free software under the GNU Public License.  See the
  37. COPYING file for details.
  38.  
  39.   This software is OSI Certified Open Source Software.
  40.   OSI Certified is a certification mark of the Open Source Initiative.
  41.  
  42. G-Kermit is:
  43.  . Fast
  44.  . Small
  45.  . Portable
  46.  . Easy to use
  47.  . Interoperable
  48.  . Low-maintenance
  49.  . Stable and reliable
  50.  
  51. Features include:
  52.  . Text and binary file transfer on both 7-bit and 8-bit connections
  53.  . Files can be transferred singly or in groups
  54.  . Automatic startup configuration via GKERMIT environment variable
  55.  . Configurability as an external protocol
  56.  
  57. Kermit protocol features include:
  58.  . Automatic peer recognition
  59.  . Streaming on reliable connections
  60.  . Selectable packet length, 40 to 9000 bytes (4000 default)
  61.  . Single shifts for 8-bit data on 7-bit connections
  62.  . Control-character prefixing for control-character transparency
  63.  . Control-character unprefixing for increased speed (incoming only)
  64.  . Compression of repeated bytes
  65.  . Per-file and batch cancellation
  66.  
  67. Features selectable on command line:
  68.  . Text or binary mode transfer
  69.  . Filename conversion on/off
  70.  . Filename collision backup versus overwrite
  71.  . Keep or discard incompletely received files
  72.  . Packet length
  73.  . Packet timeout
  74.  . Flow control
  75.  . Parity
  76.  . Streaming
  77.  . Messages
  78.  . Debugging
  79.  
  80. Features not included (see Section 14):
  81.  . Making connections
  82.  . Character-set translation
  83.  . Interactive commands and scripting
  84.  . File date-time stamps
  85.  
  86.  
  87. 2. INVOKING G-KERMIT
  88.  
  89. G-Kermit is always on the "far end" of a connection, on a Unix system that
  90. you have made a connection to from a terminal emulator by dialup, network,
  91. or direct serial.  If you have a direct or dialup serial connection into
  92. Unix, use the "stty -a" or "stty all" command to see if your Unix terminal
  93. driver is conditioned for the appropriate kind of flow control; if it isn't,
  94. very few applications (including gkermit) will work well, or at all.  The
  95. command for setting terminal flow control varies from platform to platform,
  96. but it is usually something like this:
  97.  
  98.  $ stty crtscts
  99.  
  100. (where "$ " is the shell prompt) for RTS/CTS hardware flow control, or:
  101.  
  102.  $ stty ixon ixoff
  103.  
  104. for Xon/Xoff "software" flow control.  When you have a network connection,
  105. flow control is usually nothing to worry about, since the network protocol
  106. (TCP or X.25) takes care of it automatically, but on certain platforms (such
  107. as HP-UX) the TCP/IP Telnet or Rlogin server uses this for flow control
  108. between itself and the underlying pseudoterminal in which your session runs,
  109. so Xon/Xoff might be required for these sessions too.
  110.  
  111. The G-Kermit binary is called "gkermit".  It should be stored someplace in
  112. your Unix PATH, such as /usr/local/bin/gkermit or somewhere in the /opt tree
  113. on System V R4.  To run G-Kermit, just type "gkermit" followed by command-
  114. line options that tell it what to do.  If no options are given, G-Kermit
  115. prints a usage message listing the available options:
  116.  
  117.  G-Kermit CU-1.00, Columbia University, 1999-12-25: POSIX.
  118.  Usage:  gkermit [ options ]
  119.  Options:
  120.   -r      Receive files
  121.   -s fn   Send files
  122.   -g fn   Get files from server
  123.   -a fn   As-name for single file
  124.   -i      Image (binary) mode transfer
  125.   -T      Text mode transfer
  126.   -P      Path/filename conversion disabled
  127.   -w      Write over existing files with same name
  128.   -K      Keep incompletely received files
  129.   -p x    Parity: x = o[dd],e[ven],m[ark],s[pace],n[one]
  130.   -e n    Receive packet-length (40-9000)
  131.   -b n    Timeout (sec, 0 = none)
  132.   -x      Force Xon/Xoff (--x = Don't force Xon/Xoff)
  133.   -S      Disable streaming
  134.   -X      External protocol
  135.   -q      Quiet (suppress messages)
  136.   -d [fn] Debug to ./debug.log [or specified file]
  137.   -h      Help (this message)
  138.  More info: http://www.columbia.edu/kermit/ <kermit@columbia.edu>
  139.  
  140. If an option takes an argument, the argument is required; if an option does
  141. not take an argument, no argument may be given (exceptions: -d may or may
  142. not take an argument; -s can take 1 or more arguments).
  143.  
  144. The action options are -r, -s, and -g.  Only one action option may be given.
  145. If no action options are given, G-Kermit does nothing (except possibly
  146. printing its usage message or creating a debug.log file).  Here are some
  147. examples (in which "$ " is the shell prompt):
  148.  
  149.   $ gkermit -s hello.c       <-- Sends the hello.c file.
  150.   $ gkermit -s hello.*       <-- Sends all hello.* files.
  151.   $ gkermit -r               <-- Waits for you to send a file to it.
  152.   $ gkermit -g hello.c       <-- Gets the hello.c file from your computer.
  153.   $ gkermit -g \*.c          <-- Gets all *.c files from your computer.
  154.  
  155. Options that do not take arguments can be "bundled" with other options.
  156. An option that takes an argument must always be followed by a space and
  157. then its argument(s).  Examples:
  158.  
  159.   $ gkermit -is hello.o      <-- Sends hello.o in binary mode.
  160.   $ gkermit -dSr             <-- Receives with debugging and no streaming.
  161.  
  162. G-Kermit's exit status is 0 if all operations succeeded and 1 if there were
  163. any failures.  If a group of files was transferred, the exit status is 1
  164. if one or more files was not successfully transferred and 0 if all of them
  165. were transferred successfully.
  166.  
  167.  
  168. 3. COMMAND-LINE OPTIONS
  169.  
  170.   -r     RECEIVE: This option tells G-Kermit to receive a file or files;
  171.          that is, to passively wait for you to send files from your
  172.          terminal emulator.
  173.  
  174.   -s fn  SEND: This tells G-Kermit to send the file or files specified by
  175.          fn, which can be a filename, a regular expression, or a list of
  176.          filenames and/or regular expressions (wildcards).  Regular
  177.          expressions are interpreted and expanded by your shell into the
  178.          list of names of files that is given to G-Kermit.  For example
  179.          "*.c" expands to a list of all files in the current directory
  180.          whose names end with ".c".
  181.  
  182.   -g fn  GET: This option tells G-Kermit to get a file (or files) from a
  183.          Kermit server.  It is useful only when your terminal emulator
  184.          supports the Kermit autodownload feature AND it includes a Kermit
  185.          server mode.  It is equivalent to "gkermit -r", escaping back,
  186.          telling your terminal emulator to send the given files, and then
  187.          reconnecting to Unix.
  188.  
  189.   -a fn  AS-NAME: When used with -s, this option tells G-Kermit to send
  190.          the file whose name is given as the first -s argument under the
  191.          name fn.  For example, "gkermit -s game -a work" sends the file
  192.          called "game" under the name "work", so the receiver will think
  193.          its name is "work".  When given with the -r or -g command, the
  194.          incoming file (or the first incoming file if there is more than
  195.          one) is stored under the name fn.  In all cases, the given name
  196.          is used as-is; it is not converted.
  197.  
  198.   -i     IMAGE (binary) mode transfer.  When used with -s, tells G-Kermit
  199.          to send in binary mode.  When used with -r, tells G-Kermit to
  200.          receive in binary mode if the file sender does not specify the
  201.          transfer mode (text or binary).  When used with -g, tells
  202.          G-Kermit to ask your terminal emulator's Kermit to send the given
  203.          file in binary mode.  See Section 6 for details.
  204.  
  205.   -T     TEXT mode transfer (note uppercase T).  When used with -s, tells
  206.          G-Kermit to send in text mode.  When used with -r, tells G-Kermit
  207.          to receive in text mode if the file sender does not specify the
  208.          transfer mode (text or binary).  When used with -g, tells G-Kermit
  209.          to ask your emulator's Kermit to send the given file in text mode.
  210.          See Section 6 for details.
  211.  
  212.   -P     PATH (filename) conversion disabled (note uppercase P).
  213.          Normally when sending files, G-Kermit converts filenames to a
  214.          form that should be acceptable to non-Unix platforms, primarily
  215.          changing lowercase letters to uppercase, ensuring there is no
  216.          more than one period, and replacing any "funny" characters by X
  217.          or underscore (explained in Section 8).
  218.  
  219.   -w     WRITEOVER.  When receiving, and an incoming file has the same
  220.          name as an existing file, write over the existing file.  By
  221.          default G-Kermit backs up the existing file by adding a suffix
  222.          to its name (see Section 9).
  223.  
  224.   -K     KEEP incompletely received files.  Normally when receiving files,
  225.          and a file transfer is interrupted, G-Kermit discards the
  226.          partially received file so you won't think you have the whole
  227.          file.  Include -K on the command line to tell G-Kermit to keep
  228.          partially received files, e.g. "gkermit -Kr".
  229.  
  230.   -p x   PARITY: Use the given kind of parity, where x can be 'n' for
  231.          None (which is the default, for use on 8-bit-clean connections);
  232.          's' for Space, 'e' for Even, 'o' for Odd, and 'm' for Mark.  's'
  233.          might be needed on certain Telnet connections; 'e', 'o', and 'm'
  234.          are only for serial connections; don't try them on TCP/IP
  235.          connections.
  236.  
  237.   -e n   PACKET LENGTH: Receive packet-length, where n can be any number
  238.          between 40 and 9000.  The default length on most platforms is
  239.          4000.  Use this option to specify a different length; usually
  240.          this would be necessary only if transfers fail using the default
  241.          length due to some kind of buffering problem in the host or along
  242.          the communication path.  Example: "gkermit -e 240 -r".
  243.  
  244.   -b n   TIMEOUT (sec, 0 = none).  Specify the number of seconds to wait
  245.          for a packet before timing out and retransmitting.  By default,
  246.          G-Kermit uses whatever timeout interval your terminal emulator's
  247.          Kermit asks it to use.  No need to change this unless the timeout
  248.          action causes problems.
  249.  
  250.   -x     XON/XOFF.  Force Xon/Xoff flow control in the Unix terminal
  251.          driver.  Try this if uploads fail without it.  But don't use it
  252.          if you don't need to; on some platforms or connections it hurts
  253.          rather than helps.
  254.  
  255.   --x    Don't force Xon/Xoff; for use when G-Kermit was built with the
  256.          SETXONXOFF compile-time option (Section 12), to override the
  257.          automatic setting of Xon/Xoff in case it interferes with file
  258.          transfers.
  259.  
  260.   -S     STREAMING disabled.  Streaming is a high-performance option to
  261.          be used on reliable connections, such as in Telnet or Rlogin
  262.          sessions.  It is used if your terminal emulator's Kermit requests
  263.          it.  Use the -S option (note: uppercase S) to suppress this
  264.          feature in case it causes trouble.  Details in Section 10.
  265.  
  266.   -X     EXTERNAL PROTOCOL.  Include this option when invoking G-Kermit
  267.          from another program that redirects G-Kermit's standard i/o,
  268.          e.g. over a connection to another computer.  If you omit this
  269.          switch when using G-Kermit as an external protocol to another
  270.          communications program, G-Kermit is likely to perform illegal
  271.          operations and exit prematurely.  If you include this switch
  272.          when G-Kermit is NOT an external protocol to another program,
  273.          file transfers will fail.  G-Kermit has no way of determining
  274.          automatically whether it is being used as an external protocol.
  275.  
  276.   -q     QUIET.  Suppresses messages.
  277.  
  278.   -d     DEBUG.  Use this for troubleshooting.  It creates a file called
  279.          debug.log in your current directory, to be used in conjunction
  280.          with the source code, or sent to the Kermit support address for
  281.          analysis.  More about this in Section 11.
  282.  
  283.   -d fn  DEBUG to specified file (rather than default ./debug.log).
  284.  
  285.   -h     HELP: Displays the usage message shown above.
  286.  
  287. You may supply options to G-Kermit on the command line or through the
  288. GKERMIT environment variable, which can contain any valid gkermit
  289. command-line options.  These are processed before the actual command-line
  290. options and so can be overridden by them.  Example for bash or ksh, which
  291. you can put in your profile if you want to always keep incomplete files,
  292. suppress streaming, suppress messages, and use Space parity:
  293.  
  294.   export GKERMIT="-K -S -q -p s"
  295.  
  296. G-Kermit's options are compatible with C-Kermit's, with the following
  297. exceptions:
  298.  
  299.   -P (available only in C-Kermit 7.0 and later)
  300.   -K (currently not used in C-Kermit)
  301.   -b (used in C-Kermit for serial device speed)
  302.   -S (used in C-Kermit to force an interactive command prompt)
  303.   -x (used in C-Kermit to start server mode)
  304.  --x (currently not used in C-Kermit)
  305.   -X (currently not used in C-Kermit)
  306.  
  307.  
  308. 4. THE MECHANICS OF FILE TRANSFER
  309.  
  310. To transfer files with G-Kermit you must be connected through a terminal
  311. emulator to the Unix system where G-Kermit is installed, meaning you are
  312. online to Unix and have access to the shell prompt (or to some menu that has
  313. an option to invoke G-Kermit), and your terminal emulator must support the
  314. Kermit file transfer protocol.  The connection can be serial (direct or
  315. dialed) or network (Telnet, Rlogin, X.25, etc).
  316.  
  317. 4.1. Sending Files
  318.  
  319. When you tell G-Kermit to SEND a file (or files), e.g. with:
  320.  
  321.   $ gkermit -Ts oofa.txt
  322.  
  323. it pauses for a second and then sends its first packet.  What happens next
  324. depends on the capabilities of your terminal emulator:
  325.  
  326.  . If your emulator supports Kermit "autodownloads" then it receives the
  327.    file automatically and puts you back in the terminal screen when done.
  328.  
  329.  . Otherwise, you'll need to take whatever action is required by your
  330.    emulator to get its attention: a mouse action, a keystroke like Alt-x,
  331.    or a character sequence like Ctrl-\ or Ctrl-] followed by the letter
  332.    "c" (this is called "escaping back") and then tell it to receive the
  333.    file.  When the transfer is complete, you might have to instruct your
  334.    emulator to go back to its terminal screen.
  335.  
  336. During file transfer, most terminal emulators put up some kind of running
  337. display of the file transfer progress.
  338.  
  339. 4.2. Receiving Files
  340.  
  341. When you tell G-Kermit to RECEIVE, this requires you to escape back to your
  342. terminal emulator and instruct it to send the desired file(s).  Autodownload
  343. is not effective in this case.  When the transfer is complete, you'll need
  344. to instruct your emulator to return to its terminal screen.
  345.  
  346. 4.3. Getting Files
  347.  
  348. If your terminal emulator supports Kermit autodownloads AND server mode, you
  349. can use GET ("gkermit -g files...") rather than RECEIVE ("gkermit -r"), and
  350. the rest happens automatically, as when G-Kermit is sending.
  351.  
  352.  
  353. 5. INTERRUPTING FILE TRANSFER
  354.  
  355. G-Kermit supports file and group interruption.  The method for interrupting
  356. a transfer depends on your terminal emulator.  For example, while the
  357. file-transfer display is active, you might type the letter 'x' to cancel the
  358. current file and go on to the next one (if any), and the letter 'z' to
  359. cancel the group.  Or there might be buttons you can click with your mouse.
  360.  
  361. When G-Kermit is in packet mode and your terminal emulator is in its
  362. terminal screen, you can also type three (3) Ctrl-C characters in a row to
  363. make G-Kermit exit and restore the normal terminal modes.
  364.  
  365.  
  366. 6. TEXT AND BINARY TRANSFER MODE
  367.  
  368. When sending files in binary mode, G-Kermit sends every byte exactly as it
  369. appears in the file.  This mode is appropriate for program binaries,
  370. graphics files, tar archives, compressed files, etc, and is G-Kermit's
  371. default file-transfer mode when sending.  When receiving files in binary
  372. mode, G-Kermit simply copies each byte to disk.  (Obviously the bytes are
  373. encoded for transmission, but the encoding and decoding procedures give a
  374. replica of the original file after transfer.)
  375.  
  376. When sending files in text mode, G-Kermit converts the record format to the
  377. common one that is defined for the Kermit protocol, namely lines terminated
  378. by carriage return and linefeed (CRLF); the receiver converts the CRLFs to
  379. whatever line-end or record-format convention is used on its platform.  When
  380. receiving files in text mode, G-Kermit simply strips carriage returns,
  381. leaving only a linefeed at the end of each line, which is the Unix
  382. convention.
  383.  
  384. When receiving files, the sender's transfer mode (text or binary)
  385. predominates if the sender gives this information to G-Kermit in a Kermit
  386. File Attribute packet, which of course depends on whether your terminal
  387. emulator's Kermit protocol has this feature.  Otherwise, if you gave a -i or
  388. -T option on the gkermit command line, the corresponding mode is used;
  389. otherwise the default mode (binary) is used.
  390.  
  391. Furthermore, when either sending or receiving, G-Kermit and your terminal
  392. emulator's Kermit can inform each other of their OS type (Unix in G-Kermit's
  393. case).  If your emulator supports this capability, which is called
  394. "automatic peer recognition", and it tells G-Kermit that its platform is
  395. also Unix, G-Kermit and the emulator's Kermit automatically switch into
  396. binary mode, since no record-format conversion is necessary in this case.
  397. Automatic peer recognition is disabled automatically if you include the -i
  398. (image) or -T (text) option.
  399.  
  400. When sending, G-Kermit sends all files in the same mode, text or binary.
  401. There is no automatic per-file mode switching.  When receiving, however,
  402. per-file switching occurs automatically based on the incoming Attribute
  403. packets, if any (explained below), that accompany each file, so if the
  404. file sender switches types between files, G-Kermit follows along.
  405.  
  406.  
  407. 7. PATHNAMES
  408.  
  409. When SENDING a file, G-Kermit obtains the filenames from the command line.
  410. It depends on the shell to expand metacharacters (wildcards and tilde).
  411.  
  412. G-Kermit uses the full pathname given to find and open the file, but then
  413. strips the pathname before sending the name to the receiver.  For example:
  414.  
  415.   $ gkermit -s /etc/hosts
  416.  
  417. results in an arriving file called "HOSTS" or "hosts" (the directory part,
  418. "/etc/", is stripped; see next section about capitalization).
  419.  
  420. However, if a pathname is included in the -a option, the directory part
  421. is not stripped:
  422.  
  423.   $ gkermit -s /etc/hosts -a /tmp/hosts
  424.  
  425. This example sends the /etc/hosts file but tells the receiver that its name
  426. is "/tmp/hosts".  What the receiver does with the pathname is, of course, up
  427. to the receiver, which might have various options for dealing with incoming
  428. pathnames.
  429.  
  430. When RECEIVING a file, G-Kermit does NOT strip the pathname, since incoming
  431. files normally do not include a pathname unless you told your terminal to
  432. include them or gave an "as-name" including a path when sending to G-Kermit.
  433. If the incoming filename includes a path, G-Kermit tries to store the file
  434. in the specified place.  If the path does not exist, the transfer fails.
  435. The incoming filename can, of course, be superseded with the -a option.
  436.  
  437.  
  438. 8. FILENAME CONVERSION
  439.  
  440. When sending a file, G-Kermit normally converts outbound filenames to
  441. common form: uppercase, no more than one period, and no funny characters.
  442. So, for example, gkermit.tar.gz would be sent as GKERMIT_TAR.GZ.
  443.  
  444. When receiving a file, if the name is all uppercase, G-Kermit converts it
  445. to all lowercase.  If the name contains any lowercase letters, G-Kermit
  446. leaves the name alone.  Otherwise G-Kermit accepts filename characters as
  447. they are, since Unix allows filenames to contain practically any characters.
  448.  
  449. If the automatic peer recognition feature is available in the terminal
  450. emulator, and G-Kermit recognizes the emulator's platform as Unix, G-Kermit
  451. automatically disables filename conversion and sends and accepts filenames
  452. literally.
  453.  
  454. You can force literal filenames by including the -P option on the command
  455. line.
  456.  
  457.  
  458. 9. FILENAME COLLISIONS
  459.  
  460. When G-Kermit receives a file whose name is the same as that of an existing
  461. file, G-Kermit backs up the existing file by adding a unique suffix to its
  462. name.  The suffix is ".~n~", where n is a number between 1 and 999.  This
  463. the same kind of backup suffix used by GNU EMACS and C-Kermit (both of which
  464. can be used to prune excess backup files).  But since G-Kermit does not read
  465. directories (see Implementation Notes below), it can not guarantee that the
  466. number chosen will be higher than any other backup prefix number for the
  467. same file.  In fact, the first free number, starting from 1, is chosen.  If
  468. an incoming file already has a backup suffix, G-Kermit strips it before
  469. adding a new one, rather than creating a file that has two backup suffixes.
  470.  
  471. To defeat the backup feature and have incoming files overwrite existing
  472. files of the same name, include the -w (writeover) option on the command
  473. line.
  474.  
  475. If G-Kermit has not been been given the -w option and it fails to create a
  476. backup file, the transfer fails.
  477.  
  478.  
  479. 10. KERMIT PROTOCOL DETAILS
  480.  
  481. Block check
  482.   G-Kermit uses the 3-byte, 16-bit CRC by default.  If the other Kermit
  483.   does not agree, both Kermits automatically drop down to the single-byte
  484.   6-bit checksum that is required of all Kermit implementations.
  485.  
  486. Attributes
  487.   When sending files, G-Kermit conveys the file transfer mode and file
  488.   size in bytes to the receiver in an Attribute (A) packet if the use of
  489.   A-packets was negotiated.  This allows the receiver to switch to the
  490.   appropriate mode automatically, and to display the percent done, estimated
  491.   time left, and/or a thermometer bar if it has that capability.  When
  492.   receiving, G-Kermit looks in the incoming A-packet, if any, for the
  493.   transfer mode (text or binary) and switches itself accordingly on a
  494.   per-file basis.
  495.  
  496. Handling of the Eighth Bit
  497.   G-Kermit normally treats the 8th bit of each byte as a normal data bit.
  498.   But if you have a 7-bit connection, transfers of 8-bit files fail unless
  499.   you tell one or both Kermits to use the appropriate kind of parity, in
  500.   which case Kermit uses single-shift escaping for 8-bit bytes.  Generally,
  501.   telling either Kermit is sufficient; it tells the other.  Use the -p
  502.   option to tell G-Kermit which parity to use.  Locking shifts are not
  503.   included in G-Kermit.
  504.  
  505. Control-Character Encoding
  506.   G-Kermit escapes all control characters when sending (for example,
  507.   Ctrl-A becomes #A).  When receiving, it accepts both escaped and bare
  508.   control characters, including NUL (0).  However, unescaped control
  509.   characters always present a danger, so if uploads to G-Kermit fail, tell
  510.   your terminal emulator's Kermit to escape most or all control characters
  511.   (in C-Kermit and Kermit 95 the command is SET PREFIXING CAUTIOUS or SET
  512.   PREFIXING ALL).
  513.  
  514. Packet Length
  515.   All legal packet lengths, 40-9020, are supported although a lower
  516.   maximum might be imposed on platforms where it is known that bigger ones
  517.   don't work.  When receiving, G-Kermit sends its receive packet length to
  518.   the sender, and the sender must not send packets any longer than this
  519.   length.  The default length for most platforms is 4000 and it may be
  520.   overridden with the -e command-line option.
  521.  
  522. Sliding Windows
  523.   G-Kermit does not support sliding windows.  Streaming is used instead.
  524.   If the other Kermit bids to use sliding windows, G-Kermit declines.
  525.  
  526. Streaming
  527.   If the terminal emulator's Kermit informs G-Kermit that it has a
  528.   reliable connection (such as TCP/IP or X.25), and the emulator's Kermit
  529.   supports streaming, then a special form of the Kermit protocol is used
  530.   in which data packets are not acknowledged; this allows the sender to
  531.   transmit a steady stream of (framed and checksummed) data to the
  532.   receiver without waiting for acknowledgements, allowing the fastest
  533.   possible transfers.  Streaming overcomes such obstacles as long round
  534.   trip delays, unnecessary retransmissions on slow network connections,
  535.   and most especially the TCP/IP Nagle and Delayed ACK heuristics which
  536.   are deadly to a higher-level ACK/NAK protocol.  When streaming is in use
  537.   on a particular connection, Kermit speeds are comparable to FTP.  The
  538.   drawback of streaming is that transmission errors are fatal; that's why
  539.   streaming is only used on reliable connections, which, by definition,
  540.   guarantee there will be no transmission errors.  However, watch out for
  541.   the relatively rare circumstance in which emulator thinks it has a
  542.   reliable connection when it doesn't -- for example a Telnet connection
  543.   to a terminal server, and a dialout from the terminal server to the
  544.   host.  Use the -S option on the command line to defeat streaming in such
  545.   situations.
  546.  
  547. Using all defaults on a TCP/IP connection on 10BaseT (10Mbps) Ethernet from
  548. a modern Kermit program like C-Kermit 7.0 or Kermit 95, typical transfer
  549. rates are 150-500Kcps.
  550.  
  551.  
  552. 11. PROBLEMS, BUGS, ERRORS
  553.  
  554. If file transfers fail:
  555.  
  556.  . Make sure your terminal emulator is not unprefixing control characters;
  557.    various control characters might cause trouble along the communication
  558.    path.  When in doubt, instruct the file sender to prefix all control
  559.    characters.
  560.  
  561.  . Make sure your Unix terminal is conditioned for the appropriate kind
  562.    of flow control.
  563.  
  564.  . Use command-line options to back off on performance and transparency;
  565.    use -S to disable streaming, -e to select a shorter packet length, -p
  566.    to select space or other parity, -b to increase or disable the timeout,
  567.    and/or establish the corresponding settings on your emulator.
  568.  
  569. When receiving files in text mode, G-Kermit strips all carriage returns,
  570. even if they aren't part of a CRLF pair.
  571.  
  572. If you have a TCP/IP connection (e.g. Telnet or Rlogin) to Unix from a
  573. terminal emulator whose Kermit protocol does not support streaming,
  574. downloads from G-Kermit are likely to be as much as 10 or even 100 times
  575. slower than uploads if the TCP/IP stack engages in Nagle or Delayed ACK
  576. heuristics; typically, when your terminal emulator's Kermit protocol sends
  577. an acknowledgment, the TCP stack holds on to it for (say) 1/5 second before
  578. sending it, because it is "too small" to send right away.
  579.  
  580. As noted in Section 9, the backup prefix is not guaranteed to be the highest
  581. number.  For example, if you have files oofa.txt, oofa.txt.~1~, and
  582. oofa.txt.~3~ in your directory, and a new oofa.txt file arrives, the old
  583. oofa.txt is backed up to oofa.txt.~2~, rather than oofa.txt.~4~ as you might
  584. expect.  This is because gkermit lacks directory reading capabilities, for
  585. reasons noted in Section 14, and without this, finding the highest existing
  586. backup number for a file is impractical.
  587.  
  588. If you send a file to G-Kermit with streaming active when the connection is
  589. not truly reliable, all bets are off.  A fatal error should occur promptly,
  590. but if huge amounts of data are lost, G-Kermit might never recognize a single
  591. data packet and therefore not diagnose a single error; yet your terminal
  592. emulator keeps sending packets since no acknowledgments are expected; the
  593. transfer eventually hangs at the end of file.  Use -S on G-Kermit's command
  594. line to disable streaming in situations where the terminal emulator requests
  595. it in error.
  596.  
  597. You can use G-Kermit's debug log for troubleshooting; this is useful mainly
  598. in conjunction with the source code.  But even if you aren't a C programmer,
  599. it should reveal any problem in enough detail to help pinpoint the cause of
  600. the failure.  "gkermit -d" (with no action options) writes a short debug.log
  601. file that shows the build options and settings.
  602.  
  603. The debug log is also a packet log; to extract the packets from it, use:
  604.  
  605.   grep ^PKT debug.log
  606.  
  607. Packets in the log are truncated to avoid wrap-around on your screen, and
  608. they have the Ctrl-A packet-start converted to ^ and A to avoid triggering
  609. a spurious autodownload when displaying the log on your screen.
  610.  
  611. In certain circumstances it is not desirable or possible to use -d to create
  612. a log file called debug.log in the current directory; for example, if you
  613. don't have write access to the current directory, or you already have a
  614. debug.log file that you want to keep (or transfer).  In this case, you can
  615. include a filename argument after -d:
  616.  
  617.   gkermit -d /tmp/testing.log -s *.c
  618.  
  619. (This is an exception to the rule that option arguments are not optional.)
  620.  
  621. If all else fails, you can contact the Kermit Project for technical support;
  622. see:
  623.  
  624.   http://www.columbia.edu/kermit/support
  625.  
  626. for instructions.
  627.  
  628.  
  629. 12. BUILDING G-KERMIT
  630.  
  631. G-Kermit is written to require the absolute bare minimum in system services
  632. and C-language features and libraries, and therefore should be portable to
  633. practically any Unix platform at all with any C compiler.
  634.  
  635. The source files are:
  636.  
  637.   makefile   The build procedure
  638.   gwart.c    Source code for a mini-lex substitute
  639.   gproto.w   G-Kermit protocol state machine to be preprocessed by gwart
  640.   gkermit.h  G-Kermit header file
  641.   gkermit.c  G-Kermit main module and routines
  642.   gcmdline.c G-Kermit command-line parser
  643.   gunixio.c  Unix-specific i/o routines
  644.  
  645. A simple makefile is provided, which can be used with make or gmake.  There
  646. are three main targets in the makefile:
  647.  
  648.   posix
  649.     Build for any POSIX.1 compliant platform (termios).  This is the
  650.     default target, used if you type "make" (or "gmake") alone.  This
  651.     target works for most modern Unixes, including GNU/Linux, FreeBSD,
  652.     OpenBSD, NetBSD, BSDI, HP-UX, Solaris, SunOS, Unixware, AIX, etc.
  653.  
  654.   sysv
  655.     Build for almost any AT&T System V platform (termio).  Examples
  656.     include AT&T Unix releases, e.g. for the AT&T 7300, HP-UX versions
  657.     prior to 7.00.
  658.  
  659.   bsd
  660.     Build for any BSD (pre-4.4) or Unix V7 platform (sgtty).  Examples
  661.     include NeXTSTEP 3.x, OSF/1, and 4.3BSD or earlier.
  662.  
  663. Note that the target names are all lowercase; "posix" is the default target
  664. (the one used if you just type "make").  If the build fails with a message
  665. like:
  666.  
  667.   gunixio.c: 65: Can't find include file termios.h
  668.   *** Error code 1
  669.  
  670. then try "make sysv" or "make bsd".  See the build list below for examples.
  671.  
  672. Some special build targets are also provided:
  673.  
  674.   sysvx
  675.     Like sysv but uses getchar()/putchar() for packet i/o rather than
  676.     buffered nonblocking read()/write(); this is necessary for certain
  677.     very old System V platforms (see description of USE_GETCHAR below).
  678.  
  679.   stty
  680.     When none of the other targets compiles successfully, try this one,
  681.     which runs the external stty program rather than trying to use
  682.     API calls to get/set terminal modes (system("stty raw -echo") and
  683.     system("stty -raw echo")).
  684.  
  685. Several maintenance/management targets are also included:
  686.  
  687.   clean
  688.     Remove object and intermediate files.
  689.  
  690.   install
  691.     Install gkermit (read the makefile before using this).
  692.  
  693.   uninstall
  694.     Uninstall gkermit from wherever "make install" installed it.
  695.  
  696. The default compiler is cc.  To override (e.g. to force the use of gcc on
  697. computers that have both cc and gcc installed, or that don't have cc), use:
  698.  
  699.   [g]make CC=gcc [<target>]
  700.  
  701. No other tools beyond make, the C compiler and linker, a short list of
  702. invariant header files, and the standard C library are needed or used.  The
  703. resulting binary should be 100K or less on all hardware platforms (and 64K
  704. or less on most; see list below).
  705.  
  706. You may also specify certain build options by including a KFLAGS clause on
  707. the make command line, e.g.:
  708.  
  709.   make "KFLAGS=-DSETXONXOFF -DEXTRADEBUG" sysv
  710.  
  711. By default, nonblocking buffered read() is used for packets; this technique
  712. works on most platforms but other options -- USE_GETCHAR and DUMBIO -- are
  713. provided when it doesn't work or when nonblocking i/o is not available.
  714.  
  715. The build options include:
  716.  
  717. __STDC__
  718.   Include this when the compiler requires ANSI prototyping but does
  719.   does not define __STDC__ itself.  Conversely, you might need to
  720.   include -U__STDC__ if the compiler defines __STDC__ but does not
  721.   support minimum ANSI features.
  722.  
  723. ULONG=long
  724.   Include this if compilation fails with "unknown type: unsigned long".
  725.  
  726. CHAR=char
  727.   Include this if compilation fails with "unknown type: unsigned char".
  728.  
  729. SMALL
  730.   Define this when building on or for a "small" platform, for example
  731.   a 16-bit architecture.
  732.  
  733. USE_GETCHAR
  734.   Specifies that packet i/o should be done with (buffered) getchar()
  735.   and putchar() rather than the default method of nonblocking,
  736.   internally buffered read() and write().  Use this only when G-Kermit
  737.   does not build or run otherwise, since if the default i/o code is
  738.   not used, G-Kermit won't be able to do streaming.
  739.  
  740. DUMBIO
  741.   Specifies that packet i/o should be done with blocking single-byte
  742.   read() and write().  Use this only when G-Kermit doesn't build or
  743.   run, even with USE_GETCHAR.
  744.  
  745. MAXRP=nnn
  746.   Change the maximum receive-packet length to something other than the
  747.   default, which is 9020.  You should change this only to make it smaller;
  748.   making it bigger is not supported by the Kermit protocol.
  749.  
  750. DEFRP=nnn
  751.   Change the default receive packet length to something other than the
  752.   default, which is 4000.  Making it any bigger than this is not advised.
  753.  
  754. TINBUFSIZ=nnn
  755.   On builds that use nonblocking buffered read(), override the default
  756.   input buffer size of 4080.
  757.  
  758. SETXONXOFF
  759.   On some platforms, mainly those based on System V R4 and earlier, it was
  760.   found that receiving files was impossible on TCP/IP connections unless
  761.   the terminal driver was told to use Xon/Xoff flow control.  If downloads
  762.   work but uploads consistently fail (or fail consistently whenever
  763.   streaming is used or the packet length is greater than a certain number
  764.   like 100, or 775), try adding this option.  When gkermit is built with
  765.   this option, it is equivalent to the user always giving the -x option on
  766.   the command line.  (Most versions of HP-UX need this; it is defined
  767.   automatically at compile time if __hpux is defined.)
  768.  
  769. SIG_V
  770.   The data type of signal handlers is void.  This is set automatically
  771.   for System V and POSIX builds.
  772.  
  773. SIG_I
  774.   The data type of signal handlers is int.  This is set automatically
  775.   for BSD builds.
  776.  
  777. NOGETENV
  778.   Add this to disable the feature in which G-Kermit gets options from
  779.   the GKERMIT environment variable.
  780.  
  781. NOSTREAMING
  782.   Add this to disable streaming.
  783.  
  784. EXTRADEBUG
  785.   This adds a lot (a LOT) of extra information to the debug log
  786.   regarding packet and character-level i/o.
  787.  
  788. FULLPACKETS
  789.   Show full packets in the debug log rather than truncating them.
  790.  
  791. Any compiler warnings should be harmless.  Examples include:
  792.  
  793. "Passing arg 2 of `signal' from incompatible pointer"
  794. (or "Argument incompatible with prototype"):
  795.   Because no two Unix platforms agree about signal handlers.  Harmless
  796.   because the signal handler does not return a value that is used.  We
  797.   don't want to open the door to platform-specific #ifdefs just to
  798.   silence this warning.  However, you can include -DSIG_I or -DSIG_V
  799.   on the CC command line to override the default definitions.
  800.  
  801. "<blah> declared but never used":
  802.   Some function parameters are not used because they are just placeholders
  803.   or compatibility items, or even required by prototypes in system headers.
  804.   Others might be declared in system header files (like mknod, lstat, etc,
  805.   which are not used by G-Kermit).
  806.  
  807. "Do you mean equality?":
  808.   No, in "while (c = *s++)" the assignment really is intentional.
  809.  
  810. "Condition is always true":
  811.   Yes, "while (1)" is always true.
  812.  
  813. "Flow between cases":
  814.   Intentional.
  815.  
  816. "No flow into statement":
  817.   In gproto.c, because it is a case statement generated by machine,
  818.   not written by a human.
  819.  
  820. The coding conventions are aimed at maximum portability.  For example:
  821.  . Only relatively short identifiers.
  822.  . No long character-string constants.
  823.  . Only #ifdef, #else, #endif, #define, and #undef preprocessor directives.
  824.  . Any code that uses ANSI features is enclosed in #ifdef __STDC__..#endif.
  825.  . No gmake-specific constructs in the makefile.
  826.  
  827. Here are some sample builds (December 1999):
  828.  
  829.  Platform                         Size  Target    Notes
  830.   Apple Mac OS X 1.0 gcc:          48K   posix    (AKA Rhapsody 5.5)
  831.   AT&T 3B2/300 SVR2 cc:            49K   sysv     (4)
  832.   AT&T 6300 PLUS cc:               58K   sysv     (6)
  833.   AT&T 7300 UNIX PC cc:            40K   sysv
  834.   AT&T 7300 UNIX PC gcc:           55K   sysv     (23K with shared lib)
  835.   BSDI 4.0.1 gcc:                  34K   posix
  836.   DEC 5000 MIPS Ultrix 4.3 cc:     99K   posix
  837.   DEC Alpha Digital UNIX 3.2 cc:   98K   bsd      (AKA OSF/1) (1)
  838.   DEC Alpha Tru64 UNIX 4.0e cc:    82K   bsd      (1)
  839.   DEC PDP-11 2.11BSD cc:           40K   bsd211   (7)
  840.   DG/UX 5.4R3.10 cc:               52K   posix
  841.   DG/UX 5.4R4.11 gcc:              51K   posix
  842.   DYNIX/ptx 4.4.2 cc:              43K   posix
  843.   FreeBSD 2.2.7 gcc:               41K   posix
  844.   FreeBSD 3.3 gcc:                 34K   posix
  845.   GNU/Linux RH 5.2 gcc:            35K   posix    (RH = Red Hat)
  846.   GNU/Linux RH 6.1 gcc:            44K   posix
  847.   GNU/Linux SW 3.5 gcc:            34K   posix    (SW = Slackware)
  848.   GNU/Linux SW 4.0 gcc:            36K   posix
  849.   GNU/Linux SW 7.0 gcc:            44K   posix
  850.   HP-UX 5.21 cc:                   55K   sysv     (2)
  851.   HP-UX 6.5 cc:                    40K   sysv     (5)
  852.   HP-UX 7.05 cc:                   50K   posix
  853.   HP-UX 8.00 gcc:                  33K   posix
  854.   HP-UX 9.05 cc:                   57K   posix
  855.   HP-UX 10.01 cc:                  57K   posix
  856.   HP-UX 10.20 cc:                  61K   posix
  857.   IBM AIX 3.2 IBM cc:              62K   posix
  858.   IBM AIX 4.1.1 IBM cc:            67K   posix
  859.   IBM AIX 4.3.2 IBM cc:            69K   posix
  860.   Motorola 88K SV/88 R4.3          42K   posix
  861.   Motorola 68K SV/68 R3.6          56K   sysv     (4)
  862.   NetBSD 1.4.1 gcc:                41K   posix
  863.   NeXTSTEP m68k 3.1 gcc:           77K   bsd      (3)
  864.   NeXTSTEP m68k 3.3 gcc:           78K   bsd      (3)
  865.   OpenBSD 2.5 gcc:                 47K   posix
  866.   QNX 4.25 cc:                     33K   posix
  867.   SCO XENIX 2.3.4 cc:              41K   sysv     (4)
  868.   SCO UNIX 3.2v4.2 cc:             73K   posix
  869.   SCO UNIX 3.2v4.2 gcc:            61K   posix
  870.   SCO ODT 3.0 cc:                  97K   posix
  871.   SCO OSR5.0.5 gcc:                42K   posix
  872.   SCO Unixware 2.1.3 cc:           38K   posix
  873.   SCO Unixware 7.0.1 cc:           37K   posix
  874.   SGI IRIX 5.3 cc:                 86K   posix
  875.   SGI IRIX 6.5.4 cc:               91K   posix
  876.   SINIX 5.42 MIPS cc:              57K   posix
  877.   Solaris 2.4 cc:                  50K   posix
  878.   Solaris 2.5.1 cc:                51K   posix
  879.   Solaris 2.6 cc:                  52K   posix
  880.   Solaris 7 cc:                    52K   posix
  881.   SunOS 4.1.3 cc:                  57K   posix
  882.   SunOS 4.1.3 gcc:                 64K   posix
  883.  
  884. Notes:
  885.  
  886. (1) "make posix" builds without complaint on OSF/1 (Digital UNIX (Tru64))
  887.     but it doesn't work -- i/o hangs or program dumps core.  "make bsd"
  888.     works fine.
  889.  
  890. (2) POSIX APIs not available in this antique OS (circa 1983).  Also due
  891.     to limited terminal input buffering capacity, streaming must be
  892.     disabled and relatively short packets must be used when receiving:
  893.     "gkermit -Se 250 -r".  However, it can use streaming when sending.
  894.  
  895. (3) POSIX APIs not available.
  896.  
  897. (4) On System V R3 and earlier, EWOULDBLOCK is not defined, so we use EGAIN
  898.     instead.  No special build procedures needed.
  899.  
  900. (5) Built with 'make -i "KFLAGS=-DDEFRP=512 -DUSE_GETCHAR" sysv'.  It can
  901.     be built without -DUSE_GETCHAR but doesn't work.
  902.  
  903. (6) Use 'make "CC=cc -Ml" "KFLAGS=-DUSE_GETCHAR sysv'.  It builds but
  904.     doesn't work, reason unknown, but probably because it was never designed
  905.     to be accessed remotely in the first place.
  906.  
  907. (7) This is a 16-bit architecture.  A special makefile target is needed
  908.     because its make program does not expand the $(CC) value when invoking
  909.     second-level makes.  Packet and buffer sizes are reduced to keep
  910.     static data within limits.  Overlays are not needed.
  911.  
  912.  
  913. 13. INSTALLING G-KERMIT
  914.  
  915. The makefile creates a binary called "gkermit".  Simply move this binary to
  916. the desired directory, such as /usr/local/bin.  It needs no special
  917. permissions other than read, write, and execute for the desired users and
  918. groups: no setuid, no setgid, or any other form of privilege.  It should be
  919. called "gkermit" and not "kermit", since "kermit" is the binary name for
  920. C-Kermit, and the two are likely to be installed side by side on the same
  921. computer; even when they are not, consistent naming is better for support
  922. and sanity purposes.  There is also a short man page:
  923.  
  924.   gkermit.nr
  925.  
  926. You can view it with:
  927.  
  928.   nroff -man gkermit.nr | more
  929.  
  930. Rename and store it appropriately.  In addition, this file itself (README)
  931. should be made available in a public documentation directory as:
  932.  
  933.   gkermit.txt
  934.  
  935. The makefile includes a SAMPLE 'install' target that does all this.  Please
  936. read it before use to be sure the appropriate directories and permissions
  937. are indicated.  There is also an 'uninstall' target to undo an installation.
  938. Obviously you need write access to the relevant directories before you can
  939. install or uninstall G-Kermit.
  940.  
  941.  
  942. 14. DESIGN AND IMPLEMENTATION NOTES
  943.  
  944. A primary objective in developing G-Kermit is that it can be released and
  945. used forever without constant updates to account for platform idiosyncracies
  946. and changes.  For this reason, certain features have been deliberately
  947. omitted:
  948.  
  949.  . File timestamps.  The methods for dealing with internal time formats
  950.    are notoriously unportable and also a moving target, especially now
  951.    with the 32-bit internal time format rollover looming in 2038 and the
  952.    time_t data type changing out from under us.  Furthermore, by excluding
  953.    any date-handling code, G-Kermit is automatically Y2K, 2038, and Y10K
  954.    compliant.
  955.  
  956.  . Internal wildcard expansion, recursive directory traversal, etc.  Even
  957.    after more than 30 years, there is still no standard and portable
  958.    service in Unix for this.
  959.  
  960.  . Hardware flow control, millisecond sleeps, nondestructive input buffer
  961.    peeking, threads, select(), file permissions, etc etc.
  962.  
  963. Other features are omitted to keep the program small and simple, and to
  964. avoid creeping featurism:
  965.  
  966.  . Sliding windows.  This technique is more complicated than streaming but
  967.    not as fast, and furthermore would increase the program size by a
  968.    factor of 5 or 10 due to buffering requirements.
  969.  
  970.  . An interactive command parser and scripting language (because users
  971.    always want more and more commands and features).
  972.  
  973.  . Character set conversion (because users always want more and more
  974.    character sets).  Adding character set support would increase the
  975.    program size by a factor of 2 to 4, depending on the selection of sets.
  976.  
  977.  . Making connections (because this requires huge amounts of tricky and
  978.    unstable high-maintenance platform- and device-specific code for serial
  979.    ports, modems, modem signals, network stacks, etc).
  980.  
  981. All of the above can be found in C-Kermit, which is therefore bigger and
  982. more complicated, with more platform-specific code and #ifdef spaghetti.
  983. C-Kermit requires constant updates and patches to keep pace with changes in
  984. the underlying platforms, networking methods, and demands from its users for
  985. more features.
  986.  
  987. The goal for G-Kermit, on the other hand, is simplicity and stability, so we
  988. don't need thousands of #ifdefs like we have in C-Kermit, and we don't need
  989. to tweak the code every time a new release of each Unix variety comes out.
  990. G-Kermit is meant to be PORTABLE and LONG-LASTING so the stress is on a
  991. MINIMUM of platform dependencies.
  992.  
  993. If you make changes, please try to avoid adding anything platform-dependent
  994. or in any other way destabilizing.  Bear in mind that the result of your
  995. changes should still build and run successfully on at least all the
  996. platforms where it was built originally.  In any case, you are encouraged to
  997. send any changes back to the Kermit Project to be considered for addition to
  998. the master G-Kermit distribution.
  999.  
  1000.  
  1001. 15. FURTHER INFORMATION
  1002.  
  1003. The Kermit protocol is specified in "Kermit, A File Transfer Protocol" by
  1004. Frank da Cruz, Digital Press (1987).  A correctness proof of the Kermit
  1005. protocol appears in "Specification and Validation Methods", edited by Egon
  1006. Boerger, Oxford University Press (1995).  "Using C-Kermit" by Frank da Cruz
  1007. and Christine M. Gianone, Digital Press (1997, or later edition) explains
  1008. many of the terms and techniques referenced in this document in case you are
  1009. not familiar with them, and also includes tutorials on data communications,
  1010. extensive troubleshooting and performance tips, etc.  Various other books on
  1011. Kermit are available from Digital Press.  Online resources include:
  1012.  
  1013.   http://www.columbia.edu/kermit/    The Kermit Project website
  1014.   comp.protocols.kermit.misc         The unmoderated Kermit newsgroup
  1015.   kermit-support@columbia.edu        Technical support
  1016.  
  1017. Also visit:
  1018.  
  1019.   http://www.columbia.edu/kermit/gkermit.html
  1020.  
  1021. for a more up-to-date version of this file, complete with download links.
  1022.  
  1023. (End of G-Kermit README)
  1024.