ckcbwr.txt 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390
  1. The Kermit Project
  2. Columbia University
  3. 612 West 115th Street
  4. New York NY 10025 USA
  5. kermit@columbia.edu
  6. ...since 1981
  7. As of: C-Kermit 9.0.300, 30 June 2011
  8. This page last updated: Tue Jun 28 08:54:30 2011 (New York USA Time)
  9. IF YOU ARE READING A PLAIN-TEXT version of this document, it is a
  10. plain-text dump of a Web page. You can visit the original (and
  11. possibly more up-to-date) Web page here:
  12. http://www.columbia.edu/kermit/ckcbwr.html
  13. This document contains platform-independent C-Kermit hints and tips.
  14. Also see the platform-specific C-Kermit hints and tips document for
  15. your platform, for example:
  16. http://www.columbia.edu/kermit/ckubwr.html
  17. for Unix. This document also applies to Kermit 95 for Windows,
  18. which is based on C-Kermit.
  19. CONTENTS
  20. 0. PATCHES
  21. 1. INCOMPATIBLE CHANGES
  22. 2. THE C-KERMIT COMMAND PARSER
  23. 3. MULTIPLE SESSIONS
  24. 4. NETWORK CONNECTIONS
  25. 5. MODEMS AND DIALING
  26. 6. DIALING HINTS AND TIPS
  27. 7. TERMINAL SERVERS
  28. 8. TERMINAL EMULATION
  29. 9. KEY MAPPING
  30. 10. FILE TRANSFER
  31. 11. SCRIPT PROGRAMMING
  32. 0. PATCHES
  33. Source-level patches for C-Kermit 8.0.211:
  34. (None)
  35. 1. INCOMPATIBLE CHANGES
  36. These are not necessarily exhaustive lists.
  37. 1.1. C-Kermit 6.0
  38. C-Kermit 6.0 was released 6 September 1996 and is completely documented
  39. in Using C-Kermit, 2nd Edition. The following incompatible changes
  40. were made in C-Kermit 6.0:
  41. * Unless you tell C-Kermit otherwise, if a serial or network
  42. connection seems to be open, and you attempt to EXIT or to open a
  43. new connection, C-Kermit warns you that an active connection
  44. appears to be open and asks you if you really want to close it. If
  45. you do not want these warnings, add SET EXIT WARNING OFF to your
  46. customization file or script, or give this command at the prompt.
  47. * The default for SET { SEND, RECEIVE } PATHNAMES was changed from ON
  48. to OFF, to prevent unexpected creation of directories and
  49. depositing of incoming files in places you might not know to look.
  50. * The default for SET FILE INCOMPLETE was changed from DISCARD to
  51. KEEP to allow for file transfer recovery.
  52. * The default file-transfer block-check is now 3, rather than 1. If
  53. the other Kermit does not support this, the two will drop back to
  54. type 1 automatically unless the other Kermit fails to follow the
  55. protocol specification.
  56. * The default flow-control is now "auto" ("do the right thing for
  57. each type of connection"), not Xon/Xoff.
  58. * Backslash (\) is no longer a command continuation character. Only -
  59. (hyphen, dash) may be used for this in C-Kermit 6.0 and later.
  60. * Negative INPUT timeout now results in infinite wait, rather than 1
  61. second.
  62. 1.2. C-Kermit 7.0
  63. C-Kermit 7.0 was released 1 January 2000. Its new features are
  64. documented in the C-Kermit 7.0 Supplement,
  65. http://www.columbia.edu/kermit/ckermit2.html. The following
  66. incompatible changes were made in C-Kermit 7.0:
  67. * The "multiline GET" command is gone. Now use either of the
  68. following forms instead:
  69. get remote-name local-name
  70. get /as-name:local-name remote-name
  71. If either name contains spaces, enclose it in braces (or, in
  72. C-Kermit 8.0, doublequotes).
  73. * To include multiple file specifications in a GET command, you must
  74. now use MGET rather than GET:
  75. mget file1 file2 file3 ...
  76. * C-Kermit 7.0 and later use FAST Kermit protocol settings by
  77. default. This includes "unprefixing" of certain control characters.
  78. Because of this, file transfers that worked with previous releases
  79. might not work in the new release especially against a
  80. non-Kermit-Project Kermit protocol implementation (but it is more
  81. likely that they will work, and much faster). If a transfer fails,
  82. you'll get a context-sensitive hint suggesting possible causes and
  83. cures. Usually SET PREFIXING ALL does the trick.
  84. * By default C-Kermit 7.0 and later send files in text or binary mode
  85. by looking at each file to see which is the appropriate mode. To
  86. restore the previous behavior, put SET TRANSFER MODE MANUAL and the
  87. desired SET FILE TYPE (TEXT or BINARY) in your C-Kermit
  88. initialization file.
  89. * The RESEND and REGET commands automatically switch to binary mode;
  90. previously if RESEND or REGET were attempted when FILE TYPE was
  91. TEXT, these commands would fail immediately, with a message telling
  92. you they work only when the FILE TYPE is BINARY. Now they simply do
  93. this for you.
  94. * SET PREFIXING CAUTIOUS and MINIMAL now both prefix linefeed (10 and
  95. 138) in case rlogin, ssh, or cu are "in the middle", since
  96. otherwise <LF>~ might appear in Kermit packets, and this would
  97. cause rlogin, ssh, or cu to disconnect, suspend,escape back, or
  98. otherwise wreck the file transfer. Xon and Xoff are now always
  99. prefixed too, even when Xon/Xoff flow control is not in effect,
  100. since unprefixing them has proven dangerous on TCP/IP connections.
  101. * In UNIX, VMS, Windows, and OS/2, the DIRECTORY command is built
  102. into C-Kermit itself rather than implemented by running an external
  103. command or program. The built-in command might not behave the way
  104. the platform-specific external one did, but many options are
  105. available for customization. Of course the underlying
  106. platform-specific command can still be accessed with "!", "@", or
  107. "RUN" wherever the installation does not forbid. In UNIX, the "ls"
  108. command can be accessed directly as "ls" in C-Kermit.
  109. * SEND ? prints a list of switches rather than a list of filenames.
  110. If you want to see a list of filenames, use a (system-dependent)
  111. construction such as SEND ./? (for UNIX, Windows, or OS/2), SEND
  112. []? (VMS), etc.
  113. * In UNIX, OS-9, and Kermit 95, the wildcard characters in previous
  114. versions were * and ?. In C-Kermit 7.0 they are *, ?, [, ], {, and
  115. }, with dash used inside []'s to denote ranges and comma used
  116. inside {} to separate list elements. If you need to include any of
  117. these characters literally in a filename, precede each one with
  118. backslash (\).
  119. * SET QUIET { ON, OFF } is now on the command stack, just like SET
  120. INPUT CASE, SET COUNT, SET MACRO ERROR, etc, as described on p.458
  121. of Using C-Kermit, 2nd Edition. This allows any macro or
  122. command file to SET QUIET ON or OFF without worrying about saving
  123. and restoring the global QUIET value. For example, this lets you
  124. write a script that tries SET LINE on lots of devices until it
  125. finds one free without spewing out loads of error messages, and
  126. also without disturbing the global QUIET setting, whatever it was.
  127. * Because of the new "." operator (which introduces assignments),
  128. macros whose names begin with "." can not be invoked "by name".
  129. However, they still can be invoked with DO or \fexecute().
  130. * The syntax of the EVALUATE command has changed. To restore the
  131. previous syntax, use SET EVALUATE OLD.
  132. * The \v(directory) variable now includes the trailing directory
  133. separator; in previous releases it did not. This is to allow
  134. constructions such as:
  135. cd \v(dir)data.tmp
  136. to work across platforms that might have different directory
  137. notation, such as UNIX, Windows, and VMS.
  138. * Prior to C-Kermit 7.0, the FLOW-CONTROL setting was global and
  139. sticky. In C-Kermit 7.0, there is an array of default flow-control
  140. values for each kind of connection, that are applied automatically
  141. at SET LINE/PORT/HOST time. Thus a SET FLOW command given before
  142. SET LINE/PORT/HOST is likely to be undone. Therefore SET FLOW can
  143. be guaranteed to have the desired effect only if given after the
  144. SET LINE/PORT/HOST command.
  145. * Character-set translation works differently in the TRANSMIT command
  146. when (a) the file character-set is not the same as the local end of
  147. the terminal character-set, or (b) when the terminal character-set
  148. is TRANSPARENT.
  149. 1.3. C-Kermit 8.0
  150. The following incompatible changes were made in C-Kermit 8.0:
  151. * C-Kermit now accepts doublequotes in most contexts where you
  152. previously had to use braces to group multiple words into a single
  153. field, or to force inclusion of leading or trailing blanks. This
  154. might cause problems in contexts where you wanted the doublequote
  155. characters to be taken literally. Consult Section 5 of the
  156. C-Kermit 8.0 Update Notes for further information.
  157. * Using the SET HOST command to make HTTP connections is no longer
  158. supported. Instead, use the new HTTP OPEN command.
  159. 1.4. C-Kermit 9.0
  160. The \fsplit() function is incredibly handy, it can do almost
  161. anything, up to and including parsing a LISP program (the underlying
  162. code is the basis of the S-Expression interpreter). But did you
  163. ever try to use it to parse (say) a Tab-Separated-List (TSV file) or
  164. Comma-Separated-List (CSV)? It works as expected as long as the data
  165. contains only 7-bit characters. But if your data contains (say) Spanish
  166. or German or Russian text written in an 8-bit character set such as ISO
  167. 8859-1, every 8-bit character (any value 128-255) is treated as a break
  168. character. This is fixed in C-Kermit 9.0 by treating all 8-bit bytes as
  169. "include" characters rather than break characters, a total reversal of
  170. past behavior. I don't think it will affect anyone though, because if
  171. this had happened to anyone, I would have heard about it!
  172. Since most standard 8-bit character sets have control characters in
  173. positions 128-160, it might have made sense to keep 128-160 in the
  174. break set, but with the proliferation of Microsoft Windows code pages,
  175. there is no telling which 8-bit character is likely to be some kind of
  176. text, e.g. "smart quotes" or East European or Turkish accented letters.
  177. 2. THE C-KERMIT COMMAND PARSER
  178. Various command-related limits are shown in the following table, in
  179. which the sample values are for a "large memory model" build of
  180. C-Kermit, typical for modern platforms (Linux, Solaris, AIX, VMS, etc).
  181. You can see the values for your version of Kermit by giving the SHOW
  182. FEATURES command. The maximum length for a Kermit command (CMDBL) also
  183. determines the maximum length for a macro definition, since DEFINE is
  184. itself a command. The maximum length for a variable name is between 256
  185. and 4096 characters, depending on the platform; for array declarations
  186. and references, that includes the subscript.
  187. Item Symbol Sample
  188. Value Definition
  189. Number of characters in a command CMDBL 32763 ckucmd.h
  190. Number of chars in a field of a command ATMBL 10238 ckucmd.h
  191. Nesting level for command files MAXTAKE 54 ckuusr.h
  192. Nesting level for macros MACLEVEL 128 ckuusr.h
  193. Nesting level for FOR / WHILE loops FORDEPTH 32 ckuusr.h
  194. Number of macros MAC_MAX 16384 ckuusr.h
  195. Size of INPUT buffer INPBUFSIZ 4096 ckuusr.h
  196. Maximum files to match a wildcard MAXWLD 102400 ckcdeb.h
  197. Filespecs in MSEND command MSENDMAX 1024 ckuusr.h
  198. Length for GOTO target label LBLSIZ 50 ckuusr.h
  199. \fexecute() recursion depth limit CMDDEP 64 ckucmd.h
  200. If you need to define a macro that is longer than CMDBL, you can break
  201. the macro up into sub-macros or rewrite the macro as a command file. In
  202. a pinch you can also redefine CMDBL and recompile C-Kermit. All of
  203. these numbers represent tradeoffs: the bigger the number, the more
  204. "powerful" Kermit in the corresponding area, but also the bigger the
  205. program image and possibly disk footprint, and the longer it takes to
  206. load and initialize.
  207. In the interactive command parser:
  208. * EMACS- or VI-style command line editing is not supported.
  209. * Editing keys are hardwired (Ctrl-U, Ctrl-W, etc).
  210. If you interrupt C-Kermit before it has issued its first prompt, it
  211. will exit. This means that you cannot interrupt execution of the
  212. initialization file, or of an "application file" (file whose name is
  213. given as the first command-line argument), or of an alternative
  214. initialization file ("-y filename"), and get to the prompt. There is,
  215. however, one exception to this rule: you *can* interrupt commands --
  216. including TAKE commands -- given in the '-C "command list"'
  217. command-line argument and -- if there were no action commands among the
  218. command-line arguments -- you will be returned to the C-Kermit prompt.
  219. So, for example, if you want to start C-Kermit in such a way that it
  220. executes a command file before issuing its first prompt, and you also
  221. want to be able to interrupt the command file and get to the prompt,
  222. include a TAKE command for the desired command in the -C argument, for
  223. example:
  224. kermit -C "take dial.scr"
  225. At the command prompt, if you use the backslash (\) prefix to enter a
  226. control character, space, or question mark into a command literally,
  227. the backslash disappears and is replaced by the quoted character. If it
  228. was a control character, it is shown as a circumflex (^). This allows
  229. editing (backspace, delete, Ctrl-W) to work correctly even for control
  230. characters.
  231. Priot to C-Kermit 8.0, the only way to include a comma literally in a
  232. macro definition -- as opposed to having it separate commands within
  233. the definition -- is to enter its ASCII value (44) in backslash
  234. notation, e.g.:
  235. DEFINE ROWS RUN MODE CO80\{44}\%1
  236. In C-Kermit 8.0 you can use constructions like this:
  237. DEFINE ROWS RUN MODE "CO80,\%1"
  238. If you quote special characters in a filename (e.g. in the SEND
  239. command), filename completion may seem to work incorrectly. For
  240. example, if you have a file whose name is a*b (the name really contains
  241. an asterisk), and you type "send a\\*<ESC>", the "b" does not appear,
  242. nor will Ctrl-R redisplay the completed name correctly. But internally
  243. the file name is recognized anyway.
  244. Question-mark help does not work during execution of an ASKQ command.
  245. The question marks are simply accepted as text.
  246. In OUTPUT commands only, \B sends a BREAK signal, \L sends a Long BREAK
  247. signal, and \N sends a NUL (ASCII 0). BREAK and Long BREAK are special
  248. signals, not characters, and NUL is a character that normally cannot be
  249. included in a C string, since it is the C string terminator. If you
  250. really want to output a backslash followed by a B, an L, or an N (as is
  251. needed to configure certain modems, etc), double the backslash, e.g.
  252. "output \\B". In C-Kermit 7.0 or later, you can disarm and re-arm the
  253. special OUTPUT-command escapes (\B, \L, and \N) with SET OUTPUT
  254. SPECIAL-ESCAPES { OFF, ON }.
  255. When using the command-line processor ("kermit -l /dev/tty00 -b 19200",
  256. etc), note that in some cases the order of the command-line options
  257. makes a difference, contrary to the expectation that order of
  258. command-line options should not matter. For example, the -b option must
  259. be given after the -l option if it is to affect the device specified in
  260. the -l option.
  261. 3. MULTIPLE SESSIONS
  262. C-Kermit 7.0 and earlier do not support multiple sessions. When you SET
  263. LINE (or SET PORT, same thing) to a new device, or SET HOST to a new
  264. host, the previous SET LINE device or network host connection is
  265. closed, resulting in hangup of the modem or termination of the network
  266. connection. In windowing environments like HP-VUE, NeXTSTEP, Windows,
  267. OS/2, etc, you can run separate copies of Kermit in different windows
  268. to achieve multiple sessions.
  269. To achieve multiple sessions through a single serial port (e.g. when
  270. dialing up), you can install SLIP or PPP on your computer and then use
  271. C-Kermit's TCP/IP support over the SLIP or PPP connection, assuming you
  272. also have TCP/IP networking installed on your computer.
  273. C-Kermit 8.0 has the same restriction on SET LINE and SET HOST
  274. sessions: only one regular session (dialout, Telnet, etc) can be open
  275. at a time. However, version 8.0 adds two new kinds of sessions: FTP and
  276. HTTP; one or both of these can be open at the same as a regular
  277. session.
  278. 4. NETWORK CONNECTIONS
  279. FTP Client Bugs
  280. The Unix C-Kermit 8.0.206 FTP client had the following bugs at the time
  281. most of the 8.0.206 binaries were built for the C-Kermit 8.0 CDROM:
  282. 1. FTP MGET fails when directory segments contain wildcards, as in
  283. "ftp mget */data/*.dat". Work around by doing a separate MGET for
  284. each source directory.
  285. 2. FTP MGET can fail or produce random side effects if you have a
  286. TMPDIR or CK_TMP environment variable definition in effect, or a
  287. SET TEMP-DIRECTORY value, longer than 7 characters. Work around by
  288. giving a SET TEMP-DIRECTORY command with a short value, such as
  289. "/tmp".
  290. These two bugs are fixed in the source code that is included on the
  291. CDROM, and also in Kermit 95 2.1.1. You can tell if a C-Kermit 8.0.206
  292. binary has these fixes by typing SHOW VERSION; if it says "FTP Client,
  293. 8.0.200, 24 Oct 2002" it has the fixes; if the edit number is less that
  294. 200, it doesn't, in which case can build a new binary from the source
  295. code (or contact us and we'll try to get get one for you).
  296. Making TCP/IP Connections Can Take a Long Time
  297. The most frequently asked question in many newsgroups is "Why does it
  298. take such a long time to make a Telnet connection to (or from) my
  299. (e.g.) Linux PC?" (this applies to Kermit as well as to regular Telnet
  300. clients):
  301. 1. Most Telnet servers perform reverse DNS lookups on the client for
  302. security and/or logging reasons. If the Telnet client's host cannot
  303. be found by the server's local DNS server, the DNS request goes out
  304. to the Internet at large, and this can take quite some time. The
  305. solution to this problem is to make sure that both client and host
  306. are registered in DNS.
  307. 2. C-Kermit itself performs reverse DNS lookups unless you tell it not
  308. to. This is to allow C-Kermit to let you know which host it is
  309. actually connected to in case you have made a connection to a "host
  310. pool" (multihomed host). You can disable C-Kermit's reverse DNS
  311. lookup with SET TCP REVERSE-DNS-LOOKUP OFF.
  312. 3. C-Kermit 7.0 and later strictly enforce Telnet protocol rules. One
  313. such rule is that certain negotiations must be responded to. If
  314. C-Kermit sends a such a negotiation and the host does not respond,
  315. C-Kermit waits a long time for the reply (in case the network is
  316. congested or the host is slow), but eventually will time out. To
  317. eliminate the waits (and therefore risk possible protocol
  318. mismatches -- or worse -- between Telnet client and server), tell
  319. C-Kermit to SET TELNET WAIT OFF (or include the /NOWAIT switch with
  320. the TELNET command).
  321. The Rlogin Client
  322. In multiuser operating systems such as UNIX and VMS, TCP/IP Rlogin
  323. connections are available only to privileged users, since "login" is a
  324. privileged socket. Assuming you are allowed to use it in the first
  325. place, it is likely to behave differently depending on what type of
  326. host you are rlogging in to, due to technical reasons having to do with
  327. conflicting interpretations of RFC793 (Out-Of-Band Data) and Rlogin
  328. (RFC1122)... "Specifically, the TCP urgent pointer in BSD points to the
  329. byte after the urgent data byte, and an RFC-compliant TCP urgent
  330. pointer points to the urgent data byte. As a result, if an application
  331. sends urgent data from a BSD-compatible implementation to an
  332. RFC-1122 compatible implementation then the receiver will read the
  333. wrong urgent data byte (it will read the byte located after the correct
  334. byte in the data stream as the urgent data byte)." Rlogin requires the
  335. use of OOB data while Telnet does not. Therefore, it is possible for
  336. Telnet to work between all systems while BSD and System V TCP/IP
  337. implementations are almost always a bad mix.
  338. The Telnet Client
  339. On a TCP/IP TELNET connection, you should normally have PARITY set to
  340. NONE and (except in VMS C-Kermit) FLOW-CONTROL also set to NONE. If
  341. file transfer does not work with these settings (for example, because
  342. the remote TELNET server only gives a 7-bit data path), use SET PARITY
  343. SPACE. Do not use SET PARITY MARK, EVEN, or ODD on a TELNET connection
  344. -- it interferes with TELNET protocol.
  345. If echoing does not work right after connecting to a network host or
  346. after dialing through a TCP/IP modem server, it probably means that the
  347. TELNET server on the far end of the connection is executing the TELNET
  348. protocol incorrectly. After initially connecting and discovering
  349. incorrect echoing (characters are echoed twice, or not at all), escape
  350. back, give the appropriate SET DUPLEX command (FULL or HALF), and then
  351. CONNECT again. For a consistently misbehaving connection, you can
  352. automate this process in a macro or TAKE file.
  353. TELNET sessions are treated just like serial communications sessions as
  354. far as "terminal bytesize" and "command bytesize" are concerned. If you
  355. need to view and/or enter 8-bit characters during a TELNET session, you
  356. must tell C-Kermit to SET TERMINAL BYTESIZE 8, SET COMMAND BYTESIZE 8,
  357. and SET PARITY NONE.
  358. If you SET TELNET DEBUG ON prior to making a connection, protocol
  359. negotiations will be displayed on your screen. You can also capture
  360. them in the debug log (along with everything else) and then extract
  361. them easily, since all Telnet negotiations lines begin with (uppercase)
  362. "TELNET".
  363. The SSH Client
  364. C-Kermit does not have its own built-in SSH client; instead, in the
  365. Unix tradition, uses the external SSH client to do the SSH part, and
  366. Kermit does its thing on top -- file transfer, scripting, etc. Under
  367. certain circumstances that have not yet been identified, it sometimes
  368. happens that after making an SSH connection from C-Kermit, logging out
  369. from the remote host, and popping back to the local C-Kermit program,
  370. subsequent SSH commands file with a message like "Network type not
  371. supported". Starting a new copy of C-Kermit is the workaround.
  372. 5. MODEMS AND DIALING
  373. External modems are recommended because:
  374. * They don't need any special drivers.
  375. * They are less likely to interfere with normal operation of your
  376. computer.
  377. * You can use the lights and speaker to troubleshoot dialing.
  378. * You can share them among all types of computers.
  379. * You can easily turn them off and on when power-cycling seems
  380. warranted.
  381. * They are more likely to have manuals.
  382. Modems can be used by C-Kermit only when they are visible as or through
  383. a regular serial port device. Certain modems can not be used in this
  384. normal way on many kinds of computers: Winmodems, RPI modems,
  385. Controllerless modems, the IBM Mwave, etc; all of these require special
  386. drivers that perform some, most, or all of the modem's functions in
  387. software. Such drivers are generally NOT available in UNIX or other
  388. non-Windows (or non-OS/2, in the case of the Mwave) platforms.
  389. In order to dial a modem, C-Kermit must know the modem's repertoire of
  390. commands and responses. Each modem make and model is likely to have a
  391. different repertoire. Since Kermit has no way of knowing which kind of
  392. modem will be dialed, normally you have to tell it with a SET MODEM
  393. TYPE command, e.g.:
  394. set modem type usrobotics
  395. set line /dev/cua0
  396. set speed 57600
  397. dial 7654321
  398. In the early days, there was a wide variety of modems and command
  399. languages. Nowadays, almost every modem uses the Hayes AT command set
  400. (but with some differences in the details) and its startup
  401. configuration includes error correction, data compression, and hardware
  402. (RTS/CTS) flow control. As long as C-Kermit is capable of hardware flow
  403. control (as it is on many, but not all, the platforms where it runs,
  404. since some operating systems don't support it), the modem can be dialed
  405. immediately, without lengthy configuration dialogs, and in fact this is
  406. what SET MODEM TYPE GENERIC-HIGH-SPEED does. In C-Kermit 8.0,
  407. GENERIC-HIGH-SPEED has become the default modem type, so now it is
  408. usually possible to SET LINE, SET SPEED, and DIAL without having to
  409. identify your modem. If this doesn't work, of course, then you might
  410. have to fall back to the traditional method: Give a SET MODEM TYPE for
  411. a specific modem first, then SET LINE, SET SPEED, and DIAL.
  412. An important change in C-Kermit 6.0 is that when you give a SET MODEM
  413. TYPE command to tell Kermit what kind of modem you have, Kermit also
  414. sets a number of other modem-related parameters automatically from its
  415. internal modem database. Thus, the order in which you give
  416. modem-related commands is significant, whereas in prior releases they
  417. could be given in any order.
  418. In particular, MODEM SPEED-MATCHING is set according to whether the
  419. modem is known to be capable of speed buffering. SET MODEM TYPE
  420. HAYES-2400 automatically turns SPEED-MATCHING ON, because when the
  421. Hayes 2400 reports a particular speed in its CONNECT message, that
  422. means its interface speed has changed to that speed, and C-Kermit's
  423. must change accordingly if it is to continue communicating. This might
  424. cause some confusion if you use "set modem type hayes" for dialing a
  425. more advanced type of modem.
  426. The new default for flow control is "auto", meaning "do the right thing
  427. for each type of connection". So (for example) if your version of
  428. C-Kermit supports SET FLOW RTS/CTS and your modem also supports
  429. RTS/CTS, then Kermit automatically sets its flow control to RTS/CTS and
  430. set modem's flow control to RTS/CTS too before attempting to use the
  431. modem.
  432. For these reasons, don't assume that "set modem type hayes" should be
  433. used for all modems that uses the Hayes AT command set. "set modem type
  434. hayes" really does mean Hayes 1200 or 2400, which in turn means no
  435. hardware flow control, and no speed buffering. This choice will rarely
  436. work with a modern high-speed modem.
  437. 6. DIALING HINTS AND TIPS
  438. If you have a high-speed, error-correcting, data-compressing,
  439. speed-buffering modem, you should fix the modem's interface speed as
  440. high as possible, preferably (at least) four times higher than its
  441. maximum connection (modulation) speed to allow compression to work at
  442. full advantage. In this type of setup, you must also have an effective
  443. means of flow control enabled between C-Kermit and the modem,
  444. preferably hardware (RTS/CTS) flow control. On platforms that do not
  445. support hardware flow control, it is usually possible to select
  446. software flow control (Xon/Xoff), and C-Kermit will do its best to set
  447. the modem for local Xon/Xoff flow control too (but then, of course,
  448. Ctrl-S and Ctrl-Q characters can not be transmitted on the connection).
  449. If you are having trouble dialing your modem, SET DIAL DISPLAY ON to
  450. watch the dialing interactions between C-Kermit and your modem. Consult
  451. Chapters 3-4 of Using C-Kermit (2nd Ed) for modem-dialing
  452. troubleshooting instructions. The following sections offer some
  453. additional hints and tips.
  454. 6.1. Syntax
  455. If you want to dial a number that starts with #, you'll need to quote
  456. the "#" character (as \# or \{35}), since it is also a comment
  457. introducer:
  458. C-Kermit>dial #98765421-1-212-5551212 ; Looks like a comment
  459. ?You must specify a number to dial
  460. C-Kermit>dial \#98765421-1-212-5551212 ; Works OK
  461. C-Kermit>dial =#98765421-1-212-5551212 ; This works too
  462. When using a dialing directory, remember what happens if a name is not
  463. found:
  464. C-Kermit>dial xyzcorp
  465. Lookup: "xyzcorp" - not found - dialing as given
  466. This normally does no harm, but some modems might behave strangely when
  467. given dial strings that contain certain letters. For example, a certain
  468. German modem treats any dial string that contains the letter "s" as a
  469. command to fetch a number from its internal list, and replies OK to the
  470. ATD command, which is normally not a valid response except for partial
  471. dialing. To avoid this situation, use:
  472. lookup xyzcorp
  473. if success dial
  474. 6.2. The Carrier Signal
  475. Remember: In many C-Kermit implementations (depending on the underlying
  476. operating system -- mostly Windows, OS/2, and System-V-based UNIX
  477. versions, and in C-Kermit 7.0, also VMS), you can't CONNECT to a modem
  478. and type the modem's dialing command (like "ATDT7654321") manually,
  479. unless you first tell C-Kermit to:
  480. SET CARRIER-WATCH OFF
  481. This is because (in these implementations), the CONNECT command
  482. requires the modem's Carrier Detect (CD) signal to be on, but the CD
  483. signal doesn't come on until after dialing is complete. This
  484. requirement is what allows C-Kermit to pop back to its prompt
  485. automatically when the connection is hung up. See the description of
  486. SET CARRIER-WATCH in "Using C-Kermit".
  487. Similarly, if your dialed connection drops when CARRIER-WATCH is set to
  488. AUTO or ON, you can't CONNECT back to the (now disconnected) screen to
  489. see what might have happened unless you first SET CARRIER-WATCH OFF.
  490. But sometimes not even SET CARRIER-WATCH OFF will help in this
  491. situation: certain platforms (for example Unixware 2.1), once carrier
  492. drops, won't let the application do i/o with the device any more. In
  493. that case, if you want to use the device again, you have to CLOSE it
  494. and OPEN it again. Or you can have Kermit do this for you automatically
  495. by telling it to SET CLOSE-ON-DISCONNECT ON.
  496. 6.3. Dialing and Flow Control
  497. Don't SET FLOW RTS/CTS if your modem is turned off, or if it is not
  498. presenting the CTS signal. Otherwise, the serial device driver can get
  499. stuck waiting for this signal to appear.
  500. Most modern modems support RTS/CTS (if they support any hardware flow
  501. control at all), but some computers use different RS-232 circuits for
  502. the same purposes, e.g. DTR and CD, or DTR and CTS. In such cases, you
  503. might be able to make your computer work with your modem by
  504. appropriately cross-wiring the circuits in the cable connector, for
  505. example the computer's DTR to the modem's RTS, and modem's CD to the
  506. computer's CTS. HOWEVER, C-Kermit does not know you have done this. So
  507. if you have (say) SET FLOW DTR/CD, C-Kermit will make no attempt to
  508. tell the modem to use RTS/CTS. You probably did this yourself when you
  509. configured the modem.
  510. 6.4. The Dial Timeout
  511. If it takes your call longer to be completed than the timeout interval
  512. that C-Kermit calculates, you can use the SET DIAL TIMEOUT command to
  513. override C-Kermit's value. But beware: the modem has its own timeout
  514. for completing the call. If it is a Hayes-like modem, C-Kermit adjusts
  515. the modem's value too by setting register S7. But the maximum value for
  516. S7 might be smaller than the time you need! In that case, C-Kermit sets
  517. S7 to 0, 255, or other (modem-specific) value to signify "no timeout".
  518. If Kermit attempts to set register S7 to a value higher than your
  519. modem's maximum, the modem will say "ERROR" and you will get a "Failure
  520. to initialize modem" error. In that case, use SET DIAL TIMEOUT to
  521. override C-Kermit's calculation of the timeout value with the highest
  522. value that is legal for your modem, e.g. 60.
  523. 6.5. Escape Sequence Guard Time
  524. A "TIES" (Time-Independent Escape Sequence) modem does not require any
  525. guard time around its escape sequence. The following text:
  526. +++ATH0
  527. if sent through a TIES modem, for example because you were uploading
  528. this file through it, could pop the modem back into command mode and
  529. make it hang up the connection. Later versions of the Telebit T1600 and
  530. T3000 (version LA3.01E firmware and later), and all WorldBlazers, use
  531. TIES.
  532. Although the probability of "+++" appearing in a Kermit packet is
  533. markedly lower than with most other protocols (see the File
  534. Transfer section below), it can still happen under certain
  535. circumstances. It can also happen when using C-Kermit's TRANSMIT
  536. command. If you are using a Telebit TIES modem, you can change the
  537. modem's escape sequence to an otherwise little-used control character
  538. such as Ctrl-_ (Control-Underscore):
  539. AT S2=31
  540. A sequence of three consecutive Ctrl-_ characters will not appear in a
  541. Kermit packet unless you go to extraordinary lengths to defeat more
  542. than a few of Kermit's built-in safety mechanisms. And if you do this,
  543. then you should also turn off the modem's escape-sequence recognition
  544. altogether:
  545. AT S48=0 S2=255
  546. But when escape sequence recognition is turned off, "modem hangup"
  547. (<pause>+++<pause>ATH0<CR>) will not work, so you should also SET MODEM
  548. HANGUP RS232-SIGNAL (rather then MODEM-COMMAND).
  549. 6.6. Adaptive Dialing
  550. Some modems have a feature called adaptive dialing. When they are told
  551. to dial a number using Tone dialing, they check to make sure that
  552. dialtone has gone away after dialing the first digit. If it has not,
  553. the modem assumes the phone line does not accept Tone dialing and so
  554. switches to Pulse. When dialing out from a PBX, there is almost always
  555. a secondary dialtone. Typically you take the phone off-hook, get the
  556. PBX dialtone, dial "9" to get an outside line, and then get the phone
  557. company's dialtone. In a situation like this, you need to tell the
  558. modem to expect the secondary dialtone. On Hayes and compatible modems,
  559. this is done by putting a "W" in the dial string at the appropriate
  560. place. For example, to dial 9 for an outside line, and then 7654321,
  561. use ATDT9W7654321:
  562. SET PBX-OUTSIDE-PREFIX 9W
  563. (replace "9" with whatever your PBX's outside-line prefix is).
  564. 6.7. The Busy Signal
  565. Some phone companies are eliminating the busy signal. Instead, they
  566. issue a voice message such as "press 1 to automatically redial until
  567. the number answers, or...". Obviously this is a disaster for modem
  568. calls. If your service has this feature, there's nothing Kermit can do
  569. about it. Your modem will respond with NO CARRIER (after a long time)
  570. rather than BUSY (immediately), and Kermit will declare the call a
  571. failure, rather than trying to redial the same number.
  572. 6.8. Hanging Up
  573. There are two ways to hang up a modem: by turning off the serial port's
  574. DTR signal (SET MODEM HANGUP-METHOD RS232-SIGNAL) or sending the modem
  575. its escape sequence followed by its hangup command (SET MODEM
  576. HANGUP-METHOD MODEM-COMMAND). If one doesn't work, try the other. If
  577. the automatic hangup performed at the beginning of a DIAL command
  578. causes trouble, then SET DIAL HANGUP OFF.
  579. The HANGUP command has no effect when C-Kermit is in remote mode. This
  580. is on purpose. If C-Kermit could hang up its own controlling terminal,
  581. this would (a) most likely leave behind zombie processes, and (b) pose
  582. a security risk.
  583. If you DIAL a modem, disconnect, then SET HOST or TELNET, and then
  584. HANGUP, Kermit sends the modem's hangup command, such as "+++ATHO".
  585. There is no good way to avoid this, because this case can't reliably be
  586. distinguished from the case in which the user does SET HOST
  587. terminal-server, SET MODEM TYPE name, DIAL. In both cases we have a
  588. valid modem type selected and we have a network connection. If you want
  589. to DIAL and then later make a regular network connection, you will have
  590. to SET MODEM TYPE NONE or SET DIAL HANGUP OFF to avoid this phenomenon.
  591. 7. TERMINAL SERVERS
  592. Watch out for terminal server's escape character -- usually a control
  593. character such as Ctrl-Circumflex (Ctrl-^). Don't unprefix it in
  594. Kermit!
  595. Ciscos -- must often be told to "terminal download"... Cisco ASM models
  596. don't have hardware flow control in both directions.
  597. Many terminal servers only give you a 7-bit connection, so if you can't
  598. make it 8-bit, tell Kermit to "set parity space".
  599. The following story, regarding trouble transferring 8-bit files through
  600. a reverse terminal server, was contributed by an Annex terminal server
  601. user:
  602. Using C-Kermit on an HP 9000 712/80 running the HP-UX 10.00
  603. operating system. The HP was connected to a Xylogics Annex
  604. MICRO-ELS-UX R7.1 8 port terminal server via ethernet. On the second
  605. port of the terminal server is an AT&T Paradyne 3810 modem, which is
  606. connected to a telephone line. There is a program which runs on the
  607. HP to establish a Telnet connection between a serial line on the
  608. Annex and a character special file on the HP (/dev file). This is an
  609. Annex specific program called rtelnet (reverse telnet) and is
  610. provided with the terminal server software. The rtelnet utility runs
  611. on top of the pseudo-terminal facility provided by UNIX. It creates
  612. host-originated connections to devices attached ot Annex serial
  613. ports. There are several command line arguments to be specified with
  614. this program: the IP address of the terminal server, the number of
  615. the port to attach to, and the name of the pseudo-device to create.
  616. In addition to these there are options to tell rtelnet how to
  617. operate on the connect: -b requests negotiation for Telnet binary
  618. mode, -d turns on socket-leve debugging, -f enables "connect on the
  619. fly" mode, -r removes the device-name if it already exists, etc. The
  620. most important of these to be specified when using 8 data bits and
  621. no parity, as we found out, was the -t option. This creates a
  622. transparent TCP connection to the terminal server. Again, what we
  623. assumed to be happening was that the rtelnet program encountered a
  624. character sequence special to itself and then "eating" those kermit
  625. packets. I think this is all of the information I can give you on
  626. the configuration, short of the values associated with the port on
  627. the terminal server.
  628. How to DIAL from a TCP/IP reverse terminal server (modem server):
  629. 1. (only if necessary) SET TELNET ECHO REMOTE
  630. 2. SET HOST terminal-server-ip-name-or-address [ port ]
  631. 3. SET MODEM TYPE modem-type
  632. 4. (only if necessary) SET DIAL HANGUP OFF
  633. 5. (for troubleshooting) SET DIAL DISPLAY ON
  634. 6. DIAL phone-number
  635. The order is important: SET HOST before SET MODEM TYPE. Since this is a
  636. Telnet connection, serial-port related commands such as SET SPEED, SET
  637. STOP-BITS, HANGUP (when MODEM HANGUP-METHOD is RS232), etc, have no
  638. effect. However, in C-Kermit 8.0, if the modem server supports
  639. RFC-2217 Telnet Com-Port Control protocol, these commands do indeed
  640. take effect at the server's serial port.
  641. 8. TERMINAL EMULATION
  642. Except for the Windows, OS/2, and Macintosh versions, C-Kermit does not
  643. emulate any kind of terminal. Rather, it acts as a "semitransparent
  644. pipe", passing the characters you type during a CONNECT session to the
  645. remote host, and sending the characters received from the remote host
  646. to your screen. Whatever is controlling your keyboard and screen
  647. provides the specific terminal emulation: a real terminal, a PC running
  648. a terminal emulator, etc, or (in the case of a self-contained
  649. workstation) your console driver, a terminal window, xterm, etc.
  650. Kermit is semitransparent rather than fully transparent in the
  651. following ways:
  652. * During a TELNET ("set host") session, C-Kermit itself executes the
  653. TELNET protocol and performs TELNET negotiations. (But it does not
  654. perform TN3270 protocol or any other type of 3270 terminal
  655. emulation.)
  656. * If you have changed your keyboard mapping using SET KEY, C-Kermit
  657. replaces the characters you type with the characters or strings
  658. they are mapped to.
  659. * If you SET your TERMINAL CHARACTER-SET to anything but TRANSPARENT,
  660. C-Kermit translates your keystrokes (after applying any SET KEY
  661. definitions) before transmitting them, and translates received
  662. characters before showing them on your screen.
  663. * If your remote and/or local TERMINAL CHARACTER-SET is an ISO 646
  664. 7-bit national character set, such as German, French, Italian,
  665. Swedish, etc, or Short KOI used for Cyrillic, C-Kermit's CONNECT
  666. command automatically skips over ANSI escape sequences to avoid
  667. translating their characters. Only ANSI/ISO standard
  668. (VT100/200/300-like) 7-bit escape sequence formats are supported
  669. for this purpose, no proprietary schemes like H-P, Televideo,
  670. Tektronix, etc.
  671. * If your version of C-Kermit includes SET TERMINAL APC command, then
  672. C-Kermit's CONNECT command will handle APC escape sequences if
  673. TERMINAL APC is not set to OFF (which is the default).
  674. You can make C-Kermit fully transparent by starting it with the -0
  675. (dash zero) command-line option.
  676. If you are running C-Kermit under a console driver, or in a terminal
  677. window, that emulates the VT100, and use C-Kermit to log in to a VMS
  678. system, the console driver or terminal window (not Kermit) is supposed
  679. to reply to the "what are you?" query (ESC Z) from the VAX. If it
  680. doesn't, and you can't make it do so, then you can (a) live with the
  681. "unknown terminal" problem; (b) tell VMS to SET TERMINAL/DEVICE=VT100;
  682. (c) program a key using SET KEY to send the appropriate sequence and
  683. then punch the key at the right time; or (d) use the VMSLOGIN macro
  684. that is defined in CKERMIT.INI to do this for you automatically.
  685. SET SESSION-LOG { TEXT, BINARY }, which is effective in UNIX and AOS/VS
  686. but not other C-Kermit versions, removes CR, DEL, NUL, XON, and XOFF
  687. characters (Using C-Kermit neglects to mention that XON and XOFF are
  688. removed). The TEXT-mode setting is ineffective during SCRIPT command
  689. execution, as well as on X.25 connections.
  690. 9. KEY MAPPING
  691. Except in the terminal-emulating versions, C-Kermit's key mapping
  692. facilities are limited to normal "ASCII" keys, and cannot be used with
  693. function keys, arrow keys, arcane key combinations, etc. Since C-Kermit
  694. runs on such a wide variety of hardware platforms (including, for
  695. example, more than 360 different UNIX platforms), it is not possible
  696. for C-Kermit to support every conceivable keyboard under every release
  697. of every UNIX (or VMS, or ...) product on every different kind of
  698. computer possibly under all manner of different console drivers, even
  699. if it had the means to do so.
  700. In technical terms, C-Kermit uses the read() function to read
  701. keystrokes, and read() returns a single byte (value 0 through 255).
  702. C-Kermit's SET KEY function applies to these single-byte codes.
  703. "Extended function" keys, such as F-keys, arrow keys, etc, usually
  704. return either a 2-byte "scan code" or else a character string (such as
  705. an escape sequence like "<ESC> O p"). In both cases, C-Kermit has no
  706. way to tell the difference between such multibyte key values, and the
  707. corresponding series of single-byte key values. This could only be done
  708. by accessing the keyboard at a much lower level in a highly
  709. platform-dependent manner, probably requiring tens of thousands of
  710. lines of code to support even a sampling of the most popular
  711. workstation / OS combinations.
  712. However, most workstation console drivers (terminal emulation windows,
  713. etc) include their own key-mapping facility. For example in AIX, the
  714. AIXterm program (in whose window you would run C-Kermit) allows
  715. rebinding of the F1-F12 keys to arbitrary strings. The same is true of
  716. Xterm and DECterm windows, etc. Consult the technical documentation for
  717. your workstation or emulator. See sample Xterm (Xmodmap) mappings in
  718. the Unix C-Kermit Hints and Tips document.
  719. The SET KEY command (except in Kermit 95) does not allow a key
  720. definition to be (or contain) the NUL (\0) character.
  721. 10. FILE TRANSFER
  722. C-Kermit 7.0 is the first release of C-Kermit to use fast (rather than
  723. robust and therefore slow) protocol defaults: long packets, sliding
  724. windows, control-character unprefixing, and streaming where possible.
  725. This makes most transfers (partner willing) dramatically faster "out of
  726. the box" but might break some combinations that worked before. If
  727. transfers with C-Kermit 7.0 or later fail where transfers worked with
  728. earlier C-Kermit versions, try the following (one at a time, in this
  729. order):
  730. 1. SET PREFIXING ALL: Disables control-character unprefixing.
  731. 2. SET STREAMING OFF: Disables streaming.
  732. 3. CAUTIOUS: Selects medium but cautious protocol settings.
  733. 4. ROBUST: this command reverts to the most conservative protocol
  734. settings.
  735. Execution of multiple file transfers by C-Kermit from a command file
  736. when in remote mode might exhibit long delays between each transfer. To
  737. avoid this, just include the command "SET DELAY 0" in your command file
  738. before any of the file-transfer commands.
  739. File transfer failures can occur for all sorts of reasons, most of them
  740. listed in Chapter 10 of Using C-Kermit. The following sections
  741. touch on some that aren't.
  742. The C-Kermit 7.0 Release Notes document SEND /COMMAND as taking an
  743. argument, but it doesn't. Instead of SEND /COMMAND:{some command}, use:
  744. SEND /COMMAND [ other switches such as /AS-NAME: ] command [ arguments... ]
  745. 10.1. Laptops
  746. Watch out for laptops and their assorted power-saver features; for
  747. example, a built-in modem's "auto timeout delay" hanging up the
  748. connection in the middle of a file transfer. Most modems, even if they
  749. have this feature, do not have it enabled by default. But if you
  750. experience otherwise inexplicable disconnections in the midst of your
  751. Kermit sessions, check the modem manual for such things as "idle
  752. timeout", "auto timeout", etc, and add the command to disable this
  753. feature to Kermit's init string for this modem.
  754. 10.2. NFS
  755. If uploading a large file to an NFS-mounted disk fails (or is painfully
  756. slow), try uploading it to a local disk (e.g. /tmp on Unix) and then
  757. copying to the NFS disk later.
  758. 10.3. Modems
  759. If you are dialing out and find that downloads work but uploads don't,
  760. try again with a lower serial-port speed. Case in point: dialing out on
  761. a certain PC from Linux at 115200 bps using a USR Courier 56K
  762. "V.Everything" external modem and RTS/CTS flow control. Downloads
  763. worked flawlessly, uploads stopped dead after the first few packets
  764. were sent. The modem lights showed constant retraining (ARQ light
  765. blinks slowly), and the CTS light was off 95% of the time, allowing
  766. nothing to get through. Reducing the serial port speed to 57600 bps
  767. made the problems go away. Evidently the PC in question has a very fast
  768. serial port, since dialing the same modem with a different PC at 115200
  769. bps works without incident.
  770. 10.4. TCP/IP Connections
  771. If you have trouble transferring files over a TCP/IP connection, tell
  772. Kermit to SET PARITY SPACE and try again. If that doesn't work, also
  773. try a shorter packet length or smaller window size (to compensate for
  774. certain well-known broken Telnet servers), and/or SET RELIABLE OFF.
  775. 10.5. Multihop Connections
  776. If you have a multihop connection, with the interior nodes in CONNECT
  777. mode (Kermit, Telnet, Rlogin, or any other), you can expect (a) file
  778. transfer to be slower, and (b) the connection to be less transparent
  779. (to control characters, perhaps to the 8th bit) than a more direct
  780. connection. C-Kermit 7.0 and later have a "-0" (dash-zero) command-line
  781. option to make it 100% transparent in cases where it is to be used in
  782. the middle.
  783. 10.6. Recovery
  784. The recovery feature (RESEND command) that was added in version 5A(190)
  785. works only for binary-mode transfers. In order for this feature to be
  786. useful at all, the default for SET FILE INCOMPLETE was changed from
  787. DISCARD to KEEP. Otherwise an interrupted transfer would leave no
  788. partial file behind unless you had remembered to change the default.
  789. But now you have to pay closer attention to Kermit's messages to know
  790. whether a transfer succeeded or failed -- previously, if it failed, the
  791. file would not show up on the receiving end at all; in 5A(190) and
  792. later, you'll get a partial file which could easily be mistaken for the
  793. complete file unless you change the default back to DISCARD or read the
  794. screen messages, or keep a transaction log.
  795. 10.7. Filename Collisions
  796. SET FILE COLLISION BACKUP is the default. This means:
  797. * If you send the same file lots of times, there will be many backup
  798. files. There is no automatic mechanism within Kermit to delete
  799. them, no notion of a "version retention count", etc, but you can
  800. use the PURGE command to clean them up.
  801. * If a file arrives that has the same name as a directory, the file
  802. transfer fails because Kermit will not rename a directory. Send the
  803. file with another name, or use SET FILE COLLISION RENAME.
  804. * If the directory lacks write permission, the file transfer fails
  805. even if you have write access to the file that is being backed up;
  806. in that case, switch to SET FILE COLLISION OVERWRITE or APPEND, or
  807. send to a different directory.
  808. SET FILE COLLISION UPDATE depends on the date/time stamp in the
  809. attribute packet. However, this is recorded in local time, not
  810. Universal Time (GMT), and there is no indication of time zone. The time
  811. is expressed to the precision of 1 second, but some file systems do not
  812. record with this precision -- for example, MS-DOS records the file
  813. date/time only to the nearest 2 seconds. This might cause update
  814. operations to send more files than necessary.
  815. (This paragraph does NOT apply to UNIX, where, as of C-Kermit 7.0,
  816. C-Kermit pipes incoming mail and print material directly the mail or
  817. print program): When C-Kermit is receiving files from another Kermit
  818. program that has been given the MAIL or REMOTE PRINT command, C-Kermit
  819. follows the current filename collision action. This can be
  820. disconcerting if the action was (for example) BACKUP, because the
  821. existing file will be renamed, and the new file will be mailed (or
  822. printed) and then deleted. Kermit cannot temporarily change to RENAME
  823. because the file collision action occurs when the filename packet is
  824. received, and the PRINT or MAIL disposition only comes later, in the
  825. Attribute packet.
  826. Watch out for SET FILE COLLISION RENAME, especially when used in
  827. conjunction with recovery. Recall that this option (which is NOT the
  828. default) renames the incoming file if a file already exists with the
  829. same name (the default is to rename the previously existing file, and
  830. store the incoming file with its own name). It is strongly recommended
  831. that you do not use SET FILE COLLISION RENAME if you ever intend to use
  832. the recovery feature:
  833. * When the file is first received by C-Kermit, its name is changed if
  834. another file already has the same name. When you RESEND the same
  835. file after a failure, C-Kermit will probably try to append the
  836. re-sent portion to the wrong file.
  837. * Assuming that you get RESEND to work with FILE COLLISION RENAME,
  838. C-Kermit, when receiving the remainder of the file during a RESEND
  839. operation, will report back the wrong name. Nothing can be done
  840. about this because the name is reported back before the receiving
  841. Kermit program finds out that it is a recovery operation.
  842. Also watch out for DISABLE DELETE, since this implicitly sets FILE
  843. COLLISION to RENAME. And note tht DELETE is DISABLEd automatically any
  844. time you Kermit is in local mode (i.e. it makes a connection). Also
  845. note that for purposes of DISABLE and ENABLE, "set host *" connections
  846. do not count as local mode even though, strictly speaking, they are.
  847. 10.8. DOS Pathnames
  848. When referring to foreign MS-DOS, Windows, Atari ST, OS/2, or other
  849. file specifications that contain backslash characters in a C-Kermit
  850. command, you might have to double each backslash, for example:
  851. C-Kermit>get c:\\directory\\foo.txt
  852. This is because backslash is used in C-Kermit commands for introducing
  853. special character codes, variables, functions, etc.
  854. 10.9. Cancellation
  855. If attempting to cancel local-mode file reception at a very early stage
  856. (i.e. before data packets are exchanged) with X or Z does not work, use
  857. E or Ctrl-C instead, or wait until the first data packets are sent.
  858. If you cancel a transfer that is underway using X or Z, and a lot of
  859. window slots are in use, it might take a while for the cancellation to
  860. take effect, especially if you do this on the receiving end; that's
  861. because a lot of packets might already be on their way to you. In that
  862. case, just be patient and let Kermit "drain" them.
  863. If C-Kermit is sending a file, remote-mode packet-mode breakout (three
  864. consecutive Ctrl-C's by default) is not effective until after C-Kermit
  865. sends its first packet. If C-Kermit is receiving a file or is in server
  866. mode, it is effective right away. In the former case, the SET DELAY
  867. value determines the earliest time at which you can break out of packet
  868. mode.
  869. 10.10. Partner Peculiarities
  870. When one or both partners is on an SCO operating system such as OSR5,
  871. you might issue the command:
  872. mapchan -n
  873. to disable character-set conversion by the terminal driver. Similarly
  874. for AIX:
  875. setmaps -t NOMAP
  876. When using C-Kermit to transfer files with the HP48SX calculator, you
  877. must SET FLOW NONE. The HP48SX does not support flow control, and
  878. evidently also becomes confused if you attempt to use it. You might
  879. also need to use SET SEND PAUSE 100 (or other number). For greater
  880. detail about transferring files the HP-48, see:
  881. http://www.columbia.edu/kermit/hp48.html
  882. Some communication programs have errors in their implementation of
  883. Kermit attribute packets. If you get an error message from your
  884. communication program like "Attribute error", tell C-Kermit to SET
  885. ATTRIBUTES OFF. Better yet, switch to a real Kermit program.
  886. Some communication software claims to implement Kermit sliding windows,
  887. but does so incorrectly. If sliding window transfers fail, set
  888. C-Kermit's window size to the smallest one that works, for example, SET
  889. WINDOW 1.
  890. For lots more detail about how to cope with defective Kermit partners,
  891. see:
  892. * Coping with Faulty Kermit Implementations (C-Kermit 7.0 and
  893. later).
  894. * Coping with Broken Kermit Partners (C-Kermit 8.0 and later).
  895. The UNIX version of C-Kermit discards carriage returns when receiving
  896. files in text mode. Thus, "bare" carriage returns (sometimes used to
  897. achieve overstriking) are lost.
  898. 11. SCRIPT PROGRAMMING
  899. 11.1. Comments Versus the SCRIPT Command
  900. Remember that ";" and "#" introduce comments when (a) they are the
  901. first character on the line, or (b) they are preceded by at least one
  902. blank or tab within a line. Thus constructions like:
  903. INPUT 5 ;
  904. SCRIPT ~0 #--#--#
  905. must be coded using backslash notation to keep the data from being
  906. ignored:
  907. INPUT 5 \59 ; 59 is the decimal ASCII code for ";"
  908. SCRIPT ~0 \35--#--# ; 43 is the decimal ASCII code for "#"
  909. or, more simply:
  910. INPUT 5 \; ; Just quote the semicolon
  911. SCRIPT ~0 \#--#--# ; Just quote the "#"
  912. 11.2. Alphabetic Case and the INPUT Command
  913. INPUT and MINPUT caseless string comparisons do not work for non-ASCII
  914. (international) characters. Workaround: SET INPUT CASE OBSERVE. Even
  915. then, the "lexically less than" and "lexically greater than" operations
  916. (IF LLT, IF LGT) probably won't work as expected. The same is true for
  917. the case-conversion functions \Flower() and \Fupper(). C-Kermit does
  918. not know the collating sequence for different character sets and
  919. languages. (On the other hand, it might work depending on such items as
  920. how Kermit was linked, whether your operating supports "locales", etc)
  921. 11.3. NUL (0) Characters in C-Kermit Commands
  922. You can't include a NUL character (\0) in C-Kermit command text without
  923. terminating the character string in which it appears. For example:
  924. echo In these brackets [\0] is a NUL
  925. will echo "In these brackets [". This applies to ECHO, INPUT, OUTPUT,
  926. and all other commands (but you can represent NUL by "\N" in an OUTPUT
  927. string). This is because C-language strings are terminated internally
  928. by the NUL character, and it allows all of C-Kermit's string comparison
  929. and manipulation functions to work in the normal "C" way.
  930. To illustrate:
  931. INPUT 5 \0
  932. is equivalent to:
  933. INPUT 5
  934. and:
  935. INPUT 5 ABC\0DEF
  936. is equivalent to:
  937. INPUT 5 ABC
  938. INPUT operations discard and ignore NUL characters that arrive from the
  939. communication device, meaning that they do not figure into matching
  940. operations (e.g. A<NUL>B matches AB); they are not deposited in the
  941. INPUT buffer (\v(input)); and they are not counted in \v(incount), with
  942. two exceptions:
  943. 1. An arriving NUL character restarts the INPUT SILENCE timer.
  944. 2. An arriving NUL character terminates the INPUT command with the
  945. SUCCESS condition if the INPUT command was given an empty search
  946. string. In this case \v(incount) is set to 1.
  947. Also, the \v(inchar) variable is null (completely empty) if the last
  948. INPUT character was NUL. That is, there is no way to tell only by
  949. looking at \v(inchar) the difference between a NUL that was INPUT and
  950. no INPUT at all. If the INPUT command succeeded but \v(inchar) is
  951. empty, then a NUL character was input. Also, \v(incount) will be set to
  952. 1.
  953. Here's a sample script fragment to read characters, possibly including
  954. NUL, from the communication connection and write them to a file:
  955. while true {
  956. input 1 ; read one byte
  957. if fail break ; timed out or connection closed
  958. fwrite /char \%c \v(inchar) ; record the byte
  959. }
  960. This works because when \v(inchar) is NUL, that's equivalent to FWRITE
  961. /CHAR having no text argument at all, in which case it writes a NUL
  962. character.
  963. \v(incount) and \v(inchar) are NOT affected by the CLEAR command.
  964. 11.4. \ffiles() and \fnextfile() Peculiarities
  965. The following script program:
  966. for \%i 1 \ffiles(oofa.*) 1 {
  967. send \fnextfile()
  968. }
  969. did not work as expected in C-Kermit 6.0 and earlier but does work in
  970. C-Kermit 7.0 and later.
  971. 11.5. Commands That Have Only Local Effect
  972. Certain settings are local to each command level, meaning that
  973. subordinate command levels (macros or command files) can change them
  974. without affecting their values at higher command levels. When a new
  975. command level is invoked, the value is inherited from the previous
  976. level. These settings are:
  977. CASE
  978. COUNT and \v(count)
  979. INPUT CASE
  980. INPUT TIMEOUT
  981. MACRO ERROR
  982. QUIET
  983. TAKE ERROR
  984. This arrangement allows CASE, TIMEOUT, and ERROR settings, which are
  985. used to control automatic exit from a command file or macro upon error,
  986. to be automatically restored when the command file or macro exits.
  987. The COUNT variable follows this rule too, which permits nested SET
  988. COUNT / IF COUNT loops, as in this example in which the inner loop
  989. counts down from the current COUNT value of the outer loop (try it):
  990. DEFINE INNER WHILE COUNT { WRITE SCREEN { Inner:}, SHOW COUNT }
  991. SET COUNT 5
  992. WHILE COUNT { WRITE SCREEN Outer:, SHOW COUNT, DO INNER }
  993. Keep in mind that an inferior command level cannot manipulate the COUNT
  994. value held by a higher level. For example:
  995. DEFINE OOFA SHOW COUNT, IF COUNT GOTO LOOP
  996. SET COUNT 5
  997. :LOOP
  998. OOFA
  999. ECHO Done
  1000. results in an infinite loop; the COUNT value remains at 5 because it is
  1001. never decremented at the same level at which it was set.
  1002. 11.6. Literal Braces in Function Calls
  1003. Since braces are used in function calls to indicate grouping, there is
  1004. no way to pass literal braces to the function itself. Solution: Define
  1005. a variable containing the string that has braces. Example:
  1006. define \%a ab{cd
  1007. echo \fsubstring(\%a)
  1008. ab{cd
  1009. If the string is to start with a leading brace and end with a closing
  1010. brace, then double braces must appear around the string (which itself
  1011. is enclosed in braces):
  1012. define \%a {{{foo}}}
  1013. echo \fsubstring(\%a)
  1014. {foo}
  1015. This also works for any other kind of string:
  1016. define \%a {{ab{cd}}
  1017. echo \fsubstring(\%a)
  1018. ab{cd
  1019. 11.7. Defining Variables on the C-Kermit Command Line
  1020. To define variables on the C-Kermit command line, use the -C
  1021. command-line option with one or more DEFINE or ASSIGN commands. Note
  1022. that the C-Kermit command line must cope with the quoting rules of your
  1023. shell. Examples:
  1024. kermit -C "define \\%a foo, define phonenumber 7654321"
  1025. In this case we follow UNIX quoting rules by doubling the backslash.
  1026. Once C-Kermit starts, the \%a and \m(phonenumber) variables are defined
  1027. as indicated and can be used in the normal way.
  1028. In DOS or Windows or OS/2 the command would be:
  1029. kermit -C "define \%%a foo, define phonenumber 7654321"
  1030. Here we need to double the percent sign rather than the backslash
  1031. because of DOS shell quoting rules.
  1032. 11.8. Per-Character Echo Check with the OUTPUT Command
  1033. Sometimes the OUTPUT command must be used to send commands or data to a
  1034. device in "echoplex" mode, meaning that characters must be sent one at
  1035. a time, and the next character can not be sent until the echo from the
  1036. previous one has been received. For example, a certain PBX might have
  1037. this characteristic. Let's say a Kermit script is used to program the
  1038. PBX. If characters are sent too fast, they can be lost. It would seem
  1039. that the command:
  1040. SET OUTPUT PACING milliseconds
  1041. could be used to take care of this, but the pacing interval is constant
  1042. and must be set large enough to allow even the slowest echo to finish.
  1043. If the script is large (an actual example is 14,000 lines long), this
  1044. can cause it to take hours longer than it needs to.
  1045. Here is a macro you can use to OUTPUT a string in an Echoplex
  1046. environment:
  1047. define XOUTPUT {
  1048. local \%c \%i
  1049. set output pacing 0
  1050. for \%i 1 \flen(\%*) 1 {
  1051. asg \%c \fsubstr(\%*,\%i,1)
  1052. output \%c
  1053. input 2 \%c
  1054. }
  1055. }
  1056. C-Kermit 7.0 or later is required.
  1057. It sends one character at a time and then waits up to 2 seconds for the
  1058. character to be echoed back, but continues to the next character as
  1059. soon as the echo appears, so no time is wasted. You can add an IF FAIL
  1060. clause after the INPUT in case you want to do something special about
  1061. failure to detect an echo within the timeout period. Obviously you can
  1062. also change the 2-second limit, and adjust the script in any other
  1063. desired way.
  1064. 11.9. Scripted File Transfer
  1065. Sometimes a user complains that when she makes a connection by hand,
  1066. logs in, and transfers a file, there are no problems, but when she
  1067. scripts the the exact same sequence, the file transfer always fails
  1068. after a few packets. Here's a scenario where this can happen:
  1069. 1. Upon logging in to the remote computer, it sends a "What Are You?"
  1070. escape sequence.
  1071. 2. When you log in interactively, your terminal emulator sends the
  1072. response. This is invisible to you; you don't know it's happening.
  1073. 3. When you script the login, and begin a file transfer immediately
  1074. upon logging in, the host still sends the "What Are You?" sequence.
  1075. Kermit's INPUT ECHO setting is ON by default, so the escape
  1076. sequence passes through to the terminal, and the terminal sends its
  1077. response. But by this time Kermit has already started the file
  1078. transfer.
  1079. 4. By default, the local Kermit program examines the keyboard for
  1080. interruption characters between every packet. The "What Are You"
  1081. response is sitting in the keyboard buffer. Eventually Kermit will
  1082. read a character such as "c" that is a valid interruption
  1083. character, and the file transfer stops with "User canceled".
  1084. The right way to handle this situation is to have your look for the
  1085. "What Are You?" sequence and send the response itself, as described in
  1086. Using C-Kermit, pp.429-431. Or you can work around it by telling the
  1087. local Kermit to "set input echo off" and/or "set transfer interruption
  1088. off".
  1089. 11.10. Hexadecimal arithmetic...
  1090. C-Kermit can do both integer and floating-point arithmetic, in both
  1091. ordinary algebraic notation and in Lisp S-Expression notation. All
  1092. arithmetic operators and functions operate only on decimal numbers. It
  1093. is possible, however, to write scripts that operate on hexadecimal
  1094. numbers. This is done by converting them to decimal prior to any
  1095. arithmetic operations, and then converting them back to hexadecimal for
  1096. display. Example:
  1097. ; EVALUATE is a command that evaluates an arithmetic expression.
  1098. ; See HELP EVALUATE for details. This is just for demonstration.
  1099. ; Arithmetic expressions can be used in any context where a number
  1100. ; can be used. Also, the special notation:
  1101. ;
  1102. ; .\%a ::= expression
  1103. ;
  1104. ; evaluations the expression and assigns the result to the variable.
  1105. ;
  1106. .\%a := fffe ; Set variable to hex value
  1107. set eval old ; See HELP EVAL
  1108. eval \fhex2n(\%a) ; Show value of variable
  1109. eval \fhex2n(\%a) + 1 ; Show value of expression
  1110. eval \fhex2n(\%a) + 2 ; Show value of expression
  1111. .\%x ::= \fhex2n(\%a) + 1 ; Assign value of expression to variable
  1112. echo \fn2hex(\%x) ; Display variable's value in hex
  1113. .\%x ::= \fhex2n(\%a) + 2 : Ditto
  1114. echo \fn2hex(\%x)
  1115. .\%x ::= \fhex2n(\%a) | \fhex2n(ffff) ; Similarly for logical OR
  1116. echo \fn2hex(\%x)
  1117. .\%x ::= \fhex2n(\%a) & \fhex2n(ffff) ; and logical AND
  1118. echo \fn2hex(\%x)
  1119. By the way, you might be tempted to use Kermit's \xnn notation to plug
  1120. hex numbers into arithmetic expressions but this doesn't work. That
  1121. notation is strictly for bytes (hex representation of character
  1122. values), not for numbers.
  1123. 11.11. Other...
  1124. Escape sequences (or any strings that contain control characters) can't
  1125. be used as labels, GOTO targets, or SWITCH cases.
  1126. __________________________________________________________________
  1127. C-Kermit 8.0 Unix Hints and Tips
  1128. The Kermit Project
  1129. kermit@columbia.edu
  1130. 30 June 2011