home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / old / ckermit4f / ckuker.mss < prev    next >
Text File  |  2020-01-01  |  104KB  |  2,273 lines

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