home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / c-kermit / ckc178.txt < prev    next >
Text File  |  2020-01-01  |  567KB  |  11,135 lines

  1. FILE CKU178.UPD
  2.  
  3. Author:  Frank da Cruz
  4. Address: Watson Laboratory, Columbia University Center for Computing Activities
  5.          612 West 115th Street, New York, NY 10025, USA, Earth
  6. Phone:   (212) 854-5126
  7. Fax:     (212) 662-6442
  8. E-Mail:  fdc@watsun.cc.columbia.edu (Internet), FDCCU@CUVMA (BITNET/EARN)
  9.  
  10.   Copyright (C) 1985, 1992, Trustees of Columbia University in the City of New
  11.   York.  Permission is granted to any individual or institution to use this
  12.   software as long as it is not sold for profit.  This copyright notice must be
  13.   retained.  This software may not be included in commercial products without
  14.   written permission of Columbia University.
  15.  
  16. Last update: Wed Jan 29 23:22:14 1992
  17.  
  18. This file contains the update history of C-Kermit 5A from its beginning
  19. to the end of the pre-beta test period.  History of pre-5A versions can be
  20. found in CKUV4E.UPD and CKUV4F.UPD.  Edit history of the 5A beta release
  21. is in CKUKER.UPD.
  22.  
  23. UPDATE HISTORY:
  24. ==============
  25.  
  26. ------------------------------
  27. 5A(178) Wed Jan 29 23:22:14 1992
  28.  
  29. Test for TELNET <host> <service> was backwards in setlin().  ckuus7.c.
  30.  
  31. Extraneous "#include <sys/types.h>" in ckufio.c moved to within #ifdef OS2
  32. conditional.
  33.  
  34. Sent the above two fixes to the list in e-mail.
  35.  
  36. Changed name of KOI-8 from "koi-cyrillic" to "koi8-cyrillic".  ckuxla.c.
  37.  
  38. Fixes to zmail() and zprint() for Olivetti OXOS, which uses mailx and lp
  39. rather than Mail and lpr.  Fulvio Marino.  ckufio.c
  40.  
  41. Fixed error in TRANSMIT command help message reported by Christian Hemsing.
  42. ckuus2.c.
  43.  
  44. Fixed erroneous declaration of "c" in SHOW KEY -- should be int, not KEY.
  45.  
  46. Many SCO Xenix changes from Warren Tucker and William Bader.  ckuver.h,
  47. ckufio.c, ckutio.c, makefile.
  48.  
  49. Added OS/2 changes to support "set speed 57600", adapted from code furnished
  50. by Kai Uwe Rommel.  ckuus3.c, ckotio.c, ckocon.c.
  51.  
  52. Fixed two places where some SCRIPT-command-related code was added without
  53. putting it in #ifndef NOSCRIPT..#endif, reported by Jay Rouman.  ckuus5.c.
  54.  
  55. Moved several unguarded references to character-set related variables to
  56. within #ifndef NOCSETS..#endif, or removed them where not needed.  Many
  57. ckc*.c and cku*.c modules.
  58.  
  59. Changed ckcxla.h to skip itself if NOCSETS is defined, and to make sure
  60. that CYRILL and KANJI are not defined, in case of conflicts on the cc
  61. command line, like -DNOCSETS -DKANJI.
  62.  
  63. Added -DDYNAMIC to hpuxs5r3 makefile entry.
  64.  
  65. In response to persistent complaints about slow screen updating on the NeXT,
  66. added a -DNOSETBUF compiler option to remove the setbuf() call that makes
  67. console output be unbuffered.  This definitely clears up the slow-writing
  68. problem, but there may be other risks -- the setbuf() call has been there
  69. forever, and who knows what might break by removing it.  Local testing on NeXT
  70. and SUN found no ill effects, so it was added to the sunos41 and next make
  71. entries.  So if you want to improve performance a bit, try adding this option
  72. but then test the results thoroughly.  ckutio.c, makefile.
  73.  
  74. Saved and restored duplex setting around telnet sessions.  ckuus7.c.
  75.  
  76. Finally solved Joe Doupnik's strange problem: if you "set host" from C-Kermit
  77. on his PC SV/386 R4 system, giving a hostname, you get an apparent successful
  78. connection, but then a blank screen.  Diagnosis: When a service is not
  79. specified by the user, Kermit supplies "telnet".  The TCP/IP implementation
  80. on Joe's machine, of Wollongong lineage, returns an incorrect value for
  81. getservbyname("telnet"): 111 (which is SUN RPC) rather than 23 (which is
  82. TELNET).  So Kermit, sensing that it has not reached a TELNET socket, sets
  83. a flag saying "no negotiations".  Solution: make the default service be
  84. "23" rather than "telnet" so the call to getservbyname() is skipped.
  85.  
  86. Big change: added ANSI escape sequence recognition to the CONNECT command.
  87. This was necessary to prevent character translation within escape sequences.
  88. The code is compiled by default (include -DNOESCSEQ to remove it) (it is also
  89. excluded automatically by -DNOCSETS).  It is activated only when the local or
  90. remote terminal character set is a 7-bit set other than US or UK ASCII, for
  91. example the Swedish ISO 646 NRC.  ckucon.c, therefore UNIX only.  Note: ONLY
  92. ANSI sequences are supported: not H-P, Televideo, etc etc etc, for reasons of
  93. space, complexity, performance, and standardization.
  94.  
  95. Added some HP symbols for SHOW VER and \v(cpu).
  96.  
  97. Updated VMS C-Kermit CONNECT command to current level: ANSI escape sequence
  98. recognition, character-set translation bugs fixed, etc.  ckvcon.c
  99.  
  100. Tried to make C-Kermit telnet work successfully to an HP-UX telnet server
  101. (also Wollongong based).  Each change I made that fixed this problem broke
  102. telnet for everyone else (especially the NeXT telnet server).  Finally, I
  103. totally rewrote TELNET negotiation code (again) to accommodate the situation
  104. where a telnet server (like the one on HP-UX) does not send any negotiations
  105. until after login.  This amounted to: (1) Starting out with duplex set to
  106. remote but sending DO ECHO to the server right away (this is different from
  107. UNIX telnet, see next paragraph); (2) not sending any gratuitous DO or DONT
  108. commands; (3) simplifying the treatment of received DO ECHO, DONT ECHO, WILL
  109. SGA, and WONT SGA commands; (4) Never sending unnecessary replies.  ckcnet.c.
  110.  
  111. A big cause of problems in Kermit's telnet code was the way the lower CONNECT
  112. fork would be killed and restarted every time echoing had to change.  This
  113. could cause data (including negotiations) to be lost.  CONNECT was changed
  114. to have the lower fork simply signal the upper one, to coordinate echoing
  115. changes.  Now, if need be (i.e. if new telnet problems are reported), we can
  116. start off in local-echo mode, knowing that the immediate change to remote echo
  117. won't cause us to lose the other negotiations and the login banner.  The 
  118. SUNlink X.25 code still restarts the lower fork, probably unnecessarily, but
  119. I don't want to change this without being able to test it.  ckucon.c.
  120.  
  121. Found that C-Kermit doesn't transfer files with Honeywell GCOS-8 Kermit,
  122. because the latter does not put a terminator on outgoing packets.  It has a
  123. "set sendeol" command, which apparently does not work.  So (in the UNIX
  124. version only, and only if the PARSENSE (automatic parity sensing) feature is
  125. selected), I added code to ttinl to read the packet length and use it if a
  126. line turnaround handshake character is not defined.  I had to add a sixth
  127. argument to ttinl (again, only for UNIX): a flag to tell whether the
  128. "end-of-line" (eol) character is a turnaround character or a regular eol.  If
  129. it is a turnaround character, behavior is as before.  If it is an eol, ttinl
  130. reads the number of characters specified in the length field and returns
  131. immediately, without waiting for the eol.  If an eol comes, it is skipped over
  132. when ttinl reads the next incoming packet.  This has the added benefit that
  133. packets are no longer ignored if the eol is garbaged in transmission.  Tested
  134. with MS-Kermit, Honeywell GCOS-8 Kermit, IBM mainframe Kermit in linemode, etc
  135. -- seems to work fine.  ckutio.c, ckcfns.c, ckcdeb.h.
  136.  
  137. Also built without PARSENSE defined.  Works fine (i.e. as it did before).  The
  138. PARSENSE feature is available for the UNIX, VMS, Mac, OS-9, and Amiga
  139. versions, but not the OS/2, version -- this code needs to be added to
  140. ckotio.c.  Also, the new length-reading code needs to be added to all but the
  141. UNIX version of ck?tio.c.  After that, the #ifdef UNIX around the call to
  142. ttinl() in rpack() in ckcfn2.c can be adjusted or removed.
  143.  
  144. MACINTOSH CHANGES
  145.  
  146. Fixed RENAME command in Mac Kermit.  zrenam() in ckmfio.c.
  147. Fixed DELETE command in Mac Kermit.  ckuusr.c + zdelet() in ckmfio.c.
  148. Fixed znewn() in Mac Kermit, it was writing new name over old name.  ckmfio.c.
  149.  
  150. As a result of these three fixes, five out of the six SET FILE COLLISION
  151. options work: BACKUP, OVERWITE, RENAME, DISCARD, and UPDATE.  APPEND
  152. overwrites instead of appending.
  153.  
  154. Fixed TRANSMIT command in Mac Kermit.  It works, but it doesn't echo.
  155. ckuus4.c, ckmker.mak.
  156.  
  157. Fixed TRANSLATE command on the Mac to write translated text into the
  158. Response window if no output filename is given.  ckcdeb.h, ckuus4.c.
  159.  
  160. Fixed Mac Kermit zstrip() to really strip the pathname, and zltor() to
  161. produce somewhat nicer results.  ckmfio.c.
  162.  
  163. Removed the SET CARRIER command from Mac Kermit -- The Mac doesn't "do"
  164. carrier.  ckuusr.c, ckuus3.c.
  165.  
  166. Tried to fix CD command in Mac Kermit.  ckuus5.c.  No go -- when zchdir()
  167. is called, it puts up a bunch of error boxes on the screen: "Warning - Writing
  168. to the console in applications is not supported".  Commented out the screen
  169. calls.  Now it works, except when you leave off the directory name or enter
  170. a bad one.
  171.  
  172. Disabled SET TERMINAL command for Macintosh, since it has no effect.  This
  173. code needs to be hooked into the Mac's terminal emulator.  ckuus7.c.
  174.  
  175. ------------------------------
  176. 5A(177) Mon Jan 20 12:25:35 1992
  177.  
  178. Relaxed the restriction on sliding windows that required the user to SET
  179. WINDOW n on both Kermits.  Now the receiver can determine the window size,
  180. just like with packet length.  ckcmai.c, ckcfns.c.
  181.  
  182. Added -Y command-line switch (note uppercase): system-independent way to
  183. skip init file.  ckuus5.c, ckuusy.c.
  184.  
  185. Added \v(fsize) and \v(tfsize) variables, containing the size of the last
  186. file transferred, and the total size of all the files in the last group
  187. transferred, respectively.  Suggested by Bob Larson.  ckuusr.h, ckuus4.c.
  188.  
  189. Added \v(cpu) to show the CPU type.  ckuver.h, ckuus4.c.
  190.  
  191. Restored buffered output to CONNECT mode, but only for non-TELNET,
  192. non-session-debugging, non-SO/SI sessions.  The nonbuffered output in edit 176
  193. was noticeably slower on small, slow machines.  Thanks to Tom Kloos at Sequent
  194. and Peter Mauzey at AT&T for pointing out the problem, and to Tom for
  195. suggesting some output buffering code.  ckucon.c.  NOTE: a general solution to
  196. this problem (e.g. covering the TELNET and SO/SI cases) requires massive
  197. reorganization of the code -- e.g. moving the TELNET negotiations from the
  198. high-level code (CONNECT, INPUT, SCRIPT, etc) to the lowest level (ttinc,
  199. ttinl, ttxin, etc, in ck*tio.c).  This could be done easily enough, but it
  200. would have to be done for all C-Kermit variants.
  201.  
  202. Added -DTCPSOCKET to Apollo sr10-bsd entry.
  203.  
  204. Rearranged overlays for 2.10/2.11 BSD version because root segment became
  205. a tad too large.  ckubs2.c, makefile.
  206.  
  207. Supplied many missing "\" continuation marks to makefile that were lost
  208. in edit 176.
  209.  
  210. Updated the Apollo sr10-bsd makefile entry to allow for an apparently new
  211. ANSI-compliant C compiler, plus a couple of minor changes to ckcdeb.h and
  212. ckutio.c.  Thanks to: Michael Pins <amigapd@icaen.uiowa.edu>, Iowa Computer
  213. Aided Engineering Network, University of Iowa.
  214.  
  215. Fix for SunLink X.25 PAD parameters-setting from Chris Green in England.
  216. The construction *(++p) is apparently not evaluated consistently by different
  217. compilers...  (this can't really be true, can it?)  ckcnet.c.
  218.  
  219. Removed *(++p) constructions from elsewhere too: ckucmd.c, ckuscr.c.
  220.  
  221. Stupid Compiler Tricks: changed all occurrences (169 of them) of "strlen(...)"
  222. to "(int)strlen(...)" to make compilations with the new and improved string
  223. library, in which strlen() is size_t rather than int, happy.  The previous
  224. trick of "#define strlen (int)strlen" caused recursion in certain C
  225. preprocessors (such as DG, DIAB).  I wonder what havoc will now be wrought by
  226. casting a function to its own type...
  227.  
  228. Fix for Kanji file transfer: Kanji translations were being applied even if
  229. the file type was binary.  Fix supplied by Dr. Hirofumi Fujii, KEK, Tokyo.
  230. ckcfns.c.
  231.  
  232. Fixed duplicate case in switch in ckuusx.c for compilers where \n is carriage
  233. return.  Christian Hemsing.
  234.  
  235. Fixed prototypes for xkanj[fzi]() routines in ckcker.h.
  236.  
  237. Made sure that atol() was declared as 'long' in all modules by adding it to
  238. ckcdeb.h.  Maybe this will fix the problems with speeds and file lengths
  239. once and for all.  Thanks to Steven Schultz for this one.
  240.  
  241. Improved version of warray() for ckwart.c.  Bob Larson.
  242.  
  243. Made some variables in ckwart.c static to avoid conflicts when built with VMS 
  244. shared libraries.  Piet W. Plomp.
  245.  
  246. Added OS-9 to \v(platform).  Bob Larson.  Also Macintosh, Amiga, etc.
  247. ckuus4.c.
  248.  
  249. Added check for "NO DIAL TONE" (note spaces) in Telebit dialing.  Tom Kloos.
  250.  
  251. Replaced translation tables between CP437 and Latin-1, and CP850 and Latin-1,
  252. with the official IBM invertible translations, recently published in IBM's
  253. Character Data Representation Architecture (CDRA) manuals.  Watch out, there
  254. are a few surprises in the C0 control-character area!  We also need official
  255. corporate translations like these from Apple, NeXT, DG, etc.  ckuxla.c.
  256.  
  257. Replaced translation tables between Apple Quickdraw and Latin-1 with new,
  258. invertible "Extended Macintosh Latin" encoding, in preparation for the
  259. production of the new Extended Mac Latin font (which, unfortunately, nobody
  260. has started to work on yet...).
  261.  
  262. Noticed that ttoc() can core dump on the SUN when trying to output a character
  263. and the load is VERY high.  A timer goes off, and ttoc() tries to call a
  264. special ioctl() to unstick a possibly stuck XOFF condition.  Apparently this
  265. ioctl (TCXONC), which I now cannot find documented anywhere, was being called
  266. incorrectly (like maybe TCXONC is really supposed to be for termio rather than
  267. ioctl?  Or 3rd arg is by reference rather than value?).  Replaced this code
  268. with a call to the POSIX function tcflow(ttyfd,TCOON).  ckutio.c.
  269.  
  270. Added Telnet protocol negotiation support to the SCRIPT command.  Until now,
  271. SCRIPT commands would not work at the beginning of a SET HOST connection
  272. (noticed by Bert Laverman). ckuscr.c, ckcnet.c.
  273.  
  274. Made sure that telnet echo negotiations were handled correctly by the SCRIPT
  275. and INPUT commands (previously, they were handled, but the global "duplex"
  276. setting was never changed).  ckuus4.c, ckuscr.c.
  277.  
  278. Added SET SCRIPT ECHO {ON, OFF} and made SCRIPT echoing obey it.  Also, got
  279. rid of the message that echoes the SCRIPT command, since it usually tends to
  280. contain a password.  Suggested by Augustine Cano.  Added SCRIPT ECHO state to
  281. SHOW SCRIPTS.  ckuscr.c, ckuus3.c, ckuus5.c.
  282.  
  283. Changed the SCRIPT command to take the character following "~" literally if it
  284. is not one of the special "~"-arguments.  This takes care of (in particular),
  285. "-" (dash), which there was previously no easy way to send (pointed out by
  286. Augustine Cano).
  287.  
  288. Added an #ifdef to ckcpro.w for the benefit of the Coherent C compiler,
  289. which blew up at the switch() statement that was added in the <rdata>Z case,
  290. suggested by Manfred Prange.
  291.  
  292. Added confirming message "Hanging up" when user types <esc-char>H during
  293. CONNECT mode.  Suggested by Peter Mauzey.
  294.  
  295. New ckvker.mms for building C-Kermit on VAX/VMS, optionally with shared
  296. library support, from Piet Plomp.
  297.  
  298. Added -DNOPUSH compile-time feature selector.  If defined, it disables all
  299. sorts of "shell escapes" -- the PUSH and RUN commands, "!", "@", SPAWN, etc,
  300. as well as the server's execution of REMOTE HOST commands, as well as
  301. ENABLE HOST, plus OPEN { !READ, !WRITE } commands, job control, shell escape
  302. from CONNECT mode, etc.
  303.  
  304. Changed SET HOST command to allow a TCP service name or number to be given as
  305. a separate field, in addition to allowing it to be appended to the IP host
  306. name or number (which it already did).  This way, the user gets useful ?-help,
  307. and the syntax matches that of most TELNET commands.  So now you can say: SET
  308. HOST foo, SET HOST foo:3000, or SET HOST foo 3000.  function setlin() in
  309. ckuus7.c
  310.  
  311. Added a built-in TELNET command.  It is simply a shorthand for:
  312.  
  313.   SET HOST [ <ip-name-or-number> [ <tcp-service-name-or-port-number> ] ]
  314.   IF SUCCESS CONNECT
  315.  
  316. except that if a hostname is not given, the previous session, if any, is
  317. continued.  So now you can say TELNET, TELNET foo, TELNET foo:3000, or TELNET
  318. foo 3000.  Also, cleaned up SET HOST / TELNET failure messages (no more "Error
  319. 0").  ckcnet.c, ckuusr.c, ckuus7.c.
  320.  
  321. Removed "/lis" and "/map/full" from ckvker.com -- it fills up my poor disk.
  322.  
  323. In trying to TELNET from C-Kermit to services on non-telnet ports, I
  324. discovered that Kermit often did not work, but UNIX telnet did.  Many of these
  325. services (like the University of Michigan Geographic Name server) don't do
  326. TELNET option negotiations and need to be spoken to in "linemode".  So I
  327. changed Kermit to assume half duplex linemode conventions (initially) if a
  328. TCP/IP connection is not on a TELNET port.  ckcnet.c.
  329.  
  330. Checked to make sure Kermit didn't appear idle during remote-mode file
  331. transfer.  It doesn't.
  332.  
  333. Merged in Rick Watson's Macintosh changes from edit 172.  This work consisted
  334. mainly of putting #ifndef MAC..#endif around features that are not to be used
  335. in Mac Kermit, plus converting a lot of static buffers to dynamically malloc'd
  336. ones, plus adding some special code for handling the Mac's miniparser and
  337. Command-. command cancellation, within #ifdef MAC conditionals.
  338.  
  339. Removed all occurrences of '\r' from the cku*.c modules: MPW C translates
  340. this to linefeed, not carriage return!
  341.  
  342. Transferred all of the ck[cu]*.[ch] files from this edit plus all the latest
  343. ckm*.* files from U of Texas to the Mac and compiled with MPW C 3.0 under
  344. System 6.03.
  345.  
  346. Found a conflict between the fatal() routine declared in ckuusx.c (which takes
  347. one argument) and the one declared in ckmutl.c (which takes two).  Changed all
  348. fatal() calls, and the fatal() routine, in all ckm*.* files from fatal() to
  349. macfatal().  macfatal() is different from fatal() -- it puts up a "stop alert"
  350. box and exits to the Mac "shell".  The fatal() calls in the ck[cuw]*.c files
  351. remain fatal(), for now.  The affected files are: ckmptp.h, ckmcon.c,
  352. ckmco2.c, ckmini.c, ckmtio.c, ckmusr.c, ckmutl.c, and ckmwin.c.  Made all
  353. changes via RCS in the /uw/mackermit directory.
  354.  
  355. At link time, found lots of unresolved references, mostly from routines or
  356. variables declared in ckuusx.c and ckcnet.c -- the makefile didn't include
  357. them.  Changed the makefile to include them, but then found that the ckm*.*
  358. modules declared their own versions of many of the ckuusx.c functions, so
  359. put the ones in ckuusx.c within #ifndef MAC...#endif.  Also, ckmxla.c needed
  360. a lot of updating: missing items were copied from ckuxla.c.
  361.  
  362. The result of all this compiles without complaint and links without any
  363. unresolved or duplicate references.  However, link says "Size of global
  364. data area exceeds permitted size: (Error 34), Size of global data area:
  365. 40944."  Then it spews out thousands of "Computed Reference offset out of
  366. range (Error 49).  The maximum size for the global data area is 32K, so we
  367. need to eliminate about 8K more of this to compile with MPW 3.0 or 3.1 --
  368. that would be a lot of work, and would introduce the possibility of further
  369. errors, more releases needed for debugging, etc.
  370.  
  371. MPW 3.2, however, allows bigger global data areas.  Using MPW 3.2 with "-model
  372. farData" (C compilation) and "-model far" (Link) (= "32-bit everything"), the
  373. program builds with no complaints.  But file transfer doesn't work at all.
  374. Mac loops or hangs, etc.
  375.  
  376. Discovered several places where z{in,out}{buffer,ptr} had not been changed
  377. from CHAR to char, including in ckmfio.c and ckmxla.c.  Made these changes,
  378. rebuilt on Mac, but still no improvement.
  379.  
  380. When sending a file, the Mac seems to put tons of garbage (like 4000 G's) in
  381. the file header packet.  Noticed that this caused C-Kermit on UNIX to crash,
  382. found that buffer bounds not checked in rcvfil() in ckcfns.c.  Fixed this.
  383. Ditto for sfile().
  384.  
  385. Found a horrible bug in zrtol() in ckmfio.c (Macintosh only) that would make
  386. it write all over memory.  Fixed it, but that didn't make the file transfer
  387. problems go away.  At least now you can use pathnames in SEND commands, e.g.
  388. "send disk:folder:filename" -- previously this would crash the Mac.
  389.  
  390. Finally, Rick suggested I recompile the whole thing with MPW, but without
  391. any kind of -model, -m, or -srt switches.  I got the Link message "Warning:
  392. Size of global data area exceeds 32K. (Error 34)".  But the resulting program
  393. seems to work, at least on my Mac IIx.
  394.  
  395. Fixed \v(time), \v(date), \v(ntime), and \v(ndate) for  Macintosh Kermit.
  396. ckmfio.c.
  397.  
  398. Added version herald, etc, strings for SHOW VERSION to Mac Kermit.  ckmtio.c,
  399. ckmfio.c, ckuver.h, ckuus5.c, ckmker.mak.  Also fixed ckm[tf]io.c to have
  400. all source lines < 80.
  401.  
  402. Received from Kai Uwe Rommel, at the Technical University of Munich, updates
  403. to edit 176 for OS/2, including a whole new ckufio.c with conditionals
  404. inserted for OS/2 (since the file system interface for C is very similar
  405. to BSD UNIX).  Worked all of his diffs into edit 177, recompiled on various
  406. UNIX versions and VMS to make sure these were not broken, including through
  407. GNU CC with -Wall, tested to make sure wildcard expansion, file opening &
  408. closing, etc, still worked; all seems OK (SUN BSD, SUN SYSVR3, SYSV/386 R4,
  409. VAX/VMS, etc).  With any luck, the OS/2 version will be OK too.
  410.  
  411. Changed the SET KEY command to allow not only single characters, but also
  412. character strings (no \Kverbs yet), and also to read keyboard scan codes
  413. greater than 255.  Scan codes, of course, require larger key map arrays, for
  414. example 4096 instead of 256.  For SUN Sparcstations, NeXT workstations, PCs
  415. with Xenix, DECstations, VAXstations, Aviions, etc, that can also produce scan
  416. codes via Alternate, Command, Option, Left, Right, etc, key combinations,
  417. and/or with F-keys, I need to know the system call to get the scan code.  So
  418. for now, scan codes > 255 are supported only in the OS/2 version.  (Note:
  419. looking through man pages, it seems like this can only be done through window
  420. manager calls -- but I sure don't want to drag in the X libraries just to read
  421. a key scan code!)  Many thanks to Kai Uwe Rommel for doing the preliminary
  422. coding.
  423.  
  424. A new function was added to the system-dependent console i/o module: congks()
  425. (console get keyboard scancode).  For all but OS/2, this routine is currently
  426. #defined to be "coninc", so no disruption should occur.  By the way, the code
  427. works fine just as it is on the NeXT with Alternate-key special characters,
  428. because these are just 8 bits.
  429.  
  430. Key mapping is compiled only if NOICP and NOSETKEY are not defined.  It is
  431. used only during CONNECT mode, not for OUTPUT, TRANSMIT, or other commands
  432. that can send characters to the host.  Furthermore, the key map is not used
  433. in reading escape character arguments, nor is the escape character treated
  434. as an escape character if it appears in a "key macro" (i.e. a key is mapped to
  435. a string of length greater than one).  Characters obtained from the keymap
  436. are subject to translation, shifting, and other operations governed by SET
  437. TERMINAL, exactly as if the characters had been typed at the keyboard and
  438. there were no keymap at all.  Key macros are null-terminated, and thus
  439. cannot contain null (0) characters.  I could make them counted strings, but
  440. then we'd need yet another big array.
  441.  
  442. Changed makefile to add -DNOSETKEY to all entries that already included
  443. -DNOFRILLS, so this feature won't surprise any of the small versions.  Checked
  444. to make sure the program builds and runs OK both with and without NOSETKEY
  445. defined.
  446.  
  447. Added key mapping support to the VMS C-Kermit CONNECT command.  ckvcon.c.
  448.  
  449. Several MINIX changes from Kai Uwe Rommel.  ckcdeb.h, ckuus4.c, makefile.
  450.  
  451. Noticed that terminal character set translation didn't work at all during the
  452. CONNECT command, except for Cyrillic, and probably hasn't since edit 174
  453. (November 91).  Hey, doesn't anybody use this stuff outside of the ex-USSR?
  454. Fixed in ckucon.c.
  455.  
  456. Ditto for the TRANSMIT command.  Fixed in ckuus4.c.  But after I fixed it, I
  457. noticed that when it displays the remote host's echo, the echo wasn't
  458. translated.  Fixed that too.
  459.  
  460. German Goldszmidt at IBM reported that the "ps2aix" make didn't work because
  461. of some declarations in cku[tf]io.c.  Put these within #ifndef PS2AIX10..#endif
  462. and added a definition for PS2AIX10 to the ps2aix makefile entry.  (This is
  463. for PS/2 AIX 1.0 -- 1.2.)  Also added a program herald corresponding to this
  464. symbol to ckuver.h.
  465.  
  466. Received some OS-9 fixes from Bob Larson at USC, passed them along to
  467. Christian Hemsing in Aachen, and he sent them back after testing with edit
  468. 177, plus some changes he had.
  469.  
  470. More changes from Kai Uwe Rommel for OS/2, most of them related to ANSIC C
  471. prototyping, argument passing, casts, etc.  Pervasive changes over all the
  472. modules.  Much of this was necessary because on PCs, sizeof(int) is not
  473. necessarily equal to sizeof(char *).  After applying his changes, I ran the
  474. program through GNU CC with -Wall, and got thousands of complaints, mostly in
  475. ckuxla.c -- items that Microsoft C apparently didn't care about.  Fixed these,
  476. and many others.  Now the program is getting REALLY ugly (see, especially, the
  477. function declarations in ckuxla.c).  Also, the 4th argument to debug() was
  478. changed from int to long, but this should be transparent to everybody because
  479. debug is a macro, and a cast to (long) was inserted into the macro definition.
  480.  
  481. Changed -DSIGTYP=void in makefile to -DSIG_V.  You can also use -DSIG_I to
  482. force the type of signal() to be int.  This lets us not only define the
  483. type of signal() (as before), but also to define a symbol SIGRETURN, which
  484. for SIG_V is return, and for SIG_I is return(0), to make ANSI compilers
  485. happy.
  486.  
  487. Received an updated CKVFIO.C module from Terry Kennedy that fixes console
  488. output during local-mode packet operations.  For example, REMOTE commands
  489. issued from C-Kermit/VMS now properly display the text sent back from the
  490. server on the screen.
  491.  
  492. Tested James Harvey's CKVTIO.C module with all the other updated files, but
  493. it has big problems -- flow control deadlocks, etc -- so I didn't include it
  494. with edit 177.  He's still working on it.
  495.  
  496. ------------------------------
  497. 5A(176) Thu Nov 28 22:08:52 1991
  498.  
  499. NEW FEATURES
  500.  
  501. Added PRINT command to print a local file on a local printer.  ckuus[r2].c.
  502.  
  503. Added DG-MULTINATIONAL (Data General Multinational Character Set) as a
  504. file character set.  The tables between DG MCS and Latin-1 are invertible.
  505. ckuxla.[ch].
  506.  
  507. Added ttsndlb() routine to ckutio.c.  It sends a "Long BREAK".  This routine
  508. should be added to all the other system-dependent modules.  Added calls to
  509. ttsndlb(): <esc-char>L in CONNECT mode, and OUTPUT \\L in script programs.
  510. ckutio.c., ckucon.c, ckuus5.c.
  511.  
  512. Made SHOW MACROS command wait at end of each screenful (currently hardwired to
  513. 24 x 80 screens).  Does its own line wrapping, etc.  This is done by passing
  514. each name and definition thru the new & improved shomac() routine.  Did the
  515. same for SHOW GLOBALS.  ckuus5.c.  Also, made the "more?" prompter into a
  516. separate routine, askmore(), shared by SHO MAC, SHO GLOB, HELP, can be
  517. used by other commands that need to page the screen.  ckuusx.c, ckuus2.c.
  518.  
  519. CONNECT COMMAND
  520.  
  521. Fixed a bad bug introduced in edit 175: when escaping back from connect mode,
  522. the connection is broken if there has previously been an error.  Diagnosis:
  523. sjval in ckucon.c was not reinitialized after the first connection.  Cure:
  524. initialize sjval to 0 each time the "if (setjmp(con_env) == 0)" path is taken.
  525. Thanks to Tom Kloos at Sequent.  ckucon.c.  Also from Tom: move the call to
  526. tthang() after the perror() call because tthang() resets errno (Tom also
  527. suggested that tthang() should save and restore errno, but it's not worth it
  528. -- there are no less than 33 different return points in tthang()!).  Also from
  529. Tom, add a UTEK-specific bit here to prevent EWOULDBLOCK from being a fatal
  530. error (UTEK always blocks or gives an error on any line that does not have
  531. carrier asserted).  ckucon.c.
  532.  
  533. Added a check to the CONNECT command to make sure Kermit is not running in
  534. the background.  If it is, the CONNECT command prints an informative error
  535. message and fails.  You will see it if, for example, "at" or "batch" mails
  536. Kermit's output back to you, or if you do something like:
  537.  
  538.   $ kermit -l /dev/tty4 -c &
  539.   Sorry, Kermit's CONNECT command can be used only in the foreground
  540.  
  541. ckucon.c (UNIX), ckvcon.c (VMS).
  542.  
  543. Changed VMS C-Kermit's CONNECT command to report "Back at blah" when escaping
  544. back, if local nodename is known.  ckvcon.c.
  545.  
  546. Changed C-Kermit's CONNECT command to enclose the "Back at blah" message in
  547. parentheses rather than brackets, because brackets are national characters
  548. in ISO 646 character sets.  ckucon.c.
  549.  
  550. Made UNIX and VMS CONNECT messages consistent.  ckucon.c, ckvcon.c.
  551.  
  552. Worked on the CONNECT command to make it more compact and efficient.  General
  553. cleanup of ckucon.c, found a few minor boo-boos and fixed them.  Noticed that
  554. lbuf[] was declared by both ckucon.c and ckudia.c.  Made them both static
  555. (i.e. private to their respective modules), and made them both dynamically
  556. allocated if DYNAMIC is defined.  Oddly enough, allocating these buffers
  557. dynamically makes both modules slightly bigger (size cku{con,dia}.o).  Why is
  558. that?  No matter.  Then I removed a huge chunk of ugly, redundant code from
  559. ckucon.c, collapsing the two big sections of port-reading code into one.  This
  560. was done by using a "programming 101" buffering strategy for characters coming
  561. in on the communication line.  The final result is slightly smaller (and
  562. should be more efficient) than before, and should also solve some echoing and
  563. session logging problems.  But mainly, the code is now much cleaner and more
  564. comprehensible.
  565.  
  566. BUG FIXES
  567.  
  568. Found a bug in the processing of incoming Attribute packets that has been
  569. there forever: For each attribute, C-Kermit reads the length and then copies
  570. that many characters into a buffer, advancing the input pointer to the next
  571. attribute field.  Fine.  But if the announced length is greater than
  572. C-Kermit's buffer length, C-Kermit cleverly declines to copy the excess
  573. characters, so as not to write over random memory.  However, in this case
  574. C-Kermit forgot to advance the buffer pointer to next attribute field.  It
  575. turns out that certain Kermit programs (e.g. 2.10 BSD Kermit on a PDP-11) send
  576. total garbage in the File Creation Date attribute field, and the garbage is
  577. longer than the receiving Kermit's creation date buffer.  This made the
  578. receiving C-Kermit interpret some random byte pair as the next (attribute,
  579. length) pair.  Since the garbage often tended to contain a "1" character at
  580. that point, Kermit thought it was now reading the file size attribute.  This
  581. explains the persistent but until-now-unreproducable reports of about
  582. local-mode C-Kermit reporting garbage for the incoming file's size.  Fixed in
  583. gattr() in ckcfn3.c.
  584.  
  585. Changed the code in ckufio.c that constructs the file creation date for the
  586. attribute packet.  It was using a very fancy printf format string, with
  587. options that are apparently not supported by some C libraries, for example the
  588. one for 2.11 BSD, and possibly also the AT&T 6300.  I fixed it to use a very
  589. simple format string.  Before this change, C-Kermit on the PDP-11 with 2.11
  590. BSD sent a date/time string that looked like "0yyyy0mmdd 0hh:0mm:01157"
  591. instead of "yyyy hh:mm:ss".  Now it's fixed, at least for the PDP-11.
  592.  
  593. Fixed sending of TELNET BREAK via <esc-char>B and OUTPUT \\B.  ckcnet.c.
  594.  
  595. Corrected a formatting error in SHOW FILE.  Bob Larson.  ckuus4.c.
  596.  
  597. Corrected a printf in ckwart.c that had a %s without a matching variable.
  598. Bob Larson.  ckwart.c.
  599.  
  600. Fixed bug in Telebit V.42 dialing in which it didn't recognize the modem's
  601. connect message.  Bob Larson.  ckudia.c.
  602.  
  603. Changed declarations for zinbuffer, zoutbuffer, zinptr, zoutptr from CHAR
  604. (unsigned char) to char.  The only place where the data type really matters
  605. is in the zinfill() routine, that does an fread() into the buffer.  ANSI C
  606. compilations fail because zinbuffer does not match the prototype for fread().
  607. ckcmai.c, ckcfns.c, ckufio.c.
  608.  
  609. Fixed a mistake that might have been causing C-Kermit to put the wrong
  610. filesize into outbound attribute packets.  Can't tell for sure, the symptom
  611. only shows up on 16-bit machines, and I don't have one.  ckcfn3.c.  (Later,
  612. discovered this is still not fixed -- the PDP-11 version reports wildly
  613. incorrect file sizes...)
  614.  
  615. Moved some more X.25-related declarations from ckuus3.c. to ckuus7.c.  Thanks
  616. to Chris Green in England.
  617.  
  618. Corrections to the parsing of the SET PAD command (for SunLink X.25). ckuus7.c.
  619.  
  620. Changed "fr-canadian" to "canadian-french" in the SET {FILE, TERMINAL}
  621. CHARACTER-SET commands.  ckuxla.c.
  622.  
  623. Reset some additional counters in resetc() at transaction beginning to reduce
  624. spurious statistics if "Ctrl-A" report is requested during S- or A-packet
  625. exchange, and also after file transfer with a server (to avoid counting the
  626. FINISH packet as the "last file transfer").  ckcfns.c.
  627.  
  628. Added "#define strlen (int)strlen" to ckcdeb.h in the CK_ANSILIBS section
  629. after #including <string.h>.  The SVR4 compiler did not like constructions
  630. like "if (strlen(foo) > bar)", where bar is an integer, because strlen() is
  631. a size_t instead of an int in the ANSI C library.
  632.  
  633. Included a copy of inet_ntoa within #ifdef EXCELAN because Excelan TCP/IP
  634. doesn't have this routine.  William Bader.  ckcnet.c.
  635.  
  636. Removed Olivetti X/OS from the list of systems that needed to define INADDRX
  637. (see edit 175), based on a report from Fulvio Marino at Olivetti in Italy.
  638. ckcnet.h.
  639.  
  640. Changed the wart program to omit the extraneous trailing comma from the
  641. state table switching array initialization clause.  ckwart.c.
  642.  
  643. SIZE REDUCTION
  644.  
  645. The Coherent version of edit 175 could not be built because the compiler
  646. runs out of space, so...
  647.  
  648. Demoted SET KEY to a "frill" (-DNOFRILLS gets rid of it).  ckuus[r35].c,
  649. ckucon.c.
  650.  
  651. Demoted the PRINT, PWD, PUSH, ENABLE, DISABLE, SET PROMPT, and multiline GET
  652. commands to frills (you can still use "!" to get at the shell or run shell
  653. commands).
  654.  
  655. Removed "debug" and "transaction" keywords from LOG and CLOSE commands if
  656. DEBUG and TLOG not defined, and "unk-char-set" from SET menu if NOCSETS is
  657. defined, plus many similar changes.  ckuusr.c.
  658.  
  659. Tried creating a version of C-Kermit without server mode, via a new symbol
  660. -DNOSERVER, because the state-table switching array generated by wart from
  661. ckcpro.w has become too big for at least one C compiler (Coherent): the tbl[]
  662. array is now pre-initialized with 1920 elements.  Unfortunately, there is no
  663. straightforward way to remove the server-related states because #ifdef's don't
  664. work in ckcpro.w.  But now #ifndef NOSERVER..#endif pairs are scattered
  665. throughout the program, but they don't do anything except take out the
  666. SERVER-related commands, which is useful if (for some reason) you don't want
  667. your Kermit program to be used in server mode.  When built this way, C-Kermit
  668. can still communicate with a server (GET, REMOTE, BYE, FINISH, etc, are still
  669. present).  Savings in space is minimal.
  670.  
  671. Then I found a way to reduce the size of the state-table array.  There is
  672. an entry for every combination state (currently 14 of them) with
  673. each "input character" (128 possible).  (Input characters are the packet
  674. types or pseudo-packet-types returned by the input() function in ckcfn2.c).
  675. But input characters will never be in the control range (ASCII 0-31), so
  676. by subtracting 32 from each input character, and adjusting various bits of
  677. code accordingly, I was able to change the state table array size from
  678. 128 * nstates (= 1920) to 96 * nstates (= 1440), a 25% reduction.  Not a huge
  679. savings in program size, but it could make all the difference for certain
  680. borderline compilers.  Every little bit helps.  ckwart.c, ckwart.doc.
  681.  
  682. There's not much left to squeeze out.  On a SUN-4 (Sparc RISC architecture,
  683. SUNOS 4.1.1), the resulting "minimum interactive" wermit is 180K, exactly the
  684. same size as 4E(072).  Compared to 4E(072), the minimum interactive version
  685. lacks the DIAL and SCRIPT commands, but adds sliding windows, proper handling
  686. of interrupt and suspend signals, longer packets, improved handling of
  687. lockfiles and suid operation, and numerous other improvements and bug fixes.
  688. With command-line processing removed ("minimum interactive-only") it's 172K.
  689. Adding the DIAL command back in brings it up to 196K, the SCRIPT command adds
  690. another 8K to bring it up to 204.  These sizes should be smaller on non-Risc
  691. architectures like the PC.
  692.  
  693. MAKEFILE
  694.  
  695. Added a new mechanism to let Kermit feature selection and other compilation
  696. switches be given on the "make" command line without having to edit the
  697. makefile, and also reduced its size somewhat.  To add any desired options to
  698. CFLAGS, just include "KFLAGS=xxx yyy zzz" on make's command line, e.g.
  699.  
  700.   make sunos41 KFLAGS=-DNODEBUG
  701.   make sunos41 "KFLAGS=-DKANJI -DNODEBUG -DNOTLOG -UTCPSOCKET"
  702.  
  703. (quotes are necessary if KFLAGS= clause includes spaces).
  704.  
  705. Added a new makefile entry for DIAB DS90 with DNIX 5.3 and ANSI C:
  706. dnix5r3ansi.  makefile.
  707.  
  708. Special makefile for 2.10 / 2.11 BSD on PDP-11s: ckubs2.mak.  Changed ckustr.c
  709. to look for environment variable KSTR before using hardwired pathname for
  710. string file (which happens to be /usr/local/lib/kermit5.sr, which I don't have
  711. write access to so I can't test the program after I compile it).
  712.  
  713. Added makefile entry du42 for DEC Ultrix 4.2, which adds "-O2" optimization
  714. available with new C compiler.  "-O2" optimization cuts 24K off the executable
  715. program size, compared "-O".  Also, just for amusement, I added a "du42s5r4"
  716. entry, to build us in the System V R4 environment under Ultrix 4.2.  Oddly
  717. enough, it works.  Also, "make posix" works on Ultrix 4.2.  Way to go, DEC.
  718.  
  719. Made a shar file of the old (Chris Adie, Feb 1988) OS/2 support files for
  720. C-Kermit 4F and put them with the current files, so OS/2 volunteers can have a
  721. relatively short and simple set of modules to look at, rather than plunging
  722. directly into the longer and more complicated Chris Armstrong Presentation
  723. Manager version from 5A(143), June 1990.  cko4f.sh.
  724.  
  725. Still can't compile on the local RS/6000 - any attempt to compile any but a
  726. very small C source file, even without a makefile, results in "xlc: 1501-229
  727. Compilation ended due to lack of space".  Others say they have no trouble.
  728.  
  729. watsun upgraded to SUNOS 4.1.1.  C-Kermit works ok.
  730.  
  731. Built full-blown C-Kermit on the Encore with and without -DYNAMIC.  The
  732. DYNAMIC version was about 1K bigger than the nondynamic one!
  733.  
  734. Got a new CKVTIO.C module from James Harvey at Indiana/Purdue University.  It
  735. makes VMS C-Kermit's CONNECT command work much better, but unfortunately it
  736. breaks the REMOTE commands (returned data is not displayed).  It doesn't help
  737. the MultiNet code at all -- still slow as can be.  Wait for fixed copy, add
  738. ttsndlb(), before releasing 176.
  739.  
  740. ------------------------------
  741. 5A(175) Fri Nov 22 13:55:18 1991
  742.  
  743. Added REMOTE LOGIN and REMOTE LOGOUT commands (if NOFRILLS not defined).
  744. Client end only, not server end.  ckuusr.c, ckuus7.c.
  745.  
  746. Added SET LOCAL-ECHO {ON, OFF} as a synonym for SET DUPLEX {HALF, FULL}.
  747. ckuusr.h, ckuusr.c, ckuus3.c.
  748.  
  749. Added "Trying <ip-address> ..." message for TCP/IP SET HOST connections,
  750. like telnet, so users can see the IP address in case they gave a name.
  751. Also added IP address to SHOW NETWORK display.  ckcnet.c, ckuus4.c.
  752.  
  753. Changed ckucon.c to use setjmp() in a simpler way to prevent "Macro setjmp
  754. used in invalid context" failure from Cray UNICOS C compiler (reported by
  755. Chuck Fuller <fuller@wccs.psc.edu>, diagnosed by Bill Homer at Cray Research).
  756. Similar changes to ckudia.c.  Basically, it is against the law to use longjmp
  757. to return a value through setjmp, because constructions like:
  758.  
  759.   if (x = setjmp(buf)) { ... } else { ... }
  760.  
  761. are illegal (the assignment isn't allowed).   All places where this was done
  762. have been changed to make longjmp set a global variable.
  763.  
  764. Moved the code to get the local hostname to a separate function, ckhost(),
  765. and put it in ckuusx.c so it can be used by different implementations.
  766. Strictly speaking, it should go in a system-dependent module, but it's not
  767. worth changing the interface definition and all the ck*tio.c modules just
  768. for this.  Had main() call this function when the program starts up to fill
  769. in a string called myhost, which can be printed by any module at any time.
  770. ckcker.h, ckcmai.c, ckuus4.c, ckuusx.c.
  771.  
  772. Changed CONNECT message "Back at local system" to report the host name, if
  773. known, e.g. "Back at watsun".  ckucon.c.
  774.  
  775. Fixes for MAIL and PRINT handling for VMS version from Terry Kennedy.
  776. ckcfns.c, ckv[tf]io.c.
  777.  
  778. Changes to support for incoming files that are to be mailed or printed: if
  779. mail or print fails, special return codes are now given by zmail() and
  780. zprint(), passed along by reof(), and cause ckcpro.w to issue error packets
  781. with appropriate messages, rather than "Can't close file".  So far, only the
  782. VMS version actually returns meaningful return codes -- the UNIX version
  783. always says it succeeds, even if it fails.  ckcfns.c, ckufio.c, ckvfio.c,
  784. ckcpro.w, ckasys.doc.
  785.  
  786. Corrected a few dangling commas in keyword lists in ckuus[r3].c, reported by
  787. Manfred Prange.  However, it still looks unlikely that an interactive version
  788. of C-Kermit can be compiled under Coherent.  We get "out of space" errors on
  789. ckuus3.c and ckuusr.c.
  790.  
  791. Deleted many unnecessary external declarations from ckuus*.c files, in hopes
  792. of reducing compiler symbol table space requirements, "too big" errors, etc.
  793.  
  794. Moved some X.25-related declarations from ckuus3.c to ckuus7.c.  X.25 support
  795. could not possible have worked in edit 174.
  796.  
  797. New OS-9 files: makefiles (accounting for ckuus7.c, allowing Kanji) and
  798. ck9con.c, from Christian Hemsing <SE@DACTH51.BITNET>.
  799.  
  800. Obscure workaround for Altos 986 connect mode problem -- pressing DEL causes a
  801. read error, pops you back to the C-Kermit prompt.  Reported by Bertie
  802. Coopersmith in London, who furnished the fix.  ckucon.c.  Also, added Altos
  803. 986 banner to ckuver.h and A986 symbol typeout to SHOW VERSIONS.  ckuver.h,
  804. ckuus5.c.
  805.  
  806. Removed redundant and spurious prototype for acucntrl() from ckutio.c.
  807. Reported by Ryan Stanisfer <ryan@ponder.csci.unt.edu>.
  808.  
  809. Adjustments to makefile for 2.11 BSD from Steven Schultz at Contel.
  810.  
  811. SET DIAL MNP-ENABLE should now work for HST Courier modems too -- switch
  812. settings provided by Bo Kullmar in Sweden.  ckudia.c.
  813.  
  814. Fixes to tthang() for SCO 3r2, 3r22, 3r22gcc (some automatic variables weren't
  815. being declared in the POSIX case, which these make entries use), from Warren
  816. Tucker.  ckutio.c.
  817.  
  818. New compile-time symbol: INADDRX.  Define this symbol for systems built with
  819. the TCP sockets library in which the inet_addr() function is of type struct
  820. inaddr (or in_addr), rather than the normal unsigned long.  Predefined this
  821. symbol for Olivetti X/OS, Data General UX 5.40, and DEC Ultrix 2.0.  ckcnet.h,
  822. ckuins.doc.
  823.  
  824. Simplified the conditionals in the reference to inet_addr() in ckcnet.c, and
  825. changed the code to avoid the dangerous and illegal &inet_addr() construction.
  826. I can't imagine how this ever worked.
  827.  
  828. New makefile entry for Data General UX 5.40 (= Sys V R4).  Identical to
  829. s5r4sxtcp, but defines the symbol DGUX540, which in turn causes INADDRX to
  830. be defined.  Added a herald for DG UX 5.40 to ckuver.h, and also to SHOW
  831. VERSIONS in ckuus5.c.  Tested on a DG Aviion, works good.
  832.  
  833. Corrected spurious return code from tthang() in BSD environment, which
  834. caused Kermit to say "hangup skipped" instead of "hangup ok".  ckutio.c.
  835.  
  836. Added makefile entry dynix31 for Sequent DYNIX 3.1.x with TCP/IP, from
  837. Jack Woolley, SCT Corp, jwoolley@sctcorp.com.  makefile.
  838.  
  839. Added makefile entry sco386gcc for SCO Xenix/386 2.3.3 with gcc 1.37 or later
  840. from Richard S Smith at Cal State.  makefile.
  841.  
  842. Moved WRITE command from #ifndef NOFRILLS to #ifndef NOSPL.  ckuusr.c.
  843.  
  844. Fixed bug with dynamic command buffers.  Now they work and they are used by
  845. default if DYNAMIC is also defined.  ckuus[r56].c, ckcdeb.h.
  846.  
  847. Hirofumi Fujii reports that the Kanji support, including Sony News tty mode
  848. manipulation, works fine: Sony News, DECstation/Ultrix, VAXstation/VMS.
  849.  
  850. A few trial compilations: SUNOS 4.1, POSIX, SVR4 -- so far, so good.  Size
  851. is down a bit.
  852.  
  853. Tried compiling under 2.11 BSD.  After much ado, got it to compile and link.
  854. It even works, once the file kermit5.sr is put into the right directory.
  855. All this thanks to work by Steven Schultz.
  856.  
  857. ------------------------------
  858.  
  859. 5A(174) Mon Nov  4 21:34:48 1991
  860.  
  861. Fixed a BAD BUG in the 8th-bit prefixing negotiations, which has been there
  862. for years: tinit() was initializing ebq to 0, rather than MYEBQ, which
  863. interfered with 8th-bit-prefixing negotiations.  Discovered while testing
  864. locking shift negotiations.  ckcfns.c.
  865.  
  866. Added code to rpack() to deduce the block check type using two heuristics that
  867. totally violate its datalink role by looking at the packet type: if it is I or
  868. S, the block check type is always 1, and if it is N (NAK) the block check type
  869. is always LEN-2, because NAKs never have data.  This prevents deadlocks in the
  870. case where (for example) the PC sends an S packet requesting type 3 block
  871. check, C-Kermit sends the ACK and switches its block check type to 3, but the
  872. PC retransmits the S packet with block check type 1.  ckcfns.c.
  873.  
  874. Fixed a bug in the VMS C-Kermit packet reader that caused it to sometimes
  875. fail to strip parity from all the packet bytes.
  876.  
  877. Completely disabled LPASS8 processing.  It turns out to be entirely unreliable.
  878. It only works on serial ports, and only then on systems that implement it
  879. correctly.  It does not work on terminal servers, telnet connections, rlogin
  880. connections, etc etc, because the connection method usually has no way of
  881. learning that LPASS8 has been done.  The downside to this is the loss of flow
  882. control during packet operations on BSD-based UNIX systems.  Let us hope that
  883. this and the previous two changes clear up the last remaining problems with
  884. binary file transfer.  ckutio.c.
  885.  
  886. Fixed a bug, introduced in 172, in which the new -l <numeric-file-descriptor>
  887. option prevented Kermit from opening numeric X.25 addresses.  Reported by
  888. Michael Schmidt at University of Paderborn in Germany.  ckutio.c.
  889.  
  890. Add sco3r22gcc entry from Warren Tucker.  makefile.
  891.  
  892. Added utsv entry to makefile.  It seems Amdahl UTSV does not define S_ISREG,
  893. etc, macros correctly, similar to Olivetti OXOS, so we redefine them in
  894. ckufio.c for these cases.  ckcdeb.h, ckuver.h, ckufio.c, ckuus5.c.
  895.  
  896. Put the "close(priv_open(...))" bit in ttopen within #ifndef SCO32..#endif,
  897. to keep uugetty from grabbing the device.  Robert Johnson.
  898.  
  899. Changed SCO UNIX 3.2 and Xenix 2.3 makefile entries to explicitly link
  900. libc.a before libx.a, to make sure that readdir() from libc.a (which uses
  901. sys/ndir.h) is used, rather than readdir() from libx.a (which uses dirent.h,
  902. which apparently does not work).  Reportedly, without this change wildcard
  903. expansion does not work right.  Test before and after by typing "send ?"
  904. at the C-Kermit prompt.  Suggested by Feng Chen <feng@mtnsys.wimsey.bc.ca>. 
  905. If this doesn't do the trick, Feng suggests adding -DXNDIR to the CFLAGS
  906. for these entries.
  907.  
  908. Fix for KANJI vs CYRILLIC conditionals in ckuxla.c so KANJI could be selected
  909. without CYRILLIC, from Hirofumi Fujii.
  910.  
  911. Add new support for JIS7 and DEC-KANJI from Hirofumi Fujii.  ckuxla.[ch],
  912. ckcfns.c.
  913.  
  914. Installed Short KOI as a file character set in its own right, and removed all
  915. effects of "set language russian" in the TRANSLATE command, TRANSMIT command,
  916. and CONNECT command.  This means that we don't get automatic transliteration
  917. between Cyrillic and Roman characters unless we ask for it in the normal way,
  918. i.e. by making SHORT-KOI one of the character sets.
  919.  
  920. However, this leaves us no way of sending Russian files to ASCII-only hosts
  921. whose Kermits don't understand the Latin/Cyrillic transfer character set, nor
  922. of translating received files from Short KOI to a real Cyrillic set.  So SET
  923. LANGUAGE RUSSIAN still takes effect when either the transfer character set is
  924. ASCII and the file character set is one of the 8-bit Cyrillic sets, and vice
  925. versa.  ckuxla.[ch], ckuus4.c, ckucon.c.
  926.  
  927. Testing this revealed another problem.  The character set of the file header
  928. packet (and its ACK) is translated by Kermit.  This must not happen, because
  929. the file header comes *before* the Attribute packets that contain the
  930. character set information.  In this case, translating an incoming filename
  931. (which happened to contain lowercase letters) from "Short KOI" to Cyrillic
  932. produced a filename with "random" 8-bit characters.
  933.  
  934. So the getpkt() routine was changed to require a second argument, a flag: zero
  935. means no character-set translation, nonzero means to translate.  All calls to
  936. getpkt modified to include the new flag.  Same thing in the other direction:
  937. decode() has a new 3rd translate-flag argument.  Compiled with GNU cc and ANSI
  938. function prototyping to make sure nothing was missed.  ckcker.h, ckcfns.c.
  939.  
  940. Changed the SET LANGUAGE command keyword table to make all the entries that
  941. don't do anything invisible.  ckcxla.h, ckuxla.c.
  942.  
  943. Added a new field to the csinfo (character-set info) structure: alphabet.
  944. It tells the base alphabet of the character set: Roman, Cyrillic, etc.
  945. Changed tests in TRANSLATE, TRANSMIT (ckuus4.c) and CONNECT (ckucon.c)
  946. to check this when deciding on the intermediate character set for translation,
  947. rather than a whole series of "if" conditions for each character set.
  948.  
  949. Unfortunately, this requires changes also to ckixla.[ch], ckoxla.[ch], and
  950. ckmxla.[ch].  So...  Amiga: uses ckuxla.[ch], so no problem.  OS/2: so far
  951. behind, let's worry about it later.  Macintosh: fixed up ckmxla.h and ckmxla.c
  952. (first time these have been touched in quite a while).  After some back and
  953. forth with Rick Watson at the U of Texas, character-set translation is
  954. finally working in Mac Kermit (user interface in command-window only).
  955.  
  956. Edit 173 check for "kermit -s" not specifying any files broke "kermit -s -".
  957. Reported by Bob Larson, many others.  Now fixed.  ckuusy.c.
  958.  
  959. Fixed spelling of "lockfil" in Dynix/PTX support code (Jeff Gong).  ckutio.c.
  960.  
  961. Changed all occurrences of \r in ckudia.c strings that are sent to modems to
  962. \015 for the benefit of C compilers (e.g. on Macintosh) that define \r to be
  963. something other than carriage return.  Now DIAL command works in Mac Kermit.
  964.  
  965. The CD command always returned SUCCESS, even if it failed.  Reported by John
  966. Hood.  Fixed in ckuus5.c.
  967.  
  968. Fixed HST Courier wakeup string -- it was missing the terminating CR (reported
  969. by John Hood).  ckudia.c.
  970.  
  971. Changed Hayes/USR/HST/Telebit dialing code to allow for RINGING and RRING
  972. responses.  Tested OK on Telebit (after telling Kermit it was a Hayes).
  973. ckudia.c.
  974.  
  975. Totally rewrote the code for reading Hayeslike modem responses expressed as
  976. digit result codes; added code to handle every known response, and structured
  977. the code to make it easy to handle new responses.  Previously very few
  978. responses were handled correctly because the code was originally written to
  979. assume single-digit responses only.  ckudia.c
  980.  
  981. Corrected a bug where Telebits in digit-result mode were not handled at all
  982. after initial setup.  And another where SET MODEM SLOW-TELEBIT didn't work
  983. *unless* the modem was in digit response mode.  And another bug in which speed
  984. changes based on digit result codes usually didn't work.  Also, cleaned up
  985. dial display (seen when SET DIAL DISPLAY is ON) a bit.  ckudia.c.
  986.  
  987. Added new command SET DIAL MNP { ON, OFF } to enable / disable MNP negotiation
  988. while dialing.  Presently effective only for Telebits; I don't know the switch
  989. settings for other MNP-capable modems.  Previously, MNP negotiation in the
  990. Telebits was coupled to the FLOW-CONTROL setting.  Now these are selected
  991. separately.  The modem is told to use hardware flow control if Kermit's FLOW
  992. is set to RTS/CTS; the modem is never told to use software flow control, since
  993. it would then be impossible to send Ctrl-S or Ctrl-Q to the host.  Added DIAL
  994. MNP-ENABLE to SHOW DIAL display.  ckcmai.c, ckuusr.h, ckuus2.c, ckuus3.c,
  995. ckuus4.c.
  996.  
  997. New command: SET SERVER DISPLAY { ON, OFF } enables / disables file transfer
  998. display during server operation in local mode.  In version 4E and earlier,
  999. there was always a display, and at least one site depended on it; they had
  1000. some kind of script that was driven by the file transfer display messages.
  1001. For reasons lost in antiquity, the display was removed in 4F or 5A.  The new
  1002. command lets the user decide.  The setting is shown in the SHOW SERVER
  1003. display.  The "interrupt message" ("Type this to do that, blah blah") is shown
  1004. only once, immediately as server mode is entered, rather than ever time a
  1005. transfer begins (as it was in 4E).  Default is OFF.  ckcmai.c, ckcpro.w,
  1006. ckuusr.h, ckuus2.c ckuus3.c, ckuus5.c.
  1007.  
  1008. Fixed job control for SVR4 for Sys V R4, I think.  To do this, I had to make
  1009. Sys V R4 define the CK_ANSILIBS macro, which causes it to #include <unistd.h>,
  1010. which in turn defines _SC_JOB_CONTROL, like POSIX, so we can do sysconf() on
  1011. it.  Of course, this only tells us whether the underlying UNIX kernel supports
  1012. it, not whether the shell does.  Anyone who suspends Kermit under sh is in for
  1013. a rude surprise.  ckcdeb.h, ckutio.c.
  1014.  
  1015. Removed #define TELOPTS from I386IX (Interactive ISC Sys V R3).  According to
  1016. Mike Hickey <mhickey@dbri.com>, it is already defined in <arpa/telnet.h>.
  1017. It's a mystery why the #define was there in the first place, so the #define is
  1018. left there, but commented out.  ckcnet.h.
  1019.  
  1020. For the recently added HPUXPRE65 (HPUX Pre-6.5) make option, added "typedef
  1021. mflag int;", John Dunlap <dunlap@faraday.apl.washington.edu>.  ckutio.c.
  1022.  
  1023. In response to complaints from people who have supposedly ANSI-compliant C
  1024. compilers that do not support the token-pasting operator ##, I tried changing
  1025. the definition of _PROTOTYP not to use it.  Seems to work OK on Sys V R4, on
  1026. NeXT with GNU cc -Wall, and on RS/6000 with ANSI compilation forced.  So maybe
  1027. it's OK to dispense with it completely.  This should fix the "make convex9"
  1028. entry, among others.  ckcdeb.h.
  1029.  
  1030. While compiling with -Wall, noticed a function that had not been prototyped:
  1031. macini(), the one that allocates macro buffers dynamically on startup.  That
  1032. was being called from ckcmai.c, which is really inappropriate.  Moved the call
  1033. to cmdini() in ckuus5.c, and added the prototype to ckuusr.h.
  1034.  
  1035. Changed protocol error message prefix to be "Protocol Error:".  For a long
  1036. time it was C-Kermit's prompt string, but that implied that the message was
  1037. coming from C-Kermit, when it might have come in a E-packet from the remote.
  1038. Then it was "Remote Kermit says:", but sometimes the message is generated by
  1039. the local Kermit.  Given the structure of protocol routines, there's no easy
  1040. way to separate the two cases.  ckuusx.c.
  1041.  
  1042. New command: SET QUIET {ON, OFF}, default OFF.  Same as -q command-line
  1043. option.  It is supposed to eliminate most non-error messages.  Added various
  1044. messages to this category, including CONNECT and escape-back message.
  1045. ckuusr.h, ckuus3.c, ckucon.c.
  1046.  
  1047. New command: SET KEY \xxx \yyy.  A very limited key mapping feature.  The two
  1048. items are character codes, expressed in decimal or backslash notation.  For
  1049. now all you can do with this command is replace one character by another -- no
  1050. strings, no macros, no verbs, like in MS-DOS Kermit.  No extended scan codes
  1051. are recognized: only ASCII values (0-127) or (if you have 8-bit access to the
  1052. C-Kermit command parser AND if you SET COMMAND BYTESIZE 8) full 8-bit values
  1053. (0-255).  For now, the key mappings are effective only during CONNECT mode.
  1054. Key mappings are done before character-set translation.  ckuusr.c, ckuus3.c,
  1055. ckuus5.c, ckucon.c.
  1056.  
  1057. New make entry: encore88k, for Encore 88K with UMAX V 5.3 (System V R3) and
  1058. TCP/IP support, from David Kricker at Encore <kriker@encore.com>.
  1059.  
  1060. New make entry: sonynews, for Sony NEWS OS 4.01C with Kanji support.
  1061.  
  1062. New make entry: du4kanji, for DEC Ultrix 4.x with Kanji support.
  1063.  
  1064. Added special Kanji support for Sony NEWS.  Get tty Kanji mode when entering
  1065. Kermit: congm().  Get external device Kanji mode upon SET LINE or SET HOST:
  1066. ttopen().  Put terminal into ASCII mode before entering packet mode: ttpkt().
  1067. Restore Kanji mode after packet operations: ttres().  Restore tty Kanji mode
  1068. upon exit from Kermit: conres().  Suggested by Hirofumi Fujii, who also
  1069. provided documentation for the necessary ioctl's.  ckutio.c.
  1070.  
  1071. Added some new symbols to be displayed in SHOW VERSIONS.  ckuus5.c.
  1072.  
  1073. Fixed telnet option negotiation with Xyplex (and possibly other) reverse
  1074. terminal servers.  Users reported "getty babble" on the serial side.  I was
  1075. able to verify the problem on several different servers.  Changed the telnet
  1076. negotiations a bit, and the problem went away.  ckcnet.c.
  1077.  
  1078. Fixed telnet to IBM mainframe linemode terminal server.  Certain applications
  1079. (notably Kermit-370 and Wylbur, probably those using write-chained-to-read to
  1080. issue their prompt?) do not echo linefeeds from the terminal, so commands
  1081. would overwrite each other on the same line.  Now Kermit echoes the linefeed
  1082. that it supplies automatically when the user types CR.  ckucon.c.
  1083.  
  1084. Added Mark Williams Co COHERENT fixes from Manfred W Prange
  1085. <mwprange@vale.acs.oakland.edu>.  He says he can make a functional version
  1086. with no interactive command parser.  He can't include even a minimal
  1087. interactive capability because his compiler blows up on ckuus3.c -- "out of
  1088. space".  ckcdeb.h, ckutio.c, ckufio.c.
  1089.  
  1090. Took everything out of ckuus3.c that was not part of the doprm() function and
  1091. moved it to a new module, ckuus7.c.  Changed the makefile to allow for ckuus7.
  1092. Hopefully this will allow a minimal interactive version to be built for
  1093. Coherent.  Added ckuus7 to the UNIX makefile, the VMS makefile (ckvker.mak),
  1094. and the VMS DCL build procedures (ckvker.com and ckvker.mms).
  1095.  
  1096. Fixed an error in the translation of Latin-1 to many of the ISO 646 national
  1097. sets, in which broken bar and not sign were translated into vertical bar
  1098. and tilde (but vertical bar and tilde stand for national characters!).
  1099. Changed them to translate into UNK.  ckuxla.c.
  1100.  
  1101. Fixed a bug (I hope) where suspending C-Kermit during local-mode file transfer
  1102. and then fg'ing again caused CBREAK mode to be lost on the terminal, which
  1103. prevented single-character interruptions from working.  ckuusx.c.
  1104.  
  1105. Made the default SET SUSPEND status depend on the NOJC compile-time feature
  1106. selection switch, i.e. if you compile Kermit with -DNOJC, then SET SUSPEND
  1107. is OFF by default.  ckcker.h.
  1108.  
  1109. ------------------------------
  1110.  
  1111. 5A(173) Tue Sep 24 00:32:52 1991
  1112.  
  1113. Added \m(name).  Allows you to define (or assign) a "macro" and use it like a
  1114. variable.  This gives us "long variable names".  Required two lines of code.
  1115. Example: define number 7654321, dial \m(number).  ckuus4.c.
  1116.  
  1117. Added builtin variable \v(ntime), numeric time, seconds since midnite, 0
  1118. through 86399.  Use this for timing things.  Call it once at the beginning of
  1119. whatever you want to time, again at the end, then subtract the two using
  1120. INCREMENT or whatever, for example:
  1121.  
  1122.   define xx asg \%9 -\v(ntime), transmit foo, incr \%9 \v(ntime), ec \%9 secs
  1123.  
  1124. It's the user's responsibility to worry about timing things across midnight.
  1125. ckuusr.h, ckuus4.c.
  1126.  
  1127. Added REMOTE KERMIT command (just the client end, not the server).  ckuus3.c,
  1128. ckuusr.c, ckcpro.w.
  1129.  
  1130. Added APPEND option for logs.  Now you can append to the packet, transaction,
  1131. session, or debugging log, rather than always creating a new one, by including
  1132. the word "APPEND" at the end of the LOG command.  Added new prototypes for all
  1133. log-opening functions to include a second argument.  ckuusr.h, ckuusr.c,
  1134. ckuus4.c.
  1135.  
  1136. Added SET TERMINAL NEWLINE-MODE { ON, OFF }.  If ON, then whenever you type
  1137. CR during CONNECT mode, Kermit sends CR and LF.  Otherwise, it just sends CR.
  1138. ckuusr.h, ckuus3.c, ckucon.c.
  1139.  
  1140. Attempted to fix the TRANSMIT command (again), in response to reports from
  1141. Peter Mauzey. PROBLEM: binary file transmission is *much* slower than text
  1142. file transmission.  SOLUTION: if the file type is binary, put the
  1143. communication device in ttvt mode, rather than ttpkt mode, to inhibit the use
  1144. of software flow control (doesn't seem to help much, but doesn't hurt either).
  1145. The real problem is most likely that we're doing single-character output in
  1146. binary mode, compared to line-at-a-time in text mode.  Also, don't bother
  1147. setting up character-set translation if file type is binary.  Added SET
  1148. TRANSMIT LOCKING-SHIFT and separated it from SET TERMINAL LOCKING-SHIFT.
  1149. Added SET TRANSMIT PAUSE to specify number of milliseconds to pause between
  1150. each text line (text mode) or character (binary mode); default is 0.  Added
  1151. these to SHOW TRANSMIT.  Fixed up TRANSMIT ECHO vs DUPLEX interactions.
  1152. Verified transmission worked OK under most combinations of SET TRANSMIT
  1153. settings.
  1154.  
  1155. Fixed SET PROMPT to work in TAKE file, even when followed by ASK.  ckucmd.c.
  1156.  
  1157. Made "O" an invisible abbreviation for "OUTPUT".  ckuusr.c.
  1158.  
  1159. Discovered I was calling usleep() wrong on the NeXT, SUN, etc, so msleep
  1160. was not pausing at all, which is bad for the HANGUP command.  The argument to
  1161. usleep() is microseconds, not milliseconds.  Fixed in msleep(), ckutio.c.
  1162.  
  1163. Various cosmetic changes to messages, plus new help messages for new features.
  1164. Also, changed ermsg(), which is called when C-Kermit gets an Error packet,
  1165. to prefix the message with "Remote Kermit says:", not with its own prompt,
  1166. which was misleading.  Also, ermsg() is now called only when Kermit receives
  1167. an E-packet.  ckuusx.c.
  1168.  
  1169. Got rid of all references to cmerrp (big job).  ckucmd.c, ckuus5.c, ckuusx.c.
  1170.  
  1171. Reinstated code to allocate command buffers dynamically, saving many K of
  1172. static allocation and program size, using code from Rick Watson (who has been
  1173. modifying these modules for use in Mac Kermit).  The removal of cmerrp,
  1174. however, made this a bit tricky.  Unfortunately, the result doesn't seem to
  1175. work too well -- some commands are broken (at least "IF < VERSION nnnn" in my
  1176. init file).  Luckily, all of this is conditionalized on a unique symbol,
  1177. DCMDBUF, so for now it's not defined (see ckcdeb.h).  We can debug this later.
  1178. ckuus*.c, ckucmd.c.
  1179.  
  1180. Also, allocated mactab (the macro table) dynamically.  No problems here.
  1181. Saves about 8K (on NeXT).  ckcmai.c, ckuus[r456x].c.
  1182.  
  1183. It was reported by Donn Baumgartner at Dell that the System V R4 C
  1184. preprocessor for 386's has a broken ## operator, which is what was wrecking
  1185. all the ANSI C compilations on Sys V R4.  Changed the definition of _PROTOTYPE
  1186. for Sys V R4 not to use it.  Tested on an AT&T SVR4 system -- compilations
  1187. went OK.  ckcdeb.h.
  1188.  
  1189. Installed fix for TCP/IP under SVR4, in which bzero/bcopy were defined
  1190. to be memset/memcpy, but in fact these are not argument compatible.  New
  1191. definitions from Rob Healey and Marc Boucher.  ckcnet.c.
  1192.  
  1193. Made a new makefile entry was made for AT&T Unix SVR4 on 386/486 boxes with
  1194. Wollongong TCP/IP: "make sys5r4sxtcp".  ANSI function prototyping works,
  1195. thanks to the change immediately above, <sys/termiox.h> is used, so we get
  1196. hardware flow control, and regular Berkeley sockets library TCP/IP code is
  1197. used (apparently this is a different Wollongong TCP/IP release than the one
  1198. that requires -DWOLLONGONG in the makefile for the misplaced in.h and inet.h
  1199. files).  Debugged and tested successfully on a real 386 system with real AT&T
  1200. Sys V R4.  makefile.
  1201.  
  1202. Fixes for SCO UNIX 3.2 / Xenix 2.3 from Robert M Johnson of Hoboken, NJ, via
  1203. post.  He says that whenever Kermit attempts to write to a modem on a line
  1204. that has uugetty up, uugetty wakes up and hangs the line.  He also said HANGUP
  1205. doesn't work (so what else is new...).  Solution: first, set owner and group
  1206. for the kermit program to be uucp, and set kermit's permission to 06755 (i.e.
  1207. run it setuid).  Second - make some changes to ttopen() and tthang() in
  1208. ckutio.c.  These are within SCO32 conditionals, and a new makefile entry is
  1209. added.  These changes might turn out to be useful for others too.
  1210.  
  1211. New Amiga support files from Steve Walton, based on edit 172.  Broken server
  1212. responses to REMOTE commands now fixed.
  1213.  
  1214. New OS-9 support from Christian Hemsing, based on edit 172.
  1215.  
  1216. Fixed "kermit -s xxxx" not to say "Escape back and give a RECEIVE command..."
  1217. if xxx does not exist.  Still not perfect.  Only for UNIX, because most
  1218. non-UNIXes don't expand wildcards before passing command line to Kermit.  Still
  1219. not great.  "kermit -s a b c d" stops sending files as soon as it hits one
  1220. that doesn't exist (i.e. it doesn't skip past nonexistent ones).  But it was
  1221. always this way.
  1222.  
  1223. Simplified locking-shift protocol (pending approval by "the committee") to
  1224. require single shifts, and to be used only in combination with successfully
  1225. negotiated single shifts.  lshift.txt.
  1226.  
  1227. Changed locking shift negotiations accordingly.  ckcfns.c.
  1228.  
  1229. Set TRANSFER LOCKING-SHIFT to ON, rather than OFF, by default.  Won't be used
  1230. unless other Kermit announces this capability AND eighth-bit prefixing is
  1231. successfully negotiated.  ckcmai.c.
  1232.  
  1233. Totally rewrote getpkt() (again) to (a) make it more efficient, and (b) fix a
  1234. bug found by John Chandler, namely that locking shift codes could appear after
  1235. the repeat count rather than before it.  For example: XYZXYZaaaaaa (where
  1236. XYZXYZ have their 8th bits == 1, and aaaaaa don't) erroneously produced:
  1237.   #NXYZXYZ~&#Oa, which would be decoded as: XYZXYZ^O^O^O^O^O^Oa
  1238. rather than:
  1239.   #NXYZXYZ#O~&a, which would be decoded back into the original.
  1240. ckcfns.c.
  1241.  
  1242. Changed the translation tables for IBM code pages 437 and 850 to be totally
  1243. invertible.  Thanks to John Chandler and Andre' Pirard for the new tables, and
  1244. for keeping after me to do this.  Also removed as many of the UNK entries from
  1245. the Latin-1 to ASCII table as possible.  NOTE: MS-DOS Kermit's tables are not
  1246. invertible, so we still get bad translations for line/box-drawing chars when
  1247. sending CP850 files from CK to MSK.  ckuxla.c.
  1248.  
  1249. Made a first crack at adding support for Kanji character set translation
  1250. during file transfer.  All the Kanji-related code is within #ifdef
  1251. KANJI...#endif, and you have to add -DKANJI to your makefile entry if you want
  1252. to use it.  By default, all versions are built without it.  When KANJI is
  1253. defined, we use Japanese EUC as the transfer character set, and allow
  1254. Shift-JIS and EUC as file character sets.  So far, JIS X 0201 and JIS X 0208
  1255. are not supported as file character sets, but they can probably be added
  1256. easily.  Terminal character set translation is not yet supported, nor is
  1257. translation during the TRANSMIT command, nor is the TRANSLATE command.
  1258.  
  1259. The normal translation mechanisms (i.e. the array of translation functions,
  1260. translation tables, etc) is bypassed.  A small amount of extra code was added
  1261. to getpkt() and decode() which calls special algorithmic functions zkanji()
  1262. and xkanji() in ckuxla.c.  Japan EUC is announced in the attribute packet as
  1263. "I14/87E".  The Shift-JIS/EUC translation algorithm was adapted from code
  1264. provided by Dr. Hirofumi Fujii of the Japan National Laboratory for High
  1265. Energy Physics (KEK).  The choice of transfer character set and announcer was
  1266. made in conjunction with Dr. Fujii and other Kermit developers in Japan.
  1267. ckcxla.h, ckuxla.h, ckuxla.c, ckcfns.c.
  1268.  
  1269. Because Kanji within Japanese EUC is made up exclusively of 8-bit bytes (bytes
  1270. with their high order bits set to 1), a high degree of "8th-bit prefixing"
  1271. overhead (like 100%) would normally be incurred when transferring Kanji files
  1272. over 7-bit connections.  This is where the SET TRANSFER LOCKING-SHIFT command
  1273. comes into play.  With locking shifts, the overhead becomes insignificant.
  1274.  
  1275. Implemented Warren Tucker's suggestion of allowing an open file descriptor
  1276. to be passed to Kermit on the command line: -l nn, where nn is a number,
  1277. already locked (if necessary) and ready for i/o.  Works only for serial, local
  1278. connections, and it seems you have to tell Kermit the speed, also.  So, for
  1279. example, if you have opened a communication line at 2400 bps and you know its
  1280. file descriptor is 3, you can "kermit -l 3 -b 2400" to use it.  ckutio.c.
  1281.  
  1282. Changed the TYPE command to simply run the program specified in the TYPCMD
  1283. string, rather than using built-in code, at Christian Hemsing's suggestion.
  1284. Also, changed the TYPE, WHO, and DIRECTORY commands to look for the
  1285. environment variables CK_TYPE, CK_WHO, and CK_DIR, and if defined, use those
  1286. instead of the built-in commands.  This lets TYPE run more (or less), lets
  1287. you change the directory-command switches, etc.  ckuusr.c, ckuus6.c.
  1288.  
  1289. SMALL BUT IMPORTANT CHANGE: Got rid of LPASS8 processing for all but
  1290. SUNOS41/BSD.  Reportedly (by Terry Kennedy), this is what was causing binary
  1291. file transfers to fail on many, many 4.3BSD-based systems.  His speculation
  1292. jibes with the many other reports I got about binary file transfer failures
  1293. that couldn't be explained any other way: all of them came from people using
  1294. 4.3BSD-based UNIXes.  At first I thought the problem only occurred when going
  1295. through terminal servers, but recent reports indicate it happens on direct
  1296. serial connections too.
  1297.  
  1298. Changed several args to ioctl(fd,fn,arg) from long to int, for PDP-11s, e.g.
  1299. for TIOCFLUSH calls in ttflui() and ttsndb().  I hope this doesn't harm anyone
  1300. else -- tested on SUN and NeXT with no ill effects.  From Steven Schultz.
  1301. ckutio.c.
  1302.  
  1303. Put #ifdef NOSPL around a couple references to maclvl in ckuus5.c that needed
  1304. them.  Thanks to Steven Schultz, Terry Kennedy for pointing this one out.
  1305.  
  1306. Added "pdp11" to the list of symbols that defines the maximum number of
  1307. wildcard matches (MAXWLD) to 50 rather than 1000, and smaller name string
  1308. space (SSPACE).  From Steven Schultz.  ckufio.c.
  1309.  
  1310. Changed the BSD 2.x makefile entries based on info from Steven Schultz,
  1311. who seems to have made the overlays work.  Added (for 2.x BSD only) Steven's
  1312. string extraction program and sed script as part of the make process.
  1313. makefile, ckustr.c (new), ckustr.sed.
  1314.  
  1315. Also installed ckubs2.mak from Terry Kennedy, an alternative makefile for
  1316. 2.xBSD.
  1317.  
  1318. Changes to ckcnet.h #ifdefs for HPUX and to ckutio.c #ifdefs for HPUX job
  1319. control from Jim Barbour.  ckutio.c.  Also, yet another HPUX related makefile
  1320. entry, hpuxpre65, also from Jim.
  1321.  
  1322. When command-line -l argument is given, don't call ttgspd() to get the line
  1323. speed if the speed has already been set with -b.  Suggested by Dave Gluss.
  1324.  
  1325. Added support for Sequent Dynix PTX lockfile names to ttlock().  From Bob
  1326. Larson, USC.  ckutio.c.
  1327.  
  1328. Added makefile entry for ESIX SVR4+TCP/IP from Marc Boucher, U of Montreal.
  1329.  
  1330. Added makefile entry for SCO UNIX 3.2.2 with SCO TCP/IP from William Bader.
  1331.  
  1332. Added makefile entry "make install" suggested by Casey Leedom at LLNL.
  1333. Obviously this will need tailoring at different sites.
  1334.  
  1335. Added makefile entries for Altos machines with small memories, from Bertie
  1336. Coopersmith in London, sent via post.  Also two small fixes to ckucmd.c which
  1337. Bertie says keeps the Altos from dumping core.
  1338.  
  1339. Changed svr4amiganet makefile entry to use gcc rather than cc.
  1340.  
  1341. Fix for VMS INPUT command, which wasn't timing out, from Terry Kennedy:
  1342. gtimer() shouldn't have been calling rtimer().  ckvtio.c. 
  1343.  
  1344. NOT DONE: Changing the server to use pipes rather than temp files when
  1345. executing MAIL and REMOTE PRINT commands.  Have code for this from Seth
  1346. Chaiklin, but it will have to wait till next time.
  1347.  
  1348. Verified that C-Kermit works fine on the NeXT at 38400 bps.  There's no way
  1349. to set a higher rate, at least not using ioctl's with symbols defined in the
  1350. UNIX header files -- EXTB is the highest speed.
  1351.  
  1352. ------------------------------
  1353.  
  1354. 5A(172) Sat Jun 29 22:59:36 1991
  1355.  
  1356. Added GETOK command, to ask the user a question and then set SUCCESS or
  1357. FAILURE according to the user's answer, which is parsed from a keyword table
  1358. containing "yes", "no", and "ok".  For use in script programs.  Example:
  1359.  
  1360.   getok { Shall I go on\? }
  1361.   if failure stop
  1362.  
  1363. This command is removed from Kermit if NOSPL or NOFRILLS is set.  ckuusr.h,
  1364. ckuusr.c, ckuus6.c, ckuus2.c.
  1365.  
  1366. Added IF NUMERIC <constant-or-variablename>.  ckuusr.h, ckuus[r26].c.
  1367.  
  1368. SET FILE COLLISION UPDATE didn't work any more.  It refused the file all
  1369. right, but it deleted the existing file too.  Oops!  Reported by Nelson Beebe.
  1370. Fixed in reof(), ckcfns.c.
  1371.  
  1372. Made SHOW DIAL show default (built-in) dial init string (if any) instead of
  1373. "(none)" when user has not "set dial init-string".  ckuus4.c, ckudia.c.
  1374.  
  1375. Added optional numeric operand to END, POP, and STOP commands.  0 means to
  1376. set SUCCESS flag, nonzero means to set the FAILURE flag.  This allows macros
  1377. and TAKE file to return success or failure.
  1378.  
  1379. Create command synonyms for FTP users: PUT = SEND, MPUT = MSEND, MGET = GET.
  1380. ckuusr.c.
  1381.  
  1382. Changed all references to "alt-cyrillic" to "cp866", since the latter is
  1383. the character set we're really using.  ckuxla.c.
  1384.  
  1385. Changed zmail() not to put the word "file" in the subject line.  This paves
  1386. the way (not really) for a client program to use the "send-as" feature to give
  1387. the file-to-be-mailed an assumed name, which can be treated as the subject of
  1388. the mail message.  Unfortunately, no client programs do this as yet.  Another
  1389. barrier is that you can't create files with arbitrary names on most kinds of
  1390. computers, so the real solution to this problem is to make zmail pipe the
  1391. incoming file directly into Mail, and set the subject from the file header
  1392. packet data.  See note in rcvfil() in ckcfns.c.
  1393.  
  1394. Made "Usage:" message print actual name of program (argv[0]) rather than
  1395. "kermit", in case it was installed with another name.  Suggested by David
  1396. MacKenzie.  ckuus2.c.
  1397.  
  1398. Installed replacement code in ckudia.c for reading modem responses,
  1399. contributed by Jamie Watson.  It seems the original code kept comparing
  1400. responses with "didweget()" even after it found a match, so sometimes its
  1401. diagnosis would be wrong, like in the "RING" vs "RRING" case.  Now it stops as
  1402. soon as it hits a match.  ckudia.c.
  1403.  
  1404. Fixed data type of rfilop() routine.  Was declared int, should have been CHAR.
  1405. Noticed by Larry Rosenman.
  1406.  
  1407. HANGUP, revisited.  Changes from Jamie Watson in Switzerland for the RT PC,
  1408. plus one clue about why HANGUP might not be working for various other System V
  1409. systems -- in the default case, all the flags except CLOCAL are set to zero.
  1410. Jamie says that setting the HUPCL flag to zero specifically prevents DTR from
  1411. dropping.  So now let's try it the new way: set all flags except CLOCAL and
  1412. HUPCL to zero.  ckutio.c.  
  1413.  
  1414. Also from Jamie: he says the reason HANGUP didn't work on the RS/6000 was that
  1415. the TIOCMBIC/BIS ioctl's on the RS/6000 require an int, rather than (as SVID
  1416. says) a pointer to an int.  I made this change within #ifdef _IBMR2
  1417. conditionals (this symbol is predefined by the RS/6000 compiler).  RS/6000
  1418. users, please let me know if this helps or hurts.  ckutio.c
  1419.  
  1420. Corrected spelling: TIOC_RTS should be TIOCM_RTS.  Noticed by Jamie.  Jamie
  1421. also said that if you try to manipulate RTS and DTR in the same ioctl call,
  1422. everything gets screwed up.  So I left RTS alone (but again, only within
  1423. _IBMR2 conditionals).  ckutio.c.
  1424.  
  1425. Removed inappropriate error message when user edits WRITE command.  ckuusr.c.
  1426.  
  1427. Also at Jamie's suggestion, added -DTCPSOCKET to RTAIX makefile entry.
  1428.  
  1429. Added a makefile entry for the Commodore Amiga with Sys V R4 + TCP/IP,
  1430. contributed by Rob Healey.  Also, changed the names of the Kermit symbols
  1431. AT_ALL and AT_TYPE to AT_XALL and AT_FTYP (defined in ckcker.h), to eliminate
  1432. conflict with Sys V R4 vnode.h (Rob suggested switching order of #include
  1433. files, but that could have caused trouble).  Also, at Rob's suggestion,
  1434. replaced bzero with memset and bcopy with memcpy in ckcnet.c, but only for
  1435. SVR4 (to get around buggy UCB compatibility library).
  1436.  
  1437. Added makefile entry for RT PC with ACIS 2.2.1 = BSD 4.3.  Just like "make
  1438. bsd", but with -U__STDC__ added.  From a report by Mark Kennedy at IBM.
  1439.  
  1440. Added makefile entry for Ultrix 2.0.  It seems the TCP/IP code is different
  1441. there than in regular BSD, so -DDU2 activates a tiny snippet of code in
  1442. ckcnet.c.  Found by Jamie Watson (my Ultrix 2.0 MicroVAX died...).
  1443.  
  1444. Added -DDYNAMIC to HP-9000/HP-UX "hpuxlf" makefile entry (blessed by Bo
  1445. Kullmar in Sweden).
  1446.  
  1447. Apple Macintosh support for version 5A based on edit 171 from Paul Placeway.
  1448. New files in ckm*.*.  Recompiled with version 172 files OK.
  1449.  
  1450. Commodore Amiga support for version 5A based on edit 171 from Steve Walton.
  1451. New files in cki*.*.
  1452.  
  1453. OS-9 support for version 5A based on edit 171 from Christian Hemsing in
  1454. Germany.  New files: ck9*.*, plus several small alterations to ck[cu]*.[ch]
  1455. files within #ifdef OSK conditionals.
  1456.  
  1457. VMS changes from Terry Kennedy, St Peters College (notes from his CKVKER.UPD
  1458. file):
  1459.  
  1460. 56. Correctly report the file size as (highest_block-1)*512+first_free_byte
  1461.     instead of allocated_blocks*512. (ckvfio)
  1462.  
  1463. 57. Prevent captive or restricted users from invoking lib$spawn. This disables
  1464.     some built-ins (dir, etc.) as well as spawn/push. (ckvfio)
  1465.  
  1466. 58. Fixed the LOG SESSION logfile. Previously it would contain random small
  1467.     chunks of text with extraneous line breaks. This change (of course) chan-
  1468.     ges the RMS structure of the session log file. (ckvfio, ckvcon)
  1469.  
  1470. 59. Implement SET FILE TYPE LABELED for file receives. Also cleand up a few
  1471.     typos in the main code that dealt with labeled files. (ckvfio, ckuus3,
  1472.     ckuus5).
  1473.  
  1474. 60. Correct a potential problem when flushing buffers after a disk error when
  1475.     receiving a file. (ckvfio)
  1476.  
  1477. Also from Terry, corrections to VMS labeled file support in ckuus3.c and
  1478. ckuus5.c.
  1479.  
  1480. ------------------------------
  1481.  
  1482. 5A(171) Wed Apr 24 12:36:02 1991
  1483.  
  1484. Added locking shift transfer protocol.  The new command is:
  1485.  
  1486.   SET { TRANSFER, XFER } LOCKING-SHIFT { ON, OFF, FORCED }.
  1487.  
  1488. Parsed in ckuus3.c.  Help text in ckuus2.c.  SHOW PROTOCOL and STATISTICS
  1489. material in ckuus4.c.  The negotiations are done in rpar() and spar() in
  1490. ckcfns.c.  The locking shift protocol itself is executed in getpkt() by the
  1491. file sender and decode() by the file receiver, both in ckcfns.c.  Locking
  1492. shifts are useful for transferring files containing long runs of 8-bit
  1493. characters through a 7-bit communication channel.  Good examples are Kanji,
  1494. Cyrillic, Hebrew, Arabic, or Greek text.  Binary files don't benefit very
  1495. much, nor do Roman-based text files.  Locking shifts are used in conjunction
  1496. with single shifts (8th-bit prefixes) for maximum efficiency in encoding 8-bit
  1497. data: long runs are lock-shifted, short runs are single-shifted.  To use this
  1498. feature, tell both Kermits to SET XFER LOCK ON (so far, only C-Kermit supports
  1499. this).  SET XFER LOCK FORCED means the sender uses locking shifts (but not
  1500. single shifts) regardless of negotiations, and for the receiver it means that
  1501. locking shift characters (Ctrl-N and Ctrl-O) in the data should be used as
  1502. shift characters rather than data, regardless of negotiations.  The new
  1503. protocol is described in detail in the file lshift.txt.
  1504.  
  1505. The interactive program prompt string is now evaluated each time the prompt
  1506. is issued, so you can have cute prompts like SET PROMPT \v(dir)>, or
  1507. SET PROMPT \v(time)>, etc, that change whenever the variables change.
  1508. ckuus3.c, ckucmd.c.
  1509.  
  1510. Added support for Wollongong TCP/IP for AT&T Sys V R3 on AT&T 3B series:
  1511. "make sys5r3net3b", from John Chmielewski at AT&T.  makefile, ckcnet.h.
  1512.  
  1513. Changed SET DIAL SPEED-CHANGING to SET DIAL SPEED-MATCHING, because this is
  1514. the term that is normally used, and inverted the corresponding logic.
  1515. ckuus2.c, ckuus3.c, ckuus4.c (SET DIAL, HELP SET DIAL, SHOW DIAL).
  1516.  
  1517. Fixed TRANSLATE, TRANSMIT, and CONNECT commands to correctly test for
  1518. language when determining the intermediate translation character set.  It's
  1519. not "language == L_RUSSIAN", but "langs[language].id == L_RUSSIAN".
  1520. ckuus4.c, ckucon.c.
  1521.  
  1522. Renamed file character-set "latin-cyrillic" to "cyrillic-iso".
  1523. Renamed transfer character-set "cyrillic" to "cyrillic-iso".  This makes
  1524. more sense, eh?  ckuxla.c, ckuus2.c.
  1525.  
  1526. Added "DOES NOT ANSWER" to the repertoire Rolm CBX responses.  ckudia.c.
  1527.  
  1528. Fixed SunLink X.25 support (many things were broken in a recent edit when
  1529. the network support was reorganized).  Fixes provided by Marcello Frutig
  1530. in Brazil.  Many modules.
  1531.  
  1532. Fixed shomac() not to core dump if the macro definition was a null pointer.
  1533. Still needs work -- the "more?" stuff only works for one macro definition.
  1534. ckuus5.c.
  1535.  
  1536. Fixed another bug in xxstring (the variable/function expander).  Some memory
  1537. was being malloc'd unnecessarily and later freed at possibly inappropriate
  1538. times.  The symptom was that certain functions, like \flpad(), \frpad(), and
  1539. \frepeat() would sometimes (rarely) fail to work if they appeared more than
  1540. once in a single command, e.g. "echo \flpad(\%a,8) \flpad(\%b,8)".  ckuus4.c.
  1541.  
  1542. Discovered that congm (get console terminal modes) prints scary error messages
  1543. if running under at, cron, or batch because open("/dev/tty") doesn't work ("No
  1544. such device or address").  Changed congm to skip mode-getting if !isatty(0).
  1545. ckutio.c.
  1546.  
  1547. Rewrote zchko().  There were two problems with it.  First, it copied the
  1548. filename into a local automatic fixed-size buffer that could easily have been
  1549. overrun.  Now it mallocs the buffer.  Second, reported by Fulvio Marino at
  1550. Olivetti in Italy, the call to access() would fail with EACCESS on X/OPEN
  1551. XPG3-compliant systems because zopen used "./".  Now "." is used if no
  1552. pathname is given, and "path/." is used if "path/" is included in the file
  1553. name.  ckufio.c.
  1554.  
  1555. Changed the assumption in ckcdeb.h that uid_t and gid_t exist for System V
  1556. R3.  No, they were first defined in SVR4.  The confusion stems from the way
  1557. that SVID issues are numbered.  "Issue 2" applies to SVR3, "Third Edition"
  1558. applies to SVR4.  This info from John Chmielewski, AT&T.  So the defaults have
  1559. now become:
  1560.     
  1561.   POSIX:      uid_t, gid_t
  1562.   SVR4:       uid_t, gid_t
  1563.   BSD43:      uid_t, gid_t
  1564.   All others: int, int
  1565.  
  1566. Watch out, some systems use short or unsigned short instead of int (even
  1567. though SVID Issue 2 Vol 3 says on p.31 they are "positive-integers").
  1568.  
  1569. Changed ckcdeb.h to automatically define NOSYSFILEH if POSIX is defined.
  1570. POSIX has no <sys/file.h> -- R_OK, etc, are defined in <unistd.h> instead.
  1571.  
  1572. Made -DTERMIOX the default for System V R4 (i.e. what you get when you
  1573. "make sys5r4"), meaning to use <termiox.h>.  Use "sys5r4nx" to omit it, or
  1574. "sys5r4sx" to use <sys/termiox.h>.
  1575.  
  1576. Added UID_T and GID_T definitions to tower32 make entries (from Robert
  1577. Andersson in Norway).
  1578.  
  1579. Made saval static in ckudia.c.  Previously it was declared global in both
  1580. ckudia.c and ckutio.c.
  1581.  
  1582. Fixed #ifndef NOSPL's in ckuscr.c (Bert Laverman).
  1583.  
  1584. Updated minixc68 and minix68k makefile entries (Bert Laverman).
  1585.  
  1586. Added a complete (?) list of C-Kermit's compile-time options as an appendix
  1587. to ckuins.doc.  Made corrections to ckaplm.doc.  Updated ckuker.mss,.doc,.ps.
  1588. Updated ckuker.bwr.
  1589.  
  1590. Some Amiga changes, and removal of (unused) "typedef long LONG", from Steve
  1591. Walton.
  1592.  
  1593. Some Fortune For:Pro 2.1 changes from Tom Krueger.
  1594.  
  1595. Reported problems not addressed in this edit:
  1596. . SVR4 suspend handling doesn't work (Ctrl-Z has no effect).
  1597. . File size is reported incorrectly on 16-bit machines...
  1598. . TRANSMIT command doesn't seem to work if TRANSMIT ECHO is OFF.
  1599. . switch statements in ckudia.c too long or deep for some compilers.
  1600. . There's no way to open the session log in append mode.
  1601. . Parity vs terminal servers vs LPASS8 vs rawmode...
  1602.  
  1603. VMS CHANGES:
  1604.  
  1605. Added new member to filinfo structure: unsigned int lblopts, for use with
  1606. labeled files.  ckcdeb.h.  Added definitions for VMS labeled file options to
  1607. ckcdeb.h, and a corresponding variable (bit mask), lf_opts, to hold them to
  1608. ckcmai.c.  Added SET FILE LABEL { ACL, BACKUP-DATE, NAME, OWNER, PATH }
  1609. command to ckuus3.c to set the lf_opts bitmask.  Copied lf_opts bitmask to
  1610. new lblopts member of the filinfo structure when opening a file, in opena()
  1611. in ckcfn3.c.  Added SHOW LABELED-FILE-INFO command to ckuus5.c.  Default for
  1612. NAME is ON, for others is OFF.  All of this is to allow the reception of
  1613. labeled files with selective restoration of the specified items, so Terry
  1614. Kennedy can actually add the code to receive labeled files in a future edit.
  1615.  
  1616. Made Kermit's command-line option interpreter ignore any fields
  1617. that begin with "/", so VMS switches can now be given on the command line,
  1618. like "kermit /input=foo.cmd /output=foo.log".  However, these switches have
  1619. no effect on Kermit because they don't actually make DCL redirect the input
  1620. or output -- the program has to do that itself.
  1621.  
  1622. ------------------------------
  1623.  
  1624. 5A(170) Tue Apr 23 22:21:07 1991
  1625.  
  1626. For VMS, from Terry Kennedy:
  1627.  
  1628. 1. Fix to CKVFIO.C to properly handle the FAB journaling field (pre-3.1
  1629.    versions of VAX C don't understand "fab$b_journal").  Ditto for CKVCVT.C.
  1630.    ACL handling for labeled files added.
  1631.  
  1632. 2. New makefile for VMS, using VMS MAKE (by Todd Aven, the Software Sweatshop,
  1633.    Long Beach, NY).  VMS MAKE itself is now available as CKVMAK.HEX, which
  1634.    is a VMSHEX-format encoding of a VMS BACKUP saveset containing the source,
  1635.    documentation, and executable files.  The new makefile is CKVKER.MAK, the
  1636.    MMS file (which was previously called CKVKER.MAK) is now called CKVKER.MMS,
  1637.    and there is also a new CKVKER.COM, which compiles all the modules
  1638.    unconditionally.
  1639.  
  1640. 3. Removed "extern int errno;" declaration from ckcnet.h for VMS (it gets it
  1641.    from errno.h).
  1642.  
  1643. In edit 169, I removed what I thought was a duplicate #include for <fcntl.h>
  1644. from ckutio.c, but that kept Sys V versions from compiling.  Turns out it
  1645. wasn't really duplicated at all, so I put it back.  Sorry.
  1646.  
  1647. Finally tracked down the problem, reported by Jay Rouman, with getok() failing
  1648. to read modem responses when parity was not NONE.  I was ANDing the response
  1649. with the wrong mask in ttinc(): 0277 instead of 0177.  Actually, there is
  1650. another, deeper, problem: ckutio's global for parity, "ttprty", is set only by
  1651. ttpkt() but not by ttvt().  In practice, this doesn't matter because ttpkt()
  1652. is always called before any operation (dialing, file transfer) where parity
  1653. makes a difference.  During CONNECT, INPUT, or OUTPUT, the higher-level code
  1654. takes care of parity.  Not optimal, but better not to change the calling
  1655. conventions at this late stage.  Also, removed unused variable "m" from
  1656. ttinc().  ckutio.c.
  1657.  
  1658. Removed the assumption that POSIX can do a millisecond sleep using an ftime()
  1659. loop in msleep().  Until I learn better, the POSIX version just runs a stupid
  1660. busy loop for a short while.  ckutio.c.
  1661.  
  1662. Broke doprm() up into several smaller functions, for the benefit of some C
  1663. compilers that were having trouble with its length and block nesting level.
  1664. ckuus3.c.
  1665.  
  1666. Removed extraneous "x = 0;" from Sys V case in msleep() to get rid of
  1667. "statement not reached" warnings.  ckutio.c.
  1668.  
  1669. Removed "installation instructions" from the UNIX makefile and referred
  1670. readers to ckuins.doc, which contains more complete and accurate information.
  1671.  
  1672. Added missing comment delimiters to "#endif NETCONN" in ckuus5.c.
  1673.  
  1674. Adjusted #ifdefs for xx_strp in ckucmd.h (for SCO UNIX and Xenix); apparently
  1675. I did this wrong in edit 169.
  1676.  
  1677. Noticed that '-j' command-line option (= SET HOST) stopped working.  Added
  1678. #include "ckcnet.h" to ckuusy.c to make sure NETCONN definition was picked up.
  1679.  
  1680. Added system error message to DIAL "hangup error" message.  It seems we
  1681. always get "no such device or address".  Hmmm...
  1682.  
  1683. Got rid of yindex() routine from ckcnet.c, since it was only called from
  1684. one place, and was causing complaints from linkers when Kermit was built
  1685. without TCP/IP support.
  1686.  
  1687. Got rid of return-code variable from msleep() to eliminate "statement not
  1688. reached" warnings.  Also added a catcher for big arguments.  ckutio.c.
  1689.  
  1690. Removed the -i link option from several SVR3-based make entries.  Patrick
  1691. Wolfe of Kuck & Assocs reports that it is not known to SVR3-based compilers/
  1692. linkers on Esix, Intel, Olivetti, SGI, or Sequent SVR3 systems.  Added
  1693. comments where I took it out, and also comments in cases where I left it in
  1694. (such as all the PC-based makes).
  1695.  
  1696. After learning that the System V R3 <termiox.h> file (a) exists practically
  1697. nowhere, and (b) is sometimes found in <sys/termiox.h>, I backed off on the
  1698. assumption that makes based on SVR3 and later should expect to find it.
  1699. Now you have to explicitly include -DTERMIOX or -DSTERMIOX in the make entry
  1700. to get this form of RTS/CTS flow control.  The -DNOTERMIX flag was deleted
  1701. from all makefile entries, and four new entries were created: sys5r3tx,
  1702. sys5r3sx, sys5r4tx, and sys5r4sx.
  1703.  
  1704. Telnet negotiation loops reported.  Changed the code to behave according to
  1705. words of wisdom in the original telnet RFC 542: "The symmetry of the
  1706. negotiation syntax can potentially lead to nonterminating acknowledgement
  1707. loops -- each party seeing the incoming commands not as acknowledgements but
  1708. as new requests which must be acknowledged.  To prevent such loops: (a)
  1709. Parties may only request a change in option status; i.e. a party may not send
  1710. out a 'request' merely to announce what mode it is in; (b) If a party receives
  1711. a what appears to be a request to enter some mode it is already in, the
  1712. request should not be acknowledged."  The main problem was with the ECHO
  1713. and SGA negotiations, and this appears to be fixed now -- and still work
  1714. correctly (verified by telnetting to UNIX hosts and to IBM mainframe hosts).
  1715. There still seems to be some problem with the IBM mainframe sending several
  1716. "send terminal type" requests (which Kermit fulfills), but I think Kermit is
  1717. behaving properly in this case, as these are explicit requests for info.
  1718. ckcnet.c.
  1719.  
  1720. Improved the uucp lock-checking procedure to take into account EPERM
  1721. errors when testing for the existence of the process whose pid is recorded
  1722. in the lockfile, so now Kermit correctly reports that the device is in use
  1723. by another user (and shows who it is), rather than saying "Access to lock
  1724. denied".
  1725.  
  1726. Each ANSI C feature that is introduced seems to uncover more that are needed.
  1727. Steve Walton discovered that very strict ANSI compilers (such as the one he's
  1728. using on the Amiga), complain that the command-parsing function definitions in
  1729. ckucmd.c disagree with their prototypes in ckucmd.h.  So at his suggestion I
  1730. changed all occurrences "int (*f)()" in the argument lists to "xx_strp f",
  1731. which is typedef'd in ckucmd.h.  I had to change the typedef, however, for the
  1732. non-ANSI case.
  1733.  
  1734. Added another new compile-time option, -DNOANSI, to prevent the use of ANSI
  1735. C function prototyping in cases where they cause trouble.  ckcdeb.h.
  1736.  
  1737. Worked on TRANSMIT command.  Added SET TRANSMIT ECHO { OFF, ON }.  Added SET
  1738. TRANSMIT ECHO and SET FILE TYPE to SHOW TRANSMIT.  Made SHOW XMIT an invisible
  1739. synonym for SHOW TRANSMIT.  Totally rewrote TRANSMIT logic to echo if and only
  1740. if requested and to correct numerous problems like failure to send last buffer
  1741. in text mode if last line did not end with a line terminator, to insert
  1742. judicious pauses when a line turnaround ("prompt") character is not being
  1743. used, etc.  One test case fails miserably ("transmit foo", where file foo
  1744. contains 4000 x's), but that's not Kermit's fault.  The remote end (UNIX with
  1745. "cat > foo" active) just starts spewing out an infinite number of beeps after
  1746. the first 256 characters arrive, even though Xon/Xoff is active on both ends.
  1747.  
  1748. Removed scary error message that comes out on BSD-based systems sometimes
  1749. when DIAL HANGUP and DIAL DISPLAY are ON -- "hangup failed: no such device
  1750. or address".  For some reason, the ioctl that turns DTR back on sometimes
  1751. (not always) fails with this error.  But the subsequent close(open()) seems
  1752. to bring DTR back anyway.  Also, removed a gratuitous call to ttvt() from
  1753. within tthang().  ckutio.c.
  1754.  
  1755. For the ATT6300 only -- changed "if (debug) ..." to "if (deblog)".  This was
  1756. a dumb mistake, and drove the compiler crazy (now that it's doing ANSI type
  1757. checking).  Peter Mauzey noticed this one.  ckudia.c.
  1758.  
  1759. For POSIX, wait() returns a pid_t.  Added appropriate define to ckcdeb.h.
  1760.  
  1761. Moved "extern int errno;" (for all versions except VMS) to ckcdeb.h so all
  1762. modules have access to it, and removed "extern int errno;" from all modules
  1763. and header files except ckcdeb.h.  Certain modules still "#include <errno.h>"
  1764. and so may wind up with double declarations -- but not all <errno.h> files
  1765. include the declaration.
  1766.  
  1767. Minor cosmetic fix: if program was at command level and was suspended by
  1768. Ctrl-Z or with the SUSPEND command, then when it was fg'd again it would
  1769. display its command buffer, so the user could continue typing an interrupted
  1770. command.  This worked fine, except if a SUSPEND command had been given, in
  1771. which case the word "suspend" would appear again after Kermit was fg'd, with
  1772. the cursor sitting on its first letter.  Now the command buffer is redisplayed
  1773. only if the user was in the middle of a command.  ckuusx.c.
  1774.  
  1775. Added automatic implication rule for <dirent.h> for POSIX to ckcdeb.h, so
  1776. that anyone adding -DPOSIX to a makefile entry need not also add -DDIRENT.
  1777. Tested OK on SUN and DECstation 5800.
  1778.  
  1779. Noticed that you can't really run Kermit on the NeXT directly from NeXTstep.
  1780. If you launch it, NeXTstep makes a kind of terminal window for it and you can
  1781. type commands, but nothing really works.  So until somebody converts C-Kermit
  1782. to a real NeXTstep application, you have to start a real terminal window first.
  1783. Same deal, more or less, under OpenWindows on the SparcStation.
  1784.  
  1785. But Kermit works fine on the NeXT under Xterm.
  1786.  
  1787. Updated the user guide.  Added material about malloc debugging and core-dump
  1788. analysis to ckuins.doc.
  1789.  
  1790. ------------------------------
  1791.  
  1792. 5A(169) Fri Apr 12 13:30:57 1991
  1793.  
  1794. From Terry Kennedy: a brand-new CKVFIO.C that implements the sending (but not
  1795. receiving) labeled files.  For now, a separate program, CKVCVT.C, is provided
  1796. to decode labeled files uploaded (as binary!) to VMS.
  1797.  
  1798. From Piet Plomp: a new makefile for VMS C-Kermit.  Requires the DEC MMS
  1799. product.
  1800.  
  1801. From Thomas Krueger <tjk@csd4.csd.uwm.edu>: Fortune fixes, and also one for
  1802. everybody: it seems <fcntl.h> was being included twice in ckutio.c.
  1803.  
  1804. Correction for SCO Microsoft C on Xenix from Warren Tucker: this compiler
  1805. did not like the typedef for xx_strp in ckucmd.h, so now there is a special
  1806. one for M_SYSV.  ckucmd.h.
  1807.  
  1808. From Andy Fyfe: the stub for netinc() was missing an argument.  ckcnet.c.
  1809.  
  1810. Correct "statement not reached" at line 3983 of ckutio.c.  It was a typo
  1811. in the #ifdef (MLSFTIME != MSLFTIME).
  1812.  
  1813. Somehow all the work I put into addmmac() and addmac() disappeared (it
  1814. probably had something to do with watsun crashing every five minutes for most
  1815. of the week).  So I did it again.  Also, this time I found the real culprit
  1816. and fixed it (I malloc'd some space and then strcat'd strings to it without
  1817. zeroing it first; if malloc doesn't give you clear memory this would make
  1818. the strcats go off the edge).  ckuus5.c.
  1819.  
  1820. While looking at addmac and addmmac, I also found and fixed a problem with
  1821. delmac -- it was freeing storage for the wrong macro.  Oops.  ckuus5.c.
  1822.  
  1823. Then something much worse -- the _getargs command trashed memory on the NeXT.
  1824. Built Kermit with Howie Kaye's malloc debugging package and found several
  1825. problems and fixed them: mainly in xxstring() in ckuus4.c, a routine that
  1826. mallocs memory but doesn't always free it, and which calls itself recursively.
  1827.  
  1828. Finally it turned out that an automatic array in the new dogta() routine was
  1829. declared too small and a pointer was being overwritten.  Howie spotted it.
  1830. Thanks Howie.
  1831.  
  1832. Howie's malloc debugging module is now part of the C-Kermit distribution.  The
  1833. module name is ckcmdb.c.  Two make entries show its use: nextmd and sunos41md.
  1834. If anybody is having problems potentially attributable to malloc and free,
  1835. construct similar entries for your computer, rebuild, and run wermit with a
  1836. debug log.
  1837.  
  1838. Some people complained that ckuusr.c was still too big and causes hash table
  1839. overflows, etc.  I broke ckuusr.c in half, creating yet another new module,
  1840. ckuus6.c.
  1841.  
  1842. Fixed #ifdefs in tthang().  ckutio.c.
  1843.  
  1844. Made sure all n_NAME symbols in ckudia.c were unique.
  1845.  
  1846. Added more debugging statements to getok() in ckudia.c.
  1847.  
  1848. Fixed IBM linemode telnet, from a suggestion from Steve Layton
  1849. <swl27@cas.bitnet>.
  1850.  
  1851. Added a missing close comment delimiter in tthang() which gcc didn't catch!
  1852. Found by Andy Fyfe.  ckutio.c.
  1853.  
  1854. New makefile entries for 3B1 (UNIX PC) from Andy Fyfe.  makefile.
  1855.  
  1856. Change "\l" to "\n" in ckcmai.c for MINIX, Bert Laverman.  Somebody else
  1857. (Chuck Hedrick, maybe) had inserted these, don't know why.
  1858.  
  1859. Added additional debugging statements to ttlock() to help track down problems
  1860. with uugetty in SCO UNIX 3.2.2, from Warren Tucker.  ckutio.c.
  1861.  
  1862. Some notes on program size...  Here is how the program shapes up on a
  1863. Sun-4 (a RISC architecture machine, so big executables) built with various
  1864. options (all include the -s link option):
  1865.  
  1866.  417K  Full (except X.25)
  1867.  401K  No transaction log (-DNOTLOG)
  1868.  401K  No "frills" (-DNOFRILLS)
  1869.  393K  No DIAL command (-DNODIAL)
  1870.  385K  No character set translation (-DNOCSETS)
  1871.  368K  No debugging (-DNODEBUG) 
  1872.  401K  No network support (-DTCPSOCKET omitted)
  1873.  180K  Minimum interactive (-DNOxxx for all xxx except ICP)
  1874.  114K  Command-line only.
  1875.  
  1876. ------------------------------
  1877.  
  1878. 5A(168) Mon Apr  8 19:28:28 1991
  1879.  
  1880. New items for the VMS version from Terry Kennedy: allowance for expansion
  1881. factor in checking available disk space for incoming files; replacement for
  1882. zoutdump() from Gary Mussar (allows for some odd record-boundary conditions).
  1883. Removal of VMS-specific return codes from ckcdeb.h.  For details, see
  1884. ckvker.upd.
  1885.  
  1886. Fixed a place where doexit() was called without its second argument if
  1887. NOCCTRAP was defined.  Thanks to Terry Kennedy for noticing.  ckuusx.c.
  1888.  
  1889. Removed #include <sys/types.h> from ckutio.c because ckcdeb already includes
  1890. it.  Causes problems on systems like Tandy where this file doesn't protect
  1891. itself against multiple inclusion.  Thanks to Jay Rouman.
  1892.  
  1893. Changed msleep() from parallel, sequential #ifdefs to nested #ifdefs to prevent
  1894. compilers from complaining about "statement not reached".  Thanks to Jay
  1895. Rouman for pointing out the problem.  ckutio.c.
  1896.  
  1897. In edit 167, I assumed that UID_T and GID_T could be defined as uid_t and
  1898. gid_t in all AT&T UNIX versions.  Wrong.  Now they are int for System V R2 and
  1899. earlier (verified by checking SVID R2 and R3, as I should have done in the
  1900. first place).  Thanks again to Jay Rouman for noticing.  ckcdeb.h.
  1901.  
  1902. Fixed a bad problem with the DIAL command.  The most common symptom was that
  1903. dialing would not work if the PARITY was not NONE.  The reason was that the int
  1904. returned by ttinc() was being assigned directly to a signed char in the
  1905. getok() routine.  Now ttinc() is assigned to an int, and the int is truncated
  1906. and assigned to an unsigned character.  Thanks to Jay Rouman for reporting the
  1907. problem.  ckudia.c.
  1908.  
  1909. Removed an extraneous alarm() call from ckudia.c.
  1910.  
  1911. Reduced size of command buffers if -DNOSPL is selected, to save a few K.
  1912. ckucmd.h.
  1913.  
  1914. Fixed HELP command to speak the truth in various -DNOxxx configurations.
  1915. ckuus2.c.
  1916.  
  1917. Changed HELP command not to allow any subtopics if -DNOHLP.  ckuusr.c.
  1918.  
  1919. Changed the argument vector array to be \&@[] instead of \&a[] for aesthetic
  1920. reasons; the name of the argument vector should be special.  Made the new
  1921. argument vector array read-only.  ckuus[r45].c.
  1922.  
  1923. Added character set information to transaction log.  ckcfn[s3].c.
  1924.  
  1925. Cured a longstanding problem with INPUT: its timeout interval wasn't very
  1926. accurate, and furthermore it never timed out at all as long as characters
  1927. arrived in a steady stream.  Now it works properly.  ckuus4.c.
  1928.  
  1929. Added "convex9" entry to makefile based on info from Eric Schnoebelen at
  1930. Convex.  This is another working POSIX entry, but with the BSD 4.3 lockfile
  1931. convention.  Also, fixed getpgrp() call in ckutio.c to have an argument only
  1932. for non-AT&T, non-POSIX configurations.  Also, wrapped extern declaration of
  1933. getppid() in ckufio.c within #ifndef's for POSIX and SVR3, where it is already
  1934. declared in <unistd.h>.  Thanks to Eric Schnoebelen at Convex for the info.
  1935.  
  1936. Noticed that MYREAD was not defined for POSIX, so I defined it.  ckutio.c.
  1937.  
  1938. Jay Rouman pointed out that \v(time), \v(date), etc, did not work in POSIX
  1939. configurations.  That's because I forgot to add POSIX coverage to ztime().
  1940. Done now, on the possibly erroneous assumption that POSIX uses time() and
  1941. ctime() like System V.  ckutio.c.
  1942.  
  1943. Made msleep() call usleep() on NeXT and SUN.  select() was not a good choice
  1944. for the NeXT, which (of course) has redefined the calling conventions from
  1945. BSD -- it wants a list of some kind of hideous incomprehensible structure
  1946. pointers.  This makes the gcc -Wall warnings go away.  Also, Sys V builds
  1947. on the SUN previously had no way at all of msleep'ing -- now they do.
  1948. ckutio.c.
  1949.  
  1950. The call to ttres() in ckcpro.w that occurs at the end of a file transfer had
  1951. been commented out a long time ago at somebody's insistence.  I discovered
  1952. that this was the cause Kermit's failure to properly restore interrupt, quit,
  1953. and suspend characters after exiting the program if any files had been
  1954. transferred in remote mode.  See ttpkt() and ttres().  I uncommented it, and
  1955. now terminal interrupts seem to work fine again.
  1956.  
  1957. Made sure that ckcpro.w does not try to output terminal messages when in
  1958. background (probably need to do more of this elsewhere).  This started the
  1959. following detour:
  1960.  
  1961. Discovered that I could not run Kermit in the background any more.  The
  1962. problem (this time, ho hum) was that popclvl() was being called when Kermit
  1963. reached the end of its init file.  When popclvl() pops up to top level, it
  1964. calls concb() to put the console (back) in cbreak mode.  Doing this (at least
  1965. on BSD based systems) causes Kermit's process group to change into the same
  1966. one as the terminal's process group, so now conint() thinks Kermit is in the
  1967. foreground when it's really still in the background (just ask the shell!),
  1968. which in turn lets Kermit print messages to the screen, which in turn makes it
  1969. stop because it's trying to write the terminal when it's in the background.
  1970. To fix this, I told congm() "console get modes" not to bother getting the
  1971. terminal modes if Kermit is in the background, and concb() not to do anything
  1972. if Kermit is in the background.  An added benefit of this change is that
  1973. conres() "console restore modes" does not wreck your terminal modes if you
  1974. should happen to have started Kermit in the background (e.g. with "&") and
  1975. then fg'd it and exited.
  1976.  
  1977. Well, that's fine for the BSD version, but now the Sys V and POSIX versions
  1978. are totally broken, at least on the SUN.  I wasted hours and hours on this.
  1979. It seems that getpgrp() on the SUN returns garbage about half the time --
  1980. sometimes it returns the real process group, other times 0, and still others
  1981. -1.  So I added code to conint() to only believe the return value of getpgrp()
  1982. if it was greater than 0.  I tried the same code on the RS/6000 and it works
  1983. fine, so I'm willing to believe it's the SUN's fault -- trying to be all
  1984. things to all users...  It's probably something to do with the fact that Sys V
  1985. getpgroup takes no argument, but the BSD one does, and the Sys V version is
  1986. really the BSD one, and it's reading garbage as its argument.
  1987. The same thing happens on the SUN with "sunposix".  Anyway, the aforementioned
  1988. fix seems to work, in the sense that it keeps the prompt visible.  But this
  1989. prevented background operation from working at all, because getpgrp() fails
  1990. just as much when Kermit is in the background as it does when it's in the
  1991. foreground...  So I changed conint() YET AGAIN.  This time, if the getpgrp()
  1992. test fails, it does the SIGINT == SIG_IGN test instead.  And in both cases,
  1993. it also checks to see if it's running with redirected stdio, and that case
  1994. is treated like background too.  This seems to work ok in the Sys V version,
  1995. but not in the POSIX version unless I start Kermit from the Bourne shell.
  1996. I could go on, but it's making me sick.  ckutio.c.
  1997.  
  1998. To do: If Kermit is in server mode or somesuch on an external tty device, in
  1999. the background, and then it gets fg'd, it should rearm its SIGINT and SIGTSTP
  2000. interrupts so the user's terminal doesn't freeze forever.  Oddly enough, this
  2001. works by accident in the BSD version (dunno why), but in the Sys V and POSIX
  2002. versions, you have to go to another terminal and kill the process.
  2003.  
  2004. Discovered (and fixed) a typo that disabled job control for everybody who
  2005. should have it, and enabled it for everybody that shouldn't, oops.  An #ifndef
  2006. should have been an #ifdef...  puspend() in ckutio.c.
  2007.  
  2008. Roger Wallace reported that (some) SET SEND/RECEIVE command had suddenly
  2009. stopped working.  This was because I broke a switch statement in the wrong
  2010. place in the last edit.  Fixed now.  ckuus3.c.
  2011.  
  2012. Added support for terminal character set translation, shift in / shift out,
  2013. pushing to DCL, and "set debug session" to CKVCON.C, the VAX/VMS CONNECT
  2014. command module.  Also added telnet support within #ifdef NETCONN..#endif (but
  2015. of course, this is not turned on).  This was done mostly by pasting code from
  2016. ckucon.c into the appropriate places in ckvcon.c.  Noticed a few suspect items
  2017. in ckucon.c in the process and fixed them.
  2018.  
  2019. Began work on isolating network support into a separate module, ckcnet.c:
  2020.  
  2021.  1. Made a new symbol TCPSOCKET.  This means that TCP/IP sockets support
  2022.     is selected, using the Berkeley sockets library, and it implies that
  2023.     telnet protocol support is selected too.  The SUNX25 code also uses the
  2024.     sockets library, but does not do telnet.
  2025.  2. Changed all references to NETCONN in the makefile to TCPSOCKET.
  2026.  3. Removed all network-specific #includes and #defines from ckcdeb.h,
  2027.     ckucon.c, and ckutio.c, and moved them into ckcnet.h.
  2028.  4. Made ckcnet.h define NETCONN if TCPSOCKET or SUNX25 is defined.
  2029.  5. Moved network-specific routines from ckucon.c to ckcnet.c.
  2030.  6. Changed tn_doop() to give return codes to indicate whether the local
  2031.     echo status needs to be changed, and change conect() to use these codes.
  2032.     To do this, it must know the current duplex, so this has been added as
  2033.     an argument to tn_doop(), and all calls and prototypes have been changed.
  2034.  7. Moved netopen(), netclos(), and related routines from ckutio.c to ckcnet.c.
  2035.  8. Moved all X.25 code from ckutio.c to ckcnet.c.
  2036.  
  2037. Items 7 and 8 required detailed reconstructive surgery.  The result works
  2038. ok on the SUN, NeXT, and RS/6000 with TCP/IP, needs testing everywhere else.
  2039.  
  2040. Now, armed the TGV MultiNet manual for VAX/VMS I added a small amount of code
  2041. to CKVCON.C to allow for network connections, and added code to the ttxxx()
  2042. routines in CKVTIO.C to call the netxxx() routines if a network connection was
  2043. active.  The ckcnet.[ch] files should just about fit in without changes.  If
  2044. this works I'll be amazed...
  2045.  
  2046.  1. Compile VMS C-Kermit without NETCONN or MULTINET defined (OK).
  2047.  2. Modify CKVKER.COM to define MULTINET if MultiNet exists (OK).
  2048.  3. Recompile all modules with MULTINET defined.
  2049.  4. Figure out how to link the stupid thing with TGV's runtime system.
  2050.  
  2051. Because MULTINET:MULTINET_SOCKET_LIBRARY.EXE must be linked in as a sharable
  2052. library, a linker "options file" must be used (see the VMS Linker manual).
  2053. But when you use a linker "options file", it would seem that you have to
  2054. specify at least one module that is not in a library (LINK's complaint is
  2055. "%LINK-F-FIRSTMOD, first input file being a library requires module
  2056. extraction").
  2057.  
  2058. So...  The linker option file CKVKER.OPT was created, and CKVKER.COM was
  2059. modified (ugh!) to extract one module (CKCMAI.OBJ) from WERMIT.OLB before
  2060. linking.
  2061.  
  2062. Modified CKVKER.COM to define MULTINET automatically if it finds the Multinet
  2063. socket library.  I'm not a DCL programmer, so there's probably a better way
  2064. to do it.  See comments in CKVKER.COM.
  2065.  
  2066. Three days later... it works.  File transfer ain't bad at all.  But it's
  2067. horribly slow during CONNECT mode, at least on my MicroVAX II.  That's because
  2068. the VMS C-Kermit CONNECT command does not use two forks, like the C-Kermit
  2069. version does.  Instead, it uses a horrible kind of polling kludge (in the
  2070. contti() routine) because VAX C does not (at least as of V3.2) have a fork()
  2071. call.  If fork() were available, we could replace CKVCON.C with ckucon.c and
  2072. be done with it.
  2073.  
  2074. In an attempt to improve the speed, I added an internal network input buffer
  2075. to ckvtio.c and made the network code use it (another day).  No noticeable
  2076. difference.  It's incredibly slow.
  2077.  
  2078. This has been an exercise in making the network code more portable.  I dunno
  2079. how many people will actually be able to use the MultiNet support, but now it
  2080. should be easier to add support for other networks to both the UNIX and VMS
  2081. (as well as any other) versions of C-Kermit.  For example, now that most of
  2082. the SunLink X.25 code is in ckcnet.[ch], it might be relatively easy to adapt
  2083. it to also support VAX PSI on VMS -- at least the concepts are the same.
  2084.  
  2085. Added section on networks to CKAPLM.DOC.
  2086.  
  2087. Added SHOW NETWORK command.
  2088.  
  2089. Fixed SET HOST command when no hostname given.
  2090.  
  2091. Removed extraneous spaces from makefile (again).
  2092.  
  2093. Moved congm(), conres(), around to better ensure console modes properly
  2094. restored upon exit.  ckuus5.c, ckutio.c.
  2095.  
  2096. Added Telebit fixes from tk, Hellmuth Michaelis.
  2097.  
  2098. Improved HP-UX hangup from Hellmuth Michaelis.
  2099.  
  2100. Makefile entry for HP-UX 7.0 with network support from Hellmuth Michaelis.
  2101.  
  2102. Support for two more Telebit variations from Hellmuth Michaelis: V.42
  2103. and "slow" (i.e. don't even try to dial in any fancy mode).
  2104.  
  2105. Fixed POSIX version of ztime() to use BSD/V7 style time(), asctime(), and
  2106. localtime().
  2107.  
  2108. Fixed SHOW PAD command for SunLink X.25 (again).  Thanks, Marcello.
  2109.  
  2110. Added -X2 to dnix makefile entry to cut down on compiler complaints.
  2111. Bo Kullmar.
  2112.  
  2113. Fixed makefile entry for minixc68.
  2114.  
  2115. Changed name of _PROTOTYPE macro to _PROTOTYP because apparently it conflicts
  2116. with a predefined macro of that name, e.g. with the GNU cc cross compiler for
  2117. 68000 code on SUNs.
  2118.  
  2119. Various fixes to ckutio.c for MINIX from Bert Laverman: Renamed variable
  2120. "clock" to "xclock" to prevent conflict with library routine clock(), Don't
  2121. include <sys/ioctl.h> because there isn't one, fix some function args, cast
  2122. some things, remove unnecessary prototypes, etc etc.
  2123.  
  2124. Fixes to the Apollo SR10 makefile entries from Chuck Fuller.
  2125.  
  2126. Put timer interrupt in ttclos() so we wouldn't hang up on exit, etc, any
  2127. more.  ckutio.c.
  2128.  
  2129. Added a new system symbol, SUNOS41.  It turns out there is another difference
  2130. between 4.0 and 4.1: the former did not have <stdlib.h>, the latter does.
  2131. ckcdeb.h.
  2132.  
  2133. Created YET ANOTHER new data type, PWID_T.  This is the type of the argument
  2134. expected by getpwid().  By default it is the same as UID_T, but it can be
  2135. changed independently, as it must be for SCO UNIX 3.2.2, where it has to be
  2136. int.  Use -DPWID_T=xxx in your CFLAGS to specify a getpwuid() arg type that
  2137. is different from UID_T.  ckcdeb.h, ckufio.c, makefile.
  2138.  
  2139. Removed forward declaration of real_uid() in ckutio.c.  Sergey Kartashoff,
  2140. Moscow.
  2141.  
  2142. The docmd() routine in ckuusr.c, even though the humongous switch()
  2143. statement was broken up into many smaller ones, is still too complicated for
  2144. some C optimizers, including VAX C 3.0.  Reportedly, on Microport System
  2145. V/AT 2.4 it crashes the compiler with "hash table overflow".  Ditto on ATT
  2146. 6300.  On another AT&T system, it has "too many labels".  So no more switch
  2147. statements, now just a lot of if statements.  Let's see if that helps...
  2148. (It didn't help on the VAX -- optimization of CKUUSR.C is still suppressed.)
  2149. So then I took all the big chunks of code completely out of docmd() and
  2150. moved them to their own little functions within the same file.  That (at
  2151. least) made VAX C happy.  Phew!
  2152.  
  2153. If suspend is disabled and user tries to suspend, C-Kermit should now reissue
  2154. its prompt.  ckuusx.c.
  2155.  
  2156. Several people reported that edit 167 core dumped when starting up, and
  2157. traced the problem to a malloc call in addmac for the builtin multiline _forx
  2158. macro, now installed via the new addmmac procedure, which concatenates a
  2159. multine macro definition into a single string and then calls addmac to enter
  2160. it.  Reportedly, the core dumps happen only when debug is off.  If you start
  2161. Kermit with -d, the problem doesn't happen.
  2162.  
  2163. Piet Plomp in the Netherlands found that malloc in addmac was being called
  2164. with an argument of 0: strlen(nam) + 1 == 0 implies that strlen returns -1,
  2165. which should never happen unless the we have a string longer than 0x7FFF!
  2166. An inspection of addmac() did not show how this could happen, but it did
  2167. reveal that malloc was actually being called for the same name string twice.
  2168. So I removed the extra call to malloc, and I added lots of range checking
  2169. and debugging statements to both addmac and addmmac.
  2170.  
  2171. All this just to get around a restriction on the length of constant strings
  2172. imposed by some old C compilers.
  2173.  
  2174. ------------------------------
  2175.  
  2176. 5A(167) Fri Mar 29 21:36:58 1991
  2177.  
  2178. Put reference to TIOCSETD in ttres() within #ifdef TIOCSETD..#endif.
  2179.  
  2180. Moved #include <net/errno.h> for Interactive SVR3 (I386IX) further down.
  2181. Something was wiping out the definition of ENOTCONN where it was before.
  2182. ckutio.c.
  2183.  
  2184. Changed prototype for netclos() to spell it right (no 'e').  ckutio.c.
  2185.  
  2186. Moved call to conint() in stptrap() higher up, to make sure suspend trap
  2187. is rearmed asap.  Thanks to Peter Jones for noticing this STILL didn't work
  2188. on MIPS in edit 166.  And it still might not work!  ckuusx.c.
  2189.  
  2190. Moved #includes of Kermit-specific header files to below system header files
  2191. in ckuus3.c and ckufio.c to ensure that Kermit definitions take precedence
  2192. over system definitions.  For example, ATT Sys V R4 defines AT_ALL and AT_TYPE
  2193. (Kermit file attribute symbols) in <sys/vnode.h>.  Thanks to Andrew Herbert at
  2194. Monash U in Australia for pointing out the conflict.  This required a lot of
  2195. shuffling in ckufio.c, so testers watch out!
  2196.  
  2197. Protected Kermit header files against multiple inclusion.  ck*.h.
  2198.  
  2199. Continued ANSIfication.  More function prototypes added to header files and
  2200. most forward declarations of functions removed from C source files.
  2201.  
  2202. The -DNOTERMIX (no <termiox.h> file available) switch added to makefile
  2203. entries based on reports from testers: MIPS, Xenix SVR3 variations, ...
  2204.  
  2205. Added dialhup routine to ckudia.c.  Replaced all calls to tthang() from within
  2206. DIAL with this.  Changed tthang() to return 1 if it succeeds, 0 if it doesn't
  2207. even try, and -1 if it fails.  dialup() prints a message during dialing saying
  2208. whether DIAL is hanging up (if DIAL DISPLAY is ON).
  2209.  
  2210. Installed a correction to ttpkt() line speed setting code from Andy Fyfe at
  2211. Cal Tech.  Fixes problems some people have reported with DIAL happening at
  2212. the wrong speed.  ckutio.c.
  2213.  
  2214. Improved -DNOSPL (script programming language deselection compile-time option)
  2215. to still allow \nnn numeric escapes anywhere in a command.  ckuusr.c.
  2216.  
  2217. Fixed STATISTICS command to report effective data rate when program is
  2218. built with -DNOTLOG.  ckcfns.c.
  2219.  
  2220. Andrew Herbert says that his System V R4 version of Unix creates lockfiles
  2221. with names like LK.035.mmm.nnn, containing the major and minor device numbers
  2222. of the tty device.  Added code to ttlock() to handle this, controlled by
  2223. #ifdef LFDEVNO.  Defined LFDEVNO automatically if SVR4 is defined, on the
  2224. no doubt naive assumption that all Sys V R4 systems will be compatible in this
  2225. respect.  Needs major() and minor() macros, which may or may not be defined in
  2226. <sys/types.h> or <sys/mkdev.h> or <sys/sysmacros.h> or ...???  ckutio.c.
  2227.  
  2228. Added -DNOCYRIL compile-time switch to deselect the Cyrillic character set
  2229. translations, but still keep the others.  ckcxla.h.
  2230.  
  2231. Updated ckuins.doc to include the above two items.
  2232.  
  2233. Many edits ago (last summer) I wasted some days trying to program a FOR-loop
  2234. mechanism into the C-Kermit command parser, and eventually gave up and
  2235. "simply" implemented it as a macro, passing the parts of the FOR statement to
  2236. the macro as arguments.  This allows deeply nested loops, etc.  Then I did
  2237. WHILE loops the same way, and XIF (extended IF) the same way too.  BUT...
  2238. since these are implemented as macros, you couldn't use them inside of other
  2239. macros and use the enclosing macro's arguments in the object command of the
  2240. FOR, WHILE, or XIF statement.  For example:
  2241.  
  2242.   def aa for \%i 1 3 1 { echo \%i and \%1 }
  2243.   do aa 3
  2244.  
  2245. would echo "1 and %i" etc, instead of "1 and 3".  This restriction is now
  2246. lifted.  First I added two invisible commands: _getargs lets a macro replace
  2247. its own arguments with the arguments of the macro two levels up; _putargs lets
  2248. a macro replace the arguments of the macro two levels up with its own.
  2249. ckuusr.c.  Then I just added _getargs and _putargs commands in the definitions
  2250. of the FOR, WHILE, and XIF macros (these are macros that define another macro
  2251. and then execute it, hence the "two levels").  ckuus5.c.  (** NOTE: still
  2252. have to do something about RETURN and END issued from within these commands!)
  2253.  
  2254. Broke up the big switch statement in ckuusr.c into many little ones.  This
  2255. should fix the problems that some compilers have been having.
  2256.  
  2257. Broke up the big switch() statement in ckuus3.c into many smaller ones.
  2258.  
  2259. Put some feature-specific symbols in .h files into #ifdefs to cut down on
  2260. cpp symbol table size.  Maybe I need to do a lot more of this.
  2261.  
  2262. Casted all char/CHAR implicit conversions in function calls, as well as other
  2263. types of argument / pointer mismatches that were causing ANSI compilers to
  2264. complain.  Hundreds and hundreds of them...  Now GNU cc compiles C-Kermit on
  2265. the NeXT with -Wall (all warnings on) with only a few minor complaints.
  2266. Fixing these is left as an exercise to the reader (I can't do it!).  All
  2267. modules affected.
  2268.  
  2269. Added makefile entries for Minix on 68000-based machines (Atari ST, Commodore
  2270. Amiga, Macintosh) from Bert Laverman in the Netherlands.
  2271.  
  2272. Added support for Fortune For:Pro 2.1, which included a few fixes that might
  2273. be relevant for V7, Minix, Coherent, etc.  From Thomas Krueger.
  2274.  
  2275. Broke the string definitions for built-in macros up into arrays to get around
  2276. string-constant length restrictions in some compilers, and inability of some
  2277. compilers to handle line continuation within string constants.  ckuus5.c.
  2278.  
  2279. Changed keyword tables to use short rather than int to save a few K.  Could
  2280. save even more by using char, but that would unleash reams of complaints from
  2281. type-checking compilers.
  2282.  
  2283. Added new code to support X.25 call user data (SunLink X.25 only) from
  2284. Marcello Frutig in Brazil.
  2285.  
  2286. Added mechanisms to ck[cu]xla.h to allow addition of Japanese Kanji character
  2287. sets.  The actual translation support will be added later.
  2288.  
  2289. Added support for Sequent DYNIX/PTX to makefile file, "make ptx".
  2290.  
  2291. Added POSIX function calls to cku[ft]io.c for "make posix", removed all
  2292. ioctl() calls if POSIX is defined.  This is a totally new line of source code
  2293. selection and does not follow any of the System V or BSD specific code, except
  2294. in cases where System V code is explicitly shared via the new #ifdef
  2295. SVORPOSIX.
  2296.  
  2297. I have no idea if this was done correctly, since I don't have an up-to-date
  2298. POSIX specification yet.  Information based on SUNOS 4.1 man pages and header
  2299. files.  There seems to be no way in POSIX to (a) get modem signals, or (b)
  2300. check the tty input buffer without reading it.  Compiles and links OK on the
  2301. SUN, which supposedly provides a POSIX-compliant environment if you define
  2302. _POSIX_SOURCE, but without an ANSI standard C compiler (the opposite of the
  2303. NeXT, which has Standard C, but not POSIX functions).
  2304.  
  2305. The program runs on the SUN without core dumping.  Amazingly, most features
  2306. seem to work: remote mode file transfer, wildcard expansion and filename
  2307. completion, tilde expansion, CONNECT mode, local-mode file transfer, etc.
  2308.  
  2309. POSIX questions:
  2310.  
  2311.  - What is the real POSIX name for d_ino?  d_fileno or gd_ino or what?
  2312.  - How to read modem signals?
  2313.  - How to check tty device input buffer?
  2314.  - Correct/preferred way to do nonblocking reads (O_NONBLOCK)?
  2315.  - Where are the major() and minor() macros located?
  2316.  - Does it have <sys/termiox.h>?
  2317.  - Where are fflush, fclose, [fs]printf, [fs]scanf, rewind, toupper, tolower,
  2318.    _filbuf, _flsbuf, [f]puts, perror, fclose, ungetc, setbuf, wait, pclose
  2319.    supposed to be declared?
  2320.  - How to do millisecond sleep?  (usleep()?)
  2321.  - What's different about POSIX job control?
  2322.  - What is symbol for maximum filename name length and where is it defined?
  2323.    _D_NAME_MAX, _POSIX_NAME_MAX, NAME_MAX, FILENAME_MAX, or what?
  2324.  - Ditto for pathname length.
  2325.  - Watch out for getpgrp() vs getpgrp(0)
  2326.  
  2327. In ttclos(), hang up the phone first, then reset the device modes (rather than
  2328. the other way around).  ckutio.c.
  2329.  
  2330. Put all job control (suspend) code within #ifndef NOJC..#endif conditionals.
  2331. Add -DNOJC to MIPS and SCO UNIX 3.2.0/3.2.1 makefile entries, created new
  2332. makefile entry sco3r22 for SCO UNIX 3.2.2, which does indeed support job
  2333. control.  ckutio.c, makefile.
  2334.  
  2335. Updated ckuins.doc, ckuker.bwr.
  2336.  
  2337. Modified SCRIPT command to not echo the script string if it's being executed
  2338. in a TAKE file and TAKE ECHO is OFF, or if it is being executed in a macro
  2339. and MACRO ECHO is OFF.  ckuscr.c.
  2340.  
  2341. Changed doclean() to call conres() and connoi() AFTER executing the on_exit
  2342. macro, rather than before.  Previously, if you had an on_exit macro defined,
  2343. your terminal modes could be fouled up after exiting from Kermit.  ckuusx.c.
  2344.  
  2345. Fixed telnet support in ckucon.c to handle unknown telnet options by refusing
  2346. to do them.  Previously, it just ignored them.  Also, allow for negotiated
  2347. mode changes from local echo back to remote echo.  Also, don't attempt to
  2348. print the name of an unknown option to the debug log or debug screen, print
  2349. "unknown" instead.  These three fixes allow SET HOST to a NeXT to work.  The
  2350. NeXT telnet server attempts to negotiate a lot of options that Kermit doesn't
  2351. support, like terminal speed and linemode (not to mention a few that aren't
  2352. even in the NeXT's <arpa/telnet.h> file!).  ckucon.c.
  2353.  
  2354. After all the changes described above, compiled, linked and ran the program
  2355. successfully on:
  2356.  
  2357.  [ok] MicroVAX-II VMS 5.3 (@ckvker.com)
  2358.  [ok] MicroVAX-II Ultrix 2.0 (make bsd)
  2359.  [ok] VAX-11/750 with 4.3BSD (make bsd43)
  2360.  [ok] Encore Multimax 510 with UMAX 4.3 (make encore)
  2361.  [ok] SUNOS 4.1 BSD environment (make sunos41)
  2362.  [ok] SUNOS 4.1 SVR3 environment (make sunos41s5)
  2363.  [ok] SUNOS 4.1 POSIX environment (make sunposix)
  2364.  [ok] SUNOS 4.1 POSIX environment with gcc and -Wall (make gccsunposix)
  2365.  [ok] NeXT with gcc and -Wall (make nextg)
  2366.  [ok] DECstation 5800 Ultrix 4.1 BSD environment (make du4)
  2367.  [ok] DECstation 5800 Ultrix 4.1 POSIX environment (make posix)
  2368.  [ok] IBM RS/6000 AIX 3.1 (make rs6000)
  2369.  
  2370. Phew!
  2371.  
  2372. ------------------------------
  2373.  
  2374. 5A(166) Sun Mar 17 00:36:15 1991
  2375.  
  2376. Major fix from Paul Placeway: the spack() function cleverly manipulated the
  2377. data buffer pointer to avoid recopying packet contents, allowing the packet
  2378. control fields to be deposited around the prebuilt data field in place.
  2379. However, each time it was called, it backed up the "data" pointer again, but
  2380. never restored it to its original position.  After repeated calls to spack(),
  2381. all sorts of memory could be trashed.  The problem never showed up on most
  2382. systems, but had horrible effects on others, depending on how the linker
  2383. ordered variables, where things were malloc'd to, etc.  Solution: manipulate a
  2384. local copy of the data pointer in spack() rather than the global copy.
  2385. Thanks, Paul!  ckcfn2.c.
  2386.  
  2387. Also from Paul: A more efficient implementation of debug() that avoids
  2388. function calls unless debugging is actually requested, at the cost of an
  2389. "if" test:
  2390.  
  2391.   #define debug(a,b,c,d) if (deblog) dodebug(a,b,c,d)
  2392.  
  2393. Also I cleaned up the program to make sure that all explicit references to
  2394. deblog were within #ifdef DEBUG..#endif.  This frees up even more space with
  2395. compiling with -DNODEBUG.
  2396.  
  2397. The new definition of debug() should reduce execution of the program at the
  2398. cost of some space.  To put things back the way they were, change this to:
  2399.  
  2400.   #define debug(a,b,c,d) dodebug(a,b,c,d)
  2401.  
  2402. Checked performance before and after this change on a long file transfer
  2403. from a SUN-4/280 to a PS/2-50.  No apparent difference.  Presumably an
  2404. improvement would be noticeable on a slower computer.  ckcdeb.h and ckuusx.c.
  2405.  
  2406. UNFORTUNATELY, this innocent-looking change adds about 16K to the program
  2407. size, at least on RISC architectures like SPARC.  Backed off as shown above
  2408. except for Macintosh (Paul says it makes a noticeable performance difference
  2409. on the Mac).  ckcdeb.h.
  2410.  
  2411. Changed dodebug() to malloc its string buffer rather than allocate it
  2412. statically, to save about 2K.  ckuusx.c.
  2413.  
  2414. Made "in" an acceptable abbreviation for "input" ("i" already was). ckuusr.c.
  2415.  
  2416. Added telnet option negotiation support to INPUT and OUTPUT commands, so now
  2417. script programs can work on telnet connections too.  (Funny nobody noticed
  2418. this never worked before...)  ckuus4.c, ckuus5.c.
  2419.  
  2420. Added SET FILE TYPE BINARY [ { FIXED, UNDEFINED } ] to the VMS version.  This
  2421. allows the user to specify whether received binary files should be marked as
  2422. having FIXED or UNDEFINED record format in the RMS attributes.  The file is
  2423. stored in exactly the same format either way.  This is to accommodate an
  2424. application called "Thoroughbred BASIC", which perversely requires its program
  2425. and data files to be "undefined sequential".  ckuus3.c, ckuus4.c (for SHOW),
  2426. ckcfn3.c, ckcfil.h, plus changes by Terry Kennedy to ckvfio.c.
  2427.  
  2428. Added a call to conint(trap,stptrap) in stptrap() itself, after the suspended
  2429. Kermit is fg'd (continued), so the suspend interrupt trap is rearmed.  This is
  2430. required for System V.  Many thanks to Peter Jones and Warren Tucker for help
  2431. with this one.  Removed special "no-suspend" default for MIPS.  ckuusx.c,
  2432. ckcmai.c.
  2433.  
  2434. Got rid of the bit in ckcmai.c that declared nettype to be "TCP/IP streams"
  2435. for System V systems except if there was an explicit #ifdef to make it BSD
  2436. sockets (like there was for about 10 different ones -- HPUX, Xenix/Excelan,
  2437. A/UX, etc etc etc).  After all, C-Kermit doesn't support TCP/IP streams
  2438. anyway, so I just made the default network type to be TCP/IP Sockets for all
  2439. UNIX implementations that define NETCONN.  This was prompted by noticing that
  2440. "set host" didn't work on the RS/6000 until after I gave the command "set
  2441. network tcp/ip".  Now it works fine.  Also made a few other minor changes to
  2442. get Kermit to compile cleanly and look better on the RS/6000 with AUX 3.1.
  2443. Also, added "LNKFLAGS = -s" to the makefile to strip during linking.  This
  2444. reduces the size of the program on disk by about 200K (!) (from 600 to 400 --
  2445. love that RISC architecture).
  2446.  
  2447. Made \v(filespec) work for arriving files too.  One line of code added to
  2448. rcvfil(), ckcfns.c.  And for files that the server gets a GET command for, one
  2449. line added to fnparse(), ckuusx.c
  2450.  
  2451. Changed zsout() to use write() rather than fputs() for session log, to keep
  2452. WRITE SESSION and other session log material synchronized.  ckufio.c.
  2453.  
  2454. Changed dooutput() to write to session log only on half duplex connections.
  2455. Otherwise, doinput() writes the echo.  ckuus5.c.
  2456.  
  2457. Add optional syntax to INPUT command: INPUT n {text}.  Use optional
  2458. orthodonture (braces) around INPUT text to prevent leading or trailing blanks
  2459. from being stripped.  Ditto for OUTPUT command.  Until now, it was not
  2460. possible to have INPUT or OUTPUT strings with leading or trailing spaces.
  2461. This is similar to the change that was made to SET PROMPT a while back.
  2462. To actually INPUT a string that begins and ends with braces, use 2 of each,
  2463. as in "INPUT 20 {{foo}}".  ckuusr.c.
  2464.  
  2465. Added REDIAL command.  ckuusr.[hc], ckuus2.c.
  2466.  
  2467. Changed doexit() to prevent the ON_EXIT macro from calling itself
  2468. recursively, for example if a user put an EXIT command in the ON_EXIT
  2469. definition.  ckuusx.c.
  2470.  
  2471. Made server execute cleanup code from doexit(), including running the
  2472. ON_EXIT macro, when a BYE command is received.  ckcpro.w, ckuusx.c.
  2473.  
  2474. Made SET FILE TYPE BLOCK be an invisible synonym for SET FILE TYPE IMAGE for
  2475. VMS, for compatibility with Kermit-32.  ckuus3.c.
  2476.  
  2477. Fixed DIAL command to show all dialer output, rather than just the part that
  2478. doesn't match the "waitfor" string, when SET DIAL DISPLAY is ON.  Also make
  2479. sure that "Call completed." message comes on a new line if DIAL DISPLAY is
  2480. ON.  ckudia.c.
  2481.  
  2482. Added partial completion for filenames, within #ifndef NOPARTIAL..#endif, in
  2483. cmifi() in ckucmd.c.  Works fine in UNIX and VMS.  For partial completion, I
  2484. had to make mtchs array in ckufio.c and ckvfio.c global rather than static
  2485. (hidden).  If this breaks any implementations, they should compile with
  2486. -DNOPARTIAL.  Changed ckasys.doc to include description of "char *mtchs[]".
  2487.  
  2488. Changed the definition of CR in ckcasc.c from '\r' to 015.  We want a real
  2489. carriage return here, not whatever the C compiler defines \r to be.  This
  2490. messed things up quite a bit on the Macintosh, where MPW C 3.0 appears to
  2491. define \r as linefeed (???).
  2492.  
  2493. Changed name of command keyword structure member "val" to "kwval" because some
  2494. old C compilers have only a single name space for structures, so every member
  2495. of every structure should have a unique name (or at least the names must be
  2496. unique if they reference different data types).  The .val of the keyword
  2497. structure conflicted with the .val of the file attribute structure, zattr.
  2498. Similarly, changed name of command stack structure "val" to "lvl", and macro
  2499. stack value "val" to "mval".  ckuu*.[ch].  Reported by APPP Scorer at Leeds
  2500. Polytechnic, UK, who was able to get C-Kermit 5A to compile and run under V7
  2501. UNIX (2.4BSD).
  2502.  
  2503. The CONNECT code is supposed to cancel privileges for its lower fork, and it
  2504. did so.  However, it did it in the wrong place -- outside of the new fork
  2505. instead of in it.  This prevented the uucp lockfile from being removed upon
  2506. program exit if (a) the lockfile directory was write-protected against the
  2507. user, (b) the program was setuid or setgid to the owner &/or group of the
  2508. lockfile directory, and (c) the user had given a CONNECT command.  Moved the
  2509. call to priv_can() to inside the lower fork.  Tested, works right now.
  2510. ckucon.c.
  2511.  
  2512. William Bader reported that C-Kermit hangs in CONNECT mode every so often,
  2513. and suggested this might be caused by the "pause()" that is executed if the
  2514. keyboard-reading code gets an error.  Since this is in the upper CONNECT
  2515. fork, there's no reason for a pause(), so now it just beeps if this happens.
  2516. ckucon.c.
  2517.  
  2518. Fixed the text-mode session logging yet again.  This code is really getting
  2519. hairy, full of code duplication.  But it's hard to clean up without adding a
  2520. lot of function- and/or system-call overhead.  ckucon.c.
  2521.  
  2522. Changed the file collision mechanism that is used to create files with version
  2523. numbers on UNIX to use version numbers compatible with GNU EMACS, i.e.
  2524. <name>.~<n>~, where <n> is a number from 1 to 9999 (previously it was simply
  2525. <name>~<n>).  This allows EMACS to purge old versions, as well as EMACS-
  2526. oriented-version-purging shell scripts to work on Kermit backup files.
  2527. Function znewn(), ckufio.c.
  2528.  
  2529. I also considered adding a "version retention count" mechanism (automatically
  2530. delete oldest version when creating a new one) and a PURGE <name> <n> command,
  2531. but decided against it because of (a) creeping featurism, (b) space
  2532. considerations, and (c) unexpected behavior when FILE COLLISION is not set to
  2533. BACKUP.
  2534.  
  2535. Added support for old old DNIX/Luxor-ABC versions to makefile & ckufio.c,
  2536. from Bo Kullmar.
  2537.  
  2538. Added explicit SHELL=/bin/sh to makefile because some of its line
  2539. continuations confused csh.  Reported by Sergey Kartashoff, Institute-with-
  2540. Long-Name, Moscow, USSR.  Several fixes to makefile & cku[ft]io.c for
  2541. Interactive Sys V R3, also from Sergey.
  2542.  
  2543. Ever since C-Kermit was first written, its ttpkt() function (the one that puts
  2544. the communication device in packet mode) has always turned on the System V
  2545. ISIG flag (whereas the ttvt() function always turned it off), meaning the tty
  2546. driver should check for interrupt characters.  That's bad because a stray
  2547. noise character of ^Z or ^\ during file transfer could suspend or kill the
  2548. process.  On the RS/6000, NUL characters also killed the process for some
  2549. reason (reportedly a busted TTY driver).  I have no idea why ISIG was left on
  2550. in ttpkt, but in response to complaints that remote-mode file transfer did not
  2551. work on the RS/6000, I tried turning it off.  Tested on an RS/6000 in both
  2552. remote and local modes, and it seems to work fine.  Ditto for the SUN-4,
  2553. compiled in the System V environment.  You can, of course, still interrupt a
  2554. remote-mode Kermit while it's in packet mode by typing Ctrl-C twice in a row
  2555. -- this is not done using interrupts; rather ttpkt() looks for it explicitly.
  2556. This change needs thorough testing on all System V UNIX systems.  (Sent a
  2557. message to ckermit list asking about this, all responses so far have been
  2558. positive.)  ckutio.c.
  2559.  
  2560. Added translation for IBM code pages 437 and 850, same procedure as outlined
  2561. for NeXT character set in edit 164.  These code pages are used by Unix systems
  2562. running on IBM PCs, RT PCs, and RS/6000s.  Select them with SET { FILE,
  2563. TERMINAL } CHARACTER-SET { CP437, CP850 }.  ckuxla.[ch].
  2564.  
  2565. Added translation for Apple Quickdraw character set, used by Apple A/UX Unix
  2566. running on Macintosh computers.  SET { FILE, TERMINAL } CHARACTER-SET
  2567. APPLE-QUICKDRAW.  These tables taken from Paul Placeway's ckmxla.c, which in
  2568. turn were adapted by Paul from tables developed by Andre' Pirard at the
  2569. Universite' de Lie'ge in Belgium.  ckuxla.[ch].
  2570.  
  2571. Updated ckasys.doc to show procedure for adding a new file character set.
  2572.  
  2573. Fixed TRANSLATE command not to core dump when translating from an 8-bit
  2574. international character set to ASCII when SET LANGUAGE is adding characters
  2575. (e.g. German a-umlaut => ae).
  2576.  
  2577. Added SET TERMINAL CHARACTER-SET TRANSPARENT, to be like MS-DOS Kermit, and to
  2578. make sense (it's silly to tell users to SET TERM CHAR <same> <same> to do
  2579. this).  The cost was adding a copy of the file character-set table, plus one
  2580. entry, in ckuxla.c.  ckuxla.[ch], ckuus3.c.
  2581.  
  2582. A SunLink X.25 user reported that SHOW PAD crashed at the end of the
  2583. parameter list.  I attempted to fix this, and also changed the code to
  2584. display the X.3 parameter number that goes with each keyword.  ckuus4.c.
  2585.  
  2586. Added a fix for a bad bug in fgen() (the wildcard file list builder), which
  2587. might also be present in the VMS and other versions, which just copied the
  2588. same code: the loop that frees the malloc'd memory segments wasn't really
  2589. freeing them or (worse) was freeing something else.  Thanks to Steve Walton
  2590. for this one.  ckufio.c.
  2591.  
  2592. Charlie Epstein complained that he could not "send *" from a directory that
  2593. had lots of files in it.  There are two factors governing how many files can
  2594. match a wildcard: (1) the size of the "char *mtchs[]" array, determined by
  2595. the symbol MAXWLD (normally 1000), and (2) the size of the string space for
  2596. holding the names.  Previously, the latter was in a static array in ckufio.c,
  2597. allocated (for most systems) at 2000 characters.  I changed this to dynamic
  2598. allocation and 10,000 characters.  This should allow sending of 1000 files
  2599. with an average name length of 10.  This code is all within #ifdef DYNAMIC
  2600. brackets.  ckufio.c: near the top, and in function fgen().
  2601.  
  2602. Changed server's handling of REMOTE PRINT command to feed the file to be
  2603. printed to lp[r] as standard input, rather than giving its name to lp[r]
  2604. on the command line.  This allows the file to be printed even when lp[r]
  2605. doesn't have access to it (because, for example, it is running setuid to lp
  2606. and lp doesn't have read access to the file is).  Suggested by Bo Kullmar.
  2607. zprint() in ckufio.c.
  2608.  
  2609. Removed obsolete keywords from SET keyword list to save a little space.
  2610. These are the ones that were moved to the SET { SEND, RECEIVE } section
  2611. years ago.  ckuusr.c.
  2612.  
  2613. Added -DNOXMIT compile-time option to omit the TRANSMIT command.  Saves a
  2614. little space (not measurable on the SUN-4, which saves executable program
  2615. images in 8K increments).  ckuus[r2345].c.
  2616.  
  2617. Added -DNOFRILLS to get rid of BUG, CLEAR, DELETE, ERROR, MAIL, REMOTE PRINT,
  2618. REMOTE TYPE, REMOTE WHO, RENAME, TEST, TYPE, WHO, and WRITE commands, along
  2619. with invisible aliases like MV, RM, etc.  This one also has no measurable
  2620. effect on Sun-4.  ckuus[r2345].c.
  2621.  
  2622. Added -DNOSPL compile-time option to omit script programming language: macros,
  2623. variables, functions, INPUT/OUTPUT/CLEAR, IF, GOTO, etc etc etc.  Saves less
  2624. space than everybody hoped it would -- only about 66K on the Sun-4.  Seems to
  2625. work ok, but was not tested exhaustively.  ckucmd.c, ckuus[r2345x].c,
  2626. ckcpro.w, ckuins.doc.
  2627.  
  2628. Built a minimal interactive C-Kermit 5A on the Sun-4.  Dynamically allocated
  2629. packet buffers, no network support, no script programming, no built-in help,
  2630. no dial, no transmit, no debugging, no character sets, etc etc, but still with
  2631. the new file transfer protocol stuff: sliding windows, long packets, file
  2632. attributes.  Result is 172K (down from 393K for a fully configured version on
  2633. the same computer).  I hope this is smaller on an 80x86 architecture machine;
  2634. it should be, because RISC architecture executables tend to be quite large.
  2635. If I build the same program with no interactive command parser at all, the
  2636. result is 114K on the same machine.
  2637.  
  2638. Corrected a problem with MSEND, or rather the lack of it: if you build
  2639. C-Kermit with -DNOMSEND, you couldn't GET files from it when it was in server
  2640. mode.  Fixed in ckcpro.w.
  2641.  
  2642. Added display of the compile-time options to SHOW VERSIONS (which, of course,
  2643. only works if you you haven't compiled the program with -DNOICP).  We need
  2644. this now that there are so many -DNOxxxx compile-time options.  Also includes
  2645. most of the C preprocessor predefined variables that C-Kermit might encounter.
  2646. ckuus5.c.
  2647.  
  2648. Chet Creider <creider@csd.uwo.ca> sent in a version of ckutio.c that had Mark
  2649. Williams Co Coherent OS support added by Simon Hania in the Netherlands, from
  2650. version 4E of C-Kermit, plus a fix from Chet himself for sending BREAK during
  2651. connect mode.  I moved the changes into the current ckutio.c.  Later, ditto
  2652. for ckufio.c.  Also, made some changes to the makefile suggested by Bo Kullmar
  2653. in Sweden, after he tested "make coherent" on a PC at ABC-Klubben.
  2654.  
  2655. Changed COHERENT makefile entry to use -DNOSCP to see if a minimally
  2656. configured interactive version can be built.  Also added suggestion about
  2657. trying -DNOSCP to MINIX entry.  makefile (ckuker.mak).
  2658.  
  2659. Fixed RS/6000 makefile entry to spell "-DDYNAMIC" right.
  2660.  
  2661. The symbol UXIII was getting on my nerves, so I changed it (everywhere)
  2662. to ATTSV.  Sorry folks, I know what it does to the diffs...
  2663.  
  2664. Worked on POSIX makefile entry a little, added POSIX entry to ckuver.h.
  2665. However, I don't have a current POSIX specification yet (it's on order), and
  2666. cannot complete this work until I do.  SUNOS 4.1 has a lot of _POSIX_SOURCE
  2667. junk in its header files, but they seem to be wrong.  For example, I can't
  2668. "make posix" on the SUN because <termios.h> refuses to define CBAUD, IUCLC,
  2669. IXANY, and TCFLUSH (these symbols in termios.h are defined only within #ifndef
  2670. _POSIX_SOURCE..#endif, even though they are listed in my 1986 IEEE 1003.1
  2671. POSIX draft).  Anybody out there have a truly POSIX compliant system I can
  2672. work with?
  2673.  
  2674. Defined a _PROTOTYPE() macro for forward declarations of functions, for use
  2675. with ANSI C.  It makes an ANSI-style prototype if __STDC__ is defined (as it
  2676. must be by ANSI compilers), otherwise it makes an old-style forward
  2677. declaration with no parameters.  Suggested by Bert Laverman at RUG in the
  2678. Netherlands, but done in a slightly different way (thanks to Howie Kaye at
  2679. Columbia for help with this).  ckcdeb.h.
  2680.  
  2681. To make malloc debugging a little easier, I moved the forward declaration of
  2682. malloc() into ckcdeb.h, using the new _PROTOTYPE() macro.  Now it is no longer
  2683. necessary to change the malloc declarations in many modules.
  2684.  
  2685. Added ANSI prototyping for the functions in ckcfn*.c, by declaring prototypes
  2686. with the _PROTOTYPE macro.  Added these prototypes to ckcker.h.
  2687. Unfortunately, this provokes millions of warnings from GNU cc (gcc).  Even
  2688. though the whole idea of prototyping is to have the compiler perform type
  2689. conversions on function arguments, it feels compelled to issue an "argument
  2690. passing between incompatible pointer types" message every time it converts
  2691. (say) a (char *) to an (unsigned char *).  There are hundreds of these in
  2692. C-Kermit.  Has ANYONE EVER had a use for "signed character"???  Grrr...  Added
  2693. -w to "next" makefile entry, which uses gcc.  Other gcc entries will have to
  2694. do the same, but this also suppresses useful messages.
  2695.  
  2696. The function definitions themselves are left in the old style, because there's
  2697. no way (that I can think of) to construct a portable macro for declaring
  2698. functions both the old way and the new way.  Unfortunately (from K&R 2nd Ed):
  2699. "If the function declaration is old-style, then the type of each parameter in
  2700. the prototype visible at the call must agree with the corresponding parameter
  2701. in the definition, after the definition parameter's type has undergone
  2702. argument promotion."  Without new-style function declarations, char arguments
  2703. are promoted to int, and then the compiler chokes when it sees the type
  2704. mismatch.  So #ifdef __STDC__..#else..#endif declarations have been added for
  2705. a few functions, like spack() and logpkt().  Functions without char arguments
  2706. seem to be ok.
  2707.  
  2708. Same deal for all functions declared in ck*[ft]io.c and used in other modules.
  2709. Only one in ckufio.c (zchout) needed the #ifdef __STDC__ treatment, but
  2710. several in ckutio.c (ttoc, ttinl, concb, conbin) needed this.  Owners of
  2711. ck*[ft]io.c will have to add the __STDC__ baloney to the declarations of these
  2712. functions.
  2713.  
  2714. Had to move the material from ckcfil.h into ckcker.h to make the prototypes
  2715. work right.  Got rid of all references to ckcfil.h, and replaced ckcfil.h by
  2716. a file that contains only comments.
  2717.  
  2718. This ANSI- and POSIX-ification has been a useful exercise.  Many potential
  2719. problems were uncovered -- variables possibly used before set, variables
  2720. possibly clobbered by longjmp, etc etc.
  2721.  
  2722. Compiled successfully on SUN/BSD (not ANSI), NeXT (ANSI), VAX/VMS (not ANSI),
  2723. DECstation (not ANSI), RS/6000 AIX 3.0 (very weird -- ANSI, but does not
  2724. define __STDC__ so the prototyping doesn't kick in).  Also tried "make posix"
  2725. on the RS/6000, but it crashed the compiler.
  2726.  
  2727. Fixed ttoc() to call setjmp before the read() rather than after it, oops!
  2728. Pointed out by Benn Schreiber at DEC.  ckutio.c.
  2729.  
  2730. Added Xoff-clearing code to ttoc() if it times out.  ckutio.c.
  2731.  
  2732. SET FILE COLLISION DISCARD didn't work.  It refused the file all right, but
  2733. it deleted the existing file too.  Oops!  Reported by Peter Jones.  Fixed in
  2734. reof(), ckcfns.c.
  2735.  
  2736. ASKQ worked correctly in interactive mode, not echoing what the user types.
  2737. On Unix systems, however, it did echo when issued from a C-Kermit application
  2738. file.  And reportedly on VMS systems, it echoed even from within a TAKE file.
  2739. Fixed by adding an explicit call to concb() in the ASKQ code.  ckuusr.c.
  2740.  
  2741. Moved big hunks of code out of the humongous switch() statement in docmnd().
  2742. This might make some compilers happy that previously had complained or failed
  2743. on this module.  ckuusr.c.
  2744.  
  2745. Added Telebit modem support.  Should work for Trailblazer, T1000, T1600, and
  2746. T2500.  "set modem telebit" means to let it configure itself automatically to
  2747. the answering modem (PEP, Bell 103, Bell 212, CCITT V.22).  "pep-telebit"
  2748. means to force PEP mode, and allows it to be used with or without the "Kermit
  2749. spoof" ("set dial kermit-spoof { on, off }").  "set modem v32-telebit" means
  2750. to dial in V.32 mode but allow fallback to 2400/1200 (only works with T1600
  2751. and T2500).  Much code and info from Warren Tucker and Larry Jacobs.  Tested
  2752. on my early-model Trailblazer (1985 Model 962 = RA12E, Firmware
  2753. Q2.22/PROT/MNP-026), which tends to go into a tailspin when it receives those
  2754. long register-setting commands, so I added code to feed it gently and to try
  2755. each command several times before giving up.  Needs testing on newer Telebits
  2756. (T1000, T1600, T2500).  So far there's no provision for turning on MNP.  The
  2757. DIAL module needs reorganization to allow users to select modem features
  2758. individually: MNP, compression, etc.  ckudia.c.
  2759.  
  2760. Added a new routine getok(n) to the dial module.  Reads response to
  2761. initialization commands given to Hayeslike modems (including Telebits), looks
  2762. for <CR>0 and OK<CRLF> (returns 1); <CR>4 or ERROR<CRLF> (returns -1).  Has
  2763. own built-in timer, returns 0 if none of these responses seen within n
  2764. seconds.  This makes the new Telebit code work nicely if (for example) you
  2765. "set modem v32-telebit" and then try to dial on a Trailblazer (which does not
  2766. support this).  The ERROR (or 4) response to the register-setting command is
  2767. now picked up and the dial command fails immediately.  Also added check for
  2768. '5' (= CONNECT 1200) return from dialing command in the HAYESNV section.
  2769. ckudia.c.
  2770.  
  2771. Changed TAKE ERROR default action from QUIT to PROCEED.
  2772.  
  2773. Fixed the command parser to always go back into cbreak (single-character
  2774. wakeup) mode when it returns to top (interactive) level.  popclvl() in
  2775. ckuus5.c.
  2776.  
  2777. Discovered that GOTO was case-sensitive about targets and labels.  Fixed it to
  2778. disregard case by calling xxstrcmp() (caseless string compare) instead of
  2779. strncmp().  ckuusr.c.  Changed xxstrcmp() to have a length argument like
  2780. strncmp() does.  ckuus4.c.  Changed all other xxstrcmp() calls to include a
  2781. length argument.  ckuusr.c.
  2782.  
  2783. Added -DNETCONN to sxae50 makefile entry at Dezawa-san's request.
  2784.  
  2785. The fact that the C-Kermit command parser does not allow typeahead is
  2786. annoying.  I remember having to add code to flush command typeahead years ago,
  2787. but can't remember why, and now I can't find where it happens.  cmini() and
  2788. cmres() just fiddle with the command buffer.  When there are no characters to
  2789. read in the buffer, gtword() calls regular old C getchar().  The command
  2790. parsing loop calls concb() each time thru, which calls setbuf to make stdin
  2791. unbuffered, but removing the call to setbuf doesn't make any difference.
  2792.  
  2793. Added SET ATTRIBUTES ALL { ON, OFF }, which turns all individual attributes on
  2794. or off, as compared with SET ATTRIBUTES { ON, OFF }, which turns the attribute
  2795. mechanism on and off.  Thanks to Brian Hamilton Kelly at Cranfield U (?) in
  2796. the UK for pointing out this omission.  ckuus3.c.
  2797.  
  2798. Made some attempt to parameterize the data type used for process IDs.
  2799. Defined symbol PID_T to be int in ckcdeb.h.  If anybody has a computer that
  2800. uses something besides ints for pids, try including "-DPID_T=pid_t" on the cc
  2801. command line.  ckcdeb.h, ckufio.c, ckutio.c, ckucon.c.
  2802.  
  2803. Same deal for user and group IDs: UID_T and GID_T are now used.  ckcdeb.h,
  2804. ckutio.c.  Thanks to Bob Larson and Karl Berry for pointing out the problem.
  2805.  
  2806. Made sure that telnet-init'ed flag was reset any time that ttclos() or
  2807. tthan() was called in ckucon.c.
  2808.  
  2809. Fixed TRANSMIT command in text mode to use its prompt character and echo
  2810. the echoes.  I broke this a couple edits ago.  Thanks to Peter Mauzey for
  2811. pointing out the problem.  ckuusr.c.
  2812.  
  2813. Added entries for AT&T System V Release 4 to makefile, ckcdeb.h, and ckuver.h.
  2814. They don't really do anything yet except make a new version banner.
  2815. Reportedly, C-Kermit 5A(165) builds cleanly under SVR4, but: (a) the UUCP
  2816. lockfile name has changed, (b) modem controls don't work, (c) REMOTE DIR
  2817. doesn't work, etc.  Based on report from  Andrew Herbert at Monash University
  2818. in Australia.
  2819.  
  2820. Added SET DIAL SPEED-CHANGING { ON, OFF }.  Removed the [{ CHANGES-SPEED,
  2821. MATCHES-SPEED }] optional trailing field from the SET MODEM command.
  2822. Reformatted the DIAL-related SHOW information accordingly.  ckuus3.c,
  2823. ckuus4.c.
  2824.  
  2825. Added SHOW DIAL command.  Added line & modem info to SHOW MODEM.
  2826. ckuusr.[ch], ckuus4.c.
  2827.  
  2828. Added support for RTS/CTS and DTR/CD flow control.  Well, sort of.  They are
  2829. now included as SET FLOW options, and show up in SHO COMM.  But they only take
  2830. effect on System V R3 and later, and then only if there is a <termiox.h>
  2831. include file that defines the appropriate symbols and structures.
  2832. Unfortunately, there is no mechanism to notify users whether their SET FLOW
  2833. commands took effect or not.  They have to be documented as "request Kermit to
  2834. ask the underlying operating system to select the specified kind of flow
  2835. control the next time you give a command that puts Kermit into packet mode,
  2836. with no guarantee that it will truly take effect."  Btw, I looked on the
  2837. RS/6000, whose AIX is supposed to be based on Sys V R3, POSIX, etc, and could
  2838. find no sign of <termiox.h>.  However, it does have a <tty.h> and an <mpqp.h>
  2839. that contain things about flow control.  I have no idea how to use them.
  2840. ckuus3.c, ckuus4.c, ckutio.c.
  2841.  
  2842. Added warning about -DNOTERMIX to all Sys V R3 or later based makefile entries.
  2843.  
  2844. SET FLOW RTS/CTS is hooked into the Telebit modem support.  If you tell Kermit
  2845. to use RTS/CTS, it'll tell the Telebit by setting its S58 register to 2.
  2846.  
  2847. Tried TAKEing MSKERMIT.INI from "Using MS-DOS Kermit", and then using
  2848. HAYES.SCR to "do dial <number>" from C-Kermit with a Hayes modem.  Very few
  2849. alterations required -- MS-DOS Kermit 3.10 and C-Kermit 5A can execute
  2850. practically identical script programs.
  2851.  
  2852. Tested WAIT xx CD on the NeXT with real modem -- works like a champ.
  2853.  
  2854. Tested sliding windows using non-speed matching modem.  When sending a file,
  2855. the Send light stays on solid.  When receiving, the Receive light stays on
  2856. solid (NeXT vs PC).
  2857.  
  2858. An early version of edit 166 was tested on NCR Tower 32/700 with "make
  2859. tower32".  Compiled fine, DIAL & CONNECT fine, transfer of short text files
  2860. OK, but problems were reported (later, when I wasn't there) transferring
  2861. binary files.
  2862.  
  2863. An early version of edit 166 was tested successfully on SCO Xenix/386 2.3.2
  2864. with Racal/Interlan TCP/IP.
  2865.  
  2866. The final version of edit 166 was tested successfully on MicroVAX-II Ultrix
  2867. 2.0, SUN-4/490 with SUNOS 4.1.1, SUN-4/280 SUNOS 4.1 (both BSD and System V R3
  2868. versions), SUN SparcStation IPC, VAX-11/750 with 4.3BSD, Encore Multimax with
  2869. UMAX 4.3, NeXTstation with NeXTstep 2.0, IBM RS/6000 with AIX 3.1, DECstation
  2870. 5800 with Ultrix 4.0, and MicroVAX-II with VMS 5.3 and C 3.0.
  2871.  
  2872. The various compile-time feature selection options were also tested at the
  2873. last minute: NOSPL, NODIAL, NOCSETS, and various combinations of these.
  2874.  
  2875. ------------------------------
  2876.  
  2877. 5A(165) Sun Jan 20 02:00:11 1991
  2878.  
  2879. VMS changes from Terry Kennedy.  His notes from CKVKER.UPD:
  2880.  
  2881. 36. Add support for SET FILE RECORD-LENGTH <n>. This applies only to received
  2882.     files (correct size is detected automatically when sending) and only for
  2883.     files of TYPE BINARY. Any recordsize may be selected; however it is wise
  2884.     to a) use one smaller than the file size, and b) one that RMS can handle
  2885.     without crashing (i.e. <= 32768, regardless of what the VMS manual says).
  2886.     (ckuus2, ckvfio, ckcdeb)
  2887.  
  2888. 37. Do lots of testing with asynchronous I/O, deferred writes, read-ahead,
  2889.     pre-allocation of the file, etc. No item or combination of items improved
  2890.     operation by more than .5%, which is in the noise anyway. One useful side
  2891.     effect: all modules except ckuusr are now compiled with optimization.
  2892.     (ckvker.com)
  2893.  
  2894. 38. Fix a problem reported by Joe Doupnik <jrd@usu.bitnet> where single-char-
  2895.     acter lines at the end of a file would cause access violations in the
  2896.     memmove() call in the zoutdump() routine. (ckvfio)
  2897.  
  2898. 39. Add more detailed debug loggin when creating an output file. The file mode
  2899.     being used (TEXT, BINARY, IMAGE or LABELED) is logged. If an unknown mode
  2900.     is presented, the mode number is logged as well. This should help locate
  2901.     future problems with unexpected file modes. (ckvfio)
  2902.  
  2903. 40. Completely replace the zstime() function. When a remote Kermit supplies a
  2904.     valid date/time in an attribute packet, the created file will have the
  2905.     specified time as the VMS file creation time. Also, SET FILE COLLISION UP-
  2906.     DATE now functions, although it is perhaps less useful on VMS, as VMS has
  2907.     file version numbers. (ckvfio)
  2908.  
  2909. 41. Add support for the zchkspa() function. Files which are too large will now
  2910.     be rejected. Lack of rejection does NOT imply a file can be received; other
  2911.     considerations such as disk quota and other users filling the disk prevent
  2912.     certainty of successful reception. (ckvfio)
  2913.  
  2914. 42. Move the debug() call in zxpand() inside the if statement to prevent access
  2915.     violations, per fdc. (ckvfio)
  2916.  
  2917. 43. Extensively re-work ckvfio internals to support DECnet access to files. The
  2918.     existing stat() and access() calls in zchki() were replaced with a single
  2919.     native RMS call, various tests (such as $idtoasc) now handle DECnet results
  2920.     from non-VMS operating systems where the feature isn't supported, an expli-
  2921.     cit SET FILE TYPE IMAGE forces opens in BIO mode rather than BRO, since a
  2922.     non-VMS DECnet implementation may not allow mode switches in mid-stream.
  2923.     Note that the filespec (all info to the right of the '::') may need to be
  2924.     quoted, since VMS RMS attempts to interpret fields which may be illegal on
  2925.     a VMS system (such as a non-octal digit in a PPN). Example:
  2926.       SPC11Z::[49,7]CKVFIO.C
  2927.     must be quoted as:
  2928.       SPC11Z::"[49,7]CKVFIO.C"
  2929.     Note: embedded spaces in filenames must be coded as \32, e.g.
  2930.       NODE"USER\32PASSWORD"::DEV:[DIR]NAME.EXT
  2931.     when talking to the C-Kermit command parser, or when sending filespecs 
  2932.     in a GET command to a C-Kermit server.
  2933.  
  2934. 44. Correct a long-standing bug with the READ command. (ckvfio) (so now the
  2935.     READ command works for VMS).
  2936.  
  2937. Fixed an error, noticed by Terry, in the description of zstime() in ckasys.doc.
  2938.  
  2939. Added new symbol DFESC = default CONNECT-mode escape character.  Initialize
  2940. escape variable to this value.  It's Ctrl-] for OS/2 and NeXT (because new
  2941. NeXT keyboards don't let you type Ctrl-\), Ctrl-\ for all others.  ckcker.h,
  2942. ckcmai.c.
  2943.  
  2944. Added SHOW ESCAPE command, and also added escape character display to
  2945. SHOW COMMUNICATIONS.  ckuusr.h, ckuus[45].c.
  2946.  
  2947. Initialized suspend variable to DFSUSP.  It's 0 for MIPS (because of reports
  2948. that job control doesn't work on MIPS machines), 1 for all other UNIX systems
  2949. (but isn't actually enabled unless SIGTSTP and SIGSTOP are also defined at
  2950. compile time), 0 for all others  When it's zero, Kermit refuses to issue the
  2951. kill(0,SIGSTOP), so the suspend never happens.  ckcmai.c.
  2952.  
  2953. Changed variables dialtimo and dialhang to dialtmo and dialhng.  dialtimo,
  2954. in particular, was indistinguishable from dialtime() by certain linkers that
  2955. had 6- or 7-character limits on identifiers.  ckcmai.c, ckuus[34].c, ckudia.c.
  2956.  
  2957. Moved COHERENT/PEEKTYPE #ifdefs around so SUNOS X25 version will compile
  2958. again (G. Mussar).  ckutio.c.
  2959.  
  2960. Corrected a typo in SUN X25 code, x2ibuf => x25ibuf (G. Mussar).  ckucon.c.
  2961.  
  2962. Added -DSVR3 to sco3r2 make entry (David MacKenzie).  makefile.
  2963.  
  2964. Changed HDBUUCP / SCO lockfile name to be right when compiling under gcc,
  2965. which does not define M_SYS5 (David MacKenzie).  ckutio.c.
  2966.  
  2967. Kermit application file correction from G. Mussar.  Don't check argv[0],
  2968. because it might or might not come with a pathname.  ckcmai.c.
  2969.  
  2970. Fixed dotake() to use its argument rather than global line[] array.  G.
  2971. Mussar.  ckuusr.c.
  2972.  
  2973. Changed gattr() to call zchkspa() (check disk space) only after it had already
  2974. read all the other attributes.  This way, zchkspa() can make its decision
  2975. differently based on whether the file is text or binary (binary requires no
  2976. expansion, text sometimes does -- e.g. in VMS, each line gets a record
  2977. descriptor).  ckcfn3.c.
  2978.  
  2979. Fixed C-Kermit to report file refusals to user's screen when in local mode,
  2980. including the reason for the refusal (size, date, etc).  ckcfn3.c, ckuusx.c,
  2981. ckcker.h.
  2982.  
  2983. Fixed formatting of command-line help message.  ckuus2.c.
  2984.  
  2985. Changed \v(platform) variable to replace all blanks by underscores so it can
  2986. be used conveniently in string comparisons, as in:
  2987.  IF EQUAL \v(platform) NeXT_Mach_1.0 set escape 29
  2988. ckuus4.c.
  2989.  
  2990. Changed \v(success) to \v(status) upon being convinced by Joe Doupnik that
  2991. this was more sensible -- and also to stay compatible with MS-DOS Kermit 3.02,
  2992. which is also getting this feature.  Also, reversed the sense of this
  2993. variable: \v(status) == 0 means success, \v(status) != 0 means failure.
  2994. Allows for different failure codes.  ckuus4.c.
  2995.  
  2996. Corrected a minor mistake in how the C-Kermit receiver reacts to the file
  2997. type given in an incoming attribute packet (I think!) in the opena() routine,
  2998. which affected VMS only.  Also made C-Kermit/VMS refuse an incoming file whose
  2999. type attribute is TEXT if the global file type is set to LABELED.  ckcfn3.c.
  3000.  
  3001. Bob Larson noticed that if C-Kermit receives bad parity (or, for that matter,
  3002. random noise) while reading packets in ttinl(), that it could core dump.  The
  3003. reason is that the failure return code from parchk() was not being handled,
  3004. and worse, the global parity variable was being set to the error code.  Fixed
  3005. in ckutio.c and ckvtio.c.
  3006.  
  3007. Jay Rouman noticed that UNIX text-mode session log was broken -- carriage
  3008. returns were appearing in it again.  Rearranged the code in ckucon.c to
  3009. prevent this, and combined some duplicated code sections for a slight size
  3010. reduction.  ckucon.c.
  3011.  
  3012. In previous edit, forgot to include part of Wm Bader's changes for supporting
  3013. Interlan TCP/IP (needs <interlan/il_types.h> rather than <sys/types.h>).
  3014. ckutio.c.
  3015.  
  3016. Changed SET BUFFERS command to not allow user to specify anything below 80.
  3017. ckuus3.c.
  3018.  
  3019. Changed server's parsing of filespecs in incoming GET commands.  A few edits
  3020. back, it became ok to give the C-Kermit server more than one filespec in a GET
  3021. command.  The tricky bit was how to separate the filespecs.  Space was being
  3022. used, but space is a legal character in VMS filenames (separating the DECnet
  3023. user id and password), not to mention Mac, OS/2, and others.  So now C-Kermit
  3024. allows backslash codes in GET command filenames.  Spaces within filenames must
  3025. be quoted like "\ ", or "\32", or "\x20", etc.  Unquoted spaces separate
  3026. filespecs.  Any other numeric backslash codes that evaluate to 8 bit values
  3027. can also be used in these names.  Done by having fnparse() call xxesc()
  3028. whenever it sees a backslash.  ckuusx.c.
  3029.  
  3030. In preparation for Telebit modem support (which Warren Tucker is working on),
  3031. added two new commands:
  3032.  
  3033.   SET DIAL KERMIT-SPOOF { OFF, ON }.  OFF by default; if ON, modem is
  3034.   instructed to turn on its "Kermit spoof" (modem executes Kermit protocol
  3035.   between itself and the computer, rather than passing Kermit packets
  3036.   transparently to the other computer), if it has one.  For now, this command
  3037.   does nothing. 
  3038.  
  3039.   SET DIAL INIT-STRING <string>.  User can define any string at all to be sent
  3040.   to initialize the modem, overriding the DIAL command's built-in
  3041.   initialization string for each modem type.  Use this to set S-registers,
  3042.   etc.  The string can be any length allowed by the command buffer (i.e.
  3043.   nearly 1000 chars), and can contain any backslash codes (like \13 for
  3044.   carriage return).
  3045.  
  3046.   SET DIAL DISPLAY { OFF, ON }.  Normally OFF.  If ON, displays dialing
  3047.   dialog on your screen.  A lot of characters seem to be missing, though.
  3048.  
  3049. SHOW COMM displays the SET DIAL settings.  ckcmai.c, ckuusr.h, ckuus[34].c,
  3050. ckudia.c.
  3051.  
  3052. Changed doexit() to have 2 arguments.  First is symbolic GOOD_EXIT or BAD_EXIT
  3053. or else user-supplied code.  Second is -1 (take first arg literally) or any
  3054. other number, which is presently ignored in VMS, and is OR'd in with the first
  3055. arg in UNIX.  When the second arg is not -1, it is supposed to be a bit mask
  3056. denoting protocol operations that failed: 2=send, 4=recv.  This may still need
  3057. some revision.  ckcmai.c, ckcpro.w, ckucon.c, ckutio.c, ckuus[r5xy].c.
  3058.  
  3059. Fixed stptrap() to restore terminal modes properly in all cases after
  3060. C-Kermit is continued/foregrounded after being suspended from command mode,
  3061. connect mode, or the local-mode file transfer display screen.  ckuusx.c.
  3062.  
  3063. Added character-set translation and SO/SI support to the TRANSMIT command.
  3064. ckuus4.c.
  3065.  
  3066. Changed UNIX zprint() to use lpr rather than lp for Tandy 6000, based on
  3067. report from Jay Rouman.  ckufio.c.
  3068.  
  3069. UNIX version still halts sometimes when transferring files overs a SET HOST
  3070. telnet connection to a VAX/VMS system with CMU TCP/IP, apparently after a
  3071. "ttinl myread failure, n = -3".  Added some more debugging statements to this
  3072. part of the code.  ckutio.c.
  3073.  
  3074. Checked modem signals on NeXT 68040 RS-423, /dev/cua (dialout) and /dev/cufa
  3075. (dialout with RTS/CTS) thru a Telebit Trailblazer.  Works perfectly both ways.
  3076. RTS/CTS is a function of the device driver, and works transparently to the
  3077. Kermit software.
  3078.  
  3079. Built on a new Sun-4/490 with SunOS 4.1.1.  No problems.
  3080.  
  3081. Tested on a Sun-4/110 workstation with Xterm.  Found that Latin-1 characters
  3082. are supported nicely.
  3083.  
  3084. Updated manual, man page, etc.
  3085.  
  3086. ------------------------------
  3087.  
  3088. 5A(164) Wed Jan  9 16:45:11 1991
  3089.  
  3090. Made sure all debug and transaction logging related code is within the
  3091. appropriate #ifdefs.  ckuus[r2345x].c.
  3092.  
  3093. Changed '=' to '==' in two important places in xxstring().  ckuus4.c.
  3094.  
  3095. Changed second tower32: entry in makefile to tower32g.
  3096.  
  3097. (above 3 changes sent in diff form via e-mail to ckermit list Dec 1, 1990.)
  3098.  
  3099. Removed extraneous "-O1" from tower32g makefile entry.
  3100.  
  3101. Changes for VMS C-Kermit from Terry Kennedy, St Peters College.
  3102. From CKVKER.UPD:
  3103.  
  3104. 34. Corrected the performance hit when an ASCII transfer into CK exceeded 32Kb.
  3105.     New ASCII zoutdump() code by Ben Cohen, <ben@spcvxa.spc.edu>.  ckvfio.c.
  3106.  
  3107. 35. Corrected the problem where 2 nulls would be inserted into received binary
  3108.     files every 32Kb when DYNAMIC is defined. The z<in | out>buffers must be
  3109.     a multiple of 512 bytes. DYNAMIC defined them as 32766, the fix changes
  3110.     them to 32768.  ckcker.h.
  3111.  
  3112. Changed declaration of time() function in ckutio.c to use time_t rather than
  3113. long because of conflict with sys/time.h in Ultrix 4.1.  Since time_t is used
  3114. unconditionally elsewhere in the same module, this should cause no problems.
  3115. ckutio.c.
  3116.  
  3117. Changed "make du4" for Ultrix to include -Olimit 1619 to suppress complaints
  3118. and enable optimization of ckuusr.c, in which the docmd() function has a very
  3119. long switch() statement.  Jack Bryans.
  3120.  
  3121. Added a line for IBM RT PC with ACIS 4.3 to makefile, after successful testing
  3122. using "make bsd" was reported by David MacKenzie.
  3123.  
  3124. Removed a spurious "extern char cmdstr[];" from ckuusx.c.
  3125.  
  3126. Changed screen() function not to output anything if Kermit is in server
  3127. mode, because screen() is called from errpkt().  Noticed by Joe Doupnik in
  3128. his packet logs.  ckuusx.c.
  3129.  
  3130. Changed all occurrences of maxsize in getpkt() to bufmax, and removed the
  3131. declaration of maxsize.  Not needed, was never defined, and it's a miracle
  3132. this code worked at all!  Also, increased the size of the leftover buffer in
  3133. the same function from 6 to 7 bytes, to allow for a run of 8-bit-quoted
  3134. control characters that turned out to be only two and was therefore deposited
  3135. as two 3-byte prefixed sequences.  This was an obscure boundary condition that
  3136. has been in the code forever, and could have been tickled any time 8-bit data
  3137. was being sent using 8th-bit prefixing.  The result was that the terminating
  3138. null of the 6-byte leftover sequence would overwrite some other variable, with
  3139. unpredictable symptoms.  Thanks to Steve Walton for spotting both of these.
  3140. ckcfns.c.
  3141.  
  3142. Changed dopar() to put entire argument of (CHAR) cast in parens.  Thanks to
  3143. Larry Rosenman.  ckcfn2.c.
  3144.  
  3145. Made a safe copy of the command file name in case XXTAK in docmd(), so the
  3146. call the cmcfm() could not destroy it.  Thanks to Mike Hickey.  ckuusr.c.
  3147.  
  3148. Fixed a bug in the completion of filenames beginning with tilde when user
  3149. types ESC or TAB, reported by many.  Thanks to Mike Hickey for the fix to
  3150. cmifi(), case 2 (just uncomment the call to tilde_expand()...  The filename
  3151. was being found correctly, but the echoing was wrong.)  ckucmd.c.
  3152.  
  3153. Added a makefile entry for the Tektronix 4336 with the Utek OS, from Tom Kloos
  3154. at Sequent Computer Systems, plus special Utek support within #ifdef UTEK
  3155. conditionals, most of it for a wierd kind of hardware flow control -- DTR/CTS.
  3156. ckutio.c, ckufio.c, ckuus2.c, ckuus3.c, ckuus4.c, ckuver.h.
  3157.  
  3158. Added symbols for flow control to ckcdeb.h and replaced numeric values in
  3159. various modules with symbolic references.  In preparation for adding more
  3160. widespread support for hardware flow control, e.g. with high-speed modems.
  3161.  
  3162. Made a change to the CONNECT code to put console back in binary mode after
  3163. returning from suspend (^\Z).  Thanks to Tom Kloos.  ckucon.c.
  3164.  
  3165. Added a second make entry for Apple Macintosh A/UX, "make auxufs", which is
  3166. just like "make aux" except it uses <dirent.h>, which is apparently required
  3167. on ufs file systems (reported by Jon Hamilton at Iowa State U).  It is not
  3168. known whether this same entry works with svfs systems, or if the "make aux"
  3169. version should be used.  If you're using A/UX and you can't "send *" (i.e.
  3170. wildcards are not expanded correctly), use the new make.  Maybe "make auxufs"
  3171. applies to all?  makefile.
  3172.  
  3173. Added support for Racal Interlan TCP/IP for SCO Xenix 2.3.x, from William
  3174. Bader.  makefile, ckcmai.c, ckucon.c, ckutio.c.
  3175.  
  3176. Added support for Interactive 386/ix 2.x both with and without TCP/IP,
  3177. from Mike Hickey <mike@iti.com>.  makefile, ckucon.c.
  3178.  
  3179. Added improved support for Ventel modem dialing from Tony Querubin at the U of
  3180. Hawaii.  ckudia.c.
  3181.  
  3182. Changed declaration of sstate in ckcmai.c to be CHAR rather than char to agree
  3183. with declarations in other modules (William Bader).
  3184.  
  3185. Fixed dialing code for Microcom modem not to confuse NO CONNECT and CONNECT
  3186. (William Bader).  ckudia.c.
  3187.  
  3188. Changed all calls to ttclos() to include an argument: ttclos(0).  The argument
  3189. is required because ttclos() is sometimes used as a signal handler, and signal
  3190. handlers must have an argument.  ckudia.c, ckucon.c, ckutio.c, ckuusx.c,
  3191. ckuusy.c.
  3192.  
  3193. Sergey V. Kartashoff of the Institute of Precise Mechanics and Computer
  3194. Equipment in Moscow reported that if you put "set line /dev/tty" in your
  3195. .kermrc file, then after executing a "set line" command for any other device,
  3196. the command parser loses CBREAK mode.  The problem was that ttclos() was
  3197. calling ttres() even when the device was the controlling tty.  Moved the calls
  3198. to ttres() and tthang() to within "if (xlocal) { ... }" section.  ckutio.c.
  3199.  
  3200. Mike Hickey reported that tthang() could fail if the communication line was
  3201. Xoff'd.  Two ioctl's added to tthang() to unblock a blocked port - TCXONC
  3202. and TIOCSTART - whose execution is #ifdef'd on the existence of those
  3203. symbols.  ckutio.c.
  3204.  
  3205. Added some dialing code to catch DF100-specific modem single-letter responses,
  3206. from Tony Querubin, U of Hawaii.  ckudia.c.
  3207.  
  3208. Gary Bilkus suggested that Kermit make the tty file descriptor available to
  3209. other programs as an environment variable to allow other Unix communication
  3210. programs to take advantage of Kermit's script and login facilities in a
  3211. painless way.  This would have required system-dependent code for setting and
  3212. exporting environment variables on different systems with different shells,
  3213. and doing it in many places -- a can o' worms.  Instead, I added a new
  3214. variable \v(ttyfd) which, for UNIX only, contains the current tty file
  3215. descriptor.  So now, with only moderate pain, you can do things like:
  3216.  
  3217.   take <login-script-file>
  3218.   ! KERMIT_FD=\v(ttyfd)
  3219.   run <program-name> <args>
  3220.  
  3221. or whatever syntax your system, shell, and communication program might use.
  3222.  
  3223. Added new built-in variable, \v(program) ("C-Kermit"), for portability (MS-DOS
  3224. Kermit 3.02 will have this too, but its value there will be "MS-DOS_Kermit").
  3225. ckuus4.c, etc.
  3226.  
  3227. Cleaned up a few help messages in ckuus2.c, and made them all static -- a
  3228. small load off the linker's mind.
  3229.  
  3230. Discovered that the NeXT workstation has a bizarre character set -- not ISO,
  3231. not Apple, not IBM, not DEC...  Looked it up in their manuals (not just the
  3232. user manuals, but also the Mach 1.0 technical manuals), but they don't list,
  3233. describe, or even name it anywhere.  Figured it out from dumping all 8-bit
  3234. characters to the screen and added a new file character set to C-Kermit for
  3235. it:
  3236.  
  3237.  . Added definition for FC_NEXT and increased MAXFCSETS to 16 (19). ckuxla.h.
  3238.  . Added NeXT into the fcsinfo array.  ckuxla.c.
  3239.  . Added "next" entry to file character set table, fcstab.  ckuxla.c.
  3240.  . Added a translation table from Latin-1 to NeXT: yl1ne[].  ckuxla.c.
  3241.  . Added a translation table from NeXT to Latin-1: ynel1[].  ckuxla.c.
  3242.  . Added translation functions xneas(), xnel1(), and xl1ne().  ckuxla.c.
  3243.  . Added xlation function pointers to xls and xlr tables.  ckuxla.c.
  3244.  
  3245. After some trouble in which it seemed these changes didn't work, noticed that
  3246. the makefile didn't have enough dependencies on the translation header files;
  3247. added those that were needed.
  3248.  
  3249. To use it, SET FILE CHARACTER-SET NEXT in combination with your favorite
  3250. TRANSFER CHARACTER-SET.  But you'll only be able to see the results on the
  3251. NeXT console.  Tested with the entire Latin-1 alphabet in both directions --
  3252. works fine.  Imported the result into WriteNow and looked at it in Courier,
  3253. Helvetica, Ohlfs, and Times fonts, and all characters were correct in each
  3254. font.  Obviously this won't work for Symbol.
  3255.  
  3256. All this makes me wonder about Xenix -- will we have to add IBM code pages
  3257. to our list of file character sets???
  3258.  
  3259. Tested Cyrillic translations (all three) against MS-DOS Kermit 3.02 of 5 Jan
  3260. 91.  The translation mechanisms themselves (sending in both directions,
  3261. automatic switching based on attribute character set announcer, etc) seem to
  3262. work just fine.  A few small character translation problems, but I can't tell
  3263. easily whether they are in C-Kermit, MS-DOS Kermit, or Dimitri's "CP866"
  3264. Cyrillic PC code page.
  3265.  
  3266. Improved the TRANSLATE command.  Formerly it was "TRANSLATE <file1> <file2>"
  3267. and it always translated from the current transfer character set to the
  3268. current file character set, which was unreasonably limiting.  Now it's:
  3269.  
  3270.   TRANSLATE <file1> <charset1> <charset2> [ <file2> ]
  3271.  
  3272. which you can read as "translate file-1 from character-set-1 into
  3273. character-set 2 and put the results in file-2".  The two character sets are
  3274. C-Kermit file character sets.  It works by translating file1's charset1 into
  3275. Latin-1 (or, if "set language russian", into Latin-Cyrillic) and then the
  3276. Latin-1 or -Cyrillic into charset2, putting the result in file2.  If file2 was
  3277. not specified, the result is shown on the screen.  Thus TRANSLATE now
  3278. simulates a file transfer between two C-Kermits.  Any pair of character sets
  3279. can be specified.  ckuusr.c, ckuus2.c, ckuus4.c.
  3280.  
  3281. Made XLATE an invisible command synonym for TRANSLATE, and XMIT for TRANSMIT,
  3282. to allow for shorter abbreviations (XL and XM rather than TRANSL and TRANSM)
  3283. when typing commands.  Similarly, you can now use SET XFER CHARACTER-SET (SET
  3284. XF C) as a synonym for SET TRANSFER CHARACTER-SET and SET XMIT (SET XM) for
  3285. SET TRANSMIT.
  3286.  
  3287. Having a NeXT on one's desk makes one realize the need to be able to translate
  3288. character sets during terminal emulation too.  Hence another new command:
  3289.  
  3290.   SET TERMINAL CHARACTER-SET <remote-set> [ <local-set> ]
  3291.  
  3292. This tells C-Kermit's CONNECT command to translate the characters you type
  3293. from the local-set to the remote-set before transmitting them to the remote
  3294. host, and to translate characters that arrive from the host from the
  3295. remote-set to the local-set.  The local-set and remote-set can both be any of
  3296. C-Kermit's file character sets.  The local-set defaults to the current file
  3297. character-set.  Translation takes place via the Latin-1 intermediary except
  3298. when LANGUAGE is set to RUSSIAN, in which case Latin-Cyrillic is used in the
  3299. intermediate step.  (Works just like the TRANSLATE command.)  If remote-set is
  3300. the same as local-set, no translation occurs, which is the default.  This
  3301. command has no effect on VMS -- support for it must be added to CKVCON.C (it's
  3302. simple, just copy from ckucon.c).
  3303.  
  3304. The new command and supporting CONNECT code work fine, but explaining how to
  3305. use them is another matter.  Terminal emulation works when C-Kermit is in
  3306. local mode: there is one connection from local C-Kermit to the remote host
  3307. (thru the communication port or network) and another from the local C-Kermit
  3308. to the user's keyboard and screen.  These connections are independent of each
  3309. other, and either one can be either 7 bits or 8 bits wide.  C-Kermit assumes
  3310. both are 7 bits.  If you are using an 8-bit character set between C-Kermit and
  3311. your keyboard and screen, you have to SET COMMAND BYTESIZE 8.  If you are
  3312. using an 8-bit character set between your communication port and the remote
  3313. host, you must SET TERMINAL BYTESIZE 8.  (These command names may be a little
  3314. misleading.)
  3315.  
  3316. Another word of caution: if you tell C-Kermit that your remote character set
  3317. is a 7-bit national replacement character-set (NRC), this will cause
  3318. characters such as brackets to be translated into accented characters, which
  3319. in turn will prevent VT100 escape sequences from working.  For example, if you:
  3320.  
  3321.   SET TERMINAL CHARACTER-SET GERMAN NEXT
  3322.  
  3323. then the VT-100 control sequence introducer ESC [ is translated to ESC
  3324. A-umlaut, and the NeXT's VT-100 emulator simply prints the remaining
  3325. characters of the escape sequence.
  3326.  
  3327. And one more caveat: The special accented-character-to-digraph translations
  3328. (such as German umlaut-u translated to ue) that are enabled during file
  3329. transfer by the SET LANGUAGE command do not occur during terminal emulation.
  3330. Only one-to-one translations are done.  This is (a) to prevent terminal screen
  3331. displays from becoming misaligned and (b) because the character-stuffing
  3332. tricks used in the translation functions are set up to work with disk i/o
  3333. buffers, not the communications device or the keyboard.
  3334.  
  3335. Added a SHOW TERMINAL command to show all the current terminal settings, plus
  3336. the command bytesize.
  3337.  
  3338. The undocumented (and invisible) command SHOW KEY lets you see what code
  3339. C-Kermit gets when you press a key.  The result depends on the COMMAND
  3340. BYTESIZE setting.  There is, as yet, no SET KEY command.
  3341.  
  3342. Added the SET TERMINAL SHIFT-IN/OUT { ON, OFF }.  OFF is the default, meaning
  3343. everything continues to work as before.  ON means that if you type an 8-bit
  3344. character during terminal emulation (which is only possible if you have SET
  3345. COMMAND BYTESIZE 8), it will be surrounded by Shift-In and Shift-Out
  3346. characters (Ctrl-N and Ctrl-O) and reduced to 7 bits before transmission.  The
  3347. shift state is remembered, so a run of 8-bit characters is included within a
  3348. single shift-out/shift-in sequence.  For received characters, C-Kermit sets
  3349. the 8th bit of received characters based on the current incoming Shift Out/In
  3350. state, which is maintained separately.  For now, Shift-In/Shift-Out is done
  3351. only on the Kermit-to-Remote part of the connection, not on the
  3352. Kermit-to-terminal part.  ckucon.c, ckuusr.h, ckuus3.c, ckuus5.c.
  3353.  
  3354. Added SET DIAL TIMEOUT <secs> command.  It seems that new fancy modems can
  3355. take a very long time to negotiate a common protocol -- MNP level,
  3356. compression, V.{32,42}[bis], PEP, etc etc, sometimes longer than the timeout
  3357. calculated automatically by the dial code.  Also, the dial code doesn't allow
  3358. for the extra time it may take to complete an international call.  The new
  3359. command lets the user override the built-in calculation.  NOTE: it only
  3360. applies to the interval that begins when the dial-string is sent to the modem.
  3361. There are also several other fixed timeouts of about 10 seconds each in which
  3362. the code waits for a response to its wakeup signal to the modem, etc.  So the
  3363. total timeout is usually 10 seconds plus the SET DIAL TIMEOUT value.  Added
  3364. dial hangup and timeout settings to SHOW COMM display.  ckuus2.c, ckuus3.c,
  3365. ckuus4.c, ckcmai.c, ckudia.c.
  3366.  
  3367. Robert Weiner noticed that remote-mode C-Kermit packets were Xoff-able, even
  3368. after SET FLOW NONE.  ttpkt() did not bother to put the tty in raw mode in
  3369. this case (after the addition of the new LPASS8 code in edit 155).  This is
  3370. fixed.  But now it seems that after giving the SET FLOW NONE command (which
  3371. works), subsequent SET FLOW XON/XOFF commands do not work -- the right code is
  3372. executed, but flow control remains nonfunctional.  However, if you "set line"
  3373. (which closes and reopens the tty), you can SET FLOW control back to XON/XOFF.
  3374. So (gag!) I put code into ttpkt to do just that, but only in this particular
  3375. case (BSD with LPASS8 defined, setting flow to Xon/Xoff on controlling
  3376. terminal after it had been set to none).  Works ok.  ckutio.c.
  3377.  
  3378. Added new command SET SUSPEND { OFF, ON }.  On some Unix systems, most notably
  3379. the MIPS, suspending Kermit causes it (and the terminal it was running on) to
  3380. hang forever for unknown reasons.  This, at least, can prevent that from
  3381. happening.  A better solution, of course, would be to find out why Kermit
  3382. can't be suspended on the MIPS.  A MIPS wizard is required.  The default is ON
  3383. for all UNIX systems except MIPS, and OFF for everything else (MIPS, VMS,
  3384. etc).  ckcmai.c, ckuusr.h, ckuusr.c, ckuus3.c, ckuus5.c, ckutio.c.
  3385.  
  3386. Rec'd new Mac Kermit ckm*.* source files from Paul Placeway.  He has done a
  3387. lot of work on them, but they don't quite result in a working program yet.
  3388. They are designed to be built with MPW C 3.0.  No changes to the C-Kermit
  3389. 5A(163) ckc*.[ch] modules were required to get the ckm* files to link with
  3390. them successfully.
  3391.  
  3392. Updated copyright notices to 1991.  Another year, sigh...  All modules.
  3393.  
  3394. Updated documentation to mention new features (and the new year).
  3395.  
  3396. ------------------------------
  3397.  
  3398. 5A(163) Fri Nov 30 16:52:56 1990
  3399.  
  3400. NEW FEATURES
  3401.  
  3402. Added \v(host) variable for UNIX and VMS.  For AT&T UNIX it calls uname().  I
  3403. sincerely hope this exists for pre-SVR2 implementations, since it is selected
  3404. by #ifdef UXIII.  For 4.2 BSD and later it uses gethostname().  For VAX/VMS,
  3405. it uses getenv("SYS$NODE"), with the double colon (if any) stripped from the
  3406. end.  For all others, and if any of these fail, it uses getenv("HOST").
  3407. ckuus4.c.
  3408.  
  3409. If dialing is interrupted by Ctrl-C and the modem type is Hayes, send CR to
  3410. modem to interrupt dialing.  ckudia.c.
  3411.  
  3412. Changed Hayes support in ckudia.c to recognize CONNECT followed by no number
  3413. to mean 300 bps, and to change speed to 300 if MATCHES-SPEED not set.  Also
  3414. fixed a bug in which string comparison for CONNECT could possibly start at the
  3415. wrong place.  John Dunlap.
  3416.  
  3417. NEW SYSTEMS AND OTHER MAKEFILE CHANGES
  3418.  
  3419. Added support for four NCR Tower 32 operating systems, from Robert Andersson,
  3420. ra@intsys.no (International Systems A/S, PO Boks 3356, 0405 Oslo 4, Norway).
  3421.  
  3422. Added new makefile entries for Minix: "make minixnew" (uses new beta-test C
  3423. compiler and linker, based on info from Nate Williams,
  3424. osynw@umbriel.oscs.montana.edu), and "make minix386" (for Minix/386 only,
  3425. based on info from John Nall, nall@sun8.scri.fsu.edu).
  3426.  
  3427. Added new makefile entry for PFU Compact A Series UNIX System V R3, SX/A TISP
  3428. V10/L50, from S. Dezawa (kddlab!oda.fujifilm.co.jp!dezawa@uunet.uu.net),
  3429. including some minor changes to ckutio.c and ckucon.c within #ifdef sxaE50.
  3430.  
  3431. Made first attempt at correcting Coherent makefile entry (now uses V7 as basis
  3432. rather than BSD4), based on tests by Manfred Prange (fred@cetus.mi.org).
  3433.  
  3434. Added -DDYNAMIC to various DIAB and HP makefile entries after users reported
  3435. successful testing.  makefile.
  3436.  
  3437. Added suggestions about using "makeL" to SCO Xenix/286 makefile entry (sco286)
  3438. and fix sco286hdb entry to agree with it.  makefile.
  3439.  
  3440. COMMAND PARSER BUG FIXES
  3441.  
  3442. Fixed bug in which a leading tab in a command file would prevent the command
  3443. from being recognized (first character was being skipped in untab() function).
  3444. Reported by S. Dezawa.  ckucmd.c.
  3445.  
  3446. Fixed bug in which cbreak mode (and therefore ?, ESC, etc) stopped working
  3447. after executing a '!', RUN, or PUSH command.  Case XXSHE, ckuusr.c.
  3448.  
  3449. Fixed a parsing bug that had been there forever.  Any number of words could be
  3450. typed after the last word of a command and the parser would not complain until
  3451. the command was finally entered.  Now it complains as soon as the first wakeup
  3452. character (space, question mark, ESC or TAB) appears after extraneous
  3453. characters were typed.  cmcfm() in ckucmd.c.
  3454.  
  3455. Added new flag to command parser keyword tables: CM_ABR.  If set in a
  3456. keyword's flag field, it means that the keyword is an abbreviation for another
  3457. keyword.  This allows the full keyword list to be listed when the user types ?
  3458. for a menu.  Before this change, for example, there was no way to find out
  3459. what commands started with C because C was an invisible abbreviation for
  3460. CONNECT; C? would just list C.  With this change, cmkey() will no longer
  3461. consider a match on an abbreviation to be an exact match if the user types ?,
  3462. but instead will list all keywords that start with the abbreviation.
  3463. ckucmd.c, ckucmd.h, ckuusr.c.
  3464.  
  3465. Strengthened xxstring() (variable and function expander) against pathological
  3466. cases, as where very long invalid builtin function or variable names are
  3467. entered, or when a trailing parenthesis omitted from a variable or function
  3468. reference.  This fixes the bug that Peter Mauzey reported in which "send
  3469. xxx.*" followed by "delete \v(fi" would fail to work.  ckuus4.c.
  3470.  
  3471. Fixed the bug that Terry Kennedy has been reporting for months, which occurs
  3472. only in the VMS version: "send ckv?c?" should give a list of all the ckv files
  3473. when the first question mark is typed, and then all the ckvc files at the
  3474. second one, but instead the second question mark resulted only in "No files
  3475. match".  I can't explain why this was happening (because it never happened in
  3476. UNIX, which uses exactly the same code), but I fixed it by reinitializing a
  3477. pointer.  ckucmd.c.
  3478.  
  3479. MISCELLANEOUS BUG FIXES
  3480.  
  3481. Changed Ventel modem dialing string from "<K%s\r>" to "<K\r%s\r>", based on
  3482. a report from Tony Querubin at the University of Hawaii.  ckudia.c.
  3483.  
  3484. Fixed doexit() to return right type of exit code -- had #ifndef VMS instead of
  3485. #ifdef VMS.  ckuusx.c.
  3486.  
  3487. Fixed lockfile in IBM RC PC AIX 2.2.1 implementation (again).  Piet Plomp.
  3488.  
  3489. Reportedly, during local-mode file transfer with the local C-Kermit running
  3490. on certain System-V based UNIX systems, typing ^\A to get a status report
  3491. would badly confuse the protocol, resulting in a series of timeouts and
  3492. retransmissions, and sometimes total failure.  This does not happen on BSD
  3493. based UNIX systems.  The difference is that System V (at least up thru R3)
  3494. cannot inspect the terminal input buffer without actually reading it, so
  3495. System V users must type the quit character (normally ^\) first, causing an
  3496. interrupt handler to be invoked.  This code hasn't changed in a long time, but
  3497. I tried to tighten it up a little -- now it only handles one request at a
  3498. time (i.e. per packet), instead of looking for a bunch of them queued up.
  3499. chkint() in ckuusx.c.
  3500.  
  3501. Changed (Ctrl-)A status display to correctly report the number of window
  3502. slots.  ckuusx.c.
  3503.  
  3504. Added missing SunLink X25 definitions to ckcnet.h, and changed SHOW PAD
  3505. parameter loop limit to correct value.  Marcello Frutig, Catholic University,
  3506. Sao Paulo, Brazil.
  3507.  
  3508. COMPILER ADJUSTMENTS
  3509.  
  3510. Fixed declaration of (*sx)() to be extern in ckuus4.c, to prevent multiple
  3511. definition error at link time (only seems to have been a problem on the Amiga).
  3512.  
  3513. Removed multiple definitions of debfil[], pktfil[], and sesfil[] from ckuusx.c.
  3514.  
  3515. Fixed dozens of function returns to cast their arguments to the type of the
  3516. function, thanks to Amiga C (Aztec and/or SAS) compiler complaints reported by
  3517. Larry Rosenman.  ckuus3.c, ckuus5.c, ckcfn2.c.
  3518.  
  3519. Changed declarations of signal handlers to include a dummy argument, in an
  3520. attempt to satisfy the ANSI C prototype for signal() (e.g. in System V Release
  3521. 4).  The tradeoff will be lots of new lint complaints ("argument not used").
  3522. ckuus4.c, ckucon.c, ckutio.c, ckudia.c, ckuscr.c.
  3523.  
  3524. Changed partab[] (parity table) to cast each and every initializer (256 of
  3525. them) to CHAR (= unsigned char) because ANSI C complains that "initializer
  3526. does not fit" in cases like "unsigned char foo = '\222'" -- ANSI C casts the
  3527. constant to (yes) signed char.  Also added L's after all the constants in the
  3528. CRC generation tables.  ckcfn2.c.
  3529.  
  3530. There is a similar problem (-1's initializing a unsigned character array) in
  3531. ckcpro.c, generated by wart from ckcpro.w.  Attempted to fix this by defining
  3532. the table type to be (signed) char rather than (unsigned) CHAR.  ckwart.c.
  3533.  
  3534. Removed unintentional trigraphs ("???") from comments in ckuus5.c, ckcfn2.c.
  3535.  
  3536. PROTOCOL CHANGES AND FIXES
  3537.  
  3538. (Physical layer) - If the attempt to read a packet results in a timeout,
  3539. and if Xon/Xoff flow control is selected, send an XON character in case the
  3540. other Kermit was blocked by a spurious XOFF.  rpack() in ckcfn2.c.
  3541.  
  3542. In response to several reports of "NAK out of window" errors, changed the
  3543. input() code to be more tolerant of NAKs that are received for packets that
  3544. haven't been sent yet, but still treat a NAK for a packet from the previous
  3545. window as a fatal error, because there's no way to resend it.  ckcfn2.c.
  3546.  
  3547. Added a new state to the protocol interpreter, or rather, separated two old
  3548. states: <rdata,rattr>Z.  Having these two states combined prevented a
  3549. zero-length file from being created by C-Kermit if an Attributes packet came
  3550. with it.  Suggested by Alan Grieg at Dundee Tech in Scotland.
  3551.  
  3552. Somehow some code disappeared from C-Kermit's transport layer, the input()
  3553. function, namely that after getting a NAK for a packet that is in its window,
  3554. and retransmitting the packet, it should go back and wait for another packet
  3555. to arrive, rather than returning to the protocol state machine.  This was
  3556. causing all sorts of failures of the "Unexpected packet type" type.  Added a
  3557. "continue" statement at the right place.  ckcfn2.c.
  3558.  
  3559. The sdata() function would always attempt to send a windowful of new packets
  3560. in the absence of any arriving packets.  Obviously wrong -- the maximum number
  3561. of new packets it should send at once is equal to the number of free
  3562. send-packet buffers.  I'm not sure what the symptom of this overzealousness
  3563. was other than messages about "can't allocate send buffer" in the debug log.
  3564.  
  3565. Inspection of a long debugging log of a windowed transfer showed the number of
  3566. send buffers to decrease each time there was an error causing packets to be
  3567. received out of order, and never increase again until a new file was begun.
  3568. For example, when transferring a long file with 12 window slots, the number of
  3569. effective window slots would gradually work its way down to one and stay
  3570. there.  Diagnosis: The transport layer returns an ACK to the application only
  3571. when it is the ACK for the packet at window-low, and only frees the send
  3572. buffer at this time.  As soon as the application gets this ACK it sends
  3573. another packet, thus immediately reusing the send-buffer that was just freed.
  3574. Theoretically, a send-buffer could be freed any time an ACK arrives for it,
  3575. because it will never have to be retransmitted.  But the ACK'd status is kept
  3576. in the packet structure, and if the packet is freed before it reaches
  3577. window-low, this information is lost.  Cure: Keep a separate structure (an
  3578. array indexed by packet number 0-63), to show whether each packet has been
  3579. ack'd.  Tried this: created an array sacktbl[] to hold the ACK'd flag for each
  3580. active packet.  This seems to work -- after a lost ACK is received, the number
  3581. of free send-buffers grows back to a higher number.  Needs a lot of testing!
  3582. (left old code in place to revert easily, look for all occurrences of
  3583. sacktbl[].)  ckcfn2.c, ckcfn3.c.
  3584.  
  3585. VMS CHANGES
  3586.  
  3587. Made wildcard expander return 0 (meaning no files match) rather than -1
  3588. (meaning too many files matched) if there is an unexpected RMS return code.
  3589. Alan Grieg.  ckvfio.c.
  3590.  
  3591. Made wildcard expander return -1 if too many files match.  ckvfio.c.
  3592.  
  3593. Added a bandaid for the Ctrl-C during DIRECTORY command problem.  Doesn't
  3594. really fix it, but alleviates it somewhat.  William Bader.  ckuusx.c.
  3595.  
  3596. Added "ckermit_init" to the list of logical names.  This one, unlike
  3597. "ckermit_ini:", can stand for the entire filename, rather than just the
  3598. device:[directory].  Jim Barbour.  ckvfio.c.
  3599.  
  3600. New C-Kermit/VMS help file.  Jim Barbour.  ckvker.hlp.
  3601.  
  3602. Yet another DCL command procedure for building C-Kermit/VMS.  Jim Barbour.
  3603. ckvbld.com.
  3604.  
  3605. Nothing done for CKVTIO.C -- BYTLIM quota exceedings and data overruns will
  3606. still be a problem until someone who knows more about VMS than I do can
  3607. overcome these problems.  Added a few comments to highlight known problem
  3608. areas.
  3609.  
  3610. ------------------------------
  3611.  
  3612. 5A(162) Sat Nov  3 13:54:22 1990
  3613.  
  3614. Quick fixups:
  3615.  
  3616. The change to parchk() in edit 161 was (a) a bad idea, and (b) done wrong.
  3617. This prevented C-Kermit from receiving 8-bit data files when packets were
  3618. longer than 256.  I declared an index variable to be a CHAR rather than an
  3619. int, oops.  But then I realized that including the block check in the parity
  3620. checking scheme was (a) risky and (b) overkill, so I removed all of that code.
  3621. Works fine now.  Thanks to quick reports from Robert Weiner, Bo Kullmar, and
  3622. Jay Rouman.
  3623.  
  3624. Robert Weiner also noticed that Berkeley-based versions had become suspendable
  3625. by keyboard interrupt during file transfer.  The problem was in the new
  3626. ttpkt() code that uses LPASS8 mode when available (the benefit of which is to
  3627. allow both 8-bit data and Xon/Xoff flow control during packet operations).  An
  3628. explicit system call must be made to disable the suspend character.  This was
  3629. added.
  3630.  
  3631. ------------------------------
  3632.  
  3633. 5A(161) Fri Nov  2 21:32:21 1990
  3634.  
  3635. PROTOCOL FIXES
  3636.  
  3637. Charles Lasner found that the edit 160 C-Kermit server went into text mode
  3638. after responding to any REMOTE commands, even if its global mode was binary.
  3639. Found the statements that saved and set the file mode in syscmd() were
  3640. transposed.  They have been this way at least since version 4E, but some
  3641. recent change seems to have exposed this problem.  Put the offending
  3642. statements in the right order.  Later, Terry Kennedy found another place
  3643. where this happened (REMOTE HELP).  ckcfns.c.
  3644.  
  3645. Terry Kennedy found that the file control block (fcb) was being filled in
  3646. before the attribute packet was interpreted, which prevented zopeno()
  3647. from ever opening a file in binary mode.  This affected only VMS, because
  3648. UNIX, Mac, Amiga, etc, have only one way of reading data from a file.  Moved
  3649. the attribute interpreting-code to above where the fcb was filled in and
  3650. binary/text mode determined.  ckcfn3.c.
  3651.  
  3652. Terry Kennedy found a problem introduced by the parity-sensing code. The
  3653. parchk() routine was examining the next-to-last byte of the packet [n-2]
  3654. rather than the last byte of the packet [n-1], which worked for UNIX, but not
  3655. for VMS.  The length returned by UNIX ttinl() included the packet terminator,
  3656. but the VMS version did not.  Changed parchk() to not depend on whether the
  3657. terminator was included, but to search for the rightmost printable character.
  3658. ckcfn2.c.
  3659.  
  3660. Patrick Wolfe of Kuck & Assocs sent in a packet log that showed yet another
  3661. foulup that can occur in the packet-zero-recycling area.  Server receives GET
  3662. command (R packet), replies with S packet, but client does not get the S
  3663. packet, so retransmits the R packet.  There is no state in the protocol
  3664. machine to handle this, and it's not handled at the transport layer either
  3665. because packet number zero is being reused.  The server failed to allocate a
  3666. receive buffer for the next packet and gave up with "Internal error 18".
  3667. Fixed by (a) adding a new state, "<ssinit>R", to the protocol state machine,
  3668. that resends the S packet and frees a receive buffer, and (b) changing input()
  3669. to return rather than reading another packet if it got an unknown packet type
  3670. when expecting an ACK or a NAK.  ckcpro.w, ckcfn2.c.
  3671.  
  3672. Similar fix for when REMOTE HOST (C) or REMOTE <other> (G) packet arrives
  3673. again.  ckcpro.w.
  3674.  
  3675. Changed file input and output buffers to be allocated dynamically if
  3676. DYNAMIC is defined.  ckcker.h, ckcmai.c, ckcfns.c, ck?fio.c.
  3677.  
  3678. VMS-SPECIFIC CHANGES
  3679.  
  3680. Changed VMS C-Kermit to use file i/o buffers of size 32766 (the maximum RMS
  3681. record size) rather than 4096 if built with DYNAMIC defined, in which case the
  3682. big buffers are allocated dynamically with malloc().  This allows for transfer
  3683. of files that have very long lines, such as IGES CAD interchange files, etc.
  3684. No more "line too long for internal buffer" (as in Kermit-32) except when a
  3685. line is also too long for VMS itself.  (By the way, this still doesn't fix
  3686. the problem with the interrupted DIRECTORY command.)  ckcker.h, ckvfio.c.
  3687.  
  3688. Fixed zsyscmd() to close the inferior process when done.  Previously, any
  3689. RUN-like command would prevent subsequent SEND commands from working.
  3690. ckvfio.c.
  3691.  
  3692. Changes from Terry Kennedy at St Peters College:
  3693.  
  3694. 29. Correct the behavior of zopeno() so that a superseded file will work
  3695.     correctly (for example, when a version limit is set). ckvfio.c
  3696.  
  3697. 30. Make a local copy of the binary flag when the output file is opened.
  3698.     The binary flag tends to change state before we are done needing it.
  3699.     ckvfio.c.
  3700.  
  3701. 31. Make IMAGE mode work. This is the continuation of item 24, in ckvker.upd.
  3702.     Note that image mode is only useful in very unusual circumstances --
  3703.     normally it will give you an unusable file.  This mode works by sending
  3704.     you all of the bytes in the file verbatim, including ones normally used by
  3705.     VMS for record attributes and delimiters. Also, note that this mode only
  3706.     applies to files sent from VMS C-Kermit and is ignored when files are
  3707.     received by C-Kermit.  ckvfio.c.
  3708.  
  3709. 32. Remove a spurious return from the zsoutl() routine. This was generating
  3710.     spurious <CR>'s when log files were viewed using an editor.  ckvfio.c.
  3711.  
  3712. UNIX-SPECIFIC CHANGES
  3713.  
  3714. Added CONNECT-mode escape to suspend Kermit: <escape-char>Z or <escape-char>^Z.
  3715. UNIX only.  ckucon.c.
  3716.  
  3717. Turns out that LPASS8 and Annex terminal servers just don't mix.  Since Encore
  3718. computers use Annexes, I changed the makefile entry for Encore to include
  3719. -DENCORE, changed ckuver.h to include a special banner for Encores, and
  3720. changed ckutio.c to #undef LPASS8 if ENCORE is defined.  Tested, works ok.
  3721. Probably need a more general mechanism to let "pass8" mode be selected by the
  3722. user at runtime, since one machine might have different terminal servers,
  3723. different ports on the same terminal server can be configured differently, etc
  3724. etc etc.
  3725.  
  3726. Added code to znewn() to prevent optimizing compilers from warning about
  3727. "Element buf[-2] outside array bounds" (which would never really happen).
  3728. ckufio.c.
  3729.  
  3730. Added support for the Mark Williams Company Coherent OS, from ancient code
  3731. based on UNIX Kermit 1.0, circa 1983, Coherent-specific modifications added by
  3732. Lauren Weinstein, source sent in by Bo Kullmar in Sweden.  This old version
  3733. (the one with the tar-like user interface) is still being distributed with
  3734. Coherent.  This is one of those 64K-limit systems, so my first cut at a
  3735. makefile entry builds a bare-bones version -- no interactive command parser,
  3736. no character sets, no debug, etc.  Totally untested.  ckutio.c, makefile.
  3737.  
  3738. Added entry "du3" to makefile for DEC Ultrix 3.x, from Gordon Harrington.
  3739. Like the entry for Ultrix 4.0, but without DIRENT.
  3740.  
  3741. Changed name of entry "ds4" to "du4", since it should apply to all Ultrix 4.0
  3742. systems, not just DECstations.
  3743.  
  3744. Added entry "cray" to makefile for Cray X-MP, Y-MP with UNICOS System V R3,
  3745. from Lou Muccioli, Swanson Analysis Systems.  Straight Sys V R3, but defining
  3746. the make variable NPROC to be 1.
  3747.  
  3748. Added entry "hpux7sf" to be used with HP-UX 7.0 systems that don't support
  3749. long filenames.  Apparently there are some.
  3750.  
  3751. ------------------------------
  3752.  
  3753. 5A(160) Sat Oct 20 18:20:52 1990,
  3754.  
  3755. Changed Unix DIRECTORY command back to "/bin/ls -l", and made default
  3756. filespec be the null string rather than "*".  This works better than "ls -ld"
  3757. and "*".  Robert Weiner's suggestion.  ckuusr.c.
  3758.  
  3759. SEND <prefix><ESC><completion> didn't work in edit 159.  Fixed in cmifi(),
  3760. case ESC.  ckucmd.c.
  3761.  
  3762. Changed \v(ndate) to omit punctuation, so now it is yyyymmdd, like
  3763. 19901019 rather than 1990-10-19 or 1990/10/19.  This way it won't conflict
  3764. with anybody's file naming conventions, and it fits within the MS-DOS filename
  3765. length limit.  Suggested by Jay Rouman.  ckuus4.c.
  3766.  
  3767. Commented out the line: "if (didweget(lbuf,"RING")) status = FAILED;" from the
  3768. Hayes modem dialing section of ckdial().  There's no reason why dialing should
  3769. fail if the modem reports it's ringing (as Telebits do)!  Thanks to David
  3770. Dyck, John Fluke Mfg Co.  ckudia.c.
  3771.  
  3772. Changed Hayes modem speed changing code not to set the speed to zero if the
  3773. modem reported a non-numeric speed, like "CONNECT FAST" (used by Telebit
  3774. modems).  Untested.  Reported by David Dyck.  ckudia.c.
  3775.  
  3776. Removed mdmtyp = 0 from '-l' command-line option handler.  This prevented "set
  3777. modem hayes" in initialization file from working with -l on command line.
  3778. Reported by David Dyck.  ckuusy.c.
  3779.  
  3780. Changed restoral of global file type to use actual value of binary (could
  3781. be 1, 2, 3, etc, in VMS) rather than 1 always.  ckcfns.c.
  3782.  
  3783. Added missing #include "ckcfil.h" to ckuusx.c, needed for VMS.  Thanks to
  3784. William Bader.
  3785.  
  3786. William Bader found that VMS Kermit server, after having received some number
  3787. of REMOTE commands (which cause it to start a fork) began to give "quota
  3788. exceeded" messages.  He diagnosed two problems: (1) zclosf() in ckvfio.c was
  3789. not closing and releasing the process, and (2) subsequent ttinl() calls were
  3790. failing because the piled-up processes ate into the user's BYTLIM quota.
  3791. William supplied code for zclosf() to delete the process.  ckvfio.c.
  3792.  
  3793. William also noted that the subsequent failure of ttinl() caused the higher
  3794. level code to become confused.  Here is what was happening: C-Kermit server
  3795. gets REMOTE command, successfully starts a process to handle it, turns around
  3796. the direction of transmission by sending an S-packet, then goes to read the
  3797. acknowledgment.  At this point ttinl() fails.  Kermit assumes this was because
  3798. of a timeout, so it goes to retransmit the S packet.  But (aha!) the S-packet
  3799. had been sent "out of window" and was not stored anywhere to be retransmitted,
  3800. so resend() failed with mysterious BPX code.  This was because a send buffer
  3801. had not been allocated for the S-packet at the time the direction of
  3802. transmission turned around.  So... I added code to sipkt() to allocate a send
  3803. buffer if one was not already allocated.  This makes all the "sending packet
  3804. out of window" errors disappear from the debug log, and should make the
  3805. protocol insensitive to ttinl() failures.  I hope that was the last packet
  3806. allocation buffer foulup!  ckcfns.c.
  3807.  
  3808. In the face of persistent complaints that file transfers were failing because
  3809. too-short timeouts weren't being adjusted in some cases, I was finally able to
  3810. track down the problem and (I hope) fix it.  C-Kermit was adjusting the
  3811. timeout too early, and its adjusted value was being overridden by the value
  3812. requested from the other Kermit during the protocol negotiation phase.  Now
  3813. the timeout adjustment is postponed until after protocol parameter negotiation
  3814. is complete.  But remember, automatic timeout adjustment only works (and is
  3815. only attempted) if C-Kermit can learn the transmission of the communication
  3816. line.  ckcpro.w.  Also, moved chktimo() to ckuusx.c so it can also be used
  3817. with -DNOICP.
  3818.  
  3819. Rewrote packet and buffer length #define's in ckcker.h.  They were allowing
  3820. VMS C-Kermit to say it would accept much more input at a time than it really
  3821. is capable of.  Also changed ckcfns.c and ckuus3.c to make sure that in
  3822. all cases the requested packet length is less than the #define'd maximum
  3823. packet length, and the product of the packet length and the window size is
  3824. less than the #defined maximum buffer size.  UNFORTUNATELY, it is still
  3825. possible to send enough input into VMS C-Kermit to make it crash AND log out
  3826. your job!  (at least when coming in through a terminal server via CMU's TCP/IP
  3827. package for VMS, and using any window size > 1 with any packet length at all,
  3828. but only while receiving files -- sending works OK, even with big window
  3829. sizes.)
  3830.  
  3831. Later, same tests on hardwired terminal line...  It can send packets no longer
  3832. than 1920, at least on my VMS system, without getting "quota exceeded" errors
  3833. (BYTLIM quota, no doubt).  With window sizes greater than 1, it can receive
  3834. only very short packets without getting "data overrun" errors in ttinl():
  3835.  
  3836. Window  Max Send  Max Recv
  3837.  Size    Packet    Packet
  3838.   1       1920      1920
  3839.   2       1000*       70   (* = MS-DOS Kermit restriction: 2000 / Window size)
  3840.   3        666*       35
  3841.  
  3842. There is something very wrong with VMS-specific sliding windows receive
  3843. code...  Checked to make sure that HOSTSYNC setting in VMS Kermit was
  3844. effective during packet mode.  It is.  I can't find a way to test READSYNC,
  3845. but I think it must work: my alt-typeahead buffer is 200 and I can send VMS a
  3846. 1920-byte packet at 9600 bps without losing characters or getting errors, so
  3847. it must be working.  The dismal failure of sliding windows on input must be
  3848. related to Kermit's telling VMS to do output at the same time that input is
  3849. arriving.  But then how can any full-duplex applications work???
  3850.  
  3851. When sending files, VMS C-Kermit can use pretty large window sizes -- tested
  3852. successfully with sizes up to 12, with lots of error insertion and recovery.
  3853. With larger window sizes, it sometimes gets data overruns under error
  3854. conditions when it attempts to retransmit a window full of packets.
  3855.  
  3856. Discovered that cmdir (as used in CD and DIRECTORY commands) does not work for
  3857. VMS.  It uses zxpand() to see if the directory specification contains
  3858. wildcards, but the VMS version of zxpand() expands a directory name into the
  3859. list of all the files in the directory.  If the directory contains more than
  3860. one file, CD refuses to work because it claims the user typed a wildcard.  If
  3861. the directory contains no files, the program crashes in zxpand().  Changed
  3862. cmdir() to simply call "iswild()" to see if the directory spec contains
  3863. wildcard characters, and not to verify it any further.  This works a lot
  3864. better.  Now you can type "cd [.subdir]", "cd [-]", "cd foo:", etc.  ckucmd.c.
  3865.  
  3866. Realized that all the expanding and checking being done by cmdir() was totally
  3867. unnecessary.  Commented it all out, and made Unix work like VMS (except the
  3868. UNIX version also converts tilde to user's home directory name).  ckucmd.c.
  3869.  
  3870. Found that the Ctrl-C trap works in VMS if I remove the PASTHRU/PASALL setting
  3871. in concb(), but there is still no way to trap Ctrl-Y.  If PASTHRU/PASSALL is
  3872. left in effect, the command parser uses vms_getchar() in ckvtio.c to read from
  3873. the keyboard, which looks for Ctrl-C or Ctrl-Y itself and if it sees them,
  3874. restores the terminal and exits.  After concluding that there is truly no way
  3875. to trap Ctrl-Y from Kermit, I went ahead with Plan B: leave PASTHRU/PASSALL
  3876. set in concb(), make vms_getchar() call the Ctrl-C handler if it sees Ctrl-C
  3877. or -Y, make sure the Ctrl-C handler peels back the command level, closing all
  3878. active TAKE files and macros (by calling dostop()), add calls to conres() at
  3879. beginning of TAKE, DIRECTORY, DIAL, DO, and before any local-mode file
  3880. transfer command, etc etc.  Many modules affected.
  3881.  
  3882. Added parity-sensing code to ttinl() in ckvtio.c, within #ifdef PARSENSE
  3883. conditionals.  This required moving parchk() into ckcfn2.c, where all the
  3884. ck?tio.c modules can share it, and it can use the partab[] that is already
  3885. there, rather than a separate space-consuming copy.  Doing this is a little
  3886. strange, because normally the ck??io modules don't call or depend on anything
  3887. in the system independent modules.  Debugged and tested ok.  Compared
  3888. performance with non-parity sensing version on slow MicroVAX II -- the parity
  3889. sensing version was actually a little bit faster (don't ask me why).
  3890.  
  3891. Noticed that VMS version cannot receive ASCII files with lines longer than
  3892. 1024.  This is because zoutdump() in ckvfio.c is record-oriented (as it must
  3893. be, because the VMS file system is record oriented).  The file input and
  3894. output buffer sizes are the same, INBUFSIZE = 1024, defined in ckcker.h.  I
  3895. made a separate symbol for the file output buffer, OBUFSIZE, and defined it to
  3896. be 4096 for VMS (for compatibility with Kermit-32) and 1024 otherwise.
  3897. ckcker.h.  Changed all references to output buffer size to use the new symbol:
  3898. ckcmai.c, ckvfio.c.  Also changed zoutdump() to not exit() (!) when "line is
  3899. longer than input buffer, but rather to return -1.
  3900.  
  3901. When decode() calls zmoutchar(), and zmoutchar() calls zoutdump(), and
  3902. zoutdump() returns -1 up thru decode() to ckcpro.w, the program hangs.  This
  3903. must be why somebody made zoutdump() exit() when this happened.  The reason is
  3904. that after sending its failure return, the transfer is shut down correctly
  3905. with an error packet ("Error writing file") and then Kermit tries to close the
  3906. file, but the zclose() calls zoutdump again to flush remaining buffers, and
  3907. then we get in an infinite loop.  Solution: set zoutcnt to 0 when this
  3908. happens, so subsequent calls to zoutdump() return immediately.  ckvfio.c.
  3909.  
  3910. VMS Ctrl-C/Y trap summary:
  3911.  1. When command parser is reading from the terminal: vms_getchar().
  3912.      Terminal is in PASSALL/PASTHRU mode, and Ctrl-C/Y are read as normal
  3913.      characters, only so that Ctrl-Y won't kill Kermit and leave the user's
  3914.      terminal in no-echo mode.  vms_getchar() checks for Ctrl-C and -Y and
  3915.      calls trap() in ckuusx.c (indirectly thru the function pointer that was
  3916.      passed to conint()) if it sees them.
  3917.  2. When command parser is executing from take file or macro: conres() is
  3918.      called to take terminal out of PASSALL/PASTHRU mode so that real Ctrl-C
  3919.      (SIGINT) trap can take effect, also trap().
  3920.  3. During DIAL and SCRIPT execution: Same as (2).
  3921.  4. During local-mode file transfer: Same as (2).
  3922.  5. During execution of certain commands like TYPE and TRANSMIT: real SIGINT
  3923.      trap, as in (2), but local to that command.
  3924.  6. When command parser invokes an inferior process: connoi() is called to
  3925.      turn console interrupt processing off.  Let the inferior process handle
  3926.      Ctrl-C/Y. 
  3927.  7. During remote-mode file transfer: ttinl() reads Ctrl-C/Y, passes special
  3928.      return code up through the call stack.
  3929.  8. During CONNECT: ignored entirely.
  3930.  
  3931. In case 1 and 7, Ctrl-Y is treated like Ctrl-C, just gets you back to the
  3932. prompt.  In cases 2-6, Ctrl-Y really stops the process so that it can be
  3933. CONTINUEd, and in each case the user's console terminal modes are reset so
  3934. that keystrokes echo, etc.
  3935.  
  3936. One problem with commands like DIRECTORY was that they were ultimately
  3937. executed in VMS by calling system().  Ctrl-C would indeed be caught by Kermit,
  3938. but Kermit had no way of stopping the inferior process.  Replaced all calls
  3939. to system() by calls to zsysmd(), so that the Ctrl-C handler, when it calls
  3940. zclose(ZIFILE), will kill the inferior process.  It does indeed kill them,
  3941. and returns control properly to the command parser, but something has gone
  3942. very wrong: the screen remains blank until we exit from the program.  It seems
  3943. as if terminal output (or perhaps standard output) has been redirected to
  3944. somewhere else (like maybe the NL: device).  I spent a lot of time trying to
  3945. track this one down, but a VMS expert is needed.  ckvfio.c.
  3946.  
  3947. ------------------------------
  3948.  
  3949. 5A(159) Mon Oct 15 13:46:39 1990
  3950.  
  3951. Added missing forward declaration of long for ttgspd() (pointed out by
  3952. everybody).  ckutio.c.
  3953.  
  3954. Fixed zxpand() to not core dump when trying to write to debug log when no
  3955. files match.  ckufio.c.
  3956.  
  3957. Jay Rouman pointed out that a last-minute change in edit 158 broke the
  3958. C-Kermit server's ability to convert uppercase names in incoming GET commands
  3959. (as from an Apple II that only has uppercase) to lowercase.  I moved all of
  3960. that (il)logic from gnfile() in ckcfns.c to zxpand() in ckufio.c to ensure it
  3961. can't possibly be skipped, and because it is, after all, UNIX-specific.  Ditto
  3962. for calls to tilde_expand().  This also called for changes to cmifi() and
  3963. cmdir() in ckucmd.c.  Seems much better now.  Also, added a quoting mechanism
  3964. to fgen() -- if it gets a backslash, it takes the next character literally.
  3965. But to get a backslash to fgen() from the command parser, you have to type two
  3966. of them.  But now, for the first time, you can send a file whose name is "*".
  3967. This quoting mechanism is consistent for both KERMIT and SHELL wildcard
  3968. expansion.
  3969.  
  3970. Fixed zchdir() and zgtdir().  Moved tilde-expansion stuff from ckcfn2.c into
  3971. zchdir() because it is, after all, UNIX-specific.  Fixed zgtdir() to make its
  3972. directory-name buffer static rather than automatic, so the return value is
  3973. always accessible.  Also made zchdir accept uppercase directory names, and
  3974. convert them to lowercase if the chdir to the uppercase name didn't work.
  3975. ckufio.c, ckcfns.c.
  3976.  
  3977. Changed UNIX-specific part of cmdir() to convert directory name to lowercase
  3978. and try again if it fails the first time.  ckucmd.c.
  3979.  
  3980. Looked at making server's response to REMOTE TYPE, REMOTE DIR, REMOTE SPACE,
  3981. etc, be case-independent too.  It could be done, but only at the expense of
  3982. a lot of code.  Given the present size factor, it's probably not worth it.
  3983.  
  3984. Strengthened UNIX ttol(), which is used to write packets.  Made it attempt to
  3985. recover if write()'s return code indicated it had only written a partial
  3986. packet.  It now allows itself up to 5 tries to complete the requested write().
  3987. Have not, however, been able to cause the retry code to actually be exercised.
  3988. ckutio.c.
  3989.  
  3990. Another problem related to ttol()...  If ttol() returned a failure code to
  3991. spack(), spack() failed to finish updating the packet structure.  Rearranged
  3992. this code to make sure packet was always fully installed in the packet info
  3993. structure by spack().  This clears up a lot of the mystery related to blank
  3994. packet types encountered by resend() and friends.  Thanks to Peter Mauzey for
  3995. sending in a debug log that uncovered this one.  ckcfn2.c.
  3996.  
  3997. Finally, about ttol()...  Alan Grieg suggested it incorporate a timer to break
  3998. xoff deadlocks.  I decided not to do this for several reasons: a timer is
  3999. already active during packet operations (unless the user turned it off); such
  4000. a timer could wipe out the alarm() values set by higher level routines,
  4001. especially the ones in ckdial(); and it's just more complicated, hairy code.
  4002. Before we start cluttering Kermit up with lots of conflicting timers, we need
  4003. a general-purpose alarm manager.  Fortunately, we developed one here for
  4004. another (now-dead) project.  It can probably be adapted to Kermit without too
  4005. much pain, but for now it doesn't seem to be necessary.
  4006.  
  4007. Changed resend() to fail if (ttol() < 0) rather than < 1.  Fixes problems with
  4008. VMS version, whose ttol() returned 0 on success, rather than a positive number.
  4009. Thanks to Alan Grieg, Dundee Tech, Scotland, for noticing the problem.
  4010. ckcfn2.c.
  4011.  
  4012. The resend() function has been a major irritant for many months.  Hopefully
  4013. the changes listed above will alleviate most of the problems we've been
  4014. seeing, but I also made one change to resend() itself: if it gets an i/o error
  4015. back from ttol() or spack(), it no longer treats it as fatal.  If the packet
  4016. was not successfully retransmitted, let the retry counter take care of it.
  4017. That's what higher level protocols are for.  ckcfn2.c.
  4018.  
  4019. Kermit's version string, versio, and version number, vernum, are not
  4020. sufficient for identifying divergent strains of the program.  Added a third
  4021. variable, verwho, to show "who" produced a particular version of the program:
  4022. 0 = Columbia University, other numbers to be assigned.  Added text at top of
  4023. ckcmai.c explaining this convention and urging people to follow it.  This
  4024. should help to clear up confusion from non-Columbia-released versions floating
  4025. around.  ckcmai.c, ckuus4.c, ckuus5.c.
  4026.  
  4027. Added variable \v(speed) - current line speed, or "unknown".  ckuus[4h].c.
  4028.  
  4029. Added percent done and VMS file types to local-mode (Ctrl-)A file transfer
  4030. status display.  ckuusx.c.
  4031.  
  4032. Fixed up more help messages.  Put all character-set related help messages
  4033. within #ifndef NOCSETS...#endif.  ckuus2.c.
  4034.  
  4035. Changed ttgspd() to not refer to certain speed variables like B75, B50, etc,
  4036. even if they are defined, in MINIX, in which values of many of these variables
  4037. collide, causing "duplicate case in switch" errors.  ckutio.c.
  4038.  
  4039. Changed lowercasing of tty device name for lockfile (/dev/ttyA => /dev/ttya)
  4040. to depend on #ifdef M_XENIX rather than M_SYS5 because it was felt that
  4041. M_XENIX is more indicative of SCO Xenix than M_SYS5.  ttlock() in ckutio.c.
  4042.  
  4043. Changed makefile entries for 286-based versions to use -M2let64 instead of
  4044. -M2let32.  32 was resulting in "Cannot alloc mem for env.. Stop" messages.
  4045.  
  4046. Put conint() back the way it was before.  If SIGTSTP is defined, Kermit allows
  4047. itself to be suspended.  If the user's login shell doesn't support suspended
  4048. jobs, too bad.  There's no way Kermit can know this.  If the user doesn't want
  4049. the session to hang whenever she types Ctrl-Z, she should "stty susp undef".
  4050.  
  4051. Rearranged the declarations of cflg, and made global declarations of "char *p"
  4052. in ckucon.c and ckcpro.w static, because Minix loader, asld, complained p was
  4053. multiply defined.  Ditto for a few other variables - n, msfiles, action (found
  4054. by Bert Laverman).  After these changes, the program (in its minimum
  4055. configuration) compiles ok, but does not load: "/usr/bin/asld: out of memory".
  4056.  
  4057. Size (apropos of Minix)...  On the SUN-4, this edit, compiled in its minimum
  4058. configuration ("make sunos4m"): no anything except file transfer, connect, and
  4059. command-line parser) looks like this:
  4060.  
  4061.   text   data   bss    total   disk size
  4062.   98304  16384  14400  129088  129088
  4063.  
  4064. Which is still pretty big.  But the SUN-4 has RISC architecture, and therefore
  4065. the C code generates tons of machine instructions.  On a VAX-11/750 ("make
  4066. bsdm"), the same compilation looks like this:
  4067.  
  4068.   text   data   bss    total   disk size
  4069.   67584  14336  23068  104988   82944
  4070.  
  4071. Which is more reasonable.  The text size almost makes it under the 64K limit,
  4072. and probably would on a PC, with its variable-length instructions.
  4073.  
  4074. Got new ckvfio.c and ckvtio.c, plus minor changes to ckcmai.c (reformatted
  4075. server help message) from Terry Kennedy.  Changed ttol() in ckvfio.c to return
  4076. number of characters actually written, rather than 0, on success.  Changed
  4077. Terry's change to ztime() to always use ctime(), which is apparently available
  4078. even for the oldest versions of VAX-11 C, rather than asctime().  These
  4079. changes suggested by William Bader.  Wrapped lines > 80 in ckvtio.c.
  4080.  
  4081. Added (local) WHO command (yes, there was a request).  Only 4 lines of code.
  4082. ckuusr.c.
  4083.  
  4084. Made VERWHO symbol ("who produced this version") that can be defined on the
  4085. cc command line so the ckcmai.c source does not have to be edited.  ckcmai.c.
  4086.  
  4087. ------------------------------
  4088.  
  4089. 5A(158) Sun Oct  7 22:18:34 1990
  4090.  
  4091. WILDCARD EXPANSION
  4092.  
  4093. Added a new option, SET WILDCARD-EXPANSION { KERMIT, SHELL }, for UNIX only.
  4094. The default is KERMIT, meaning Kermit itself expands wildcards in SEND and
  4095. MSEND, as well as what it receives while in server mode in GET commands, just
  4096. as it has always done.  The new option, SHELL, means Kermit calls upon the
  4097. user's preferred shell (via SHELL environment variable, or failing that, the
  4098. user's login shell via getpwuid) to expand them.  The tilde_expand() function
  4099. is still active, so "~" can always be handled, even if the shell or UNIX
  4100. version doesn't support it.
  4101.  
  4102. Advantages of the new method include more flexibility in file selection,
  4103. consistency with the user's shell, and ability to handle a larger number of
  4104. files.  But there are drawbacks.  It's noticeably slower.  Characters in
  4105. filenames that are special to the shell (like |, &, `, etc) must now be quoted
  4106. with \ (this was not necessary before).  And the same Kermit command (SEND,
  4107. MSEND, or GET sent to a server) may behave differently depending on what your
  4108. login shell is.  For example, "{aaa,bbb}" is expanded by the csh, but taken
  4109. literally by sh and ksh; "[a-z]" is expanded by csh and ksh, but taken
  4110. literally by sh.
  4111.  
  4112. The expansion is done by passing "echo " concatenated with the user's filespec
  4113. to the shell.  This assumes that echo is a built-in shell command, or if it's
  4114. not, then the echo program is in the user's path (risky).  "echo" is used
  4115. rather than "ls -d" because ls says "xxx not found" if xxx does not exist
  4116. (unfortunately, the csh version of "echo" says "echo: no match" if you give it
  4117. a string containing metacharacters and no files match, wherease sh and ksh
  4118. simply echo the string back at you).  It doesn't matter much, because C-Kermit
  4119. checks each word that is returned for its existence as a file (but of course,
  4120. you could have a file called "echo:", "no", or "match"...).  And then what
  4121. happens if the user has a file called "-n"? ...
  4122.  
  4123. Most of these pitfalls were brought up by Kristoffer Eriksson.  So that's why
  4124. we now have a SET command to select the expansion method, and why "shell" is
  4125. not the default.
  4126.  
  4127. Kristoffer also raised a related, and very important point: If Kermit expands
  4128. wildcards in filenames it gets from the command line (this change was made in
  4129. edit 151), what happens if a filename contains a metacharacter?  For example,
  4130. what if one of the files has the name "*"?  (Think about it!).  The change was
  4131. made for a good reason, namely to let VMS, OS/2, and other non-Unix systems
  4132. (that don't have shells that expand metacharacters) give Kermit wildcard
  4133. filespecs on the command line.  Therefore, the UNIX version of C-Kermit no
  4134. longer expands filenames inherited from the command line, but the others
  4135. continue to do so.
  4136.  
  4137.  
  4138. X.25 SUPPORT
  4139.  
  4140. Added supporting code for SunLink X.25 network connections and X.3 pad
  4141. control, contributed by Marcello Frutig of Catholic University, Rio de
  4142. Janeiro, Brazil.  To use this code, you must have (a) a SUN, (b) the SunLink
  4143. product (libraries and header files), and (c) an X.25 connection into your
  4144. SUN.  There are numerous new commands: SET NETWORK X.25; PAD CLEAR, PAD
  4145. INTERRUPT, PAD RESET, PAD STATUS; SET/SHOW PAD (most X.3 PAD parameters may be
  4146. set, like escape, echo, forward, editing characters, etc); SET X.25 (call
  4147. options); and some new CONNECT-mode escape options.  Code added to ckcmai.c,
  4148. ckucon.c, ckutio.c, ckuus[r2345xy].c, and new entries added to makefile:
  4149. sunos4x and sunos41x.  This code is totally untested.  The selection of
  4150. SunLink X.25 support is governed by the CFLAG -DSUNX25; ckcdeb.h was changed
  4151. to ensure that this becomes undefined for any non-SUNs that try to include it.
  4152. THIS CODE IS TOTALLY UNTESTED.  It is based on edit 153 of C-Kermit 5A, fitted
  4153. into edit 158 and reworked in various ways.  The original code was written and
  4154. tested on a SUN-3 with SUNOS 4.0; SUN-4 testing is needed, as is SUNOS 4.1
  4155. testing.  The best I could do locally was ensure that the program still builds
  4156. and runs without SUNX25 defined.  I also tried compiling each module
  4157. separately with SUNX25 defined, and got no errors other than missing SunLink
  4158. header files and undefined SunLink-related symbols.  I wonder if any other
  4159. UNIX systems support X.25 connections, and if so, whether their support
  4160. libraries resemble SunLink enough to make this code more widely usable...
  4161. Does anybody out there have SunLink X.25?  Please report results, good or bad,
  4162. if you do.
  4163.  
  4164.  
  4165. SUPPORT FOR CYRILLIC CHARACTER SETS
  4166.  
  4167. Several translation tables were replaced based on discussions with Konstantin
  4168. Vinogradov in Moscow, John Chandler in Boston, and others.  New
  4169. Latin/Cyrillic-to-xxx tables were furnished by John, which are more invertible
  4170. than the first ones, and also correct a few mistakes.  Also, a new case was
  4171. added: C-Kermit sending a file with file character-set ASCII, transfer
  4172. character-set CYRILLIC, and language RUSSIAN.  In that case only, the file is
  4173. interpreted as "Short KOI" (KOI-7), and all lowercase ASCII letters (actually,
  4174. all characters in columns 6-7 except DEL) are converted to uppercase
  4175. Latin/Cyrillic letters.  This restores a file that was received with F=ASCII,
  4176. T=CYRILLIC to its original orthography, except the result is all uppercase
  4177. and hard signs are lost (Short KOI does not have a hard sign, so incoming
  4178. hard signs were translated to apostrophe).
  4179.  
  4180.  
  4181. OTHER CHANGES
  4182.  
  4183. Added a new command string, DIRCM2, to the system-dependent module.  This
  4184. tells the command the C-Kermit server should use if it receives a REMOTE
  4185. DIRECTORY command with no arguments, as distinct from the command to use when
  4186. arguments are given.  Necessary because in UNIX we use "ls -ld" (to avoid
  4187. recursive listings), but if no argument is given to ls -ld, it just prints a
  4188. listing for ".".  Keepers of all other C-Kermit based versions (Mac, Amiga,
  4189. etc) will have to add this definition.  ckufio.c, ckcpro.w.
  4190.  
  4191. Changed opena() for VMS case.  If user has set C-Kermit's file type to image
  4192. and an attribute packet comes in reporting type B (binary), C-Kermit should
  4193. not change its file type to binary, but rather leave it at image.  On the
  4194. other hand, a file type of binary reported in the incoming attribute packet
  4195. should continue to override a locally prevailing file type of text.  ckcfn3.c.
  4196.  
  4197. Changed ttlock() to lowercase the device name if it was uppercase on SCO
  4198. Xenix systems, which use lowercase lock names for uppercase tty devices
  4199. (e.g. /dev/tty2A is really /dev/tty2a, but with different modem control).
  4200.  
  4201. Changed \v(ndate) to use dashes rather than slashes, so it could be used in
  4202. filenames, and to supply a leading zero for the day of the week (rather than a
  4203. leading blank).  So today is "1990-10-06" rather than "1990/10/ 6".  Thanks to
  4204. Jay Rouman.  ckuus4.c
  4205.  
  4206. Changed DIAL command to set alarm after it outputs the dial string, rather
  4207. than before, to prevent the alarm set by ttoc() from undoing the alarm set for
  4208. the modem response.  Suggested by Mike Wuerth of BASES Burke Institute,
  4209. Cincinnati, OH.  Can't test here, because I don't have a modem connected, and
  4210. so DIAL always times out looking for its "wake string" response.  ckudia.c.
  4211.  
  4212. Changed all signal(SIGALRM,xxx) calls in ckutio.c to save and restore the old
  4213. signal handler.  This didn't make any difference in the dial time either.
  4214. This is probably because subsequent alarm() calls destroy the alarm(waitcnt)
  4215. call in the DIAL command.  What is needed is a general purpose facility for
  4216. stacking alarm calls, values, and handlers, and keeping track of elapsed time.
  4217. Not to mention a total rewrite of ckcdia.c to make it comprehensible.  Sorry,
  4218. not me.
  4219.  
  4220. Paul Placeway, working on Mac Kermit, found he could save a lot of space if he
  4221. defined NOICP and NOCMDL, but then the only statement in ckcmai.c that ever
  4222. got executed was "doexit()".  Added a special section for the MAC when both
  4223. NOICP and NOCMDL are defined.
  4224.  
  4225. Paul also complained that the srvcmd buffer was allocated statically, taking
  4226. up a lot of space (9K) when DYNAMIC is defined.  This is now allocated
  4227. dynamically by inibufs() in ckcfn3.c if DYNAMIC is defined, still static
  4228. otherwise.
  4229.  
  4230. Changed the default filespec for the DIRECTORY command in UNIX to be "*"
  4231. rather than ".", now that "ls -ld" is used.  This gives the desired effect.
  4232. In previous edits, "dir" with no operands just listed ".".  ckuusr.c.
  4233.  
  4234. Tested latest changes on SUN, NeXT, and Macintosh II with A/UX.  Also
  4235. discovered that I could add -DNETCONN and -DDYNAMIC to the makefile entries
  4236. for A/UX, with a slight change to the initialization of the variable nettype
  4237. in ckcmai.c -- A/UX is System V, but with a BSD sockets library.  Tested
  4238. SET HOST from A/UX, works fine.  Also added -DDYNAMIC to "make next".  That
  4239. works fine also.
  4240.  
  4241. Changed SHOW COMM to say "Terminal bits" rather than "Data bits", since this
  4242. reports like "parity: none, data bits: 7" were confusing and misleading.
  4243. Also, "Terminal bits" is reported only if the program is in local mode, since
  4244. it's the terminal bytesize setting.
  4245.  
  4246. Changed ckuusr.h for Minix to include <sys/types.h> before <pwd.h>.  John
  4247. Nall (new Minix tester) says it didn't work the other way.  This change should
  4248. only affect Minix, because the "#include <sys/types.h>" is within #ifdef MINIX
  4249. conditionals.
  4250.  
  4251. Changed makefile to make the object file type a variable EXT rather than
  4252. constant "o".  EXT is defined to be "o", but can be changed on the "make"
  4253. command line, as in "make minix EXT=s" (Minix uses s rather than o).  This is
  4254. done internally for the Minix make.  Thanks to John Nall for the information
  4255. about Minix object files.
  4256.  
  4257. BUGS FIXED
  4258.  
  4259. Fixed a typographical error that resulted in Kermits built with -DHDBUUCP
  4260. to write an integer, rather than string, pid into the lockfile.  ckutio.c.
  4261.  
  4262. Changed ttsspd() to make local-mode speed changes permanent by also putting
  4263. them in the ttold structure, where ttres() reads them.  ckutio.c.
  4264.  
  4265. Fixed a bug that caused C-Kermit to send unnecessarily short packets because
  4266. of confusion among the size given in a SET SEND PACKET-LENGTH command, the
  4267. size negotiated in the Send-Init parameters, and the dynamic packet length
  4268. calculation: (1) don't let dynamic packet length calculation kick in until
  4269. after the first couple packets have been sent; (2) create a new variable,
  4270. spsizr, for the send-packet length requested in SET SEND PACKET-LENGTH, as
  4271. distinct from any negotiated or recalculated value.
  4272.  
  4273. Fixed a bug introduced by the new "multiple get" code in edit 157.  "GET xxx"
  4274. sent to the C-Kermit server caused the server to hang if the file xxx did not
  4275. exist.  This involved a total reorganization and rewrite of sinit() and
  4276. gnfile().  This also fixes several other lurking problems that nobody reported
  4277. yet, and (I hope) does not introduce too many new ones.  ckcfns.c.
  4278.  
  4279. Thanks to persistent reports from Peter Jones, I finally realized that it is
  4280. bad to turn on trapping of the keyboard stop (suspend) signal if the user's
  4281. shell does not support job control.  It leaves the terminal permanently
  4282. wedged.  I added a test to conint() within the #ifdef SIGTSTP section: if the
  4283. SHELL environment variable is "/bin/sh", I signal(SIGTSTP,SIG_IGN) rather than
  4284. to the normal suspend-interrupt handler function.  This is still not optimal,
  4285. however -- it seems that the MIPS version of sh can be started as "sh -J" to
  4286. enable job control...  ckutio.c.
  4287.  
  4288. Added missing help messages.  ckuus2.c.
  4289.  
  4290. Compiled and tested on SUN-4 (both BSD and System V environments), Encore
  4291. Multimax, NeXT, DECstation 5810 Ultrix 4.0, Macintosh II A/UX 2.0, and
  4292. MicroVAX II with VMS 5.3.
  4293.  
  4294. ------------------------------
  4295.  
  4296. 5A(157) Wed Sep 26 20:57:53 1990
  4297.  
  4298. Rewrote gnfile() (get next file).  Previously, it worked either with a list of
  4299. nonwild filenames, or a single wild filespec.  The new version works with both
  4300. at once, and it's much simpler too.  So now you can feed C-Kermit a list of
  4301. filenames on the command line, some of them wild, some not.  C-Kermit expands
  4302. the wild ones itself.  This allowed a big chunk of Data-General-specific code
  4303. to be removed.  ckcfns.c.
  4304.  
  4305. Added MSEND command (at David MacKenzie's suggestion).  Just like SEND,
  4306. except you can give a list of filespecs (separated by spaces), rather than
  4307. just one, e.g.:
  4308.  
  4309.   C-Kermit>msend cku*.c cku*.h ckc*.c ckc*.h ckw*.c ckcpro.w makefile
  4310.  
  4311. All the files on the list are sent in a single transaction, i.e. between
  4312. one pair of S and B packets.  This command adds about 200 words of storage,
  4313. plus a small amount of code.  Put -DNOMSEND in your CFLAGS to compile it out.
  4314. ckuusr.[hc].
  4315.  
  4316. Yes, it would have been better to change the SEND command to allow a list of
  4317. names and asnames, as in:
  4318.  
  4319.   C-Kermit>send foo bar, x*.*, *.old *.new, etc
  4320.  
  4321. but this is just too much work -- the command parser would need a new function
  4322. added (cmcomma) and this could break many other commands that allow commas,
  4323. and it would probably take a week to put things right again.  Save this for
  4324. 5B.
  4325.  
  4326. Changed the server to read multiple filespecs in GET string, so now you can
  4327. give a list of filespecs (separated by spaces) in GET commands from MS-DOS
  4328. Kermit or wherever.  The GET string is broken up into its component filespecs
  4329. by a new function fnparse, which I put in the user interface section
  4330. (ckuusx.c).  C-Kermit implementations that use different user interfaces
  4331. and/or which allow spaces in filenames (like Macintosh) will have to alter or
  4332. make their own version of this function.  You can restore the old behavior
  4333. by adding -DNOMGET to your CFLAGS.  ckuusx.c, ckcpro.w.
  4334.  
  4335. Changes to Cyrillic translations suggested by Konstantin Vinogradov and
  4336. "Kermit Gang" at ICSTI in Moscow.  Also nomenclature changes - "Old KOI-8"
  4337. rather than "KOI-8" (it's a long story)...  Added a new table for translating
  4338. Cyrillic into ASCII -- it uses the widespread convention ("Short KOI") of
  4339. converting all ASCII letters to uppercase, and all Cyrillic letters to
  4340. lowercase Latin letters having approximately the same sound, using braces,
  4341. bars, etc, for the few letters that have no phonetic equivalents (like cha,
  4342. sha, shcha, yu, etc).  ckuxla.c.
  4343.  
  4344. Added DEC-MCS-to-ASCII translation of OE ligature to O and E (both capital
  4345. and small).  ckuxla.c.
  4346.  
  4347. Added new variable \v(home) to contain user's home directory.  For UNIX,
  4348. it includes the trailing slash, like "/usr/fdc/", and for VMS it looks like
  4349. "$DISK1:[FDC]".  Thus it can be concatenated with a filename, as in
  4350. "take \v(home)compuserve.tak" in both UNIX and VMS.  This lets TAKE commands
  4351. can work no matter what directory the user is cd'd to, if the user keeps the
  4352. command files in her home directory.
  4353.  
  4354. During local mode file transfer, typing any character other than a legal
  4355. interruption command (A, X, Z, etc) will now reprint the list of legal
  4356. interruption commands.  Suggested by David MacKenzie.  ckuusx.c.
  4357.  
  4358. Added error messages for all commands that were not giving them if the user
  4359. omitted mandatory fields.  ckuus*.c.
  4360.  
  4361. Removed double error messages for most other commands when they are
  4362. incompletely entered: close, delete, log, mail, take, translate, transmit,
  4363. type.  ckuusr.c.
  4364.  
  4365. Fixed most error message to be more informative and not to make a blank line
  4366. unnecessarily.  ckuus*.c, ckucmd.c.
  4367.  
  4368. In GET command, initialized "as-name" to the null string.  There were reports
  4369. of files arriving in response to the GET command being stored with the wrong
  4370. name, like (yes) "*.*".
  4371.  
  4372. Moved declaration of mdmspd (modem changes/matches speed flag) from ckuus3.c
  4373. to ckcmai.c, in case program is build with -DNOICP (Jay Rouman).
  4374.  
  4375. Changed SCRIPT command to recognize \\b as a code for sending BREAK, just
  4376. like OUTPUT.
  4377.  
  4378. Finally found a Xenix/286 tester, Ethan Lish, Tomorrow's Horizons, Bethesda,
  4379. MD.  Naturally, Kermit would not compile or load -- compiler crashed, segments
  4380. too big, etc.  After much correspondence and hints from Kristoffer Eriksson
  4381. and Warren Tucker, success.  New "sco286" entry in makefile.  Another "?"
  4382. becomes a "+"...
  4383.  
  4384. Added support for Excelan TCP/IP for SCO UNIX 3.2.0 and SCO Xenix 2.3.x,
  4385. from William Bader.  ckcmai.c, ckutio.c, makefile.
  4386.  
  4387. Added BUG command (tells how to report bugs).
  4388.  
  4389. A couple fixes for ATT7300 from Andy Fyfe.  Add two missing closing right
  4390. parens in dialer code, and hangup just by setting speed to zero.
  4391.  
  4392. A couple fixes for AIX 3.1 on the RS/6000 - It uses a PID string in its
  4393. lockfiles, but it is not HDB UUCP.  Changed variable name hz to hertz because
  4394. hz is defined as a symbol in a system include file.  Larry Rosenman, Lehigh
  4395. University.  ckutio.c.
  4396.  
  4397. Tested building program with -DNOICP.  Found a couple other misplaced items
  4398. and moved them to better places.
  4399.  
  4400. ------------------------------
  4401.  
  4402. 5A(156) Sun Sep 23 13:26:18 1990
  4403.  
  4404. DYNAMIC PACKET LENGTH
  4405.  
  4406. Charles Lasner reported a wierd interaction between MS-DOS Kermit and the
  4407. C-Kermit server, when GETting files.  As soon as an error occurred, all
  4408. subsequent files were being reported by MS-DOS Kermit as "100% received".  The
  4409. C-Kermit side of this problem was caused by the dynamic packet length
  4410. calculation, which was a little too draconian.  I had changed this a while
  4411. back to kick in on every packet, not every 8th.  Somehow this seems to have
  4412. disturbed some assumption made by the hairy algorithm, and in Charles's case
  4413. the packet length would drop down from 1000 to 31, yow!  This prevented
  4414. C-Kermit from sending its Attribute packet, which is longer than 31 (so MS-DOS
  4415. Kermit, because of a bug, would think the incoming file was 0-length, hence
  4416. the constant 100% report).  Charles also pointed out that once an error
  4417. occurred, it took forever for the packet size to recover to its original value.
  4418. Solutions: (1) replace the hairy packet-length calculation with a much simpler
  4419. and faster one that I understand, and (2) don't refuse to send an A packet
  4420. just because the current dynamic packet size is something ridiculous like 31.
  4421. The new resizing algorithm is: if there was an error (timeout or checksum) 
  4422. receiving the most recent packet, cut the send-packet length in half (down to
  4423. a minimum of 20); if there was no error, increase it by 5/4.
  4424.  
  4425. Here's another idea for packet length resizing that keeps a history of the
  4426. last n packets.  Push a 1 into the left end of an n-bit shift register if the
  4427. current packet is bad, otherwise push a zero.  The current n-bit value, w, of
  4428. this register is a weighted sum of the noise hits for the last n packets, with
  4429. the most recent weighing the most.  The current packet length is some function
  4430. of w and the negotiated packet length, like:
  4431.  
  4432.   (2^n - 1 - w) / (2^n - 1) * (negotiated length)
  4433.  
  4434. If the present resizing method causes problems, think about this one a little
  4435. more.
  4436.  
  4437. NEW COMMANDS AND FEATURES
  4438.  
  4439. By popular demand (the vote was 21 to 5), changed the UNIX version of C-Kermit
  4440. to not match "hidden" files (whose names start with ".") when SEND filespec
  4441. starts with "*" or "?".  The overwhelming sentiment was that Kermit should
  4442. behave like ls and the shell.  This is a simple 1-line comparison added to
  4443. match() in ckufio.c.  You can still send hidden files by starting the SEND
  4444. filespec with ".", as in "send .*", "send .k*c", etc.  Unfortunately, this
  4445. change means that there is no way to send all the files in a directory -- both
  4446. hidden and nonhidden, in a single command.  "send *" gets the nonhidden files,
  4447. send ".*" gets the hidden ones.  To put it back the old way, add -DMATCHDOT to
  4448. your make entry.  "*.*" does not match hidden files (nor does it in the shell
  4449. or ls).  Anybody want to change their vote?
  4450.  
  4451. Added a new transfer character set: Latin/Cyrillic.  Added support for three
  4452. file character sets to go along with it: Latin/Cyrillic itself (little used so
  4453. far), "Alternative Cyrillic" (popular among Soviet programmers and recently
  4454. adopted by IBM as Code Page 866), and KOI-8 (reportedly used on UNIX systems
  4455. in the USSR).  All of this depends on the symbol CYRILLIC being defined.  If
  4456. it is not, the translations work as before, and the program is no bigger.  At
  4457. first I thought I would need to change the logic of the program because it
  4458. would not be practical to translate between Cyrillic and Roman alphabets.  But
  4459. then I realized that KOI-8 is designed specifically to be rendered in Roman
  4460. characters, simply by chopping off its 8th bit (the Russian & Roman characters
  4461. match up phonetically for the most part).  So I completely sidestepped this
  4462. problem, and did the whole thing just by adding and updating a few tables; you
  4463. can still translate anything to anything.  If you #define CYRILLIC in
  4464. ckcxla.h, all the Cyrillic translations will be compiled in, at a cost of
  4465. about 1760 bytes to the program image.  Since this is so small, I'm leaving it
  4466. in by default for now.  ckcxla.h, ckuxla.h, ckuxla.c.
  4467.  
  4468. Added translation of AE/ae ligature to Ae/ae for tcs=Latin1, fcs=ASCII,
  4469. language=(any Scandinavian).
  4470.  
  4471. It seems that the code that was added to ckudia.c to notice when a Hayes-like
  4472. modem reports a different CONNECT speed than the dialing speed and changes
  4473. Kermit's speed automatically is not appropriate for speed-matching modems.
  4474. Reportedly, for example, a Hayes 9600bps modem will keep its DTE-side speed at
  4475. 9600, no matter what speed it negotiates with the other modem.  BUT... it
  4476. still reports the negotiated speed, like "CONNECT 2400", even though it
  4477. doesn't change its DTE speed.  So we don't want our speed-changing code to
  4478. kick in at this point.  However, older modems (like Hayes 2400) *do* change
  4479. their DTE speeds when dropping down from the dialing speed.  So... A command
  4480. is required to let the user tell Kermit whether to believe the CONNECT <speed>
  4481. message or not.  This has been added as an optional trailing field to the SET
  4482. MODEM <name> command:
  4483.  
  4484.   SET MODEM <name> [ { CHANGES-SPEED, MATCHES-SPEED } ]
  4485.  
  4486. The default is CHANGES-SPEED, for compatibility with earlier releases and most
  4487. existing modems, meaning Kermit should believe and act on the CONNECT <speed>
  4488. message.  If MATCHES-SPEED is selected, Kermit will not change its speed, even
  4489. if the message implies it should.  ckudia.c, ckuus3.c.  SHOW COMMUNICATIONS
  4490. shows the current setting.  Presently this mechanism applies only to Hayes, US
  4491. Robotics, and HST Courier modems.
  4492.  
  4493. Added a new feature, sort of an analog to the initialization file.  Upon exit,
  4494. if a macro called "on_exit" is defined, Kermit executes it just before
  4495. terminating itself.  This macro can, of course, be defined in your
  4496. initialization file.  ckuusx.c.
  4497.  
  4498. Added SET FILE BYTESIZE command to go along with SET { COMMAND, TERMINAL }
  4499. BYTESIZE.  Default is 8.  ckuus3.c.
  4500.  
  4501. Changed SHOW MACROS to only show macros.  Added SHOW ARGUMENTS, SHOW
  4502. VARIABLES, SHOW ARRAYS, SHOW GLOBALS, SHOW FUNCTIONS.
  4503.  
  4504. Added variable \v(system) and \v(platform).  The former is (presently) "UNIX"
  4505. or "VMS" or "unknown", determined via #ifdefs in ckuus5.c, function vnlook.
  4506. Mac, Amiga, etc, developers, please let me know the symbols I can use to add
  4507. to this list.  \v(platform) is simply a copy of the string ckxsys, like "SUNOS
  4508. 4.1" or "NeXT Mach 1.0", etc.  These variables are handy for writing
  4509. transportable command files & macros.
  4510.  
  4511. Added variable \v(filespec), to contain the file specification from the most
  4512. recent SEND or GET command.  Peter Mauzey's suggestion.
  4513.  
  4514. Added variable \v(ndate) - date in numerical format, e.g. 1991/09/22, suitable
  4515. for lexical comparison, sorting, etc.  Depends on ztime returning English
  4516. 3-char abbreviations for months, might not work on "localized" systems.
  4517.  
  4518. Changed \fvalue() to \v(return).  It makes more sense as a variable.  ckuus4.c.
  4519.  
  4520. Removed \fmodulus(n,m).  It's available as \feval(n % m).
  4521.  
  4522. Changed \fsubstring(string,start,length) to return rest of string if length
  4523. argument omitted, and to return whole string if both length and start are
  4524. omitted.
  4525.  
  4526. Changed ASK and ASKQ to allow the prompt to be specified in braces to prevent
  4527. trailing spaces from being deleted.  Ditto for SET PROMPT.  Made better help
  4528. messages.
  4529.  
  4530. Changed CLEAR command to work in remote as well as local mode, and to set the
  4531. SUCCESS flag appropriately.  ckuusr.c.  Changed ttflui() to clear file
  4532. descriptor 0 if called in remote mode.  ckutio.c.
  4533.  
  4534. Changed code that reads lines from command files to trim trailing whitespace
  4535. between last nonblank char and line terminator.  This removes the confusion
  4536. that occured when a continued line has whitespace after the hyphen.  ckuus5.c.
  4537.  
  4538. Added SET TRANSMIT EOF <string> to allow TRANSMIT to automatically send the
  4539. specified string (like \4 = Ctrl-D) on end of file.
  4540.  
  4541. Changed meaning of command-line option -w to mean "write over files", rather
  4542. than "don't write over files" because the default filename collision action is
  4543. now to back up a file when a new file arrives with the same name.  ckuusy.c.
  4544.  
  4545. Installed change from Andy Fyfe to allow ATT7300/3B1 internal modem to dial
  4546. either pulse or tone.  Previously it only did tone dialing.  ckutio.c.
  4547. Increased dial time for this modem from 25 to 30 seconds.  ckudia.c.
  4548.  
  4549. Added CKVKER.MMS to the distribution, from Piet Plomp, Groningen University,
  4550. Netherlands.  This is a "makefile" for VAX/VMS that uses MMS (if you have it;
  4551. I think it's part of CMS, the Code Management System, a "layered product").
  4552. This is an alternative to the three DCL files CKVKER.COM, CKVMAK.COM and
  4553. CKVCDT.COM.
  4554.  
  4555. Added minor fixes & rename() routine to CKVFIO.C, and fixes to fix bps/cps
  4556. confusion (and a few other things) in ckvtio.c (Wm Bader).
  4557.  
  4558. Installed changes from Peter Mauzey, agreed to by John Chmielewski (both of
  4559. AT&T), for AT&T DTDM dialing.  ckudia.c.
  4560.  
  4561. BUGS FIXED
  4562.  
  4563. Discovered that "kermit -r", "kermit -s" didn't work any more in BSD
  4564. implementations.  No characters could be read from the communication line.
  4565. The reason for this finally penetrated...  The tty needs to have the CBREAK
  4566. bit set.  I made this discovery last edit, but thought it was required only
  4567. for local mode.  Now I realize it's always required, but for remote mode it
  4568. was being set by the command parser in concb().  When the command parser is
  4569. not used (as in "kermit -r") it wasn't being set.  So now ttpkt() always sets
  4570. it.
  4571.  
  4572. Fixed a bug that caused C-Kermit to go into an infinite beeping loop when
  4573. reading a command file that contained certain control characters, like Ctrl-D.
  4574. ckucmd.c.
  4575.  
  4576. Fixed problem with CONNECT command telnet negotiations that surfaced when
  4577. connecting to a half-duplex system, transferring a file, and reconnecting.
  4578. Kermit would start the telnet negotiations all over again on the second and
  4579. subsequent CONNECTs, which for some reason known only to the VM/CMS telnet
  4580. server, caused the SGA and ECHO options to become messed up.  Now Kermit
  4581. remembers about this and only negotiates once per session.  This change also
  4582. fixes the problem in which connecting to a SET HOST host after giving a BYE
  4583. command to the server causes Kermit to disappear.  ckucon.c, ckuus3.c.
  4584.  
  4585. MIPS users reported that the process group test (comparing Kermit's process id
  4586. to the controlling terminal's process id) does not work.  I think this must be
  4587. a MIPS bug.  Every computer that allows this sort of thing (because it defines
  4588. the TIOCGPGRP ioctl) says these two pgids are equal when Kermit is running in
  4589. the foreground, except MIPS.  So I #ifdef'd this test out for MIPS.  ckutio.c.
  4590.  
  4591. Discovered that "output \b" no longer sends a BREAK signal, but just a "b".
  4592. This is because of a change I made a while back to let \ followed by any
  4593. non-special character (other than %, &, v, f, {, etc) simply quote that
  4594. character, but with the backslash removed.  There's no way to fix this,
  4595. because by the time the OUTPUT command gets the text, the backslash is already
  4596. gone.  So the notation has to change to "output \\b".  Sorry.
  4597.  
  4598. Fixed command parser to restore normal prompt if Ctrl-C typed while a special
  4599. prompt was being used, as in ASK or multiline GET.  Increased size of prompt
  4600. buffer to allow for fancy prompts.
  4601.  
  4602. Discovered a truly obscure bug.  In a command like this:
  4603.  
  4604.   IF = 1 \fexec(macro) ECHO FOO
  4605.  
  4606. the IF comparison will not work if the macro executes an IF command with
  4607. a different condition.  Temporarily patched this by saving and restoring the
  4608. IF condition-code around calls made by \fexec().  I say "patch" because what's
  4609. needed in the general case is yet another stack for such items.  ckuus4.c.
  4610.  
  4611. Changed IF DEFINED to succeed only if the variable is defined and has a
  4612. non-null value.  Previously it could succeed if the variable was defined but
  4613. had a null value, as in "asg \%a \%1, if def \%a xxx" (where \%1 was
  4614. undefined).
  4615.  
  4616. Fixed parsing of SET COUNT.  It did not allow comments.  Removed SET COUNT
  4617. ARGC, no longer necessary because now you can SET COUNT \v(argc).
  4618.  
  4619. Noticed that SHOW MACROS always returned a SUCCESS value of zero, which caused
  4620. any command file that contained this command to terminate immediately.  Fixed,
  4621. ckuus4.c.
  4622.  
  4623. Fixed a bad typo in ckcpro.w, in which "=" should have been "==" (thanks to
  4624. William Bader).  This one could have prevented servers from responding
  4625. properly to GET or REMOTE commands.  Several other possibly important lint
  4626. findings reported by William also corrected in various modules.
  4627.  
  4628. Fixed SHOW FILE to report FILE COLLISION setting correctly (Andy Fyfe).
  4629.  
  4630. In ckucmd.c, declared malloc() correctly and removed casts (Kristoffer).
  4631.  
  4632. Changed INPUT command to strip carriage returns when writing to UNIX session
  4633. log if SET SESSION-LOG TEXT is in effect (Jay Rouman).  ckuus4.c.
  4634.  
  4635. Fixed REINPUT.  For me, at least, it only worked when DEBUG was set on
  4636. (which made it pretty hard to debug the problem!).  Turns out to have been
  4637. an unterminated string.  Plus I forgot to free some malloc'd memory.  ckuus4.c.
  4638.  
  4639. Fixed popcmd() in ckucmd.c to not attempt to strcpy a string whose pointer
  4640. was null.  This was causing core dumps under certain (rare) conditions, like
  4641. when \fexec() functions recursed too deeply.
  4642.  
  4643. Removed the restriction that SET RETRIES value must be greater than number of
  4644. window slots.  This restriction was added in edit 138, for a good reason (see
  4645. 138 notes).  But the change made in edit 155 makes it unnecessary.  So now
  4646. it's gone.  ckuus3.c, ckcfns.c.
  4647.  
  4648. TESTING...
  4649.  
  4650. Tried running a C-Kermit server as a UNIX login shell.  This can't be done
  4651. directly by putting "kermit -x" as the shell in /etc/passwd, because you
  4652. can't put command-line arguments in the passwd file.  But it works fine if
  4653. you use a shell script like this for the login shell:
  4654.  
  4655.   SHELL=/bin/sh
  4656.   export SHELL
  4657.   /usr/local/kermit -x
  4658.  
  4659. If you don't include the SHELL business, then the many operations done by the
  4660. Kermit server (like executing REMOTE commands) requiring a shell will use the
  4661. user's login shell, which is Kermit itself, with pretty strange results...
  4662.  
  4663. Edit 156 was run through lint and through gcc with all its picky options.
  4664. It was compiled and tested on the following systems:
  4665.  
  4666.   DECstation 5810, Ultrix 4.0 (make ds4)
  4667.   Encore Multimax 510, 4.3 BSD (make encore)
  4668.   IBM 4381, AIX 3.0 under VM/CMS (make aix370)
  4669.   IBM PS/2, AIX 3.0 (make ps2aix)
  4670.   MicroVAX II, Ultrix 2.0 (makd bsd)
  4671.   MicroVAX II, VMS 5.3 (@ckvker.com)
  4672.   NeXT, Mach 1.0 (make next)
  4673.   SUN 4/280, SUNOS 4.1, BSD environment (make sunos41)
  4674.   SUN 4/280, SUNOS 4.1, System V R3 environment (make sunos41s5)
  4675.   VAX-11/750, 4.3 BSD (make bsd43)
  4676.  
  4677. The VAX/VMS version is still a bit rocky, and will be improved in future
  4678. edits.
  4679.  
  4680. When I tried to run the version I had compiled with gcc, I had two unnerving
  4681. symptoms -- symptoms that other people have been reporting for some time:
  4682.  
  4683.   1. During local-mode operations (like sending REMOTE commands to a remote
  4684.      server), I get strange messages like "flush fails: IOCTL inappropriate
  4685.      for device".
  4686.   2. The program fails the foreground test, so there is no prompt.
  4687.  
  4688. I suspect that gcc must be using different include files, and we wind up
  4689. making some bad system calls.  If these things are happening to you, try using
  4690. your computer's regular cc and see if the problem goes away.
  4691.  
  4692. MORE TESTING NEEDED...
  4693.  
  4694. Piet Plomp reports that all IBM AIX systems, not just AIX/RT, use the
  4695. weird multi-lockfile convention.  This is undocumented in AIX manuals, but can
  4696. be verified by looking at what cu does.  AIX users, please do this:
  4697.  
  4698.   1. Get a directory listing of /etc/locks/.
  4699.   2. Start cu on a dialout port, escape to the local shell,
  4700.      and get another directory listing of /etc/locks/.
  4701.   3. Send me the two directory listings.
  4702.  
  4703. I have had reports that edit 155 does not build cleanly on Xenix/286.  Several
  4704. people are working on this, but if anyone else can offer tips, please do.
  4705.  
  4706. Still need someone with MINIX to try "make minix" and let me know the
  4707. results!
  4708.  
  4709. ------------------------------
  4710.  
  4711. 5A(155) Thu Aug 30 02:11:39 1990
  4712.  
  4713. Several major topics in this edit.
  4714.  
  4715. SLIDING WINDOW PROTOCOL
  4716.  
  4717. Thanks to a debug log sent in by Ted Medin (and thanks to his persistence in
  4718. trying to convince me there was a bad problem in the sliding window code), I
  4719. found a case where send-packet buffers were being deallocated prematurely, so
  4720. that any attempt to retransmit them would result in horrible errors.  Moved
  4721. the buffer deallocation, a few statements down (in the input() function), so
  4722. that a send buffer is not deallocated until it is rotated out of the window,
  4723. and also took pains to make sure that an ACK for a packet ahead of winlo
  4724. caused that packet to be marked as ACK'd, so that this ACK could be returned
  4725. when the packet number popped up to the top of the window.  ckcfn2.c.
  4726.  
  4727. A little more behavioral analysis...  What happens if I'm sending a file from
  4728. a PC to C-Kermit using, say, 7 window slots, and I remove the data wire for a
  4729. couple seconds?  (I'm sure you've often asked yourself this question.)  When
  4730. the wire is reconnected, C-Kermit gets a packet far ahead of the one it wants.
  4731. So it stores the packet away, but sends no response to the PC.  This results
  4732. in a lengthy timeout/retransmit recovery phase, for example (5 sec x 7 window
  4733. slots = 35 seconds).  Wouldn't it be better if the file receiver sent a NAK
  4734. for the expected packet if it got a packet ahead of the one it needed?  Yes,
  4735. but C-Kermit used to do this until I discovered that this strategy, applied
  4736. blindly, could result in many unnecessary retransmissions and even failure
  4737. because of too many retries.  So now the file receiver, upon receipt of a
  4738. packet ahead of the expected one, sends a NAK for the expected, but only if
  4739. that one had never been NAK'd before.  Testing shows that this clears up
  4740. deadlocks much faster than before without automatically causing a windowful
  4741. of retransmissions.
  4742.  
  4743. Discovered that C-Kermit did not handle rejection well (who does?).  The
  4744. problem was in the sxeof() routine -- it tried to allocate a send buffer after
  4745. one had already been allocated.  This same thing probably happened any time
  4746. there was an error and C-Kermit had to send an EOF packet with "D" data,
  4747. telling the receiver to discard.  Fixed in ckcfn2.c.
  4748.  
  4749. FLOW CONTROL DURING PACKET OPERATIONS
  4750.  
  4751. All these years, it has been a source of great annoyance that flow control did
  4752. not work in packet mode in BSD UNIX implementations.  But I found that 4.3BSD
  4753. (don't know about 4.2 or earlier) has a local modes word in which one can set
  4754. the LPASS8 bit, meaning to pass 8-bit data, which does not affect flow
  4755. control.  I added sections to the BSD sections of ttopen(), ttpkt(), and
  4756. ttres() conditionalized on the existence of LPASS8 to use it if it's
  4757. available.
  4758.  
  4759. Unfortunately, this had the unpleasant side effect of allowing quit and
  4760. interrupt signals to interfere with file transfer and even cause core dumps if
  4761. a QUIT character arrives.  So in ttpkt() I added "signal(SIGINT,SIG_IGN)", but
  4762. only for remote mode because we still want the real Ctrl-C trap active in
  4763. local mode, and changed connoi() to set SIGQUIT to SIG_IGN instead of SIG_DFL.
  4764.  
  4765. But that had another unpleasant side effect: Two Ctrl-C's could no longer be
  4766. used to interrupt a remote-mode Kermit in packet mode, because when you set
  4767. SIGINT to SIG_IGN, UNIX *really* ignores the interrupt character, and does not
  4768. pass it to the program when you type it.  To get around this, I added code to
  4769. ttopen() to read the interrupt character from the tchars structure, to ttpkt()
  4770. to set it to -1 during packet mode, and to ttres() to restore it.  Everything
  4771. worked fine in remote mode, but I could not transfer files at all in local
  4772. mode: the local C-Kermit's ttinl() function could not read even one character
  4773. from the communication line.  So I added one further change: for local mode
  4774. only, set the CBREAK bit.  I have no idea why this is necessary.
  4775.  
  4776. Testing the System V version, I found that ^C^C does not, and apparently never
  4777. did, interrupt a remote kermit out of packet mode.  So I added
  4778. "ttraw.c_cc[VINTR] = 0;" to ttpkt() in the Sys V case.  Now it works.
  4779.  
  4780. INTERRUPTS
  4781.  
  4782. Made CONNECT's lower fork ignore SIGINT and SIGQUIT interrupts.  This corrects
  4783. problem with ^\! (escape to local shell from connect mode) experienced on some
  4784. systems, in which Ctrl-C typed at escaped-to shell would invoke Kermit's
  4785. interrupt handler rather than the shell's own.  Thanks to Chuck Hedrick for
  4786. this one.  ckucon.c.
  4787.  
  4788. MODEM SIGNALS, HANGING UP, AND DIALING
  4789.  
  4790. Increased sleep from 1/2 sec to 1 sec before declaring DIAL succeeded, because
  4791. some systems "blink" DTR at this point, and connecting too soon could cause
  4792. an i/o error (from John Chmielewski, based on experience with AT&T systems
  4793. using the DTDM modem).  John also discovered that the "sleep(3)" that was
  4794. removed in edit 151 is necessary after all, because of what happens when one
  4795. DTDM dials another DTDM.
  4796.  
  4797. Also from John Chmielewski: In tthang(), 3B2 systems need the CLOCAL flag to
  4798. be OFF (unlike the Tandy 6000, which requires it to be ON).  So now there is
  4799. a special case for 3b2's within #ifdef u3b2..#endif ("u3b2", John says, is
  4800. defined by the 3b2 compiler).  There is probably a better way to do this...
  4801. ckutio.c.
  4802.  
  4803. Added additional bulletproofing to ckudia.c: if ttpkt() fails, it will try
  4804. to close and reopen the device and then try ttpkt() again - same trick as is
  4805. used in ckucon.c if ttvt() fails, which seemed to help CONNECT a lot.
  4806.  
  4807. MISCELLANEOUS
  4808.  
  4809. Re-enabled dynamic packet length recalculation, changed it from every 8th
  4810. packet to every packet.  Added code to kick it in not only on reception of a
  4811. corrupted packet, but also whenever a NAK is received or a timeout occurs.
  4812. Tested it over a horrible connection, seems to work well.  ckcfn2.c.
  4813.  
  4814. Fixed up local-mode file transfer message and interrupt characters, so now it
  4815. takes both upper and lower case characters, as well as the control versions:
  4816. A/a/Ctrl-A for status report.  Allow CR or LF as well as ^R/R/r to resend a
  4817. packet, ^X/X/x as well as ^F/F/f to cancel file, ^Z/Z/z as well as ^B/B/b to
  4818. cancel batch.
  4819.  
  4820. Added REMOTE SET FILE COLLISION command, both ends.  You can send this command
  4821. from C-Kermit to a remote server, and you can send this command to a C-Kermit
  4822. server, like from MS-DOS Kermit.
  4823.  
  4824. Changed "make sys5r3" to include -DDIRENT and -DHDBUUCP, since these are both
  4825. part of the System V R3 definition.  Hope this doesn't cause any trouble (it
  4826. probably will).  Removed "sys5r3hdb".
  4827.  
  4828. Moved the "set languages" table from ckuus3.c to ckuxla.c, since it is not
  4829. necessarily universal to all implementations of C-Kermit.
  4830.  
  4831. Added code to protocol module in <rdata>D case to close the file and keep or
  4832. discard it, depending on SET INCOMPLETE KEEP setting (the keep flag), if there
  4833. is an error writing data out to disk.  ckcpro.w.
  4834.  
  4835. Added code to reof() to not discard a file if the keep flag is set.  ckcfns.c.
  4836.  
  4837. Added ERROR command to send an error packet.  Handy when you've got a Kermit
  4838. on the other end of the connection in packet mode but in some unknown state,
  4839. like when you've Ctrl-C'd out of a file transfer from local-mode C-Kermit.
  4840.  
  4841. Changed SET COMMAND { 7, 8 } to SET COMMAND BYTESIZE { 7, 8 } to make it
  4842. have the same syntax as SET TERMINAL BYTESIZE.
  4843.  
  4844. Added more (invisible) command synonyms for VMS and UNIX users.  ckuus[r3].c.
  4845.  
  4846. Removed more unused code.
  4847.  
  4848. TESTING
  4849.  
  4850. Compiled it myself for the first time on a PS/2 with AIX 3.0.  Compiles fine,
  4851. seems to run OK in remote OK over a telnet connection, but I had no way of
  4852. testing dialout or local mode.
  4853.  
  4854. Fixed declaration of lklockf[] in ttlock() for RT AIX, from Piet Plomp
  4855. ckutio.c.  With this change, he says RT AIX lockfile stuff now works correctly.
  4856.  
  4857. Edit 154 tested successfully on AT&T 6300 with SET DIAL HANGUP OFF, at last.
  4858.  
  4859. Measured C-Kermit performance on a very heavily loaded long-distance TCP/IP
  4860. (SET HOST) connection from NYC to Long Beach, CA, where the round trip delay
  4861. varied between 1 and 10 seconds.  Running C-Kermit 154 on a SUN in Long Beach,
  4862. against C-Kermit 154 on a SUN in New York, gave the following results:
  4863.  
  4864.     Packet   Window  Throughput
  4865.     Length   Slots    (CPS)      Comments
  4866.  
  4867.       90       1       118       No problems
  4868.       90       7       156       No problems
  4869.     1000      20       556       No problems
  4870.     2000      20       117       Lots of timeouts and retransmissions
  4871.     1500      20       654       No problems
  4872.     1500      30       213       Lots of timeouts and retransmissions
  4873.  
  4874. So a good combination of packet length and window size boosts performance
  4875. by nearly 600%.  Sending too many characters at once overloads the telnet
  4876. server at the receiving system and it drops characters.  This is demonstrated
  4877. clearly by repeating the same experiment with a DECstation at Long Beach,
  4878. whose telnet server drops characters if they come in bursts of more than about
  4879. 400 (these measurements were taken when the network was somewhat less loaded):
  4880.  
  4881.     Packet   Window  Throughput
  4882.     Length   Slots    (CPS)      Comments
  4883.  
  4884.       90       1       151       No problems
  4885.      200       1       165       No problems
  4886.      500       1         0       Total failure, no packets got through
  4887.       90       2       172       No problems
  4888.      120       2       238       No problems
  4889.      200       2       357       No problems
  4890.      300       2         0       Total failure
  4891.       90       3         0       Total failure
  4892.  
  4893. Improvements from sliding windows would probably be even greater on virtual
  4894. circuit networks, but so far none have been available for benchmarking.  For
  4895. comparison, using C-Kermit SET HOST connections over my own local Ethernet
  4896. between two SUN-4/280s looks like this:
  4897.  
  4898.     Packet   Window  Throughput
  4899.     Length   Slots    (CPS)      Comments
  4900.  
  4901.       90       1       5142
  4902.     1000       1      18000      18000 seems to be top speed.
  4903.     1000       4      18000
  4904.     4000       4      18000
  4905.  
  4906. Since there are no delays in this connection, windows don't help.  Kermit's
  4907. throughput could be much higher than ftp's if it didn't have to go through
  4908. the telnet server.  Future project: a TCP/IP Kermit server?
  4909.  
  4910. OUTSTANDING PROBLEMS
  4911.  
  4912. Always a few.  If you're telnetted (SET HOST) to another computer and you
  4913. get an i/o error, the local C-Kermit just disappears.  I can't figure this
  4914. one out.  Debug logs show that it happens inside the write() system call;
  4915. write() simply doesn't return.
  4916.  
  4917. If you telnet to a half duplex host, local echo is negotiated automatically
  4918. via telnet SGA.  OK so far.  Then if you escape back, transfer a file, and
  4919. reconnect, the local echo setting is lost.
  4920.  
  4921. ------------------------------
  4922.  
  4923. 5A(154) Thu Aug 23 15:09:49 1990
  4924.  
  4925. Can binary files containing 0xFF characters be transferred over TCP/IP telnet
  4926. SET HOST connections?  Yes.  (But don't ask me how!)
  4927.  
  4928. Tested with "make bsd" on DECstation 5810 with Ultrix 4.0.  Despite compiler
  4929. warnings about signal()-type, it worked.  Changed SIGTYP in ckcdeb.h from a
  4930. typedef to a #define.  Now you can add -DSIGTYP=void or -DSIGTYP=int to your
  4931. makefile entry, rather than having to edit ckcdeb.h.  Made a new make entry
  4932. "ds4" for DECstation with Ultrix 4.0 using this SIGTYP.  For a complete make
  4933. entry, still need to find out whether it has saved original setuid, and what
  4934. its uucp lockfile conventions are.
  4935.  
  4936. Peter Mauzey reports that the error-after-receiving-1K-of-file problem is
  4937. fixed in edit 153.
  4938.  
  4939. Added another CONNECT-mode escape: any backslash numeric code, like
  4940. \65 to send an A, \240 to send an 8-bit character, \xff to send a hex
  4941. character, etc.  To use it, type the escape character, then backslash followed
  4942. by the radix indicator and number, then carriage return.  If what you typed
  4943. translates into a legal number in the range 0 - 255, it will be sent,
  4944. otherwise Kermit will beep.
  4945.  
  4946. Fixed the file character count as reported by STATISTICS and in the
  4947. transaction log for files sent by C-Kermit.  Until now, this number was always
  4948. a little bit too big because it included not only the file's contents, but
  4949. also its name.
  4950.  
  4951. Found that I had busted string expansion in a seemingly innocent change a few
  4952. edits ago.  Statements like "for \%i \%j \%x 3" no longer worked.  Fixed it.
  4953.  
  4954. Upon program startup, the new variable \v(args) is set to the main program's
  4955. argc, i.e. the number of command line arguments including the program name,
  4956. and the array \&a[] is declared to be of that size and filled with the
  4957. arguments themselves.  So \&a[0] is the filespec of the Kermit program, etc.
  4958. You can display the program's argument count and vector like this:
  4959.  
  4960.   echo argc = \v(args)
  4961.   for \%i 0 \feval(\v(args)-1) 1 { echo argv(\%i) = \&a[\%i] }
  4962.  
  4963. Added a new command-line switch "=", which tells Kermit's command-line option
  4964. parser to ignore all following command line options.  This allows you to write
  4965. Kermit commands that process any old command-line arguments, and therefore
  4966. provides a way to extend Kermit's command-line argument syntax.  For example:
  4967.  
  4968.   kermit = arg1 arg2 "arg3 is a quoted bunch of args" arg4
  4969.  
  4970. In this case \&a[1] is "=", \&a[2] is "arg1", etc.
  4971.  
  4972. This would be a nice feature if Kermit's command parser could handle variables
  4973. that expand into multiple words.  Then you could do:
  4974.  
  4975.   kermit = "set parity mark" "send oofa.txt" "statistics"
  4976.  
  4977. and then within Kermit:
  4978.  
  4979.   for \%i 2 \feval(\v(args)-1) 1 \&a[\%i]
  4980.  
  4981. to execute each command.  Unfortunately, it would take major surgery on the
  4982. command parser to make this work.  I spent a day on it and gave up.
  4983.  
  4984. Got rid of all the disgusting nested #ifdef's at the top of ckufio.c and
  4985. ckutio.c that are used to define the system version string.  Moved them to a
  4986. common place, a new file, ckuver.h, and reorganized them to (a) make sense,
  4987. and (b) make it easy to add new ones.
  4988.  
  4989. Added code to trap() to close any files that were open because they were being
  4990. transferred, so now you can transfer another file after Ctrl-C'ing a
  4991. local-mode file transfer without Kermit complaining "Can't open file".
  4992.  
  4993. Added a specific makefile entry for IBM AIX 3.0 on RISC System/6000, based on
  4994. information from Ken Mizialko, IBM, Manassas, VA.  Apparently AIX 3.0 on the
  4995. RS/6000 is a lot different from AIX 3.0 on the 370 or the PS/2.  Also,
  4996. separated the makefile entries for AIX 3.0 PS/2 and 370.
  4997.  
  4998. Built program with -DNOICP again, found & corrected a few problems (ckucmd.c
  4999. NOICP case needed a couple more header files).
  5000.  
  5001. Ran the program through gcc with -Wpointer-arith -Wcast-qual -pedantic.  Not
  5002. a single valid complaint about any of the Kermit modules, but lots of
  5003. complaints about header files from /usr/include(/sys).
  5004.  
  5005. From Patrick Wolfe: in zkself(), use "exit(kill(getppid(),1))" to increase
  5006. the chances that a server that logs itself out given the BYE command will
  5007. also hang up the phone.
  5008.  
  5009.  
  5010. 5A(153) Wed Aug 22 19:52:47 1990
  5011.  
  5012. CONTROL-C TRAP
  5013.  
  5014. Previously, Ctrl-C trapping was turned off during the INPUT command, because
  5015. it would cause a core dump.  Chuck Hedrick found the solution here was to
  5016. put an alarm(0) in the Ctrl-C trap to turn off the timer that was set by the
  5017. INPUT command.  Rather than do that, I added a new system dependent function,
  5018. ttimoff(), to turn off timer interrupts because we can't count on all C
  5019. compilers / libraries providing an alarm() function.  For now the call to
  5020. ttimoff is within #ifdef UNIX..#endif.  Everybody else should add this
  5021. function to their ck?tio.c modules so this fix can apply universally.
  5022.  
  5023. Finally, after all these years, I fixed the Ctrl-C trap to work during
  5024. local-mode file transfer.  Thanks to Howie Kaye of CUCCA for suggesting the
  5025. answer: The setjmp for Ctrl-C trapping was done inside the parser() function,
  5026. but when packet protocol is active we have returned from the parser, thereby
  5027. deallocating the environment from which setjmp was called.  Solution: move the
  5028. setjmp to top level in main().  This required a lot of code reorganization.
  5029. The Ctrl-C trapping business remains conditional within #ifndef
  5030. NOCCTRAP..#endif, in case your C compiler does not support setjmp/longjmp (or
  5031. calls them by different names).  Ctrl-C trapping now seems to work anywhere
  5032. while typing a command, during execution of a command, during file transfer,
  5033. and even during file transfer initiated from command-line options (like
  5034. "kermit -l /dev/ttyxx -cnr").  And, thanks to the previous change, during
  5035. INPUT.
  5036.  
  5037. Unfortunately, Ctrl-C trapping seems to work in UNIX only, not VMS.
  5038.  
  5039. USER INTERFACE
  5040.  
  5041. Added REMOTE DELETE status to SHOW SERVER.
  5042.  
  5043. Changed the main program to look at argv[1] (if any).  If it is the name of a
  5044. readable file, then do a TAKE command on it after executing the initialization
  5045. file (if any), and before executing any command-line options and/or entering
  5046. the interactive command parser.  So a command like this:
  5047.  
  5048.   kermit cmdfile -p e
  5049.  
  5050. results in the following actions:
  5051.  
  5052.   1. Execute commands from init file;
  5053.   2. Execute commands from cmdfile;
  5054.   3. Set parity to even;
  5055.   4. Issue C-Kermit> prompt for interactive commands.
  5056.  
  5057. Perhaps you're wondering what motivated this feature.  It is the ability of
  5058. the Unix shell (any Unix shell: sh, csh, or ksh) to read a line of the form:
  5059.  
  5060.   #!/dir/filespec
  5061.  
  5062. at the top of a "shell script", and execute the "shell" given in the filespec.
  5063. In this case, the shell is Kermit.  This lets you write a Kermit command file
  5064. or script program and execute it directly without having to run Kermit first,
  5065. kind of like clicking on a Macintosh data file and having the Mac start up the
  5066. appropriate application automatically.  The filespec has to be a full
  5067. pathname, as in:
  5068.  
  5069.   #!/bin/local/kermit
  5070.  
  5071. As luck would have it, this first line is ignored by Kermit when it reads the
  5072. file because "#" is a comment introducer.  To make a Kermit command file work
  5073. in this way, you have to set the execute permission bit with "chmod +x".
  5074.  
  5075. I don't see any way to make a VMS DCL command procedure invoke Kermit like
  5076. this.  Do you?
  5077.  
  5078. MODEM SIGNALS, HANGUP, ETC
  5079.  
  5080. Found a possible bug in tthang(), in the BSD case where the "close(open())"
  5081. magic was being done to clear an error condition: priv_opn(ttnmsv) was being
  5082. called, instead of do_open(), and it was being called without the required
  5083. second argument, which would result in garbage modes being set.  Replaced the
  5084. erroneous priv_opn() call with do_open().  Thanks, lint.
  5085.  
  5086. Jay Rouman found that tthang() stopped working for him on his Tandy 6000
  5087. System V based Xenix in edit 151, with its new trick of setting c_cflag to 0.
  5088. He tried all combinations of bits and discovered that setting CLOCAL to 0
  5089. prevents hangup from working, but the others don't seem to hurt.  So now the
  5090. famous statement which originally said:
  5091.  
  5092.     ttcur.c_cflag &= ~CBAUD;        /* Change the speed to zero.  */
  5093.  
  5094. and then in edit 151 said:
  5095.  
  5096.     ttcur.c_cflag = 0;            /* Change all flags to zero.  */
  5097.  
  5098. now says:
  5099.  
  5100.     ttcur.c_cflag = CLOCAL;        /* Change all but CLOCAL to zero.  */
  5101.  
  5102. I also noticed that when the remote system drops carrier, the local system's
  5103. tty driver drops DTR, so that when you connect back to the remote system, it
  5104. won't talk to you.  So I added a call to tthang() in CONNECT, right after it
  5105. gets the "Communications disconnect" error.  This seems to do the trick
  5106. nicely.  Now subsequent CONNECTs after a disconnect almost always work.  It
  5107. might be better, however, to add an explicit "turn on DTR" function to
  5108. ckutio.c, at the cost of all the non-UNIX versions having to add it too.
  5109.  
  5110. OTHER
  5111.  
  5112. New CKVFIO.C for VMS from Terry Kennedy.  Fixes some minor problems.  A couple
  5113. fixes made to ck[cu]*.c files for VMS's benefit that Terry had given me for
  5114. edit 151, but which I missed.
  5115.  
  5116. Fixed -DNOICP (no interactive command parser) not to exclude the debug()
  5117. and tlog() routines, which are used even if there is no interactive command
  5118. parser.  Rearranged some other routines that were also affected.
  5119.  
  5120. Added SET CASE { ON, OFF }.  Controls whether alphabetic case is significant
  5121. in string comparisons including INPUT, IF EQUAL, IF LLT, etc etc.  It's just
  5122. a synonym for SET INPUT CASE { OBSERVE, IGNORE }.
  5123.  
  5124. Removed all explicit casts to (void), since they seem to upset so many
  5125. compilers.  Let's hope that their removal won't upset even more of them.  If
  5126. so, we'll have to add a typedef {void, int} VOID bit to ckcdeb.h.
  5127.  
  5128. Fixed up ckwart.c.  Broke up the long string that has been causing so much
  5129. grief to assorted compilers.  Changed "trans" to "transx" and "Trans" to
  5130. "trans".  Reformatted the source code to be consistent with the rest of Kermit
  5131. (not good for diffs, sorry!).
  5132.  
  5133. Fixed STATISTICS command to show speed and efficiency if known.  It used to
  5134. do this before, but somehow the speed variable was getting set back to zero.
  5135. Now the STATISTICS command calls ttgspd() to read the current speed.
  5136.  
  5137. Dozens, maybe hundreds, of lints -- removal of unused variables, functions,
  5138. etc, some mismatched types.  Nothing dramatic, except as noted above.  Maybe
  5139. some of these will cure a few problems.
  5140.  
  5141. TESTING...
  5142.  
  5143. Built, tested, works fine on the following systems.  All my testing is done
  5144. either in remote mode, or (on the SUN) in local mode through a null modem
  5145. cable that goes into another port on the same SUN, or with SET HOST.  I don't
  5146. have access to any dialout modems.  So "works fine" does not necessarily mean
  5147. it works in local mode with a modem.
  5148.  
  5149.  Encore Multimax 510, UMAX 4.3
  5150.  IBM 3083, AIX/370 (VM guest)
  5151.  MicroVAX-II with Ultrix 2.0
  5152.  MicroVAX-II with VMS 5.1
  5153.  NeXT with Mach OS 1.0
  5154.  SUN-4/280 in BSD environment
  5155.  SUN in Sys V environment
  5156.  VAX/750 with 4.3BSD
  5157.  
  5158. Note: AIX/370 is the first system I've encountered where pids are not ints.
  5159. On this system, pid_t is typedef'd as long.
  5160.  
  5161. System V CONNECT-mode behavior is much improved (at least on SUN).  Both
  5162. HANGUP (^\H) and logging out from the remote (causing it to drop carrier)
  5163. result "Communications disconnect" and popping back to prompt.
  5164.  
  5165. DIFFS
  5166.  
  5167. I fixed my diff-making procedure to be consistent with Larry Wall's patch
  5168. program, and ran the diffs through patch myself to make sure they worked.  The
  5169. new diff file is cku153.dif, which is a concatenation of all the diff files
  5170. for UNIX C-Kermit.  All diffs are now context diffs.  Normally there would
  5171. also be a ckv153.dif for the VAX/VMS-specific differences (in the CKV*.*
  5172. files), but all the differences this time around are confined to the CKVFIO.C
  5173. file, and the diff for that is bigger than the file itself.  The differences
  5174. between 151 and 152 remain available in cku152.dif.
  5175.  
  5176. LINGERING (MAYBE NEW) PROBLEMS
  5177.  
  5178. According to Terry Kennedy, the business where spack backs up the data pointer
  5179. to write the packet header into the packet buffer is still writing over random
  5180. memory, despite the fixes I thought I made in edit 151.  The solution for now
  5181. is to have arrays of "padding" allocated just before the packet buffer, whose
  5182. names are alphabetically guaranteed to sort before these buffers (VMS sorts
  5183. its variables).  ckcfn3.c (see bigsbuf, bigsbt, bigrbuf, bigrbt);
  5184.  
  5185. This one discovered by Patrick Wolfe.  SET HOST to another host, login, run
  5186. Kermit there in server mode, escape back, do stuff, then send BYE.  Subsequent
  5187. CONNECT gets some characters, as if Kermit exited to the shell, then an i/o
  5188. error, and then local Kermit disappears, poof!  On Patrick's system, a zombie
  5189. fork was left behind (probably Kermit's lower CONNECT fork).  On my SUN, there
  5190. were no zombies, but Kermit disappeared nonetheless.  Could it have something
  5191. to do with notifying the parent process using SIGUSR1?
  5192.  
  5193. Peter Mauzey reports that on the 3B2/300, dialing out and getting a file from
  5194. a remote server, the transfer consistently fails after the first 1K, i.e.
  5195. after zoutdump() writes out its first buffer.  The debug log shows that
  5196. zoutdump's write operation succeeded, and tracing through the code & debug log
  5197. does not show any obvious way the code could fail if zoutdump succeeded.  My
  5198. only suspicion so far is a compiler error in the evaluation of the zmchout()
  5199. macro (called from decode() in ckcfns.c, defined in ckcker.h).  Peter says
  5200. this did not happen in edit 149, but started happening in 150.  Added
  5201. additional debugging statements to decode() to see what zmchout is doing, plus
  5202. a few "& 0xFF"'s to undo any possible sign extension, and some extra parens in
  5203. the macro suggested by Paul Placeway.
  5204.  
  5205. Rob Weiner reported an "Internal error number 18", which means that rpack()
  5206. was called, but could not allocate a receive buffer, and "resend error NPS",
  5207. meaning No Packet to Send, i.e. resend() was told to retransmit a packet that
  5208. had not been built yet.  Added debugging statements.  If you can make this
  5209. happen reproducibly, send me a debug.log.
  5210.  
  5211. ------------------------------
  5212.  
  5213. 5A(152) Mon Aug 20 13:23:27 1990
  5214.  
  5215. Fixed various problems found & diagnosed by Chuck Hedrick of Rutgers
  5216. University:
  5217.  
  5218. Made ckufio.c do a better job of defining the maximum name length for a file,
  5219. and also added a definition for the maximum path length.  The latter is used
  5220. in declaring the "scratch" array in fgen (the wildcard expander).  The change
  5221. in edit 150 was a disaster for short-filename systems, because it shortened
  5222. the scratch array from 100 to 14, but this array is supposed to hold the
  5223. entire pathname, not just the filename.  Now it should be at least 255, and
  5224. maybe a lot bigger depending on the system's definition of MAXPATHLEN or
  5225. related variables.  Also changed scratch[] from an automatic to a static
  5226. array, because of its possible large size.  ckufio.c.
  5227.  
  5228. Added max file name and path length info to SHOW FILE display.
  5229.  
  5230. In ckutio.c, priv_opn didn't declare its arguments, resulting in garbage modes
  5231. on 16-bit systems.
  5232.  
  5233. And from Patrick Wolfe of Kuck & Assoc's:
  5234.  
  5235. Typo in "make clean" fixed.
  5236.  
  5237. Typo in command-line help message fixed (";" -> ",").
  5238.  
  5239. A variable was referenced in SHOW VERSIONS that should have been ifdef'd
  5240. (you'd notice this if you compiled the program with -DNOCSETS).
  5241.  
  5242. ------------------------------
  5243.  
  5244. 5A(151) Sun Aug 19 02:20:55 1990
  5245.  
  5246. VMS-RELATED CHANGES:
  5247.  
  5248. Changes to system-independent files for VMS, from Terry Kennedy:
  5249.  
  5250.  . Fix filename completion for VMS files.  ckucmd.c.
  5251.  . Make TYPE command to output a CRLF first.  ckuus4.c.
  5252.  . Fix program return code for VMS.  ckuus5.c
  5253.  . Fix DIRECTORY command (VMS wasn't doing it at all).  ckuusr.c
  5254.  
  5255. Plus a brand-new CKVFIO.C module from Terry, which does full RMS i/o for
  5256. both sending and receiving files.  See CKVKER.UPD for details on Terry's work
  5257. on the VMS version.
  5258.  
  5259. SET FILE command.  After much discussion with Terry Kennedy about how to
  5260. support RMS files in VMS, it was decided that many of the fancy SET FILE
  5261. commands were unnecessary -- and dangerous -- and so they have been removed by
  5262. enclosing them within #ifdef COMMENT..#endif: SET FILE FORMAT, SET FILE
  5263. ORGANIZATION, and SET FILE CARRIAGE-CONTROL plus all their suboptions. The
  5264. remaining item is SET FILE RECORD-LENGTH, which is now #ifdef'd only for VMS.
  5265.  
  5266. A new SET FILE TYPE option was added for VMS only: SET FILE TYPE IMAGE.  It
  5267. tells VMS to do naked block i/o on the file, bypassing all RMS record-oriented
  5268. services, like SET FILE TYPE BLOCK in Bliss Kermit-32.  New symbols for the
  5269. values for SET FILE TYPE are defined in ckcfil.h.  The file type is passed to
  5270. the file open routines in the zattr structure, so all the work necessary to
  5271. support it is confined to the system-dependent modules.  This command is only
  5272. parsed, there is no supporting action yet in CKVFIO.C.
  5273.  
  5274. Also, SET FILE TYPE LABELED was added for VMS, to allow a file to be
  5275. transferred along with lengthy information about its characteristics.  See
  5276. description in Info-Kermit V12 #3.  Presently same status as SET FILE TYPE
  5277. IMAGE (parsed, but not executed, supporting code to be added to CKVFIO.C).
  5278.  
  5279. The CKVTIO.C module has not been touched yet, so there are still some rough
  5280. spots in CONNECT mode and packet i/o for VMS.  In particular, if you try to
  5281. send sliding windows into the VAX, you're likely to get buffer overruns
  5282. failures.  This area will be attacked by Terry, most likely in edit 152.
  5283. Anyone who's an expert on VMS terminal i/o, and how to control it from C, is
  5284. urged to contact Terry directly: TERRY@SPCVXA.BITNET.
  5285.  
  5286. PACKET-PROTOCOL RELATED CHANGES
  5287.  
  5288. Changed zminchar (the macro that reads a character from a file) to return
  5289. a value of -2 if there was an i/o error reading the file.  This is
  5290. conditionalized on the existence of the stdio.h ferror macro.  ckufio.c.
  5291.  
  5292. Changed getpkt() to set the cxseen flag if it gets a -2 return from zminchar.
  5293. This should cause Kermit to send an EOF packet right away, with a D in the
  5294. data field, telling the receiver to Discard the file.  ckcfns.c.
  5295.  
  5296. There was a problem in spack(), when the pointer is backed up (up to 7
  5297. positions) behind the data to deposit the packet header, with other program
  5298. variables being written over.  This bit of trickery is intended to relieve the
  5299. program of copying the data into the packet -- it just builds the packet
  5300. around the data that's already there.  There should be no problem with this,
  5301. because the data pointer is allocated 7 positions into the packet buffer.
  5302. But... I discovered that the data pointer was set without the extra 7
  5303. positions by any code that called the encstr() function.  Fixed it in about 5
  5304. places, and I expect that will make the problem go away.  The fix is really
  5305. ugly.  (The symptom, which only showed up in VMS, was that the variable
  5306. bigsbufsiz was being changed to some huge number.)  ckcfns.c, ckcfn2.c,
  5307. ckcpro.w. 
  5308.  
  5309. Added calls to ttflui() (flush input buffer) for SEND, GET, MAIL, FINISH, BYE,
  5310. and REMOTE commands when executed in local mode.  When these commands are
  5311. issued, the local Kermit is initiating the operation and so there could not
  5312. possibly be anything of use waiting in the input buffer.  The flush operation
  5313. clears out any piled up NAKs from a server or receiver, preventing unnecessary
  5314. retransmissions.
  5315.  
  5316. COMMAND PARSER, USER INTERFACE, AND NEW COMMANDS
  5317.  
  5318. Added ! connect-mode escape to "push" to a local shell.  ckucon.c.
  5319.  
  5320. Changed file transfer message to:
  5321.   X to cancel file,  R to resend current packet
  5322.   Z to cancel batch, A for status report
  5323. Old Ctrl-F, Ctrl-B, etc, still work, but are not reported in the message.
  5324. This is for compatibility with MS-DOS Kermit.  Still need to find a way to
  5325. make this interruptible by Ctrl-C (without core dumps!).
  5326.  
  5327. Fixed cmfld() to beep if ESC typed at beginning of a field for which no
  5328. default was supplied.
  5329.  
  5330. Fixed xxesc() to treat a backslash followed by anything other than a digit, d,
  5331. x, o, or brace ({) as a quote.  The backslash is removed and the next
  5332. character is taken literally, as you would expect.  For example, "echo \;xxx"
  5333. now prints ";xxx".  ckucmd.c.
  5334.  
  5335. Added SET COMMAND { 7, 8 }.  Normally, C-Kermit's command parser strips the
  5336. 8th bit off any command characters the user types.  SET COMMAND 8 will inhibit
  5337. this action to allow international characters to be entered in Kermit commands
  5338. (for example, in filenames, ECHO strings, etc).  ckuusr.h, ckuus3.c.
  5339.  
  5340. Added helpful error messages to many (all?) places where user could terminate
  5341. a command prematurely.  Previously, many commands (like ASK, ASSIGN, DO,
  5342. DISABLE, SET COUNT, SET ESCAPE, etc) gave no error message at all when this
  5343. happened.
  5344.  
  5345. Added ENABLE/DISABLE DELETE.  Thanks to Bo Kullmar for noticing the oversight.
  5346.  
  5347. Separated DISABLE/ENABLE FINISH and BYE; now FINISH and BYE can be enabled
  5348. and disabled individually, as requested by Bo.
  5349.  
  5350. Checked whether C-Kermit's command parser responds correctly to Xon/Xoff from
  5351. the controlling terminal.  It does, in both UNIX and VMS.
  5352.  
  5353. Added a new command, SET BACKGROUND { ON, OFF }.  This is to let the user
  5354. manually override C-Kermit's decision that it is in the background.  This is
  5355. necessary because Kermit considers itself in the background if its stdio is
  5356. redirected, like if you do "kermit < cmdfile > logfile" -- you don't want a
  5357. lot of prompts showing up.  However, if you do "kermit | vt100", where vt100
  5358. is a terminal emulation filter on a workstation, you want to be able to have
  5359. an interactive session with prompts showing up, etc.  Since Kermit can't tell
  5360. WHY its stdio was redirected, it can't decide what to do on its own.  Hence
  5361. the new command.  Probably useful only in UNIX.  Also available on the command
  5362. line as "-z".  ckuus[r235y].c.
  5363.  
  5364. Added SET and SHOW DEFAULT for VMS (simply synonyms for CD/CWD and PWD).
  5365.  
  5366. Fixed problem with completion of filenames of 99 chars or longer causing
  5367. coredumps.  Problem was in fgen() in ckufio.c -- a temporary buffer called
  5368. scratch[] was declared with 100 bytes.  Changed its size to MAXNAMLEN+1.
  5369.  
  5370. Fixed problem with parsing of LOG command.  LOG <anything> X<DEL> would
  5371. make the cursor jump back to the prompt instead of deleting the single
  5372. character X.  ckuusr.c.
  5373.  
  5374. Changed ARGC (and \v(argc)) to be the number of macro arguments plus one,
  5375. rather than just the number of args, to be consistent with MS-DOS Kermit 3.0
  5376. (and C itself).
  5377.  
  5378. Added SET FILE COLLISION NO-SUPERSEDE as an invisible synonym for SET FILE
  5379. COLLISION DISCARD, for MS-DOS Kermit compatibility.
  5380.  
  5381. C-Kermit has always relied upon the shell to expand wildcards given on the
  5382. command line (as in "kermit -s oofa.*").  But the VMS "shell" (DCL) doesn't do
  5383. this.  A simple 3-line change to ckuus4.c lets C-Kermit expand command-line
  5384. wild filenames itself, provided there is only one of them.  Tested on Unix:
  5385. "kermit -s oofa.txt, kermit -s oofa.*, kermit -s oofa.\*" all work OK.
  5386.  
  5387. Considered adding SET DOUBLE <char> to cause the specified character to be
  5388. doubled when a packet is output, for use with Arpanet TACs, Honeywell
  5389. mainframes, etc.  Added the parsing code.  But then decided not to do it after
  5390. all because it would slow down packet formation and transmission by a large
  5391. factor.  As it stands now, the variable "dblchar" contains the character that
  5392. is to be doubled on transmission.  Implementation could be done in two places:
  5393. (1) in the system-independent code (in the encode() function for the data
  5394. field AND in spack() for the control fields), by adding a statement like this
  5395. after each character that is deposited in the packet buffer:
  5396.  
  5397.     if (data[i-1] == dblchar) data[i++] = dblchar;
  5398.  
  5399. (dozens of them!) or (2) in the system-dependent ttol() function.  Option 2 is
  5400. particularly awful because it would require the packet to be recopied before
  5401. transmission.  A lot of effort went into version 5A to eliminate unnecessary
  5402. copying of packets.  So if anybody REALLY NEEDS this function, it should be
  5403. added using method (1).
  5404.  
  5405. SUPPORT FOR DIFFERENT UNIX SYSTEMS
  5406.  
  5407. Turned on TCP/IP support for HP-UX Sys V R3 - based versions ("make
  5408. hpuxs5r3"), based on info from Jim Barbour.  ckcmai.c and makefile.
  5409.  
  5410. Fixed a couple things for MIPS compilation, thanks to Peter Jones for the
  5411. info.  ckutio.c.
  5412.  
  5413. Changed Masscomp/Concurrent BSD-based RTU implementations to include
  5414. <fcntl.h> after all, at Farrell Woods' suggestion.  If this causes problems,
  5415. let me know.  Also, fixed the make entries for these versions to specify
  5416. "LIBS = -lndir" rather than "LIBS = lndir".  Also added "-DNETCONN" for
  5417. "make rtubsd"; Farrell says it works.
  5418.  
  5419. Added yet another new directory-related CFLAG: -DSDIRENT.  This means to use
  5420. <sys/dirent.h> for directory-related operations.  -DDIRENT means <dirent.h>.
  5421. Apparently necessary for Amdahl Sys V R2.6b.  ckufio.c, ckutio.c, ckuins.doc.
  5422.  
  5423. Added "make sys3nv" entry to makefile, for those who do "make sys3" and
  5424. get lots of "Illegal pointer combination" warnings: "nv" means "no void";
  5425. this entry just includes "-Dvoid=int" in the CFLAGS.
  5426.  
  5427. COMMUNICATION LINES AND MODEM SIGNALS
  5428.  
  5429. In edit 150, I removed the call to tthang() from ttclos(), figuring that
  5430. when the device is closed, DTR is dropped.  I was wrong, some systems don't
  5431. do this.  I put the call back, but this time after the call to ttres() rather
  5432. than before it, because ttres() gets horrible errors if called on a
  5433. modem-controlled line that is not presenting carrier.
  5434.  
  5435. John Chmielewski of AT&T found that he could make tthang() work on his
  5436. recalcitrant 3B2/400 system by setting not only the line speed (CBAUD) to zero
  5437. in ttcur.c_cflag, but all of the cflags to zero.  Kristoffer thinks this may
  5438. be a dangerous change, and we should investigate each flag separately (CREAD,
  5439. HUPCL, CLOCAL, etc).  Kristoffer also suspects that uugetty may be a culprit
  5440. here, by altering the device flags out from under Kermit.  In any case, this
  5441. change is worth a try.  If tthang() works for everybody and there are no ill
  5442. side effects, we can put a detailed investigation on the back burner for a
  5443. while.  So please test: the HANGUP command, the Ctrl-\H CONNECT-mode escape,
  5444. the DIAL command with SET DIAL HANGUP ON, and the EXIT (or QUIT) command.
  5445.  
  5446. Removed "sleep(3)" for AT&T DTDM modem at Peter Mauzey's request -- he
  5447. says it's not really necessary, and the 3B2 connects a lot faster without it.
  5448.  
  5449. Added code for bizarre UUCP lockfile conventions of IBM RT PC AIX 2.2.1 --
  5450. it has not one, but two, lockfiles.  From Piet Plomp, ICCE, Netherlands.
  5451.  
  5452. Changed ckcmai.c to call ttopen(), if the local flag is nonzero, as one of the
  5453. first things it does, so in case the default mode (dfloc) and device (dftty)
  5454. were defined in a system-dependent module (e.g. ckutio.c), the device would be
  5455. usable immediately.  A default terminal device can be specified in the
  5456. makefile entry as -DDFLOC=\\\"/dev/ttyxx\\\".  This change was made for the
  5457. benefit of the Macintosh and Amiga versions.  There's a slight pitfall here
  5458. for UNIX, namely that there is currently no mechanism for specifying a default
  5459. modem type at program startup time, so if the the default device is connected
  5460. to a modem, the initial open could hang.  The workaround, for now, would be to
  5461. start Kermit with "-l /dev/tty" on the command line, then "set modem" and "set
  5462. line".  In general, it's probably best to build the program in the normal way
  5463. for UNIX, and put any necessary "set" commands in the .kermrc file.
  5464.  
  5465. Changed the DIAL command to wait for carrier if modem type is UNKNOWN (Dan
  5466. Shullman's suggestion from 5 years ago).  But I don't have any way to test it.
  5467. Anyone?  ckudia.c.
  5468.  
  5469. Users of BSD-based systems were complaining that HANGUP (or ^\H) followed by
  5470. another CONNECT gets i/o error.  To cure this, I attacked the BSD section of
  5471. tthang(), adding a "close(open(ttnmsv));" and then a call to ttvt() to restore
  5472. the modes.  Cured the problem on my SUN just fine.
  5473.  
  5474. A related problem: What if the modem drops carrier before C-Kermit hangs up?
  5475. In this case, C-Kermit gets a "communications disconnect" and pops back to the
  5476. C-Kermit prompt.  The next CONNECT gives "Sorry, can't condition communication
  5477. line" as a result of a failure return from ttvt().  I fixed this one too, but
  5478. I'm not happy about how.  First, I observed that if I gave a HANGUP command
  5479. before reconnecting, everything worked OK.  So (I reasoned), a call to
  5480. tthang() at the place where the error occured would do the same thing.  It
  5481. didn't.  After much unsuccessful experimentation with moving the tthang() call
  5482. around, sleep()ing before &/or after it, etc, I changed the CONNECT code to
  5483. hang up, close, and reopen the device if it gets an error from ttvt().  This
  5484. works, but you will get a burst of garbage at first when you reconnect.  Oddly
  5485. enough, I also tried flushing the input the input buffer at this point, but
  5486. that made the whole business stop working again.
  5487.  
  5488. I tested the program in the System V environment and found it had the same
  5489. problem.  Although reconnecting after HANGUP and ^\H worked OK, reconnecting
  5490. after logout didn't.  The change to the CONNECT code fixed this for System V
  5491. too.  No changes were necessary to tthang() for System V in this area.  That
  5492. is, if tthang() works in System V at all, it works well enough to let you
  5493. reconnect to a line that has been hung up.  But you might see some garbage at
  5494. first.
  5495.  
  5496. Some people complained of DIAL complaining that it can't hang up the tty
  5497. line when DIAL HANGUP is ON.  Added code to ckdial() to close and reopen
  5498. the line if tthang() returns a failure code.  ckudia.c.
  5499.  
  5500. COMPILER-RELATED CHANGES
  5501.  
  5502. Removed all references to "pid_t".  Let's just use ints (don't fix it if it
  5503. ain't broke -- that'll teach me to read SVID!).
  5504.  
  5505. Changed names of all translation functions (like xl1toas) to remove "to" so
  5506. they will be unique in 6 characters (for PDP-11 C compiler).  ckuxla.c.
  5507.  
  5508. Changed names of variables wslotsr and wslotsn to wslotr and wslotn to be
  5509. unique within 6.  ckuu*.c, ckcfn*.c.
  5510.  
  5511. Changed cmflgsav to be cmfsav to be unique within 6.  ckucmd.c.
  5512.  
  5513. Changed mixed-case variable and function names to lowercase.  ckudia.c.
  5514.  
  5515. Removed many unreferenced variables.
  5516.  
  5517. Added -O to "make sunos4" and "make sunos41".  On SUN, saves about 64K in
  5518. the program image file.
  5519.  
  5520. PROGRAM SIZE
  5521.  
  5522. C-Kermit has become to large to build on certain systems.  Even when it can
  5523. be built successfully, it can take a long time to load into memory because of
  5524. its size (on my SUN-4/280, edit 151 takes 416K on disk!).
  5525.  
  5526. Added -DNODIAL to remove DIAL command.  Results in 8K reduction on SUN.
  5527. Here are the effects of various size reductions on the SUN (where programs
  5528. are always saved in multiples of 8K):
  5529.  
  5530.   -DNOHELP   32K
  5531.   -DNODEBUG  32K
  5532.   -DNOTLOG    0K
  5533.   -DNODIAL    8K
  5534.   -UNETCONN   8K
  5535.  
  5536. All of the above combined gives a total savings of 88K on the SUN.
  5537.  
  5538. Addition of the -O (optimize) compilation switch gives another 24K reduction,
  5539. and the -s (strip) linker switch removes another 56K, bringing the total size
  5540. down to 247K.  Now, lessee how much smaller we can make it...
  5541.  
  5542.   -DNOSCRIPT removes (UUCP-style) SCRIPT command.  8K on SUN.
  5543.   -DNOCSETS completely removes international character set support.  16K.
  5544.   -DNOCMDL removes the command-line interface ("kermit -s foo").  8K.
  5545.   -DNOICP removes the entire Interactive Command Parser.  128K.
  5546.  
  5547. Isolating the interactive command parser was a pretty big job.  It required
  5548. the creation of two new modules: ckuusx.c (containing functions and variables
  5549. common to both the interactive and command-line interfaces) and ckuusy.c (the
  5550. command-line interface itself).
  5551.  
  5552. After all this, the SUN executable is 104K.  With everything removed BUT
  5553. the command parser, it's 224K (an overall reduction of 128K).
  5554.  
  5555. Added an entry for MINIX to the makefile.  It includes all of the -DNOxxx
  5556. switches except -DNOCMDL, so the result will fit in 64K+64K.  Totally
  5557. untested.  Read the notes in the makefile (search for "minix:").
  5558.  
  5559. MISC
  5560.  
  5561. Updated help commands, documentation.  ckuker.mss, .doc, .ps, ckuus2.c.
  5562.  
  5563. ------------------------------
  5564.  
  5565. 5A(150) Mon Jun 25 11:38:14 1990 - Sun Jul 22 19:24:22 1990
  5566.  
  5567. NEW COMMANDS
  5568.  
  5569. Added WHILE command.  The syntax is:
  5570.  
  5571.   WHILE <cond> { command [, command [, command ... ] ] ] }
  5572.  
  5573. where <cond> is any condition accepted by the IF command, for example:
  5574.  
  5575.   WHILE not exist foo.bar { pause 1 }
  5576.  
  5577. WHILE commands can be nested in any combination with other WHILE commands,
  5578. IF commands, or FOR loops.
  5579.  
  5580. Added -m option to command line, to select modem type.  ckuus4.c, ckuus2.c.
  5581. Thanks to William Bader, Software Consulting Services, Nazareth, PA, for the
  5582. suggestion and the code.
  5583.  
  5584. Added -v option to command line, to select window size ("v" for "vindow").
  5585. Now the only letters left are o, u, and z.  ckuus4.c.  ckuus2.c (help
  5586. message).  ckuker.nr and ckuker.mss (documentation for both -m and -v).
  5587.  
  5588. Added the built-in function \fcharacter().  It takes a numeric argument, and
  5589. returns the corresponding character, for example \fchar(65) is 'A',
  5590. \fchar(161) is inverted exclamation mark (in Latin-1).  If you give a negative
  5591. number or a number larger than 255, only the low-order 8 bits are used.  Now
  5592. you can use Kermit to display special characters on your terminal by giving
  5593. the character codes, for example:
  5594.  
  5595.   for \%i 160 255 1 { echo \flpad(\%i). [\fchar(\%i)] }
  5596.  
  5597. Code in ckuus4.c (just a few lines).  Documentation in ckuker.mss, ckuker.nr.
  5598.  
  5599. Added IF BACKGROUND command, true if Kermit (thinks it) is running in the
  5600. background.  This lets you have Kermit command files that will work both as
  5601. TAKE files and also with "kermit < file":
  5602.  
  5603.   DEFINE FATAL ECHO \%1\13, IF BACKGROUND EXIT 1, ELSE STOP
  5604.   INPUT 10 login:
  5605.   IF FAILURE FATAL {no login prompt}
  5606.  
  5607. Commands like STOP and END have no effect when Kermit's commands are being
  5608. redirected or piped from standard input, because Kermit just goes on to the
  5609. next command, as if it were in interactive command mode.  IF BACKGROUND works
  5610. fine in Unix, but depends on the system-dependent module setting the variable
  5611. backgrd to zero if running in the foreground and nonzero if running in the
  5612. background (see discussion of conint() below).  Not sure if this will be of
  5613. any use in VAX/VMS, Amiga DOS, Macintosh, etc.  ckuusr.c.
  5614.  
  5615. Filled in the SHOW MODEM and WAIT commands (see below, section on modem
  5616. signals).
  5617.  
  5618.  
  5619. BACKGROUND OPERATION FIXED (?)
  5620.  
  5621. Several important C-Kermit features relating to background operation in Unix
  5622. seem to have been broken for quite some time.  For example:
  5623.  
  5624.   kermit < foo.cmd &
  5625.  
  5626. did not work in the BSD universe if foo.cmd contained a SET LINE command and
  5627. then attempted to do file transfer or DIAL/INPUT/OUTPUT/SCRIPT over the device.
  5628. This was because ttopen() was being called incorrectly, and was incorrectly
  5629. deciding that it was running in remote mode, when it was really running in
  5630. local mode.  Furthermore, ttopen's default assumption (taken in the absence of
  5631. any reliable tests) was remote, when it should have been local.
  5632.  
  5633. Second, some screen messages were appearing during execution of a
  5634. redirected-stdin command file in the background.  These are now conditional on
  5635. the program's not running in the background.
  5636.  
  5637. The following command file, for logging in to a Unix system and sending a file
  5638. to it, was executed successfully in the background using "kermit < cmdfile &":
  5639.  
  5640.   define fatal echo \%1\13, if background exit 1, else stop
  5641.   if background set input echo off
  5642.   log transactions
  5643.   set line /dev/ttyh8
  5644.   pause 2
  5645.   output \13
  5646.   script login:--login:--login: myuserid ssword: mypassword ~w15$--$--$
  5647.   if fail fatal {script failed}
  5648.   output kermit -x\13
  5649.   input 10 reconnect.
  5650.   if fail fatal {failed to start kermit server}
  5651.   send test.file
  5652.   bye
  5653.   echo done.
  5654.   if background exit 0    
  5655.  
  5656. The same command file works when TAKEn in interactive mode, or when invoked
  5657. via -y on the command line.  I think this is the kind of thing that people
  5658. have been asking for.  By the way, note (once again) that a redirected-stdin
  5659. "command file" cannot have GOTOs in it.  GOTOs work by rewinding the command
  5660. file, and stdin cannot be rewound!  This is one reason why the SCRIPT command
  5661. remains useful.
  5662.  
  5663.  
  5664. PACKET PROTOCOL
  5665.  
  5666. Raised the maximum packet size from 4096 to 9024 (the absolute maximum), and
  5667. initial packet buffer allocation from 6000 to 9050, for the -DDYNAMIC case.
  5668. Reason: Why Not? -- If you really want 9K packets, now you can have them.
  5669. Tested sending a file with 9024-character packets.  Worked fine (fast too, but
  5670. only because there were no retransmissions).  ckcker.h.
  5671.  
  5672. If C-Kermit was sending a file using a window size greater than one, and the
  5673. file transfer was interrupted (e.g. by typing 'X' to MS-DOS Kermit), C-Kermit
  5674. would fail to send a B packet, and the file transfer would hang until the
  5675. receiver timed out.  This is because sdata() in ckcfn2.c sends data packets
  5676. ahead of the current packet number.  The protocol module in ckcpro.w is
  5677. unaware of anything to do with packet numbers, and so blithely proceeds to
  5678. <sseof> state if the interruption flag had been set, but now the two Kermits'
  5679. packet numbers are out of sync.  The same thing would happen when the end of
  5680. file is reached, but in that case, the sdata() function sets a "drain" flag to
  5681. allow the protocol module to "catch up" (see the comments in sdata(), if you
  5682. care).  The fix was to move the test for file interruption from ckcpro.w to
  5683. sdata() in ckcfns.c; sdata() now sets the drain flag when a file is
  5684. interrupted, just like it does when the end of file is reached.
  5685.  
  5686. Fixed resend() to log the packet number correctly in the packet log, and to
  5687. indicate resent packets with 'S' rather than 's'.  Also, made its error
  5688. messages a little more informative (for me, at least -- a weird error code,
  5689. plus the packet number and packet index of the offending packet).  This is in
  5690. response to persistent reports from Ted Medin that downloads from C-Kermit to
  5691. MS-DOS Kermit with window size of 7 fail because "resend error number 12"
  5692. (which means that the pointer from the sequence number table into the packet
  5693. buffer has been invalidated, which should not happen at all, and probably
  5694. happens only because freesbuf() has been called when it shouldn't).  ckcfn3.c.
  5695.  
  5696. Looked through C-Kermit to see where freesbuf() was being called, and found
  5697. at least one place (in the input() function) where it was being called
  5698. incorrectly.  While I was looking at input() I also fixed a few other things.
  5699. For one thing, I realized that the situation where ACKs arrive out of order
  5700. was not fully handled, so I added code to take care of it.
  5701.  
  5702. There are still a couple other possible problem areas, in which C-Kermit might
  5703. be a little too strict -- canceling the file transfer with an E packet if
  5704. something happens that isn't supposed to.  Joe Doupnik suggests that some of
  5705. these situations should be silently tolerated.  If we continue to get reports
  5706. of failing windowed transfers, then I can try loosening up a bit in these
  5707. remaining areas.
  5708.  
  5709. Tried these changes against MS-DOS Kermit 3.02 with 7 window slots, both
  5710. sending and receiving, and introducing errors and retransmissions any way
  5711. I could think of -- seems pretty solid, but then so did previous versions.
  5712.  
  5713.  
  5714. AUTOMATIC PARITY DETECTION
  5715.  
  5716. C-Kermit (UNIX version only) now automatically detects and adjusts to the
  5717. parity on the other Kermit's packets if (a) C-Kermit's parity is initially
  5718. NONE, and (b) the other Kermit's packets have EVEN, ODD, or MARK parity.
  5719.  
  5720. ttinl(), the system-dependent packet reading function, was changed to accept
  5721. an additional argument, the packet start character.  Now ttinl() can do
  5722. complete packet framing, and extraneous interpacket junk (or intentional
  5723. padding) is no longer stored in Kermit's incoming packet buffers.  ckutio.c.
  5724. rpack() was changed to take advantage of this, and no longer has to search the
  5725. buffer for the start-of-packet character.  ckcfn2.c.
  5726.  
  5727. Part of ttinl()'s job is to strip parity bits if the user has given a "set
  5728. parity" command (for parity other than none).  rpack() assumes that ttinl() is
  5729. returning a true packet with no parity bits.  If the user forgets (or does not
  5730. know) to "set parity even" (or whatever), then ttinl() will not strip the
  5731. parity bits, and rpack() will diagnose a bad checksum, and the transfer will
  5732. fail.
  5733.  
  5734. Now that ttinl() knows where the start of the packet is, it can check the
  5735. packet control fields (which never contain 8-bit data) to determine the
  5736. prevailing parity.  This is done only if the parity is set to none, in which
  5737. case, ttinl() calls a new function, parchk().  parchk() sees if the packet has
  5738. parity, and if so, what kind.  It returns the parity which it has sensed to
  5739. ttinl(), which in turn sets the global variable ttprty, which is used by all
  5740. the other functions in ckutio.c.  In order for the parity to be changed from
  5741. none to even, odd, or mark, ALL of the packet control fields must have the
  5742. SAME kind of non-NONE parity, which effectively rules out spurious parity
  5743. changing because of line noise.
  5744.  
  5745. If C-Kermit is receiving a file, it will see the parity on the S-packet, and
  5746. will enable 8th-bit quoting by setting '&' in the EBQ field its reply.  This
  5747. ensures that 8-bit data will go through correctly even if the user failed to
  5748. set parity on both Kermits (and parity is being added by something between
  5749. them).
  5750.  
  5751. If C-Kermit is sending a file with parity = none to another Kermit in RECEIVE
  5752. mode, then the first packet C-Kermit receives will be the S-packet reply.  By
  5753. this time, it is too late to negotiate 8th-bit prefixing if the receiving
  5754. Kermit did not request it.  If the file contains no 8-bit data, it will be
  5755. transferred correctly.  Otherwise, the checksum will be wrong and Kermit will
  5756. catch the error (just as it has always done).
  5757.  
  5758. If C-Kermit is sending a file with parity = none to a server, then the first
  5759. packet it will receive will be a NAK or the reply to an I packet, in which
  5760. case 8th-bit prefixing can be successfully negotiated in the following
  5761. S-packet exchange.
  5762.  
  5763. Meanwhile back in ckcfn2.c, if rpack(), the system-independent part of the
  5764. packet reader (the one that checks the checksum, etc), after calling ttinl(),
  5765. notices that the global variable ttprty changed, then it changes Kermit's
  5766. parity variable (the one associated with SET PARITY) accordingly, and then
  5767. things work OK in the protocol too.  And once the parity has been changed, the
  5768. check is no longer made (because parity is no longer NONE), so efficiency is
  5769. not badly compromised.
  5770.  
  5771. This mechanism kicks in only when Kermit's parity is set to NONE.  If the user
  5772. has already SET PARITY to something else, Kermit assumes she knows what
  5773. she's doing.
  5774.  
  5775. Any additional overhead caused by the parity detection feature seems to be
  5776. more than offset by the performance boost that comes from removing the
  5777. start-of-packet searching loop from rpack().  In one benchmark, MS-DOS Kermit
  5778. 3.02 sending a 36K file to C-Kermit using 2000-byte packets and one window,
  5779. the efficiency was 83% with edit 149, and 86% with edit 150.
  5780.  
  5781. The ttinl() functions for VAX/VMS and other non-Unix versions of C-Kermit
  5782. should be changed to accept the packet start character as a fifth argument,
  5783. and to return the first argument pointing to the start-of-packet character.
  5784.  
  5785. All of the new parity-sensing code is selected by defining the symbol PARSENSE
  5786. (parity sense).  I added -DPARSENSE to ckcdeb.h within #ifdef UNIX
  5787. conditionals, so all Unix-based versions of Kermit will get it automatically
  5788. next time they are recompiled, and non-Unix versions will not.  Non-Unix
  5789. versions should define this symbol when they have changed their version of
  5790. ttinl() accordingly.
  5791.  
  5792. If parity was changed automatically, a message appears in the STATUS display.
  5793.  
  5794. Updated ckasys.doc to describe the new features of ttinl().  Thanks to
  5795. Christine Gianone for the parity-sensing idea.  (A similar feature has been
  5796. added to the MS-DOS Kermit 3.02 beta test as of 15 July 90.)
  5797.  
  5798.  
  5799. HANGING UP, DTR, AND GETTY -
  5800.  
  5801. Changed -DNEWUUCP to -DACUCNTRL to be more descriptive.
  5802.  
  5803. Changed acucntrl("enable",flfnam) to acucntrl("enable",ttname) in ttclos().
  5804. All these years it had been called with the lockfile name instead of the tty
  5805. device name, which only worked (if it ever did) because acucntrl apparently
  5806. contains a hack that scans the second argument for the first '/'.  This change
  5807. only affects those who build the program with -DACUCNTRL.  ckutio.c.
  5808.  
  5809. Looked up termio(BA_DEV) in SVID for R3.  Found out that there are ioctl's for
  5810. controlling modem signals.  I wonder how many systems actually implement
  5811. them...  So I added code to tthang() within #ifdef's for TIOCMBIS, TIOCMBIC,
  5812. and TIOCM_DTR to turn DTR off and on again.  This code will be used
  5813. automatically on System V systems that define these symbols.  However, even if
  5814. the symbols are defined, the ioctl might fail; if it does, the close/open path
  5815. described below is still taken.  Btw, this code was tested, and worked
  5816. correctly, on the SUN-4 with SUNOS 4.1 in both BSD and Sys V R3 environments.
  5817. ckutio.c.
  5818.  
  5819. Then, in a fit of disgust, I ripped the guts out of the System III/V case in
  5820. tthang().  Now it simply (a) gets the modes, (b) sets the speed to zero, (c)
  5821. sleeps for about 300 msec, (d) does the close(priv_open(...)) magic, (e)
  5822. restores the modes, and (e) returns.  If this doesn't work for you, then add
  5823. -DCLSOPN to your makefile CFLAGS, and then step (d) is replaced by the more
  5824. drastic (and dangerous) close(ttyfd) followed by priv_open(...); the danger is
  5825. here that getty can seize the line during the short time it is closed.  I
  5826. don't know if all (or any) gettys honor the lockfile.  Let's hope the second
  5827. method won't be necessary.
  5828.  
  5829. So, here's how to test the new hangup code on System-V based Unix:
  5830.  
  5831.   1. Build it with no special switches.
  5832.   2. LOG DEBUG.
  5833.   3. Try a HANGUP or DIAL command.
  5834.   4. Did it work?  Save all tthang lines from debug log (grep tthang debug.log)
  5835.   6. Build it again, but this time with -DCLSOPN.
  5836.   7. Try HANGUP or DIAL.
  5837.   8. Did it work?  Save all tthang lines from debug log.
  5838.  
  5839. Please send me the tthang lines from both debug logs, showing which is which,
  5840. and saying which method(s) worked (if any).  Hopefully, either the non-CLSOPN
  5841. or else the CLSOPN case will work all the time, and then we can remove the one
  5842. that doesn't.
  5843.  
  5844. Note: None of this tthang() business applies to BSD, HP-UX, or ATT7300, which
  5845. have their own specific hangup methods.  If the edit 150 code STILL does not
  5846. work, then another alternative is to do modem-dependent hangup operations if
  5847. ttmdm is not 0, like for Hayes: sleep, +++, sleep, ATH0.  Not hard, but it
  5848. would mean moving modem-related definitions out of ckudia.c to a common header
  5849. file.
  5850.  
  5851. Also, while perusing SVID R3, I found the TIOCMGET ioctl documented.  Used the
  5852. information there to fill in the ttgmdm() function, so now SHOW MODEM actually
  5853. shows you the modem signals, but only if your system supports the TIOCMGET
  5854. ioctl and the symbols for each modem line, and the ioctl does not fail.  Also,
  5855. I added the modem signal display to SHOW COMMUNICATIONS.  Tested OK on SUN-4
  5856. in both System V and BSD environments.
  5857.  
  5858. Also added code to ttgmdm() for HPUX.  This is all guesswork, since I don't
  5859. have a man page.  HPUX users please test this!
  5860.  
  5861. Now that ttgmdm() is filled in, I also filled in the WAIT command, so that
  5862. users can give commands like "WAIT 10 CD" (wait 10 seconds for carrier),
  5863. "WAIT 4 CD DSR" (wait 4 seconds for carrier and dataset ready), or WAIT 5
  5864. (just wait 5 seconds, equivalent to PAUSE 5).  ckuusr.c
  5865.  
  5866. Discovered that the function ttwmdm() (wait for modem signals) is not
  5867. necessary, since it just calls ttgmdm() in a loop, which is what the
  5868. user-level code in ckuus5.c does, so I removed it from ckutio.c.  Every little
  5869. bit helps...
  5870.  
  5871. Removed the call to tthang() from ttclos().  There is no need for ttclos() to
  5872. hang up the phone, because closing the file descriptor will drop DTR just
  5873. fine.  Doing a hangup in ttclos() can cause the BSD version of ttres() to fail
  5874. because the modes can't be restored by stty() after the device has been hung
  5875. up when the hangup causes the other end to stop sending carrier.
  5876.  
  5877. On the SUN-4, the BSD-based version will sense carrier drop if I log out from
  5878. the remote UNIX and will drop back to the command prompt with the
  5879. "Communications Disconnect" message.  The Sys V version does not do this.
  5880. Haven't figured out why yet -- could it be that O_NDELAY has been set somehow?
  5881. Both versions will drop back to the command prompt with "Communications
  5882. Disconnect" if I hang up (Ctrl-\ h) during a session.
  5883.  
  5884.  
  5885. THE CASE OF THE DISAPPEARING PROMPT -
  5886.  
  5887. Many System V users complained that the C-Kermit> prompt disappeared after any
  5888. file transfer operation in edit 149.  This one was subtle.  In edit 149, I
  5889. went to a lot of trouble to fix Kermit to be Ctrl-C proof if the user gives
  5890. DISABLE BYE/FINISH.  Part of this was changing connoi() (the "console no
  5891. interrupts" function) to use SIG_IGN rather than SIG_DFL for SIGINT, and this
  5892. did, indeed, make the program Ctrl-C proof while connoi() was in effect.
  5893. However, when conint() was called again to restore the regular Ctrl-C traps,
  5894. etc, its test for whether the program was running in the background (System V
  5895. only) is if SIGINT is set to SIG_IGN, so of course it would go into promptless
  5896. "background mode" after any protocol operation because connoi had indeed just
  5897. set it to SIG_IGN.  Solution #1: write my own sig_ign() function (note
  5898. lowercase), and use it in connoi() in place of SIG_IGN.  Tested ok on SUN-4 in
  5899. Sys V R3 environment.  ckutio.c.
  5900.  
  5901. While testing the aforementioned changes, I noticed that if I did "wermit &"
  5902. and then fg'd it, the prompt would not appear until after I did a protocol
  5903. operation, because conint() was never called again until then.  So I put a
  5904. call to conint() in the main interactive parsing loop in function parser().
  5905. Works fine and seems to do no harm -- Ctrl-C still works right, etc.
  5906. ckuus5.c.
  5907.  
  5908. I also noticed that if I started the System V version of wermit under the ksh
  5909. or csh with "wermit &" to background it, that it would not notice that it was
  5910. in the background, whereas "wermit &" under the Bourne shell (&) worked fine.
  5911. This is because csh and ksh apparently do not set a background process's
  5912. SIGINT to SIG_IGN, but rather leave it as SIG_DFL.
  5913.  
  5914. Solution #2: Since the System V method of checking background status is so
  5915. likely to fail, it is much better to use the "BSD" method, namely comparing
  5916. Kermit's process group with the controlling terminal's process group.  This
  5917. depends on the presence of getpgrp() and ioctl(1, TIOCGPGRP, ...).  getpgrp()
  5918. is defined for both Sys V R2 (int) and Sys V R3 (pid_t).  TIOCGPGRP is listed
  5919. in SVID for R3.  Thus I think it is safe to use the process-group test on any
  5920. system where TIOCGPGRP is defined.  I made this change in conint().  Tested ok
  5921. on SUNOS 4.1 in System V and BSD environments.  ckutio.c.
  5922.  
  5923. Also, while I was rummaging around in connoi(), I noticed that the "bgset"
  5924. flag was not used at all, so I removed it.  I wonder what it was for...
  5925. ckutio.c.
  5926.  
  5927.  
  5928. SHELL AND SYSTEM() -
  5929.  
  5930. Removed second, unused, vestigial argument from zshcmd().
  5931.  
  5932. Many testers have complained about the use of the user's preferred shell for
  5933. running commands like DIRECTORY, SPACE, etc.  This was not done because I
  5934. thought it was the right way to do it, but because doing it any other way
  5935. would have required adding a new system-dependent function that would have to
  5936. be implemented for all C-Kermit variants -- VAX/VMS, Macintosh, Amiga, etc etc
  5937. etc -- just because in Unix we sometimes want to use the user's login shell,
  5938. and other times want to use /bin/sh (a subtle distinction to users of other
  5939. operating systems!).  Well, the outcry has been so overwhelming that I went
  5940. ahead and added the new function after all: zsyscmd().  For Unix, it's defined
  5941. in ckufio.c.  It does approximately what system() does, except of course it
  5942. turns off privileges before execl'ing the command.
  5943.  
  5944. In ttopen(), I replaced the call to system() with zsyscmd().  As Kristoffer
  5945. pointed out, the arrangement in edit 149 posed a gaping security loophole (I
  5946. won't go into detail).  The only bad thing that can happen now is that users
  5947. won't see a directory listing of the lockfile in case the requested device is
  5948. in use and the lock directory and/or file is read-protected against them.
  5949.  
  5950. Some testers have been reporting problems when running C-Kermit in server mode
  5951. and sending REMOTE commands to it (REMOTE SPACE, REMOTE HOST sum filename,
  5952. etc).  Symptoms include hung server, unwanted appearance of shell prompt, etc.
  5953. I hope these problems are fixed now, because of several of the changes in 150.
  5954. There is apparently at least still one cause for hung servers: if the program
  5955. is built with -DDYNAMIC on the Tandy 6000, the server can hang.  If built with
  5956. static allocation for packet buffers, the server won't hang.
  5957.  
  5958.  
  5959. VAX/VMS
  5960.  
  5961. Thanks to some changes sent in by William Bader, I was able (after adding
  5962. zsyscmd() to ckvfio.c, exactly the same as zshcmd() for VMS) to successfully
  5963. compile C-Kermit 5A for the first time on my MicroVAX with VMS 5.0 and VAX C
  5964. 2.something (even though I still get linker errors about "system" and "rename"
  5965. multiply defined).  As Mark Buda pointed out when he sent in his last batch of
  5966. changes on June 6th, the VMS support is far from ready, the CONNECT code
  5967. needs to be worked over, and the RMS file support is not done.
  5968.  
  5969. When edit 150 is executed on my VMS 5.0 system, many parts of it actually work:
  5970.  
  5971.  - Transfer of text files works in both directions with 1 window slot, using
  5972.    either short or long packets (I tested up to 1K packets), except that the
  5973.    last record of received files is not saved in the file (and if you send
  5974.    another file, then the last record of the previous file becomes the first
  5975.    record of the next file, and so on).
  5976.  
  5977.  - Character set translation works fine (e.g. sending CP850 German text from
  5978.    a PC to a Latin-1 file on the VAX).
  5979.  
  5980.  - Basic server mode works: GET, SEND, FINISH, BYE.
  5981.  
  5982.  - !, PUSH, and RUN seem to work OK (spawning DCL fork).
  5983.  
  5984.  - TAKE, DEFINE, macros, scripts, arithmetic, etc, all work.
  5985.  
  5986.  - OPEN WRITE, WRITE, CLOSE WRITE work.
  5987.  
  5988. But, as you might expect, there are some rough spots: 
  5989.  
  5990.  - If you send a file to VMS Kermit that has the same name as an existing
  5991.    file, VMS Kermit refuses to accept it: "Can't transform filename".  This
  5992.    happens with the default SET FILE COLLISION BACKUP.  SET FILE COLLISION
  5993.    OVERWRITE works just fine, and creates a new generation.  I changed
  5994.    ckcmai.c to make this the default for VMS.
  5995.  
  5996.  - Sliding windows doesn't work when receiving files, VMS gets data overruns
  5997.    ("ttinl: sys$qiow(iosb) %SYSTEM-W-DATAOVERUN").  Sliding windows works fine
  5998.    for sending files.
  5999.  
  6000.  - The file size attribute is not sent.
  6001.  
  6002.  - The server crashes if you send it any REMOTE command that requires
  6003.    spawning a fork, like REMOTE DIRECTORY, REMOTE SPACE, etc.
  6004.  
  6005.  - Incompletely received files are kept, rather than deleted.
  6006.  
  6007.  - REMOTE commands sent to the VMS server seem to crash the program.
  6008.  
  6009.  - DIRECTORY doesn't work at all.
  6010.  
  6011.  - CD doesn't work at all, even though PWD works ok.
  6012.  
  6013.  - The TYPE command does not send CRLFs, only linefeeds, so text file lines
  6014.    come out in stairstep form.
  6015.  
  6016.  - Speed is reported in cps rather than bps, and percent efficiency
  6017.    calculations (STATUS command) are wrong by a factor of 10.
  6018.  
  6019.  - Filename completion works, but the display is wrong.  For example, if you
  6020.    have a file OOFA.TXT and you type OOF<ESC>, Kermit will fill in
  6021.    SK1:[DIRECTORYNAME]OOFA.TXT;1 after the "OOF".  But it still finds the file
  6022.    and uses it correctly.
  6023.  
  6024.  - OPEN READ, READ, CLOSE READ don't work.
  6025.  
  6026.  - Exiting from the program always gives an error message %SYSTEM-F-ABORT.
  6027.  
  6028. I didn't test any local-mode operations (SET LINE, DIAL, HANGUP, etc) -- I
  6029. don't have an outgoing line from the VAX.
  6030.  
  6031.  
  6032. OTHER
  6033.  
  6034. Fixed a bug in the command parser.  A command like this:
  6035.  
  6036.   IF < \%a 3 ECHO Foo
  6037.  
  6038. would produce unexpected results if the variable \%a wasn't defined: the
  6039. cursor would shoot back to the prompt as soon as the space after the variable
  6040. name was typed.  This was fixed by giving undefined variables when used in
  6041. this numeric context the value of zero.
  6042.  
  6043. Fixed a bug in GOTO, in which a GOTO could fail if it was issued from a macro
  6044. which was invoked before other macros had been defined or deleted, thus
  6045. changing the position of macros in the macro table.  Fixed GOTO to work
  6046. independently of whether the macro table had changed.
  6047.  
  6048. Alistair Gorman in New Zealand reported that file transfer failed on a SUN-4
  6049. in local mode.  Examination of the logs he sent showed that he was using even
  6050. parity on both ends, so it shouldn't have failed.  Of course, I had tested
  6051. this many times locally, also on a SUN-4, and it worked fine, but for the past
  6052. month all my local-mode testing had been through SET HOST rather than SET LINE
  6053. because my my dialout port cable needed fixing.  So I fixed the cable and
  6054. tested this complaint.  Sure enough, it fails.  The symptom is that a
  6055. local-mode C-Kermit built in the BSD universe (at least on a SUN) fails to
  6056. input ANY CHARACTERS AT ALL while in packet mode when its parity is not NONE.
  6057. At first I suspected the new parity sensing code, but Alistair's problem
  6058. occurred in edit 149, before that code was installed.  To make a long story
  6059. short, the problem was in ttpkt(), where it puts the BSD ttyfd in cooked
  6060. rather than raw mode if parity is not NONE (in order that Xon/Xoff can work).
  6061. For some unfathomable reason, this works fine in remote mode, and not at all
  6062. in local mode.  So I changed ttpkt() to do this only in remote mode.  Symptom
  6063. cured, but disease still lurking beneath the surface.  ckutio.c.
  6064.  
  6065. Found one place that the new Ctrl-C trap added in edit 149 does not work:
  6066. during protocol operations while in local mode, where typing Ctrl-C invariably
  6067. causes a memory-fault core dump in Unix, both BSD and Sys V.  Why?  Probably
  6068. some other function has executed a setjmp or something and screwed up the
  6069. stack or registers.  I don't see an easy way to make Ctrl-C work here (can
  6070. you?), so instead, I changed ckcpro.w to call connoi() (console no interrupts)
  6071. whenever it starts a protocol operation, rather than only when it does so in
  6072. remote mode.
  6073.  
  6074. Fixed text-mode (new default) session logging.  Problem was that CONNECT-mode
  6075. port input was done in two places, and I only put the text-mode conversion in
  6076. one of them.  Not done in the most efficient possible way, can be speeded up
  6077. if necessary at the cost of some more memory.  ckucon.c.
  6078.  
  6079. Changed default filespec for directory command in UNIX to be "." rather than
  6080. "*".  The latter (*) caused listings to be recursive, the former (.) confines
  6081. them to the current directory.  If you want a recursive listing, include the
  6082. "*" explicitly, as in "directory *".  Note, any directory command that
  6083. contains a "*" will be recursive, like "directory x*".  I suppose I could
  6084. change "ls -l" to "ls -ld", but I'm not sure if that would be universally
  6085. portable.  ckuusr.c.
  6086.  
  6087. Changed BSD version of SPACMD to remove "quota".  This is not available on
  6088. some systems, and on most others it does nothing anyway.
  6089.  
  6090. Change znewn() to validate its data & lengths, added some parens to cut down
  6091. on headaches for certain optimizers.  Corrected the problem in which this
  6092. function ate into the end of the filename as it added digits to the generation
  6093. number.  Until now, C-Kermit has always done: oofa, oofa~1, oofa~2, ...,
  6094. oofa~9, oof~10, oof~11, ..., oof~99, oo~100, etc.  Now it leaves the name
  6095. intact when it goes to 10, 100, etc.
  6096.  
  6097. Fixed a problem in the automatic speed recognition in the Hayes modem section
  6098. of the DIAL command.  In "cptr = (*s == c) ? s : NULL;", the c was really
  6099. supposed to be 'C' (the first letter of CONNECT).  Thanks to William Bader for
  6100. finding "c may be used before set" when running this module through lint, and
  6101. also for several other probably less important lint-bits that were also fixed.
  6102.  
  6103. Fixed dumpsbuf() to actually show the send-packet buffer in the debug log.
  6104. ckcfn3.c.
  6105.  
  6106. From Steve Walton: Changed external declaration of parser() in main() from
  6107. char to int.  ckcmai.c.  Supplied missing argument to doexit() in ckuusr.c.
  6108. Changed declaration of rpar() from char to CHAR in ckcpro.w.  Removed
  6109. reference to ttyfd in ckasys.doc (it was already removed from the code).
  6110.  
  6111. Added definition for TELOPT_TTYPE to ckucon.c if it was still not defined
  6112. after including <arpa/telnet.h>.  This is needed on SGI Iris, Ultrix 2.0,
  6113. and maybe some other 4.2-based systems.
  6114.  
  6115. Removed -i switch from CFLAGS for trs16, because it conflicts with -n in
  6116. LNKFLAGS.  Jay Rouman.  makefile.
  6117.  
  6118. Built and ran edit 150 successfully on SUN-4 with SUNOS 4.1 in both BSD and
  6119. ATT SVR3 environments, NeXT, and MicroVAX-II with Ultrix 2.0.
  6120.  
  6121. ------------------------------
  6122.  
  6123. 5A(149) Sun Jun 24 21:42:09 1990
  6124.  
  6125. The description of changes since edit 148 is quite long (about 500 lines)
  6126. and is divided into major sections.  I feel like I should put a table of
  6127. contents here...
  6128.  
  6129. PACKET LENGTHS AND BUFFERS
  6130.  
  6131. Changed the packet buffers from static to dynamic allocation, but only
  6132. if you put -DDYNAMIC in your CFLAGS.  Here's how it works:
  6133.  
  6134. The following symbols are now defined in ckcker.h in such a way that you
  6135. can override them by defining them in CFLAGS:
  6136.  
  6137.   MAXSP = Maximum send-packet length = 2048.
  6138.   MAXRP = Maximum receive-packet length = 2048 for Unix, 1920 for VMS.
  6139.   SBSIZ = Total allocation for send-packet buffers (default = 3008)
  6140.   RBSIZ = Total allocation for receive-packet buffers (default = 3008)
  6141.  
  6142. If you do nothing to your makefile entry, you will get the defaults shown
  6143. for these four quantities, and the packet buffers will be ordinary arrays
  6144. (6K worth) in your program save image.  This is exactly how C-Kermit 5A has
  6145. been configured since the beginning.
  6146.  
  6147. Still using static allocation, you can reduce (or increase) the size of the
  6148. program image by changing the values of any or all of these symbols in CFLAGS,
  6149. for example:
  6150.  
  6151.   make foo "CFLAGS = -DBSD4 -DSBSIZ=2000 -DRBSIZ=1247"
  6152.  
  6153.   make foo "CFLAGS = -DSVR3 -DMAXSP=500 -DMAXRP=250 -DSBSIZ=2000 -DRBSIZ=1247"
  6154.  
  6155. If you include -DDYNAMIC, then the packet buffers will be allocated
  6156. dynamically using malloc().  If malloc() fails to allocate buffers of the
  6157. requested size, it will try progressively smaller sizes until it succeeds or
  6158. the size becomes too small.  See the new function inibufs() in ckcfn3.c.  With
  6159. dynamic allocation, the default definitions are:
  6160.  
  6161.   MAXSP = 4096 for Unix, 2048 for VMS.
  6162.   MAXRP = 4096 for Unix, 1920 for VMS.
  6163.   SBSIZ = 6000
  6164.   RBSIZ = 6000
  6165.  
  6166. So by including just the -DDYNAMIC switch, you get 4K packets, rather than 2K.
  6167. Dynamic allocation has been tested on a SUN-4 using 4K maximum packet lengths
  6168. and up to 10K buffers, with various combinations of actual packet sizes and
  6169. window sizes, and it works fine.  For a direct connection with no delays,
  6170. there is no special performance advantage in using 4K packets instead of 2K or
  6171. even 1K, but when delays are involved, the longer the packets and the bigger
  6172. the window size, the better the performance (see "How Efficient Is Kermit?" in
  6173. Kermit News #4).
  6174.  
  6175. By the way, these tests were performed SUN-to-SUN over Ethernet, using SET
  6176. HOST.  On a serial connection, such long packets might overrun the Unix
  6177. kernel's buffers.  If this seems to be happening to you, try SET PARITY EVEN
  6178. on both ends to see if it improves matters (this lets Xon/Xoff work during
  6179. packet mode).
  6180.  
  6181. NEW COMMANDS
  6182.  
  6183. Added "SET BUFFER x y" command, to allow users to change the send and receive
  6184. buffer sizes from whatever was selected at compile time.  Executes only if the
  6185. program was built with -DDYNAMIC, otherwise just prints a message "?Sorry, not
  6186. available".  SHOW PROTOCOL now displays the buffer sizes.  I was able to give
  6187. numbers as big as five million (yes, SET BUFFERS 5000000 5000000) successfully
  6188. on the SUN.  On smaller and/or 16-bit systems, the upper limit is obviously
  6189. much smaller.  If you give this command and nothing seems to be happening for
  6190. a long time, type Ctrl-C to get the prompt back -- apparently, malloc() can
  6191. sometimes become quite preoccupied with itself and never return.
  6192.  
  6193. Jay Rouman wanted to have an option to write the session log with CR's
  6194. stripped, so I added a command SET SESSION-LOG { TEXT, BINARY }.  TEXT is the
  6195. new default, and strips carriage returns, NULs, XONs, and XOFFs.  BINARY
  6196. records all incoming characters in the session log.  ckuus3.c, ckucon.c.
  6197. Updated manual and man page.
  6198.  
  6199.  
  6200. MAKEFILE-RELATED CHANGES
  6201.  
  6202. "make ps2aix" tested successfully, changed "?" to "+" in makefile.
  6203.  
  6204. Added makefile entry for SUN OS 4.1, which has switched to Honey DanBer UUCP.
  6205. "make sunos41" and (for the System V environment) "make sunos4s5h".
  6206.  
  6207. Added -DDYNAMIC to "make sunos4" and "make sunos41".  Add this to your
  6208. makefile entry too and see if it works.  If so, let me know, and I'll add
  6209. it to the master copy of the makefile (except for non-virtual memory systems?).
  6210.  
  6211. Made -DDEBUG and -DTLOG the default, and removed these from all makefile
  6212. entries.  To build Kermit without debugging or transaction logging, include
  6213. -DNODEBUG and/or -DNOTLOG in makefile CFLAGS; this was done for all entries
  6214. that previously omitted -DDEBUG or -DTLOG.  ckcdeb.h, makefile.
  6215.  
  6216. Cleaned up the #ifdefs in ckutio.c and ckufio.c that determine whether
  6217. <sys/file.h> is included.  Added -DNOFILEH to the makefile entries, and simply
  6218. included <sys/file.h> unless NOFILEH was defined.  Added a couple special
  6219. cases because RTU, CIE, FT18, and BSD41 need to have <sys/file.h> in one of
  6220. these modules, but must not have it in the other.  I don't know why.  Does
  6221. anyone?  Anyway, from now on, new makefile entries can simply include
  6222. -DNOFILEH in CFLAGS if including <sys/file.h> causes trouble, rather than
  6223. having to modify the source.  More detail about this in ckuins.doc.
  6224.  
  6225. Added many new variations to try for HP-UX and Masscomp RTU.  Hopefully the
  6226. number of these can be reduced after testing.
  6227.  
  6228.  
  6229. MODEM SIGNALS AND HANGUP
  6230.  
  6231. Supplied missing } in ckudia.c, ATT6300 case.
  6232.  
  6233. Restored the close() and open() to the ATT7300-specific part of tthang().
  6234. Removing it broke everything.  Andy Fyfe.
  6235.  
  6236. Kristoffer pointed out that it's a bad idea to call ttclos() from tthang(),
  6237. because ttclos() calls tthang()!  So I replaced the call to ttclos() in
  6238. tthang() with calls to ttunlck(), ttres(), and close(), along with error
  6239. messages so we can see where it gets stuck.  Also, put a 3-second time limit
  6240. on the the call to ttopen() so that it won't get stuck waiting for carrier in
  6241. case of SET CARRIER ON.  Also, put all references to O_NDELAY within #ifdef
  6242. O_NDELAY conditionals.  Added one more close(priv_opn()) to tthang(), just in
  6243. case this will make the ioctl and fcntl flags take root before trying the
  6244. final big sequence of total close and massive reopen.
  6245.  
  6246. I also considered adding code to support O_NONBLOCK for POSIX, but that would
  6247. further multiply the number of possibilities and combinations.  As you might
  6248. expect, the behavior of O_NONBLOCK is not quite the same as O_NDELAY.  Nobody
  6249. has asked for this yet, so I didn't do it.
  6250.  
  6251.    All designers of Unix operating systems and "portable Unix" standards
  6252.    should be forced to read C-Kermit's tthang() function...  BSD and HP-UX
  6253.    are the only ones that even come close to doing it right, i.e. giving
  6254.    the programmer direct access to the modem signals, rather than hiding
  6255.    them behind thirty-seven layers of undocumented magic and obfuscation.
  6256.  
  6257. In ckdial(), added calls to tthang() when the DIAL command times out.  Andy
  6258. Fyfe had reported that when he got the "Call did not complete" message, that
  6259. the phone line was not hung up, and just kept on ringing.  tthang() is invoked
  6260. here only if SET DIAL HANGUP ON (which is the default).  ckudia.c.  Also
  6261. reformatted this file a little bit to look more like the other modules.
  6262.  
  6263. Jim Barbour complained that upon escaping back from CONNECT, Kermit hung up
  6264. the line.  Inspection of the code showed that if you CONNECT and then use
  6265. Ctrl-\ h to hangup the phone, the flag "dohangup" was set to 1.  This flag was
  6266. examined any time the user escaped back, and so any Ctrl-\ c used subsequent
  6267. to any Ctrl-\ h would also hang up the phone.  Added an instruction to reset
  6268. dohangup to zero after hanging up to make sure this doesn't repeat.
  6269.  
  6270. At Kristoffer's suggestion, in the System-V section of tthang(), activated
  6271. O_NDELAY before attempting to set the speed to zero.  This is done in both the
  6272. first and second sections.  It probably doesn't hurt, and it should be undone
  6273. automatically in the subsequent restoral of modes.
  6274.  
  6275.  
  6276. LOCK FILES
  6277.  
  6278. In ttlock(), made sure the pid-string was null terminated before attempting
  6279. to read it with sscanf().  Also, added "Removing stale lockfile" message.
  6280.  
  6281. Changed ttlock() to return -2 if the device is truly locked (in use by another
  6282. legitimate process), -1 otherwise (access to lock directory denied, etc).
  6283. Changed ttopen() to have the following return codes:
  6284.  
  6285.     0 on success
  6286.    -5 if device is in use
  6287.    -4 if access to device is denied
  6288.    -3 if access to lock directory denied
  6289.    -2 upon timeout waiting for device to open
  6290.    -1 on other error
  6291.  
  6292. Changed SET LINE in ckuus3.c to print an appropriate message for each of these
  6293. return codes.
  6294.  
  6295. For Unix C-Kermit, additional messages are printed by ttlock or ttopen:
  6296.  
  6297.    -5 "ls -l" listing of lockfile to show user and time
  6298.    -4 message stating reason
  6299.    -3 message stating reason (directory does not exist or permission denied)
  6300.  
  6301. In the -5 case, we use priv_on(), system(), priv_off() rather than zshcmd() in
  6302. order to make sure we can give them the directory listing.  And then we even
  6303. try to show them the pid of the process that wrote the lock.
  6304.  
  6305. In the -3 case when the directory does not exist, ttlock prints "UUCP not
  6306. installed or Kermit misconfigured".  This raises the interesting question:
  6307. what does the user do about it?  This happened to me when the SUN-4 I work on
  6308. was upgraded from 4.0 to 4.1, and UUCP was not installed.  This completely
  6309. prevented me from using Kermit to dial out.  This made me think of the many
  6310. users of Unix workstations who do not use uucp, tip, or cu, or even know what
  6311. they are.  These people should not be forced to install uucp just in order to
  6312. run Kermit.  For this reason, I added a new CFLAGS option: -DNOUUCP.  This is
  6313. a reversal of previous "policy".
  6314.  
  6315. Why the reversal?  Because (a) anybody can circumvent UUCP lockfile "security"
  6316. if they want to without Kermit's help, and (b) part the "spirit of Kermit" is
  6317. that users should not have to depend on proprietary packages or privileged
  6318. system administrators in order to install or run it.  The only people who
  6319. would deliberately use -DNOUUCP for evil purposes could accomplish the same
  6320. effect by changing the (freely available) C-Kermit source code, or running an
  6321. older version of C-Kermit, or even by writing their own simple little i/o
  6322. program.
  6323.  
  6324. The explanation of UUCP lockfiles in ckuins.doc has been rewritten to take all
  6325. this into account.
  6326.  
  6327.  
  6328. SETUID
  6329.  
  6330. Added another function to ckutio.c priv package -- real_uid().  This returns
  6331. the real uid of the process, which is simply ckutio's static int realuid.
  6332. There were several places in ckufio.c that called getuid(), but if these had
  6333. been swapped by the priv package on a BSD system without the saved original
  6334. setuid feature, then getuid() would return the wrong real uid!  So the
  6335. getuid() calls in ckufio.c have been replaced with calls to real_uid().  These
  6336. were all in the tilde-expansion code, and would only occur when the user was
  6337. referring to herself, as in "send ~/oofa".
  6338.  
  6339. I did not replace the call to popen() zxcmd() with yet another a hand-coded
  6340. fork(), exec(), etc etc.  If somebody else wants to do this, be my guest.  The
  6341. reason why it's needed is that before feeding the command to popen(), we have
  6342. to turn off privileges.  But then, for some Unix versions, we can never turn
  6343. them back on again, which will be confusing.  This only affects Kermit
  6344. programs that are running setuid on versions of Unix that do not save the
  6345. original set-user-id, and only after the user uses the OPEN !WRITE or OPEN
  6346. !APPEND commands.
  6347.  
  6348. Replaced several remaining calls to system() -- in ongetty(), offgetty(), and
  6349. acucntrl() in ckutio.c -- with calls to zshcmd().
  6350.  
  6351.  
  6352. FORKS
  6353.  
  6354. Changed zshcmd() in ckufio.c to check for fork() failure, so it doesn't go
  6355. into a loop waiting for a nonexistent fork.
  6356.  
  6357. I also removed the output redirection feature from zshcmd(), so now the second
  6358. argument to this function is ignored.  Actually this happened a couple edits
  6359. ago, because it was interfering with (believe it or not) some work on X.25
  6360. network support.  There are other ways to do the same thing (OPEN !READ, READ,
  6361. OUTPUT, etc).
  6362.  
  6363. People have been reporting very strange behavior since I replaced all calls to
  6364. system() by calls to zshcmd() a couple edits ago.  The major difference is
  6365. that zshcmd() uses the user's preferred shell, whereas system() always uses
  6366. /bin/sh.  Before the change, zshcmd() was used by the "!" (RUN, PUSH) command,
  6367. and system() was used execute miscellaneous commands like DIRECTORY (ls -l) and
  6368. SPACE (df .), and some protocol-related functions like mailing and printing of
  6369. incoming files.  Recall, this change was made so that the processes invoked
  6370. by system() would not inherit any privileges from Kermit if Kermit was running
  6371. setuid, and still the main process would not have to lose its privileges
  6372. permanently.
  6373.  
  6374. Several people have reported that issuing commands like SPACE and DIR, which
  6375. previously used system(), result in having the shell's prompt show up in
  6376. screen listings.  One user reported this happens only in local mode, but not
  6377. in remote mode.  I cannot repeat this locally on SUNOS, AIX, or anywhere else
  6378. I tried.  The only reason I can guess for this happening is that when an
  6379. argument is given, the user's shell is run with -c and the given argument.  If
  6380. the user's shell does not happen to understand the -c option, it might issue a
  6381. prompt.  sh, csh, and ksh respond uniformly to -c: they don't prompt, they do
  6382. the single command, then exit.
  6383.  
  6384. What about an interactive shell, with no command line arguments?  In this case
  6385. we use the "-i" option, to force interactive mode.  This only happens if the
  6386. string pointer to zshcmd is NULL or points to an empty string.  All three
  6387. shells (sh, csh, ksh) accept and treat the -i option uniformly.
  6388.  
  6389. Many C-Kermit testers have suggested that /bin/sh should be used, rather than
  6390. the user's preferred shell, when there are commands, i.e. when the shell is
  6391. not to be run interactively.  The cost of not using the user's preferred shell
  6392. would be:
  6393.  
  6394.    a. Changing how the "!" works, because it has always used the user's
  6395.       preferred shell, whether it had arguments or not.
  6396.  
  6397.    b. Changing the calling conventions of zshcmd to include an argument to
  6398.       specify whether to use the user's preferred shell or the system's
  6399.       standard shell (which would make little sense outside of Unix, so why
  6400.       inflict it on C-Kermit programmers in other operating systems?).
  6401.  
  6402.    c. Adding yet another new system-dependent function that everybody else
  6403.       would have to implement (Mac, Amiga, OS/2, VMS, etc etc) but nobody
  6404.       would understand.  Groan.  Let's avoid this if we can.
  6405.  
  6406. Allister Gorman in New Zealand reported that on his SUN-4, if he invokes an
  6407. inferior shell with "!" and then exits from it, he finds himself back in the
  6408. shell that invoked Kermit in the first place, with Kermit placed in the
  6409. background.  I can't reproduce this one either, not even on a SUN-4.  Maybe
  6410. it's the Coriolis effect?  He says that when this happens, Kermit can be fg'd
  6411. and continued ok, and that this does not happen if you give an argument to the
  6412. shell escape, e.g. "! more file".
  6413.  
  6414. Maybe the reason I can't reproduce any of these problems is that I already did
  6415. something by accident to fix them.  If they recur, please let me know.
  6416.  
  6417.  
  6418. TERMINAL INTERRUPTS
  6419.  
  6420. DISABLE FINISH is supposed to let you start a Kermit server that can't be
  6421. taken out of server mode by its client: BYE and FINISH commands are simply
  6422. ignored.  This is to let you make "kermit -x" be a login shell on a certain
  6423. tty, e.g. for dialup Kermit service.
  6424.  
  6425. The trick is to make a remote Kermit server with FINISH disabled also ignore
  6426. keyboard interrupts (SIGINT, etc).  I tried unsuccessfully to do this before,
  6427. but now I think I have it.  First of all, connoi() was setting SIGINT to
  6428. SIG_DFL; I changed this to SIG_IGN (ckutio.c).  Second, ttinl() was calling
  6429. ttres() when it read two Ctrl-C's in a row; I removed that call (ckutio.c).
  6430. Third, proto() was calling conint() instead of connoi(); that's fixed too
  6431. (ckcpro.w).  Now it seems like Ctrl-C works fine to interrupt a remote Kermit
  6432. in packet mode, and a remote server with FINISH disabled is immune to Ctrl-C's.
  6433.  
  6434. Changed the Ctrl-C (sigint) trap in the interactive command parser to return
  6435. to the prompt, rather than exit the program by using setjmp and longjmp.
  6436. Works at the prompt, works at any point while typing a command, seems to work
  6437. ok during execution of (most) commands, interrupts deeply nested take files or
  6438. macros OK, works before and after file transfer.  If this feature causes you
  6439. problems, add -DNOCCTRAP to CFLAGS in your makefile entry.  FURTHER TESTING
  6440. NEEDED!
  6441.  
  6442. So far, it causes one problem for me: if I type Ctrl-C while an INPUT command
  6443. is in progress (on the SUN-4 at least), I get a core dump.  I think this is
  6444. because doinput() calls ttinc() and coninc() with timeout parameters, and when
  6445. the alarm goes off inside of these ckutio.c functions, the stack gets screwed
  6446. up because of a longjmp within a longjmp???  It seems to be a delayed effect,
  6447. because the longjmps within ckutio.c work fine repeatedly, and the Ctrl-C
  6448. returns control to the right place, and lots of parser code gets executed
  6449. correctly, and then then the program core dumps when the parser calls
  6450. ckmkey2().  I can't figure out how to fix this, can you?  ckuus5.c.
  6451.  
  6452. As a temporary, but completely unsatisfying, solution to this problem, I
  6453. inserted a call connoi() at the beginning of doinput() and to conint() at the
  6454. end, meaning that INPUT can't be interrupted with Ctrl-C.  In remote mode
  6455. (e.g. when you're testing it with your own terminal) it can't be interrupted
  6456. at all.  In local mode, you can interrupt it by typing two carriage returns at
  6457. your terminal.  ckuus4.c.
  6458.  
  6459.  
  6460. LONG FILENAMES AND WILDCARD EXPANSION
  6461.  
  6462. Attempted to "modernize" the directory reading functions of ckufio.c, and
  6463. to make them more easily selectable from the makefile via CFLAGS.  This is
  6464. a long story...
  6465.   
  6466. When C-Kermit is given a "*" or "?" in a filename in an interactive command
  6467. like SEND, or in server mode when the other Kermit gives a GET command, Kermit
  6468. expands the given file specification into a list of all files that match by
  6469. reading the directory.  There have been increasing reports that Kermit fails
  6470. to do this correctly, and similar reports that it fails to find files that
  6471. have long names.  Here are some tests to make sure that Kermit is reading the
  6472. directory correctly:
  6473.  
  6474.    1. Make a new directory and cd to it.
  6475.    2. Create files with the following names (contents don't matter):
  6476.         aa, ab, ac, ad, ae, afilewithaveryverylongname.
  6477.    3. Start Kermit.
  6478.    4. Type SEND ?.  Do you see all the filenames?
  6479.    5. Type SEND a<ESC>.  Does it beep?  (It should.)
  6480.    6. Type SEND af<ESC>.  Was the long filename completed?
  6481.  
  6482. If your answer to any of the questions was no, then you need to change the way
  6483. Kermit is built for your file system.  First, a little background...
  6484.  
  6485. Back in simpler times, there was only one way to read a directory, which was
  6486. used in original Bell Labs Unix, Unix Versions 6 & 7, AT&T System III and V,
  6487. and their derivatives (BSD 2.8, 4.0, 4.1, etc):
  6488.  
  6489.   #include <sys/dir.h>
  6490.   int fd;
  6491.   struct direct dir_entry;
  6492.   struct direct *dirbuf = &dir_entry;
  6493.   fd = open(directoryname); read(fd,dirbuf,sizeof dir_entry); close(fd);
  6494.  
  6495. In this model, we read the actual directory entry.  Unix file and directory
  6496. names have a maximum length of 14 characters.  Most of Kermit's filename
  6497. problems on System-V based systems occur because it is using this model, but
  6498. the underlying system has adopted a different one which probably allows for
  6499. longer filenames.
  6500.  
  6501. In BSD 4.2 (and 2.9), Berkeley changed their file system to allow long file
  6502. and directory names, and (perhaps more important) for a variety of directory
  6503. structures.  BSD 4.2 supplied new directory-related system calls to hide the
  6504. details of the underlying directory structure from the program:
  6505.  
  6506.   #include <sys/dir.h>
  6507.   DIR *fd, *opendir();
  6508.   struct direct *dirbuf;
  6509.   fd = opendir(directoryname); dirbuf = readdir(fd); closedir(fd);
  6510.  
  6511. For many years, these were the only two ways to read a directory.  This made
  6512. Kermit's job easy.  For AT&T-based Unixes (UXIII), Kermit used the first
  6513. method, and for Berkeley-based the second (ANYBSD).
  6514.  
  6515. But soon, the System-V Unixes became envious of BSD's longer names, and so
  6516. vendors like Masscomp and Silicon Graphics began to add long filenames,
  6517. creating AT&T Unixes with Berkeley file systems.  Usually, access to the long
  6518. filenames is given by means of an alternative header file and/or library, like
  6519. <sys/ndir.h>, -lbsd, -lx, -I/usr/include/bsd, etc.
  6520.  
  6521. And then, in an apparent effort to provide a single interface to the various
  6522. styles of file system, and to allow for remote file systems like RFS and NFS,
  6523. AT&T (???) decided in System V Release 2 (or 3?) (see SVID Issue 2 and SVID
  6524. 3rd Ed) that all directory references should use new portable system (or
  6525. library) calls that do not require the programmer to know the format of the
  6526. directory entry itself, and to go through a new header file, <dirent.h>, and
  6527. that <sys/dir.h> would become obsolete.  POSIX took this one step further, and
  6528. does not even allow for the existence of <sys/dir.h> (see IEEE Std 1003.1).
  6529. (Historical note: reportedly, the <dirent.h> approach is the result of work by
  6530. Doug Gwyn of BRL contributed to the public domain.)
  6531.  
  6532. In any case, we now have a WIDE VARIETY of ways in which to read directories.
  6533. The variables seem to be:
  6534.  
  6535.   1. The directory header file:  <sys/dir.h>, <dir.h>, <ndir.h>, <sys/ndir.h>,
  6536.      "/usr/lib/bsd/ndir.h", <dirent.h>, ...
  6537.  
  6538.   2. Whether to use open()/read()/close() or opendir()/readdir()/closedir().
  6539.  
  6540.   3. If using opendir()/readdir()/closedir(), how to declare them (struct
  6541.      direct or struct dirent).
  6542.  
  6543. So here's the new arrangement for C-Kermit.  First we have system-specific
  6544. #ifdefs at the top of ckufio.c (and ckutio.c) to decide which header file to
  6545. include: if some special symbol like NDIR or XNDIR is defined, we use the
  6546. associated file, like <sys/ndir.h>.  Otherwise, if DIRENT is defined, we use
  6547. <dirent.h>.  In all other cases we use <sys/dir.h>.
  6548.  
  6549.   NOTE: Why do we even bother with this in ckutio.c???  Because we want
  6550.   to find out if MAXNAMLEN is defined, and thereby automatically determine 
  6551.   whether we have a pre-4.2 version of Berkeley UNIX.  At this point, it
  6552.   might be safe to remove this "intelligence" from ckutio.c, and rely on
  6553.   makefile CFLAGS.
  6554.  
  6555. The actual directory reading is confined to the traverse() function in
  6556. ckufio.c.  Here we define a symbol LONGFN if BSD42 or BSD29 are defined.  For
  6557. other systems that are not compiled with BSD42 or BSD29 defined, you can add
  6558. -DLONGFN to CFLAGS in the makefile entry to enable BSD-style directory reading
  6559. (making sure that you have included the appropriate header file for this).
  6560.  
  6561. Then we take care of the declarations.  For DIRENT, we use the well-defined
  6562. standard declarations for opendir(), etc.  When DIRENT is not defined, we
  6563. have two cases: the old BSD case, which we select if LONGFN is defined, and
  6564. the old Bell/AT&T case, which we select otherwise.
  6565.  
  6566. Both the DIRENT and the LONGFN-non-DIRENT cases use opendir(), etc, rather
  6567. than open().  In these cases we define the symbol OPENDIR.
  6568.  
  6569. Finally, we handle the actual opening, reading, and closing of the directory.
  6570. This is much simplified.  If OPENDIR is defined, we use opendir(), readdir(),
  6571. and closedir(), otherwise we use open(), read(), and close().
  6572.  
  6573. So here are the new guidelines for constructing a makefile entry:
  6574.  
  6575. 1. If your system has /usr/include/dirent.h, then you should add
  6576.    -DDIRENT to your makefile entry!  Otherwise:
  6577.  
  6578. 2. If you have a System-V based system that uses long filenames, or has in
  6579.    any other way a non-vanilla-original Unix directory format:
  6580.  
  6581.    a. Read your system manuals about directory (long filename?) support.
  6582.    b. If the relevant header file is not <sys/dir.h>, include one of the
  6583.       following switches:
  6584.  
  6585.         Header file     CFLAGS switch
  6586.          <ndir.h>        -DNDIR   
  6587.          <sys/ndir.h>    -DXNDIR  
  6588.          other...        You'll have to invent a new one.
  6589.  
  6590.    c. Add any special libraries (like "LIBS = -lbsd") to your makefile entry.
  6591.  
  6592.    d. Add -DLONGFN to CFLAGS in your makefile entry.
  6593.  
  6594. 3. Otherwise, do nothing.  Kermit should pick the right options automatically.
  6595.  
  6596. Thanks to Bo Kullmar for many of the basic ideas here, and to Andy Fyfe and
  6597. David MacKenzie and others for much useful information.  I think/hope a lot of
  6598. problems will be solved by adding -DDIRENT to makefile entries...
  6599.  
  6600. Tested this stuff on SUNOS 4.1 and IBM AIX/370 (both with -DDIRENT), works
  6601. fine.  Tested without -DDIRENT on on SUNOS 4.1 System V environment, and it
  6602. compiles & loads ok, but can't find long files; tested with -DDIRENT in the
  6603. same environment, and it can find long files.  Tested on Encore 4.3BSD without
  6604. -DDIRENT, also works fine.  Still needs testing on Xenix, AT&T systems that
  6605. don't have <dirent.h>, etc, and on the special-case systems like RTU and Iris,
  6606. and most of all, on HP-UX; there are now several makefile entries for HP-UX:
  6607.  
  6608.   hpux:     <dir.h>, open(), read(), close().  Pre-6.2 versions of HP-UX?
  6609.   hpuxlf:   <ndir.h>, opendir(), readdir(), etc (BSD style)
  6610.   hpuxde:   <dirent.h>, opendir(), etc. (POSIX style)
  6611.   hpuxs5r3: Like hpuxde, but also uses Sys V R3 signal() type (void, not int)
  6612.  
  6613. All four may be necessary.  Reportedly, hpuxlf is needed for the Series 300.
  6614. It's not clear if these are strictly related to the release number of HP-UX,
  6615. or if long filename support is an "unbundled option" that may be present on
  6616. some HP-UX systems and absent on others.  Feedback needed.
  6617.  
  6618.  
  6619. MISCELLANEOUS
  6620.  
  6621. Ted Medin sent packet logs showing C-Kermit failing to send files to MS-DOS
  6622. Kermit with window size 7.  MS-DOS Kermit got a checksum error, sent a NAK,
  6623. and C-Kermit claimed the NAK was not in the current window and gave up.  I
  6624. looked at the code for hours, comparing it with the logs, and could not find
  6625. any way this could happen (even though it did).  Found one case in input()
  6626. where a variable, x, could be used before being set, which could have resulted
  6627. in a spurious termination of a file transfer (but probably not with a "NAK out
  6628. of window" message) and fixed that.  ckcfn2.c.
  6629.  
  6630. Fixed two calls to logpkt() in ckcfn2.c, which had quotes misplaced around the
  6631. arguments, causing a core dump if these calls were ever executed.  Changed
  6632. calling convention to logpkt so caller specifies whether it is a sent (s) or a
  6633. received (r) packet.  In the previous edit, all logged packets were marked
  6634. with 's-'.
  6635.  
  6636. Changed all declarations of ttname[] and filname[] to be char rather than
  6637. CHAR, to avoid complaints from compilers about incompatible pointer types in
  6638. strcpy(), etc.  Many modules.  In other strcpy()'s, put explicit casts on
  6639. literal strings to avoid complaints.  Many other minor lintish corrections.
  6640.  
  6641. In the lower fork of the CONNECT command, in which it sends a signal to its
  6642. parent, asking to be killed, and then pause()'ing, changed these pause()'s
  6643. to "for (;;) pause();" in case some harmless signal causes pause() to return
  6644. unexpectedly.  Currently this code is used only in telnet connections.
  6645.  
  6646. ------------------------------
  6647.  
  6648. 5A(148) Fri Jun 15 16:45:14 1990
  6649.  
  6650. Bo Kullmar found some problems with zoutdump() in ckufio.c.  I made the test
  6651. for success more stringent, namely that write() must write exactly the number
  6652. of characters it is told to write.  Previously if, for some reason (like a
  6653. disk filling up) it wrote less than asked, it would still reset the buffer
  6654. count and pointer, which would lead to gaps in the output file.  To compound
  6655. the situation, a set of parentheses was missing!  In addition, Bo says that
  6656. using ferror() to determine if there was an error did not work in Sys V R2 and
  6657. earlier.  (Actually, it never did, and could never, work with write() -- it
  6658. was left there as an artifact from an earlier release when frwrite() was used
  6659. instead of write().)
  6660.  
  6661. Bo also said that when collecting logs, in particular the debug log, that
  6662. disk-full errors were not handled correctly.  So I made sure that zchout,
  6663. zsout, zsoutl, and zsoutx all caught and returned errors, and made all calls
  6664. to them check the return code.  In ckcfn2, I collapsed a lot of redundant code
  6665. into a new logpkt() function.  Added checks to all zsout*()'s in dump[rs]buf()
  6666. for the debug log in ckcfn3.c.  Added checks to all zsout*()'s and zchout()'s
  6667. for session logging in ckucon.c, and ckuscr.c.  Added checks to all zsout*()'s
  6668. in debug() and tlog() in ckuus3.c.  etc etc...
  6669.  
  6670. While I was at it, I removed the debug() calls from ttinc() and ttoc(), since
  6671. they tended to make the debug log HUGE during CONNECT.
  6672.  
  6673. Jay Rouman said that on the Tandy 6000, CONNECT mode is a lot slower in 147
  6674. than in 146 & earlier edits.  I guess it wasn't such a great idea to get read
  6675. of the block-mode reads after all.  I fixed it so that the block reads are
  6676. executed on all non-network systems (no -DNETCONN), and on network systems
  6677. except during a telnet session.
  6678.  
  6679. Andy Fyfe noticed that removing the -DUXIII from the Unix PC make entry
  6680. caused problems in ckutio.c, because there are some #ifdefs before ckcdeb.h
  6681. is included.  I moved the #include to before the #ifdefs & compiled for BSD
  6682. and ATT.  Seems OK.
  6683.  
  6684. ------------------------------
  6685.  
  6686. 5A(147) Thu Jun 14 23:48:05 1990
  6687.  
  6688. Some of you might wonder why I write such verbose notes about each edit.  It's
  6689. because if I have to describe what I've done, I usually realize that what I'm
  6690. trying to describe is a crock, and so I wind up doing it over again.  I think
  6691. this must have happened with each of the major topics listed below in this
  6692. edit...
  6693.  
  6694. FILE SYSTEM
  6695.  
  6696. Learned from Bertil Stenstroem at Stockholm University Computer Centre (QZ) in
  6697. Sweden that HP-UX 7.0 is a System V Unix with a BSD file system, that uses
  6698. <ndir.h> rather than <sys/dir.h>.  Added a makefile entry "make hpux7" that
  6699. includes the -DNDIR and -DBSD4FILE options, and changed the code in ckufio.c
  6700. to do the right thing (I hope) if -DNDIR is included.  I thought I did this
  6701. before, but the code was missing.  The hpux7 entry assumes a basis of System V
  6702. R2 or earlier.  If it's really System V R3 or later, then we need to change it
  6703. to include -DSVR3.
  6704.  
  6705. Bjorn Carlsson, also of QZ, pointed out that BSD4FILE was not implemented
  6706. correctly.  Originally, it applied to the whole ckufio.c file, turning a
  6707. normally AT&T version into a BSD version not just for the file system, but
  6708. also for anything else that happened to be in ckufio.c, causing all sorts of
  6709. problems, like trying to use nonexistent things like seteuid, struct timeb,
  6710. etc.  So I changed ckufio.c to only make BSD4FILE effective around the
  6711. directory-traversing functions splitpath(), fgen(), traverse(), addresult(),
  6712. iswild(), and match().
  6713.  
  6714. Needs testing on HPUX 7.0 (make hpux7) and Silicon Graphics Iris (make iris).
  6715. This might possibly be the solution to the problems on the MIPS machines too.
  6716. Corrections from Sweden (as always) are welcome and expected!  Anywhere else
  6717. too...
  6718.  
  6719. COMPILATION SWITCHES
  6720.  
  6721. Decided that it was dumb to require makefile entries to contain compilation
  6722. switches to denote features or systems that could always be inferred from
  6723. other compilation switches, for example SVR3 and UXIII.  So I added the
  6724. following inferences to ckcdeb.h, since all C-Kermit files that might need
  6725. these version dependent symbols #include "ckcdeb.h":
  6726.  
  6727.   SUNS4S5 => SVR3
  6728.   ( SVR3, AUX, XENIX, ATT7300, ATT6300, HPUX, ISIII ) => UXIII
  6729.   ( BSD41, BSD43, SUNOS4 ) => BSD4
  6730.  
  6731. I also added the following two rules.  ANYBSD is a useful symbol, but
  6732. previously was defined only in cku[tf]io.c.  UNIX is new, it means any
  6733. version of UNIX.
  6734.  
  6735.   ( BSD4, BSD29 ) => ANYBSD
  6736.   ( ANYBSD, UXIII ) => UNIX
  6737.  
  6738. These symbols should allow us to remove a lot of duplicated #ifdef code.
  6739. The new rules are all of the form:
  6740.  
  6741.   #ifdef XXX
  6742.   #ifndef YYY
  6743.   #define YYY
  6744.   #endif /* YYY */
  6745.   #endif /* XXX */
  6746.  
  6747. so that no harm should be done if the redundant switch is left in the makefile
  6748. entry.  In the case of UNIX, it is not redefined if it is already defined by
  6749. the compiler.  Of course, this could be done more elegantly with macros, but
  6750. that would not be portable.  Meanwhile, I removed all the inferable switches
  6751. from the makefile.  Tested OK on the SUN.
  6752.  
  6753. MODEM SIGNALS
  6754.  
  6755. At Kristoffer's suggestion, changed the call to carrctl() in ttvt() to omit
  6756. the term "&& flow == CONNECT".  The idea is that we're always connecting (or
  6757. simulating a connect when dialing or running INPUT and OUTPUT commands) when
  6758. we call ttvt(), but when ttvt() was called with a "real" flow parameter,
  6759. rather than CONNECT or DIALING, the call to carrctl() was incorrect.
  6760. Note for the future: the overloading of the flow parameter with states like
  6761. DIALING and CONNECT was a bad idea.  The modem/line state should be separated
  6762. into a distinct parameter.
  6763.  
  6764. This one was my idea...  I rewrote tthang() (again!) for AT&T-based Unixes.
  6765. Now, for all UXIII versions except HP-UX (which provides system calls to
  6766. lower and raise DTR explicitly), the new tthang() does the following:
  6767.  
  6768.   1. save speed, flags, etc.
  6769.   2. set speed to zero.
  6770.   3. restore speed (etc) using ioctl and flags with fcntl.
  6771.   4. read speed using ioctl.
  6772.   5. if it's the same as the original speed in (1), done, return 0.
  6773.   6. close the device and open it again.
  6774.   7. restore speed using ioctl and flags using fcntl.
  6775.   8. read speed again using ioctl.
  6776.   9. if it's the same as the original speed in (1), return 0.
  6777.  10. "major reset": ttclos(), ttopen(), ttvt() or ttpkt().
  6778.  11. read speed yet again using ioctl.
  6779.  12. if it's the same as the original speed in (1), done, return 0.
  6780.  13. nothing worked, return -1.
  6781.  
  6782. I kept the previous version of tthang() in ckutio.c, within #ifdef OLDTTHANG
  6783. conditionals (the new version is in the #else part).  I compiled under both
  6784. the BSD and AT&T environments on the SUN-4, and ran it.  It works ok for me,
  6785. but then I have had a problem with hanging up.
  6786.  
  6787. -DCLOSEOPEN and -DCLSOPN2 are no longer used -- it's all done at runtime.
  6788.  
  6789. TESTING NEEDED!  If tthang() goes past step 5, diagnostic messages will appear
  6790. on your screen letting you know what's happening, so you'll know how far
  6791. Kermit had to go in order to hang up your device.  These are printed by a
  6792. macro, TTPRINT, which for now is defined as printf, but after the testing
  6793. period can be dummied out.  This part is untested because I can't make it
  6794. happen on any of my systems.
  6795.  
  6796. UUCP LOCKFILE
  6797.  
  6798. Corrected ttlock() to set haslock correctly to nonzero if a lockfile was
  6799. created, and to zero if it wasn't.  About 10 people noticed this mistake right
  6800. away.  Now lockfiles should no longer be left behind.  This depends on link()
  6801. returning 0 when successful and nonzero when it fails.  Let's hope all Unixes
  6802. and C's follow this convention.  All the ones I have access to do.  Also,
  6803. removed a diagnostic printf that was mistakenly left in.  ckutio.c.
  6804.  
  6805. Added display of the lockfile name to SHOW [ COMMUNICATIONS ] (for UNIX only,
  6806. first use of #ifdef UNIX).  ckuus4.c.
  6807.  
  6808. Changed ttopen() to return -3 if it can't create the lockfile, so that SET
  6809. LINE can print a more intelligent message if this happens.  Also, commented
  6810. out the "exclusive access" code based on TIOCEXCL from ttopen() and ttclose()
  6811. -- it never did anything except produce annoying error messages.  Like it or
  6812. not, we have to use lockfiles for exclusive access in Unix.  ckutio.c.
  6813.  
  6814. Added code to ttlock() to deal with stale lockfiles.  If it fails to create
  6815. the lockfile because a lockfile already exists, it reads the pid from the
  6816. lockfile and if the read is successful, it checks to see if their is still a
  6817. valid process with that id and if not, it removes the lockfile and creates its
  6818. own.  Suggested by Kristoffer.  Tested with integer pids, not tested with HDB
  6819. string pids.  Somebody please test this!  ckutio.c.
  6820.  
  6821. Kristoffer pointed out that if the lockfiles are protected against ordinary
  6822. users, then most likely the tty devices will be too.  Therefore, every open()
  6823. of a tty device should have priv_on/off() around it.  At his suggestion, added
  6824. a new routine, priv_opn(), for this purpose, and changed all tty-device
  6825. open() calls to priv_opn().  ckutio.c.
  6826.  
  6827. SETUID
  6828.  
  6829. At Kristoffer's suggestion (I should just abbreviate this, AKS...) I defined
  6830. a symbol SETREUID automatically for all versions based on BSD 4.2 and above.
  6831. Then I put the priv_off() "safety feature" mentioned in the previous edit
  6832. within SETREUID conditionals to prevent infinite loops of priv_off() and
  6833. priv_can() calling each other in the non-SETREUID case.  Also (AKS) simplified
  6834. the definition of switchuid and switchgid based on the new symbol SETREUID,
  6835. and changed ANYBSD in priv_can() to SETREUID.
  6836.  
  6837. Kristoffer also suggested that my "safety feature" was less than optimal,
  6838. because if it ever takes effect, that means that priv_on() will NEVER work.
  6839. Instead, priv_can() should be called only (a) from a created fork, so that it
  6840. only effects its own process rather than the main Kermit process, or (b) when
  6841. there is absolutely no other choice.  Here's how I handled this situation:
  6842.  
  6843. 1. I installed calls to priv_can in any fork that Kermit creates.  That
  6844. includes the CONNECT fork in ckucon.c, and the zxcmd() and zshcmd() functions
  6845. in ckufio.c.
  6846.  
  6847. 2. I created a new routine, priv_chk(), which calls priv_off() and then checks
  6848. to see if if the real uid is the priv'd id -- which will be the case if we are
  6849. using setre[ug]id() to swap real and effective uids -- and if so, to call
  6850. priv_can to permanently cancel privs.
  6851.  
  6852. 3. I replaced all Unix calls to system() to calls to zshcmd() (which cancels
  6853. privs, but only in the child fork).  For non-Unix versions, I call priv_chk()
  6854. before calling system().  NOTE: Kristoffer suggests that zshcmd might need
  6855. some things done to it before it can be a totally adequate system()
  6856. replacement, but I don't know what those things are.  All the former system()
  6857. functions seem to work OK: SPACE, DIRECTORY, etc.
  6858.  
  6859. 4. I called priv_chk() before calling popen().
  6860.  
  6861. xsystem() is a new macro that is used in ckuusr.c, where there were many calls
  6862. to system():  #define xsystem(cmd) zshcmd(cmd,0)
  6863.  
  6864. By taking this approach, I think I have isolated all the non-Unix Kermits from
  6865. having to know anything about the priv_*() functions.
  6866.  
  6867. TELNET (SET HOST)
  6868.  
  6869. At Jack Bryans' suggestion, in netopen(), changed:
  6870.  
  6871.     if (connect(ttyfd, (caddr_t)&saddr, sizeof(saddr)) < 0) {
  6872. to:
  6873.     if (connect(ttyfd, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) {
  6874.  
  6875. because the former caused complaints from the compiler on the NeXT, and
  6876. because it seemed wrong judging from the man page on connect() and the
  6877. definition of sockaddr and sockaddr_in in the header files.  Also, a peek at
  6878. the telnet source shows that Jack's way agrees with telnet.  Jack compared the
  6879. changed binary with the unchanged one on the NeXT and they were identical.  I
  6880. did the same on the SUN, and they were also identical, and the resulting
  6881. program does SET HOST and CONNECT (telnet) just fine.  ckutio.c.
  6882.  
  6883. Added code to make sure that if the user somehow manages to type an IAC
  6884. character (0xFF) during a telnet connection, that Kermit sends two of them.
  6885. ckucon.c.
  6886.  
  6887. Put a lot of work into conect() to support telnet negotiation options.  Moved
  6888. the code that sends the initial option string from netopen() in ckutio.c to
  6889. ckucon.c.  Put all telnet-protocol-related functions into ckucon.c, and made
  6890. them all start with "tn_": tn_ini() (send initial options), tn_sopt() (send
  6891. options), tn_doop() (do options), tn_sttype() (send terminal type).
  6892.  
  6893. Determined that if the remote host refuses to "Suppress Go Ahead" (WONT SGA),
  6894. that Kermit should (a) turn on local echo (duplex = 1) and (b) transmit LF (or
  6895. perhaps CRLF) whenever the user types CR (it does not seem to be necessary to
  6896. actually deal with GA's at all).  Kermit now handles these negotiations (and
  6897. subnegotiations) just fine.  The structure of the CONNECT command is an upper
  6898. fork that reads keystrokes and sends them, and a lower fork reads port input
  6899. and prints it -- it's the lower fork that must handle the telnet negotiations,
  6900. but it's the upper fork that must must act on them, and the two forks don't
  6901. share memory so we can't simply set variables in response to telnet
  6902. negotiations.  The only portable way I could think of to have the lower fork
  6903. tell the upper fork to change its duplex is for the lower fork to kill itself
  6904. with a user-defined signal, SIGUSR2, sent to the parent (SIGUSR1 is already
  6905. used for communications disconnect).  When this happens, the parent fork
  6906. toggles the value of "duplex" and starts a new child fork with the new value.
  6907. It's not clear to me how to extend this mechanism to more than one parameter.
  6908.  
  6909. Tested all this against the 4.3BSD telnetd (full duplex) on both SUN and
  6910. Encore, 4.2BSD telnetd (full duplex) on a VAX, and the IBM TCP/IP VM Telnet
  6911. daemon on a 4381 mainframe (half duplex).  Seems to work OK in all cases.
  6912. Current strategy is: Kermit refuses to echo (WONT ECHO) unless it gets WONT
  6913. ECHO or WONT SUPPRESS SGA from the telnet server.
  6914.  
  6915. To see the telnet negotiations interpreted, SET DEBUG SESSION before
  6916. connecting.  What Kermit sends is in [square brackets], what Kermit receives
  6917. is in <angle brackets>.  The actual raw negotiation characters are recorded in
  6918. the session log if you LOG SESSION.
  6919.  
  6920. Fixed a bug, discovered by Marcello Frutig in Brazil (who is adding SunLink
  6921. X.25 support).  If your network connection drops (e.g. because you log out
  6922. from the remote host) and then you CONNECT again, the program bombs.  The fix
  6923. is to make conect() in ckucon.c close the device if there is an error, but
  6924. only if it's a network device.
  6925.  
  6926. One useful by-product of the telnet work is that ckutio.c now contains a new
  6927. variable that can be accessed by other modules: ttnproto (network protocol in
  6928. use on the currently selected network).  So far, the only valid network type
  6929. is TCP/IP (BSD Sockets), and the only valid protocol is Telnet, but symbols
  6930. for some others have been added.  This will let future code distinguish
  6931. between, say, CTERM and LAT on a DECnet connection.  Added mention of ttnproto
  6932. to ckasys.doc.
  6933.  
  6934. Another useful (re)discovery was that there was code in the CONNECT command
  6935. fork that reads blocks of data from the communication device in order to
  6936. reduce single-character read() system calls.  That code was removed, because
  6937. (a) ttinc() now does its own buffering using myread(), and (b) when this code
  6938. reads a chunk of data it misses any telnet negotiations that happened to be in
  6939. it.
  6940.  
  6941. Compiled the program without -DNETCONN just to make sure none of today's work
  6942. interfered with systems that don't include network support.  It compiled and
  6943. ran OK.  The non-network version is 8K smaller on the SUN.
  6944.  
  6945. MISCELLANEOUS
  6946.  
  6947. Changed the DIAL command to allow any dial string that was not null, for
  6948. example "dial /" (in case the modem accepts / as a redial command).  Suggested
  6949. by Peter Mauzey.  ckuusr.c.
  6950.  
  6951. Reduced the number of dots per line in local-mode file transfer display by one
  6952. to prevent wrapping (again).  Peter Mauzey.  ckuus3.c.
  6953.  
  6954. Put the ATT6300 "if (debug) { if (didWeGet(...) ... }" code within
  6955. #ifdef DEBUG to prevent compilation errors without -DDEBUG.  Also added
  6956. sleep(3) to the debug case to avoid a carrier-loss error, just like the
  6957. ANSWERED case, because the DTDM apparently blinks carrier after giving its
  6958. ANSWERED message.
  6959.  
  6960. Added -O back to "make ATT6300" CFLAGS in makefile entry.  Compiler
  6961. automatically ignores -O on a per-module basis if it runs out of space, etc.
  6962. Peter Mauzey.
  6963.  
  6964. ------------------------------
  6965.  
  6966. 5A(146) Sun Jun 10 14:48:53 1990
  6967.  
  6968. SETUID DAY:
  6969.  
  6970. Over the years, as C-Kermit has had more and more features added to it --
  6971. not just reading and creating transferred files, but reading command files,
  6972. starting forks, executing system commands, reading and writing files from
  6973. command level, etc etc -- it has become increasingly difficult to manage the
  6974. code in light of the fact that in Unix, the program must be run setuid'd to
  6975. uucp (or daemon, or similar) in order to access the uucp lockfile.  As
  6976. features were added, the setuid people would put code around each feature to
  6977. change to the real user id (uid) and/or group id (gid), access the desired
  6978. system resource (file, fork, etc), and then put the id back to the original
  6979. effective one.  Basically, the program ran in privileged mode all the time,
  6980. except for brief moments (like file opening) where privs were turned off.
  6981. There are fundamental problems with this approach:
  6982.  
  6983.   1. It doesn't work at all on most BSD systems (explained below).
  6984.  
  6985.   2. It requires EXTREMELY CAREFUL programming, remembering to put the
  6986.      id-switching code around every item in the entire program that could
  6987.      conceivably give the user access to normally inaccessible resources.
  6988.  
  6989.   3. id-switching methods are not portable among Unix implementations, so
  6990.      each instance of (2) was a spaghetti of #ifdef's.
  6991.  
  6992. Kristoffer Eriksson sensibly suggested that we reverse things so that Kermit
  6993. runs unprivileged all the time except for the two brief moments when it might
  6994. need privileges, namely the creation and deletion of the uucp lockfile.  He
  6995. contributed a compact and consistent package of functions that could be called
  6996. from anywhere to turn privileges on and off.  After some scrutiny and
  6997. modifications by various people (notably Dean Long) in the BSD world, this
  6998. package is ready to install.  Anybody who intends to run C-Kermit setuid or
  6999. setgid should read this whole story.
  7000.  
  7001. Added descriptions of the new functions -- priv_ini(), priv_on(), priv_off(),
  7002. and priv_can() -- to ckasys.doc.
  7003.  
  7004. Removed all setuid-related code from ckufio.c -- about 2K of text!
  7005.  
  7006. Removed all setuid code from ckutio.c, and installed Kristoffer's setuid
  7007. package.  Installed later changes from Kristoffer sent in e-mail of 31 May,
  7008. in which many confusing #ifdefs were replaced by a couple elegant macros.
  7009. To handle the case where Kermit is being built in the BSD environment, but
  7010. setre[ug]id() is not supplied, I added a -NOSETREU option for makefile use,
  7011. which, if elected, results in using setuid() and setgid() instead (there might
  7012. be some better way?)
  7013.  
  7014. Put a call to priv_ini() in sysinit(), and put calls to priv_on() and
  7015. priv_off() around lockfile manipulations in ttlock() and ttunlck().  Changed
  7016. the access() call that checks write access to lockfile in look4lk() to be
  7017. executed only if the program is not running setuid.  (But all this was changed
  7018. later, see below.)
  7019.  
  7020. Changed priv_off() to plug a loophole pointed out by Dean Long: if it turns
  7021. out that privileges were turned off by swapping the real and effective uids
  7022. (gids) using setre[ug]id() in BSD, then an opportunistic user could fork from
  7023. Kermit (like with ! or PUSH), swap the ids back again, and get privileges.  So
  7024. in priv_off(), after doing the id-setting calls, I check to see if the real
  7025. uid is the priv'd uid, and if so, I call priv_can() to cancel all privileges
  7026. permanently.  This way, we don't have to rely on users to build the program
  7027. with the right compile options.  Of course, this defeats the purpose of this
  7028. part of our general-purpose privilege handling package, but there's no choice.
  7029. This change should not interfere with System V or BSD saved-setuid operation.
  7030.  
  7031. There are no calls to priv_ini(), priv_on(), priv_off(), or priv_can() in any
  7032. module except ckutio.c.  The entire setuid business is now totally isolated to
  7033. this one system-dependent module.
  7034.  
  7035. The new code should work for all System V implementations, and for those BSD
  7036. implementations that support the saved-original-effective-user-id feature.  It
  7037. will NOT work for other BSD implementations, but then it never did, and no
  7038. code can!  This is because BSD does not allow a setuid program, once it has
  7039. changed its effective uid to be its real uid, to get the original effective
  7040. uid back unless the BSD implementation supports the saved-setuid feature in
  7041. the kernel.  (In fact, it would be possible to make things work right for BSD,
  7042. V7, or any other Unix version by creating a priv'd fork at startup time,
  7043. opening a pipe to it, then turning off privs in the main fork permanently, and
  7044. feeding commands to the priv'd fork when privs are required.  If anybody feels
  7045. motivated to try this approach, be my guest!  And then prove it's secure!)
  7046.  
  7047. The result is that a setuid'd Kermit should work just as it did before, but
  7048. with the following advantages:
  7049.  
  7050.   1. There is no longer any need to put uid-related system calls around
  7051.      ordinary file accesses or process creation.  The programmer can treat
  7052.      Kermit just as though it will never run setuid.
  7053.  
  7054.   2. Both user and group ids are supported consistently throughout.  Kermit
  7055.      can run setuid and/or setgid to uucp or any other user except root.
  7056.      Kermit will no longer create files that have the improper user or group
  7057.      id, and it will no longer give or deny improper file access to users who
  7058.      are running a setuid'd Kermit.
  7059.  
  7060. In BSD, the saved-setuid feature is available only when the setreuid() and
  7061. setregid() functions are available.  Unfortunately, there is no way to
  7062. determine automatically at compile-time whether this is so.  And to complicate
  7063. matters, the availability of setre[ug]id() does not guarantee the availability
  7064. of the saved-setuid feature (setre[ud]id() are necessary but not sufficient).
  7065.  
  7066. If the saved-setuid feature is available, you have to include -DSAVEDUID in
  7067. your makefile entry in order to have Kermit use it (BSD variations of Kermit
  7068. only, AT&T versions don't need this compiler option because they all have the
  7069. feature).  If you include this option, but your system does not have the
  7070. saved-setuid feature, then the safety feature of priv_off() should catch the
  7071. problem and compensate automatically.
  7072.  
  7073. Since there is no way to determine at compile time whether the setre[ug]id()
  7074. functions are available, or what they do, you might have to make several
  7075. passes.  To simplify matters, there is a small test program, ckuuid.c.  Get
  7076. that program, follow the instructions in the comments, and note the results.
  7077.  
  7078. Here's the drill for BSD (AT&T versions are built normally, as before).
  7079.  
  7080.   1. Build C-Kermit for your system in the normal way.
  7081.  
  7082.   2. If the linker complains about undefined symbols _setreuid or _setregid,
  7083.      add -DNOSETREU to your makefile entry and try again.  This makes Kermit
  7084.      use setuid() and setgid() instead.
  7085.  
  7086.   3. If your system has setreuid() and setregid(), you can tell whether it
  7087.      supports the saved-setuid feature by using the ckuuid test program on
  7088.      your system.  If it shows that the effective (priv'd) uid can be turned
  7089.      off and back on and off again, then you have this feature, and you should
  7090.      add -DSAVEDUID to your makefile entry.
  7091.  
  7092. SUNOS 4.x supports the saved-uid feature, so I added -DSAVEDUID to the sunos4
  7093. entry in the makefile.
  7094.  
  7095. Need I say... CAREFUL TESTING IS REQUIRED!
  7096.  
  7097. Wrote ckuins.doc, installation notes for C-Kermit 5A / Unix.  This is to
  7098. supplement what's in the makefile, and mainly explains some of the available
  7099. compile and link time options.
  7100.  
  7101. Updated ckuker.mss, .doc, and .ps (the user manual), ckaaaa.hlp (the road map
  7102. to the C-Kermit files), ckuker.bwr (the beware file), ckuker.ann (the draft
  7103. announcement).
  7104.  
  7105. Totally rewrote ttlock(), and removed Herm Fisher's old look4lk() function.
  7106. The new version is, I hope, much clearer and it removes some windows of
  7107. vulnerability that were pointed out by Warren Tucker, Dave Slate, and others.
  7108. The way ttlock used to work, it would (1) compute what the lockfile name
  7109. should be; (2) check to see if a file of that name already exists; (3) if not,
  7110. create the file; (4) write the pid into the file; (5) close the file.  This
  7111. left open the possibility that Kermit would find no lock in (2), but then some
  7112. other process creates the lock before Kermit could do (3), then in (4) Kermit
  7113. creates its own lock, destroying the other.  And creating the lockfile and
  7114. then writing the pid to it left open the possibility that another process
  7115. would see the just-created lock file, find no pid there, diagnose it as
  7116. invalid, and remove it before Kermit could write the pid.  Furthermore, the
  7117. old ttlock() and look4lk() were full of access() calls which were meaningless
  7118. when the program was setuid.  The new ttlock is a single function which (1)
  7119. computes the lockfile name and a unique temporary filename based on Kermit's
  7120. pid; (2) turns on privileges; (3) creates the temporary file in the lock
  7121. directory, failing if it can't (and, of course, turning off privs); (4) writes
  7122. its own pid into the lockfile in the appropriate format; (5) creates a link
  7123. from the real lockfile name to the temporary file - if a lockfile of this name
  7124. already exists, the link will fail; (6) unlinks the temporary file, leaving
  7125. the lockfile in place if (5) succeeded, and removing the temp file completely
  7126. if (5) failed; (7) turns off privileges; (8) if (5) failed, prints an
  7127. informative message showing the lockfile and its owner; (9) returns.  This
  7128. code was moderately tested on the Sun-4 and seems to work as it should.
  7129. Obviously, FURTHER TESTING IS NEEDED!
  7130.  
  7131. ------------------------------
  7132.  
  7133. 5A(145) Sat Jun 9 16:27:52 1990
  7134.  
  7135. Added support for AT&T Information Systems Network (ISN) dialing from John
  7136. Chmielewski of AT&T.  ckudia.c.
  7137.  
  7138. Checked a report from Dan Senderowicz that piping text into Kermit as commands
  7139. or running Kermit from redirected stdin didn't work.  I guess I must have
  7140. fixed this, because the examples he gave work now.
  7141.  
  7142. Bruce Wong of AT&T pointed out that "kermit -f" and "kermit -g" are not
  7143. allowed in remote mode.  I removed this restriction.  ckuus4.c.
  7144.  
  7145. Bo Kullmar pointed out that if the program was started with the -q (quiet)
  7146. option, then it left the terminal modes messed up upon exit.  It seems that
  7147. the exit code specifically did not restore the terminal if the quiet flag was
  7148. set, for reasons lost in antiquity.  I removed the test, let's see who
  7149. complains now.  ckuus4.c.
  7150.  
  7151. Marcello Frutig at the Catholic University of Rio de Janeiro noticed a bug
  7152. that has been in C-Kermit for years.  If C-Kermit sends an I-packet to a
  7153. Kermit server that does not understand I-packets (such as MTS Kermit), and
  7154. which responds with an E packet, C-Kermit does not recover as intended, but
  7155. rather keeps sending the I-packet.  I'm not sure what was wrong with 4F and
  7156. earlier, but the problem in 5A was that when input() goes to read the next
  7157. packet, which is packet 0 just like the previous packet, it sees packet 0
  7158. already in its receive buffer, and so returns it; packet 0 is, of course, the
  7159. error packet we just got.  Solution: (1) input() should not do "read ahead"
  7160. unless more than one window slot is in use (ckcfn2.c); (2) the protocol state
  7161. table for <ipkt>E has to delete the error packet buffer before going on to the
  7162. next state.  In theory, (1) should be sufficient, but then buffer allocation
  7163. gets messed up and we get an "internal error".
  7164.  
  7165. SET HOST <name> followed by SET LINE did not work.  Now fixed, and also
  7166. improved to restore any previously set modem type.  ckuus3.c.
  7167.  
  7168. Discovered something that should have been obvious: because SET FILE COLLISION
  7169. BACKUP is now the default, a file that arrives having the same name as an
  7170. existing file causes the existing file to be renamed to name~n.  But if the
  7171. existing file is a directory, the renaming fails (as it should).  Remember to
  7172. warn users about this in the documentation, or maybe change the program to do
  7173. something nicer.
  7174.  
  7175. Back in April, Bo Kullmar sent in a script program similar to this:
  7176.  
  7177.   def foo set host bar, if fail goto :bad, inp 10 ogin:, if fail go :bad, ...
  7178.  
  7179. He said it went into an infinite loop.  He's right.  If he hadn't included the
  7180. colon in the GOTO command label, it would have worked right.  Fixed GOTO
  7181. within a macro to find the label only if it occurs at the beginning of a line.
  7182. It already worked right for GOTOs and labels in TAKE files.
  7183.  
  7184. Fixed xxstring() to allow expansion of \%0..9 variables when they are global,
  7185. i.e. declared at top level.
  7186.  
  7187. The DISABLE command wasn't totally working -- many of the pieces had not been
  7188. filled in.  Filled them in.  However, I can't seem to totally prevent people
  7189. from Ctrl-C'ing out of the server.  It catches the first two Ctrl-C's OK,
  7190. but then wedges, then quits.  ckcpro.w.  
  7191.  
  7192. Added a new function to ckufio.c, which will have to be added to all other
  7193. ck?fio.c's: zstrip(name,&name2).  Given a file specification "name" in local
  7194. format, this function returns a pointer to the filename with all device and
  7195. directory portions stripped.
  7196.  
  7197. Changed openo() and openi() to check if the program is running in server mode
  7198. with CWD disabled, and if so, to call zstrip() on any filenames to see if a
  7199. pathname was included, and if so to fail to open the file.  ckcfn3.c.
  7200.  
  7201. Changed server to respond "Access denied" if a REMOTE DIRECTORY request comes
  7202. in which contains a pathname and CWD is disabled.  Ditto for REMOTE TYPE,
  7203. REMOTE DELETE.  Access is also denied to REMOTE SPACE if an argument is given.
  7204.  
  7205. Updated the manual, ckuker.mss, to reflect the new security features, and to
  7206. discuss SET LINE, SET CARRIER, and SET DIAL HANGUP a little better.
  7207.  
  7208. Finished following Kristoffer's advice given below in edit 144: make sure that
  7209. ttvt() is executed if ttcarr has changed since last time.  The change that was
  7210. made in 144 fixed some of Peter Mauzey's dialing problems, maybe this one will
  7211. finish the job.  ckutio.c.
  7212.  
  7213. Also in ttvt(), get rid of the statement that sets ttvt.sg_ispeed and ospeed
  7214. to the value returned previously by ttsspd(), which has just taken great pains
  7215. to handle 75/1200 split speed.  ckutio.c.
  7216.  
  7217. Added a Control-C interceptor to ttopen() so that an open() call hung because
  7218. the device doesn't have carrier can be interrupted from the keyboard.
  7219.  
  7220. ------------------------------
  7221.  
  7222. 5A(144) Tue Jun  5 12:45:48 1990
  7223.  
  7224. Backed off on making QUIT leave the line open.  Now once again, QUIT == EXIT.
  7225.  
  7226. Added #include <stdio.h> to ckcfns.c, ckcfn3.c, and ckuxla.c so that NULL will
  7227. be defined appropriately for given compiler and computer architecture.  It
  7228. turns out that defining NULL to be 0 on a 16-bit system where pointers are 32
  7229. bits results in garbage or core dumps when NULL is passed as an argument to
  7230. a procedure that expects a pointer.  If, after including <stdio.h>, NULL is
  7231. still undefined, then it is defined to be 0L, in hopes that the size of a
  7232. pointer is the same as the size of a long.  This may cause problems.  If it
  7233. does, we're going to have to define the NULL pointer for each implementation.
  7234.  
  7235. Fixed SHOW LANGUAGES and SET LANGUAGE ICELANDIC (problem reported by Andy Fyfe
  7236. and others).  A table entry for Icelandic was missing from the langs[]
  7237. structure in ckuxla.c.  Added variable nlangs to specify how many languages
  7238. are really in the table, rather than using the symbol MAXLANG in "set
  7239. language" parsing code in ckuus3.c.
  7240.  
  7241. Changed AT&T 7300 modem dial timeout from 20 to 25 seconds, and 7300 system ID
  7242. string to not have trailing newline, and SHOW PROTOCOL not to have a blank
  7243. line.  Andy Fyfe.  ckudia.c, ckutio.c, ckuus4.c.
  7244.  
  7245. Revised man page from Chuck Hedrick, ckuker.nr, containing much more material
  7246. than the first -- lists of commands, etc.  Changed some wording to make it
  7247. more general.  To view it, "nroff -man ckuker.nr".
  7248.  
  7249. Bo Kullmar discovered that that "kermit -e 2048" did not work but that
  7250. "kermit -e 2047" worked OK.  Off-by-one error, fixed in ckuus4.c.
  7251.  
  7252. Changed ttpkt() in ckutio based on the following complaint from Bo Kullmar and
  7253. the suggested solution from Kristoffer Eriksson:
  7254.  
  7255. > Since some version I can always talk to the modem on the dnix systems
  7256. > (both the 5.2 and the 5.3 system) and it does not matter what I do with
  7257. > "set carrier". I have reported this to Kristoffer but he could not repeat
  7258. > it on his dnix system.
  7259.  
  7260. Argh! The carrctl() call in ttvt() has been assuming that conect() would call
  7261. ttvt() with flow=CONNECT, so it would know when to enable carrier detection in
  7262. AUTO mode. But conect just calls it with the global flow variable, which I
  7263. don't think ever is set to CONNECT.
  7264.  
  7265. SET CARRIER ON works as it should if I set it before SET LINE. If I set it
  7266. afterwards, it doesn't take effect. That is probably caused by the check for
  7267. tvtflg in ttvt() which checks for changes in speed and flow, but doesn't
  7268. notice that ttcarr has changed. Should be fixed. (I said tvtflg would be
  7269. troublesome, didn't I?)
  7270.  
  7271. With SET CARRIER AUTO, I don't get carrier loss detection during CONNECT at
  7272. all (even with a modem type set, which is a prerequisite), which is caused as
  7273. explained above. Bo says that this worked at sime point in the past, but I've
  7274. check version 123 and there the code was the same, and in 121 carrctl() hadn't
  7275. been added yet.
  7276.  
  7277. Now, how do we solve this? A quick solution would be to make conect() use
  7278. CONNECT in the ttvt() call, but the use of the CONNECT/DIALING flow values
  7279. should rather be decreased in stead of increased, and we would loose control
  7280. of the flow control.
  7281.  
  7282. I've used identical calls to carrctl() in ttpkt() and ttvt() up to now, and
  7283. relied on the flow parameter to determine what to do in the AUTO mode. I
  7284. suppose this was wrong. The right way to do it is probably to set up CONNECT
  7285. mode when you're in ttvt() and non-CONNECT mode in ttpkt().  (That sounds very
  7286. reasonable.) Thus, in ttvt(), the term "&& flow == CONNECT" should simply be
  7287. dropped. Conversely, one can argue that the entire line that starts with "||
  7288. ttcarr == CAR_AUT ..." in ttpkt() should be dropped, too. I'm not entirely
  7289. sure about that, though. Just the bare existence of "flow == CONNECT" makes one
  7290. wonder what should be done in that mode. It is used in ckudia.c. It can be
  7291. interpreted either as "end the DIALING mode" or "prepare for ttvt() mode". I
  7292. suggest we try the former alternative, and drop that line. This can possibly
  7293. even help Peter Mauzey some, because ttpkt(CONNECT) is called after dialing
  7294. and enabling carrier detection so soon can possibly be part of the cause for
  7295. the premature disconnect that he is experiencing (or, at least it doesn't
  7296. exactly contribute to avoiding it).
  7297.  
  7298. Fixed the fix that was made to the XXDEL: case in docomd(), in which the
  7299. response from zchki was treated as a long rather than an int -- needed to
  7300. change the variable in another place (Bo Kullmar).  ckuusr.c.
  7301.  
  7302. Added some fixes to cmifi() so that a file whose name begins with tilde can
  7303. actually be found and opened if the user types esc or tab to complete it (this
  7304. never worked before, since tilde-expansion was first added in 4F).
  7305.  
  7306. New VMS support files arrived from Mark Buda.  Not finished yet, but he says
  7307. they should compile and link without complaint, and produce a running C-Kermit
  7308. for VMS that can dial, connect, etc, has a working command parser, but does
  7309. not yet transfer files correctly because the RMS-related aspects of ckvfio.c
  7310. are not yet completely filled in.  The new files are installed with the other
  7311. C-Kermit files as ckv*.*.  There were also a couple very minor changes
  7312. required in ckcfns.c, ckcfn3.c, and ckcfil.h.  I tried building the program
  7313. under VAXC 2.3-024 and VMS 5.0 (Mark has much newer C and VMS versions), but
  7314. it failed because my VMS system doesn't have a header file, STARLET.H, needed
  7315. by ckvfio.c.  Mark says this file is not necessary -- contains only
  7316. prototypes.  I commented out the #include and tried again.  This time it
  7317. failed on ckufio.c, objecting to many occurrences of "&((char *) 0)".  Didn't
  7318. know what to do about these, but managed to run the rest of the files thru the
  7319. compiler, which turned up a few more errors -- typos within #ifdef VMS
  7320. conditionals in ckuus5.c, which i fixed.  Sent results of today's compiler
  7321. runs to Mark.
  7322.  
  7323. SUNOS 4.1 was installed recently on watsun, and I was just looking through the
  7324. manual.  This new release of SUNOS is "8-bit clean", and even attempts to
  7325. support ISO 8859 Latin Alphabet 1 in various ways.  Sure enough, if I do "stty
  7326. pass8" to the Sun, and SET DISPLAY 8 on the PC, I can view 8-bit Latin-1 data
  7327. directly with cat, more, etc.  Tested some features of C-Kermit in this
  7328. environment:
  7329.  
  7330.  - TYPE displays 8-bit files correctly.
  7331.  
  7332.  - If you SET LINE or SET HOST, and SET TERMINAL BYTESIZE 8, and then CONNECT
  7333.    to another computer that can display 8-bit characters, C-Kermit displays
  7334.    them correctly.
  7335.  
  7336.  - TRANSMIT and LOG SESSION work right with 8-bit characters if you give the
  7337.    command SET TERMINAL BYTESIZE 8 first.
  7338.  
  7339.  - File transfer works right, but you have to tell C-Kermit to SET TRANSFER
  7340.    CHARACTER-SET LATIN1 first, so that the Kermit on the other end (e.g.
  7341.    MS-DOS Kermit) will know that incoming data is Latin-1 and will convert
  7342.    it properly if necessary.  This is most obvious when you run C-Kermit in
  7343.    server mode, and then send REMOTE TYPE commands to it for Latin-1 files.
  7344.    The default transfer character-set remains TRANSPARENT, for compatibility
  7345.    with previous releases.
  7346.  
  7347. Compiled this edit on the NeXT.  It complained about argument passing between
  7348. incompatible pointer types in ckcfn3.c (sprintf(&data[i+2],...).  No harm done
  7349. at runtime, but I made the complaints go away by casting the first argument to
  7350. (char *) -- the problem was that data[] is CHAR (= unsigned char).  The NeXT
  7351. also has a pointer complaint about this line in netopen() in ckutio.c:
  7352.  
  7353.     if (connect(ttyfd, (caddr_t)&saddr, sizeof(saddr)) < 0) {
  7354.  
  7355. but I have no idea how to make the complaint go away.  The code works fine at
  7356. runtime on the NeXT (and everywhere else), so who cares?
  7357.  
  7358. At Jack Bryans' suggestion, added "LIBS = -lsys_s" to the makefile entry for
  7359. the NeXT to request the shared library, saving over 80K in the executable
  7360. program.
  7361.  
  7362. Tried building the program on an IBM mainframe with AIX370.  The compiler
  7363. complained correctly about several variables in ckuus*.c defined but never
  7364. referenced.  Removed their definitions.  Many other lintish problems in other
  7365. modules were fixed too (but we can't fix the the "statement not reached"
  7366. warnings when compiling ckcpro.c).  Fatal compilation problems with SIGTYP and
  7367. getuid(), in ckufio.c.  Changed the definition of SIGTYP for AIX370 in
  7368. ckcdeb.h (again!), and put extern declarations of getuid() within #ifndef
  7369. AIX370 conditionals.  Changed the makefile entry because it was not including
  7370. the library file libbsd.a, which is needed for ftime().  Added a special
  7371. version herald for AIX/370.  Compiled OK except for the 4 unavoidable warnings
  7372. in ckcpro.c, and cursory testing of SET HOST, CONNECT, SEND, RECEIVE, etc,
  7373. was successful.
  7374.  
  7375. Compiled the program on a MicroVAX with Ultrix 2.0.  No problems at all.
  7376. Seems to run OK too.
  7377.  
  7378. ------------------------------
  7379.  
  7380. 5A(143) Mon Jun  4 17:38:59 1990
  7381.  
  7382. Rec'd many messages from Chuck Hedrick at Rutgers University.  One of them
  7383. included a new man page for version 5A, which gives an overview of how to use
  7384. C-Kermit on Unix in both remote and local mode, but without listing all the
  7385. commands and options (it refers the reader to the manual for that).  ckuker.nr.
  7386.  
  7387. Suggestions from Chuck:
  7388.  
  7389.   A method of exiting the program without hanging up the line.  Can't be
  7390.   done, because this leaves the lockfile hanging around, and so the line
  7391.   can't be assigned next time Kermit is run -- especially true if Kermit
  7392.   was running setuid.  Instead, use PUSH to start an inferior shell, or
  7393.   SUSPEND (or Z) to suspend the program if the computer system supports job
  7394.   control.  Also, if the program receives the SIGTSTP signal, it will be
  7395.   suspended.   
  7396.  
  7397.   Chuck wanted a "more" option for TYPE, but this would require tons of code
  7398.   to handle tab expansion, line wrap, checking termcap to find out the
  7399.   terminal's screen length, etc.  Easier to just let the user define a macro,
  7400.   "more" to be "run more \%1", which works fine.
  7401.  
  7402. Fixes from Chuck:
  7403.  
  7404.   "=" should be "==" in pktopn().  This is what was preventing the packet
  7405.   log from working.  (also noticed by Bo Kullmar.)  ckuus4.c.
  7406.  
  7407.   Debug log listed old, rather than new, parity value in ttpkt().  Changed
  7408.   to list new one.  ckutio.c.
  7409.  
  7410.   A (hopefully) never-used spack() call in ckcfn3.c had two of its arguments
  7411.   reversed (the one where it cops out by sending an empty attribute packet if
  7412.   the attributes came out to be too long for the current packet length).
  7413.  
  7414.   speed was declared external int rather than long in ckuusr.c.
  7415.  
  7416.   various type declaration mismatches among modules, typically int vs long,
  7417.   char vs int (speed, ttgspd(), zchki(), filcnt, ffc, tfc, rptn, kermrc).
  7418.   Many modules.
  7419.  
  7420.   tlog() sometimes called with 4th arg of type int, rather than long.  Made
  7421.   sure all were cast to long.  Changed all "0l" to "0L" for clarity.
  7422.   Corrected a couple occurrences "01" that were supposed to be "0l" (i.e. 0L).
  7423.  
  7424.   Several files which are supposed to be UNIX-independent (ckcfn*.c) included
  7425.   #ifndef NULL, #define NULL 0, #endif.  Since NULL is intended to be a
  7426.   pointer, which is normally the same length as a long, Chuck suggested that
  7427.   the #define should be changed to 0L.  I made this change, but also inserted
  7428.   an #include <stdio.h> first, to pick up the local compiler's preferred
  7429.   definition, so that the 0L definition will only kick in if <stdio.h> does
  7430.   not define NULL.  The problem was that 0 is an int, and on 16-bit systems,
  7431.   passing an int to a function that expects a pointer results in garbage or
  7432.   core dumps.
  7433.  
  7434.   atol() used in ckcfn3.c and ckuus4.c without being declared as long.
  7435.  
  7436.   Changes to makefile for Microport SV/AT 286 Sys V R2.
  7437.  
  7438.   Added description of SET DIAL HANGUP command to ckuker.mss.
  7439.  
  7440. From Andy Fyfe, a couple fixes to ckutio.c for ATT7300 (3B1) UNIX PC dialing.
  7441.  
  7442. From John Chmielewski, AT&T Lisle IL, add post-connect delay for AT&T DTDM.
  7443. ckudia.c.
  7444.  
  7445. Also from John Chmielewski, put #ifdef SETUID around access() call in
  7446. look4lk() rather than in ttlock().  ckutio.c.  This whole business will,
  7447. hopefully, become obsolete once the priv_on/off() code is installed.
  7448.  
  7449. Make tempfd global to ckutio.c, so that ttclos() can close it if it's open.
  7450.  
  7451. Supply a missing semicolon in tthang() in the extra open() that's inside
  7452. of #ifdef CLSOPN2 conditionals.  Only would have been noticed if -DCLSOPN2
  7453. was added to a makefile entry.  From Peter Mauzey.  ckutio.c.
  7454.  
  7455. From Kristoffer Eriksson: merge some redundant code in ttopen() into a new
  7456. function, do_open(), which also has the benefit of handling the case where the
  7457. symbol O_NDELAY is not defined.  ckutio.c.
  7458.  
  7459. Fixed a bad problem in which any REMOTE command sent to a C-Kermit server, and
  7460. then interrupted, could result in junk being sent the next time data was
  7461. requested from a server.  The problem was that zxcmd(), the function that
  7462. opens a fork (rather than a file) for file transfer i/o, did not reset the
  7463. buffer pointers and counts used by the zminchar/zmchout & related macros.
  7464. This bug has been in C-Kermit since early 4F, and nobody ever noticed it (???)
  7465.  
  7466. ------------------------------
  7467.  
  7468. 5A(142) Sat May 26 16:32:12 1990
  7469.  
  7470. Added BREAK and CONTINUE for FOR-loops.  Easy, just defined them as macros
  7471. inside the _FOR definitions that GOTO the appropriate place.  ckuus5.c.
  7472.  
  7473. Added fixes to cmofi() and cmifi() for tilde expansion from Bo Kullmar.
  7474. ckucmd.c.
  7475.  
  7476. Removed one last strchr() from ckutio.c (it was in netopen()).  Now there
  7477. should be no more strchr's or index's or rindex's.  No C library can be
  7478. depended upon to have any of these.  Thanks to Steve Jenkins at the Lancaster
  7479. U, UK.
  7480.  
  7481. Removed declarations of int big[sr]bufsiz from ckcfn3.c.  These variables are
  7482. not used in that module, and they were causing some C compilers to complain
  7483. (incorrectly) about name conflicts.  Thanks to Jay Rouman at U of Mich.
  7484.  
  7485. Removed atthang() function from ckutio.c, and added a few statements
  7486. particular to the ATT7300 (3B1) to the regular tthang() function, based on
  7487. info from Andy Fyfe.  Also, turned on myread() for the ATT7300 for the first
  7488. time; Andy says it works OK.  Needs wider testing!
  7489.  
  7490. In a final attempt to get the ATT systems working, I added a second open()/
  7491. close() sequence to tthang(), within #ifdef CLSOPN2 conditionals.  According
  7492. to some reports, HANGUP would only bring DTR up after dropping, if the device
  7493. was closed and then opened not once, but twice!  Also, reorganized tthang()
  7494. somewhat, so that things seem to happen in the most logical sequence.  Too
  7495. many little changes to describe here, but they are well commented in the
  7496. function itself.  I really, really hope this is the last go-round for tthang!
  7497. (dream on...)  ckutio.c.
  7498.  
  7499. Also, towards the same goal, added a new command SET DIAL HANGUP {OFF, ON}.
  7500. Default is ON, as before, but if you use OFF, then DIAL will not hang up the
  7501. line before dialing.  If we can't fix this problem, at least we can give the
  7502. user the means to work around it.  ckuus3.c, ckcmai.c, ckudia.c.
  7503.  
  7504. Another fix from Andy Fyfe: in ckuus5.c, initialize mrval[maclvl] (macro
  7505. return value) to NULL, rather than "" (the empty string), so that it won't
  7506. be freed erroneously, causing a core dump.  Also required making sure that
  7507. user-defined functions return "" rather than NULL in ckuus4.c.
  7508.  
  7509. Found that the function, rdebu(), that enters outbound Send-Init parameters
  7510. into the debug log was printing data from the wrong buffer.  I don't think
  7511. this was doing any harm other than printing misleading data in the log, but
  7512. who knows? ...  ckuus4.c.
  7513.  
  7514. Changed rcalcpsz(), the function that recalculates packet size based on the
  7515. number of errors, to take sliding windows into account (simply uncommented
  7516. some of Paul Placeway's code, and changed some variable names to agree with
  7517. the ones that are actually used).  ckcfn2.c.
  7518.  
  7519. Changed the CRC lookup tables, crcta[] and crctb[], to be of type LONG rather
  7520. than unsigned int, because some of the values were greater than 16 bits, and
  7521. on (at least) the ATT 6300, this caused incorrect CRC calculations and
  7522. prevented file transfers.  Also added a cast to LONG in the chk3() function.
  7523. Works on the SUN, but needs testing on the 6300 and other machines that really
  7524. do use 16-bit ints.  Watch out for sign extension!  LONG is typedef'd (in
  7525. ckcdeb.h) as "long" rather than "unsigned long" because some compilers don't
  7526. have unsigned long.  ckcfn2.c.
  7527.  
  7528. Changed the VERSION command to output the numeric version number as a long,
  7529. rather than an int, since it *is* a long (ATT 6300 again).  ckuusr.c.
  7530.  
  7531. There may still be crashes on the 6300 when it issues a REMOTE HOST or similar
  7532. command.  These have been traced to when it calls zopeno() from opent() after
  7533. receiving the first data packet.  There is nothing obviously wrong here.
  7534. Added a few debugging statements to help home in on the problem.
  7535.  
  7536. Bo Kullmar discovered that Kermit did not detect an error when it failed to
  7537. write out received data to a disk that had filled up, and just kept on
  7538. receiving, and creating empty files (you really need a floppy disk for this!).
  7539. The problem was in zoutdump(), which was not testing the return code from
  7540. write() properly.  Now fixed, I hope.  ckufio.c.
  7541.  
  7542. The DIAL command was changed to require the user to specify a dial string
  7543. (phone number).  Previously, the user could just type "dial" with no number,
  7544. and the program would try to dial nothing.  ckudia.c.
  7545.  
  7546. Changed the "Dialing" message to include the modem type.  ckudia.c.
  7547.  
  7548. Changed names of privilege_on() and privilege_off() to priv_on() and
  7549. priv_off(), to keep within the 8-character limit for function names. ckutio.c.
  7550.  
  7551. Changed SET LINE code to print an informative message telling the user what
  7552. to do if it times out waiting for carrier.  ckuus3.c.
  7553.  
  7554. OS/2 -- Chris Armstrong is leaving the country, and has done all he can for
  7555. the OS/2 version of C-Kermit.  All his work was based on C-Kermit 5A edits
  7556. in the Feb-March era, and he made some minor changes to the system-independent
  7557. code, which I have added in this edit.  However, I have no idea if the
  7558. resulting set of files will compile or run successfully any more, because a
  7559. lot of changes were also made on this end since Chris last took the 5A code,
  7560. in particular some of the calling conventions to the functions in the
  7561. ck*[tf]io.c modules.  We need another OS/2 person -- Thanks to Chris for all
  7562. his help up till now!  Chris's changes are listed in the file ckoker.upd.
  7563.  
  7564. Problems transferring files with very long packets.  This was caused by the
  7565. packet-receive timeout alarm going off before the packet was completely read.
  7566. When packets are very long and/or the transmission speed is low, it is
  7567. increasingly likely that the user has the timeout interval set to fewer
  7568. seconds than it would take to read a packet at that speed.  Code had been
  7569. added in many places to adjust for this possibility automatically, but there
  7570. were a few places where this adjustment was skipped.  Also, it the SET SERVER
  7571. TIMEOUT command interfered by overriding the adjusted timeout whenver server
  7572. mode was entered.  Many changes made to correct these problems.  A new
  7573. variable was added, pkttim, the number of seconds to wait for a packet during
  7574. a transaction, as opposed to srvtim, the number of secs to wait for a packet
  7575. while in server command wait.  The active timer, timint, is now set to one or
  7576. the other depending on what state Kermit is in.  Tested at 1200 bps, seems to
  7577. work ok now.  Further testing needed.  ckcpro.w, ckcmai.c, ckcfns.c, ckuus3.c,
  7578. ckuus4.c.
  7579.  
  7580. After looking through several people's debug logs, I decided it's a bad idea
  7581. to NAK all un-ACK'd packets when receiving, and to retransmit all un-ACK'd
  7582. packets when sending, whenever a timeout occurs.  input() has been changed to
  7583. only NAK or resend the packet at window-low (the oldest outstanding packet).
  7584. The old code has been left intact within #ifdef BULKNAKS conditionals in case
  7585. we need to revive it.  I tested this as best I could, but my primary testing
  7586. mechanism seems to have stopped working, namely the ability to turn my
  7587. t-switch away momentarily during file transfer.  When I do that now (because
  7588. of an upgrade in the SUN's OS, not because of anything in Kermit) Kermit gets
  7589. a HUP signal and shuts down.  Verified that when this happens, Kermit saves
  7590. the partially received file, which, I suppose, is good.  More testing needed.
  7591. ckcfn2.c.
  7592.  
  7593. Changed various modules not to record packets in the debug log.  Otherwise,
  7594. with long packets and/or windowing, the log gets huge mighty fast.  If you
  7595. want to record the packets, use a packet log.
  7596.  
  7597. More work on character sets.  Added a special translation from Latin-1 to
  7598. ASCII for Icelandic, provided by Fridrik Skulason, handling Thorn, Eth, and
  7599. AE.  Changed transliteration from Latin-1 into ASCII of U-diaeresis to be Ue
  7600. rather than Y (and ue rather than y) for the Scandinavian languages, by
  7601. consensus of many Swedes, Norwegians, Finns, and Danes.  Removed SET LANGUAGE
  7602. SWISS, because SWISS isn't a language, it's an NRC.  Or if Swiss really is a
  7603. language (Romansch), I don't know any special transliteration rules for it.
  7604. Needs testing.  ckcxla.h, ckuxla.c, ckuus3.c.
  7605.  
  7606. Began to look at adapting Kristoffer's uid-handling routines to Kermit.
  7607. Unfortunately, this method does not seem to work in the BSD environment.  I
  7608. wrote a little test program to see what happens on the SUN, which, by default,
  7609. acts like a BSD system as far as uid's are concerned, see ckuuid.c.
  7610. Then I chown'd the program to another user, cmg, and chmod'd the program u+s 
  7611. and g+s:
  7612.  
  7613. $ ls -lg uid
  7614. -rwsrws---  1 cmg      candf       24576 May 27 22:17 uid*
  7615.  
  7616. and then ran it with these results:
  7617.  
  7618. $ ./uid
  7619. at startup...
  7620.  getuid = 107, geteuid = 4505
  7621.  getgid = 301, getegid = 1327
  7622. initsuid returns 0
  7623.  getuid = 107, geteuid = 107
  7624.  getgid = 301, getegid = 301
  7625. priv_on returns 2
  7626.  getuid = 107, geteuid = 107
  7627.  getgid = 301, getegid = 301
  7628. priv_off returns 0
  7629.  getuid = 107, geteuid = 107
  7630.  getgid = 301, getegid = 301
  7631.  
  7632. So I can't get the priv'd ID back.  This seem to agree with what Ken Arnold
  7633. says in his article "Setuid Security Blankets" in the C Advisor section of
  7634. Unix Review, May 1990: "When UNIX checks permissions, it uses the effective
  7635. uid.  A running process can change its effective uid to be the same as its
  7636. real uid at any time.  However, under BSD this is a one-way trap door.  Having
  7637. done it once, you can't get back."  Anyway, I modified Kristoffer's routines
  7638. to use setre[ug]id() for BSD, apparently with no effect.  ckutio.c.
  7639.  
  7640. Fixed the implementation of FOR loops to only require one macro, rather than
  7641. two (one for ascending loops, a second one for descending).  Now the
  7642. comparison operator is passed by the FOR command as an argument to the
  7643. combined _forx macro.  Old code is within #ifdef TWOFORS conditionals, can be
  7644. removed if no problems surface.  ckuusr.c, ckuus5.c.
  7645.  
  7646. Added optional numeric trailing argument to EXIT and QUIT commands, which is
  7647. the program exit status code to be returned to the operating system.  The
  7648. default is GOOD_EXIT (OS-dependent, defined in ckcdeb.h).  Tested in UNIX,
  7649. works fine.  ckuusr.c.
  7650.  
  7651. Compiled this edit on the NeXT, which has one of the pickiest C compilers
  7652. around.  Only one warning (from netopen in ckutio.c, about incompatible
  7653. pointer types).  Works fine, including SET HOST (where the warning came from).
  7654.  
  7655. Compiled on the Encore with UMAX 5.0 using "make bsd43".  Fixed a typo in the
  7656. makefile (-DNETCONN-O should be -DNETCONN -O).  After that, no complaints,
  7657. runs fine.  
  7658.  
  7659. ------------------------------
  7660.  
  7661. 5A(141) Thu Apr 26 18:45:43 1990
  7662.  
  7663. Christine Gianone and I wrote a draft manual for version 5A: ckuker.mss
  7664. (Scribe source), ckuker.doc (plain ASCII), ckuker.ps (Postscript).  Comments
  7665. welcome.
  7666.  
  7667. In makefile, change "make clean" to not remove wermit.  Added entry for MIPS.
  7668.  
  7669. In ckuus2.c, remove spurious \'s from character strings.
  7670.  
  7671. In ttopen(), added fourth parameter, timeout, default 0.  If > 0, then open()
  7672. is timed, and ttopen() returns -2 if the timer expires.  Timer is set by the
  7673. command SET CARRIER ON [ n ] (in ckuus3.c), where n is the number of seconds
  7674. to wait for carrier when trying to open the communication line, and is
  7675. initialized to zero in ckcmai.c (variable cdtimo), and need not be specified
  7676. in the SET CARRIER ON command, in which case it defaults to zero.  In order to
  7677. avoid spurious error messages, removed call to perror if open() failed because
  7678. of timeout.  ckutio.c.
  7679.  
  7680. Changed all calls to ttopen() in ckcpro.w, ckudia.c, ckuscr.c, ckuus3.c, and
  7681. ckuus4.c to include new timeout parameter.  Updated ckasys.doc and ckuker.mss.
  7682.  
  7683. In tthang(), changed the order of restoring ioctl() and fcntl() in the
  7684. close/open case in a last-ditch attempt to make this code work for Peter M.
  7685. ckutio.c.
  7686.  
  7687. For BSD, change sleep(1) in ttres() and conres() to msleep(300) to cut down
  7688. on program recovery and exit time.  ckutio.c.
  7689.  
  7690. Set tvtflg=0 in ttkpkt right after calling carrctl(), to make sure that later
  7691. calls to ttvt() are not incorrectly skipped.
  7692.  
  7693. Found that the code added to openi() in ckcfn3.c that was added to prepare
  7694. for SSEND broke "kermit -s file".  Nobody noticed!  Removed the offending code.
  7695.  
  7696. Looked into the possibility of reinstating Paul Placeway's "encode-ahead"
  7697. trick from version 4F to boost performance in the common non-windowing case.
  7698. The trick is to have C-Kermit encode the next packet while waiting for the ACK
  7699. to the current packet.  It only makes sense to use this with 1 window slot.
  7700. The trick worked in 4F because the encoding buffer was copied into the packet
  7701. buffer when the packet was actually sent, so that resend() still had access to
  7702. it in case a NAK was received.  5A, however, encodes directly into the packet
  7703. buffer, so this trick can't work.  So all of Paul's "sdahead()" code was
  7704. removed from ckcfns.c, lest some unsuspecting person (like me again in a year)
  7705. be tempted to reactivate it (which I did try, and it caused horrible errors).
  7706. Ran some benchmarks sending long files from 4F (with encode-ahead) and 5A
  7707. (without) and found only about 1% difference anyway.  Later, we can try some
  7708. kind of trick to use the existing windowing code in non-windowing transfers
  7709. to allow packets to be encoded in advance while waiting for ACKs.
  7710.  
  7711. While I was at it, I measured Kermit against FTP between 2 SUN-4s.  Turns out
  7712. FTP is faster after all...  about 2.5 times.  But it's still fun to watch
  7713. C-Kermit transfer files at 167,000 bps.
  7714.  
  7715. Changed calling convention to conint() in ckutio to include a second argument,
  7716. namely a pointer to a function to call in order to suspend, for use with job
  7717. control.  Formerly, conint() had the function name hardwired into it, which
  7718. wouldn't have been so bad except the function was in ckuus5.c!  ckutio.c is
  7719. not supposed to depend on any code outside itself.  Also noticed in ckuus5.c
  7720. that trap() and stptrap() were not declared to be of type SIGTYP, which may
  7721. account for some of the pointer errors that some compilers have been
  7722. complaining about, and maybe even some misbehavior at runtime.  Moved
  7723. system-dependent contents of stptrap() from ckuus5.c to ckutio.c, into a new
  7724. routine called psuspend().
  7725.  
  7726. Fixed job control.  Ctrl-Z was not suspending Kermit.  Discovered that this
  7727. was because there was no #include <signal.h> directive in ckuus5.c, probably
  7728. because stptrap() had been moved there from some other module.  Added SUSPEND
  7729. command, and an invisible synonym for it, Z, which is found in many other UNIX
  7730. programs.  They simply call stptrap().
  7731.  
  7732. Added Kristoffer's suid-handling functions to ckutio.c.  Within #ifdef SKESUID
  7733. conditional, call init_suid() from within sysinit().  Didn't do anything else
  7734. with it yet, however.  Still need to adapt to Berkeley use, and then go
  7735. through all of the code in C-Kermit that does any kind of uid call and remove
  7736. it, and then add calls to privilege_on() and privilege_off() around the
  7737. lockfile garbage.  Should be easy enough, except I'm not sure what to do about
  7738. the code in look4lock() (and in the filename parsing functions in ckucmd.c,
  7739. anywhere else???) that calls access(), which doesn't work with uid switching.
  7740.  
  7741. Changed name of ckcxla.c to ckuxla.c, because other C-Kermit implementations
  7742. (like Macintosh, OS/2) will need a different set of translation tables and
  7743. functions.  Changed ckuxla.c not to use ident() as the identity function, but
  7744. rather NULL, and have all code in ckcfns.c (and for the TRANSLATE command) in
  7745. ckuus4.c avoid calling the translate function if the pointer to it is NULL.
  7746. Thanks to Kristoffer for the suggestion to use NULL rather than rely on the
  7747. address of the ident() function for this test.
  7748.  
  7749. For SET LANGUAGE DUTCH, added special translation for umlaut-y = ij.
  7750.  
  7751. Added SET TRANSFER CHARACTER-SET TRANSPARENT.  This means to do no
  7752. character translations in text mode, and it is now the default.  SET TRANSF
  7753. CHAR ASCII is different -- it means to translate from the current file
  7754. character set into plain 7-bit ASCII.  Diacritics are stripped, so that
  7755. a-umlaut becomes simply a, etc, unless a SET LANGUAGE command has been given
  7756. to activate special language-specific conversions.  SET TRANSF CHAR LATIN1
  7757. works as before.
  7758.  
  7759. Discovered a bug that has been in C-Kermit ever since the international
  7760. character set stuff was added, but nobody noticed it before.  If you SET
  7761. TRANSFER CHARACTER-SET LAT, SET FILE CHAR ASCII, SET LANG GERMAN (or any
  7762. language that has special translation tricks) and then receive a file with
  7763. accented characters, the program core dumps.  Why?  Because the Latin-1 to
  7764. ASCII translation function, xl1toas(), is designed for reading files and
  7765. sending, not receiving and writing them, and uses the zmstuff() macro to push
  7766. characters onto the disk file input stream.  Not good for writing files!
  7767. Wrote a second copy of xl1toas(), called zl1toas(), identical to xl1toas(),
  7768. except it pushes characters onto the input packet data field.  So now the cute
  7769. national-language-to-ASCII translations work in both directions.
  7770.  
  7771. At this point I have to call it quits for a while, even though there is still
  7772. much left to do -- taking the weekend off, and going on a business trip next
  7773. week.  So I will install this version now so Kristoffer, Bo, Warren, Peter,
  7774. Jay, Joe and everybody else can bang on it for a week, and I will send it to
  7775. Mark on tape tomorrow so the VMS work can begin at last!
  7776.  
  7777. ------------------------------
  7778.  
  7779. 5A(140) Wed Apr 18 21:29:29 1990
  7780.  
  7781. Some minor (but time-consuming) performance tuning.  Profiled the program
  7782. while receiving a big file and found that it was spending an inordinate amount
  7783. of time in the decode() function: about 27% of total elapsed time, which put
  7784. decode() at the top of the list, by far.  Did some fine tuning in decode():
  7785.  
  7786.  . Don't call the translation function if it happens to be ident() (ditto in
  7787.    encode());
  7788.  
  7789.  . Organize and group the if-conditions more intelligently, for example,
  7790.    change "if (rptflg) { if (a == rptq) ... }" into
  7791.    "if (a == rptq && rptflg) { ... }";
  7792.  
  7793.  . Group the text file-handling (end of record, character translation) all
  7794.    within a single "if (!binary) { ... }" statement.
  7795.  
  7796. This brings decode() down to under 7% consumption of elapsed time.  The list
  7797. is now headed by read(), ioctl(), and write(), with all others relatively
  7798. insignificant, and this is as it should be.  However, file transfer benchmarks
  7799. before and after this tuning show only a small (1-2%) gain in efficiency.
  7800.  
  7801. I ran some benchmarks to see how our performance is doing.  These are for a
  7802. 36K Text file (with no repeated characters, so no compression) between an
  7803. unloaded SUN-4/280 with C-Kermit 5A(139) and an IBM PS/2 with a hard disk and
  7804. MS-DOS Kermit 3.01 at 9600 bps, no parity, block check 1.  The results are a
  7805. little disappointing but at least they demonstrate that file transfer is
  7806. pretty solid.  All transfers took place with no errors or retransmissions.
  7807.  
  7808.   Packet    Window Size............
  7809.   Length    1          2          4
  7810.  
  7811.      90     65  64     79  87     80  87   figures are percent efficiency:
  7812.     250     76  76     82  91     84  91
  7813.     500     79  80     87  91     84  93     file characters / sec x 10
  7814.     750     84  82     87  93                --------------------------
  7815.    1000     84  82     87  93                         baud rate
  7816.    1500     85  83
  7817.    2000     85  84
  7818.         Up  Dn     Up  Dn     Up  Dn   (Upload, Download)
  7819.  
  7820. In this configuration, that's about the best we can do.  It's as good as older
  7821. releases of Kermit, and of course better when windows are used.  The SUN CPU
  7822. is not the bottleneck, because network transfers (using SET HOST on the SUN)
  7823. can clock up to about 17,000 characters per second.
  7824.  
  7825. Here's the same benchmark, but between two C-Kermits, both on SUN-4s (no PC):
  7826.  
  7827.   Packet    Window Size............
  7828.   Length    1          2          4
  7829.  
  7830.      90     73  73     89  89     89  89
  7831.     250     81  81     91  91     91  91
  7832.     500     97  87     93  93     91  91
  7833.     750     89  89     93  93
  7834.    1000     87  87     96  96
  7835.    1500     89  89     93  93
  7836.    2000     91  91
  7837.         Up  Dn     Up  Dn     Up  Dn   (Upload, Download)
  7838.  
  7839. This is significantly better than the PC/C-Kermit test, especially at the
  7840. low end, and the 96 figure for 1000-byte packets in 2 windows is actually
  7841. exceeds to the theoretical maximum of 94.999999...%.
  7842.  
  7843. Tried the same benchmark on a half duplex connection to an IBM mainframe in
  7844. linemode using XON line turnaround handshake, mark parity.  Found that the
  7845. change made to ttpkt() in edit 128 broke this mode of operation.  It seems
  7846. that if you don't tell BSD UNIX to put the line in raw mode, then it ignores
  7847. received XON characters EVEN IF TANDEM IS NOT SET (grrrrr).  So I changed
  7848. ttkpt() to put the line in raw mode whenever parity is none as well as
  7849. whenever parity is not none and Xon/Xoff is not requested.  File transfer with
  7850. IBM mainframes works once again, at least in BSD.  The AT&T versions did not
  7851. change in this area, so they should still work (but testing is needed).  Also
  7852. found and removed a spurious setting of speed in ttpkt().
  7853.  
  7854. The results of the IBM mainframe linemode benchmark were comparatively poor,
  7855. except at the longer packet lengths (windows can't be used because the
  7856. connection is half duplex):
  7857.  
  7858.   Packet    
  7859.   Length    Window Size 1      
  7860.  
  7861.      90     40  52
  7862.     250     52  73
  7863.     500     58  81
  7864.     750     56  85
  7865.    1000     **  87
  7866.    1500     **  89
  7867.    1750     **  89
  7868.         Up  Dn   (Upload, Download)
  7869.  
  7870. Additional discoveries...  "set line /dev/null" (and certain other devices)
  7871. would cause a core dump.  Added lines to ttopen() to refuse to accept devices
  7872. which, once opened, fail the isatty() test, and return an error code.  Seems
  7873. to work ok, and not interfere with i/o redirection like "kermit -k",
  7874. "cmd | kermit", etc.
  7875.  
  7876. Discovered that if you try to receive a file in local mode, but there is no
  7877. Kermit on the other end, that C-Kermit will just keep timing out and sending
  7878. NAKs forever, until eventually its buffer allocator gets confused and returns
  7879. a fatal error.  The problem was in nack() -- the code was incrementing the
  7880. wrong retry counter!  This fix may also have noticeable benefits in more
  7881. realistic circumstances.
  7882.  
  7883. In local mode, there was no way to interrupt a file transfer until it reached
  7884. the data phase, except by typing Ctrl-C which would exit the program
  7885. completely, dropping the connection -- inconvenient if dialed.  This has been
  7886. fixed by allowing the user to type 'c' or 'e' to cancel packet operations and
  7887. return to the prompt.
  7888.  
  7889. Started to add SSEND, SRECEIVE, and SGET commands to send from and receive/get
  7890. to a command rather than a file.  SSEND almost works but not quite.  See
  7891. openi() in ckcfn3.c, etc.  Just a matter of getting the word to openi through
  7892. various layers of calls in which this stuff is not passed as parameters.
  7893. (Later...) this is a bigger deal than it would appear.  Leave this for some
  7894. other time.
  7895.  
  7896. Tested ttgmdm() on the Encore, whose OS is supposed to be based on 4.3 BSD.
  7897. It has the symbol TIOCMGET defined in its <sys/ioctl.h>, but calling ioctl()
  7898. with this function on an open file descriptor for a terminal device just
  7899. returns the error "not a typewriter".
  7900.  
  7901. WHOOPS!  TIMER IN TTOPEN should be removed, or made user-selectable.  The
  7902. "hang forever waiting for carrier" behavior turns out to be desirable if you
  7903. want Kermit to wait for an incoming call!
  7904.  
  7905. All-day project: Added help text for recently added commands.  Clean up help
  7906. text and make it consistent.  Change hmsga() to do more-style prompting if
  7907. help text is longer than one screen.  Make all help messages go thru hmsg() or
  7908. hmsga() (except just a couple that need to do special things).  ckuus2.c.
  7909. Because this file grew so much from the new help text, I put all the help text
  7910. and subordinate functions within #ifndef NOHELP conditionals, so that the
  7911. built-in help feature can be compiled out (not recommended, but it works).
  7912. On the SUN-4, the savings is about 24K.
  7913.  
  7914. ------------------------------
  7915.  
  7916. 5A(139) Mon Apr 16 18:42:18 1990
  7917.  
  7918. C-Kermit should not NAK packet k just because packet k+1, k+2, ..., k+n-1
  7919. arrive, except if the timeout interval has expired on packet k.  Commented out
  7920. the code in the input() function in ckcfn2.c that sends a NAK for the packet
  7921. at window-low if higher numbered packets arrive.  Now NAKs are only sent if
  7922. a damaged packet arrives or if there is a timeout.
  7923.  
  7924. Found another place where the packet length is recalculated based on the
  7925. negotiated window size: in spar() in ckcfns.c.  Fixed this code to call
  7926. adjpkl() like all the other places do.
  7927.  
  7928. Added the XIF (Extended IF) command.  This is like the IF command in that it
  7929. works with the same set of conditions, but the object command can be a group
  7930. of commands rather than a single command.  The original IF command is
  7931. preserved for compatibility with MS-DOS Kermit.  The two commands are not
  7932. merged because the syntax of the object command is different.
  7933.  
  7934. The XIF command is implemented like the FOR command -- it's a macro, and since
  7935. macros execute on the stack, FOR and XIF commands can be nested and, in fact,
  7936. can contain each other in any combination.  The built-in macro that executes
  7937. the XIF command is called _xif, and its definition is simply:
  7938.  
  7939.   ass \%9 \fdef(_ify),ass _ify { \%1 },do _ify,ass _ify \fcont(\\%9)
  7940.  
  7941. The parser in ckuusr.c evaluates the condition and then accordingly selects
  7942. the THEN part or the else PART to be the macro argument (\%1).
  7943.  
  7944. Syntax of XIF:
  7945.  
  7946.   XIF <condition> { command-list } [ ELSE { command-list } ]
  7947.  
  7948. meaning that the word ELSE and the following command list are optional.  The
  7949. braces enclose a list of one or more comma-separated commands.  As with the
  7950. FOR command, "?" help is not available while typing in the object commands.
  7951.  
  7952. To illustrate the use of XIF, here's our familiar bubble sort, finally coded
  7953. more or less as one might do in a normal programming language:
  7954.  
  7955.     ass \%m \feval(\%n-1)
  7956.     for \%i 1 \%m 1 { -
  7957.     for \%j \%i \%c 1 { -
  7958.         xif lgt \&a[\%i] \&a[\%j] { -
  7959.                 ass \%t \&a[\%i], -
  7960.                 ass \&a[\%i] \&a[\%j], -
  7961.                 ass \&a[\%j] \%t -
  7962.             } -
  7963.     } -
  7964.     }
  7965.  
  7966. Here's a more useless example, showing how XIFs and ELSEs can be nested and
  7967. how each part can contain multiple statements:
  7968.  
  7969.   xif < \%i \%j {-
  7970.       echo \%i is less than \%j,-
  7971.       xif < \%i \%k {-
  7972.       echo \%i is less than \%k,-
  7973.       def \%a ONE-
  7974.       } else {-
  7975.       echo \%i is not less than \%k,-
  7976.       def \%a TWO-
  7977.       }-
  7978.   } else {-
  7979.       echo \%i is not less than \%j,-
  7980.       xif < \%j \%k {-
  7981.       echo \%j is less than \%k,-
  7982.       def \%a THREE-
  7983.       } else {-
  7984.       echo \%j is not less than \%k,-
  7985.       def \%a FOUR-
  7986.       }-
  7987.   }-
  7988.   echo \%a
  7989.  
  7990. The mechanism for adding grouping or looping commands is now pretty usable.
  7991. Should the need arise for a WHILE command (for example), it should be possible
  7992. to add it easily.
  7993.  
  7994. ------------------------------
  7995.  
  7996. 5A(138) Fri Apr 13 15:30:40 1990
  7997.  
  7998. Fixed a bug in which bad commands within the initialization file would cause
  7999. Kermit to go into a loop, postpone displaying its herald, and/or put the
  8000. terminal into weird-mode.  ckuus5.c.
  8001.  
  8002. Added code to ckuus3.c to ensure that the requested number of window slots
  8003. is never greater than or equal to the per-packet retry limit (SET RETRY,
  8004. SET WINDOW).  Imagine a connection with a delay time of n packets, in which
  8005. Kermit has its window size set to n.  Packet k does not arrive, so receiver
  8006. NAKs it.  But sender will not get this NAK for n-1 packet times, and so sends
  8007. the next n-1 packets.  The receiver cannot ACK these new packets, so it
  8008. responds to each new packet by sending another NAK for packet k, for a total
  8009. of n.  If n is greater than the retry limit, the sender will give up
  8010. unnecessarily.
  8011.  
  8012. Moved code that puts \flit() around all commands within a bracket-enclosed,
  8013. comma-separated list of commands to a function, litcmd(), in ckuus5.c, so that
  8014. it can also be used by XIF and any other commands we add later that operate
  8015. upon a group of statements.
  8016.  
  8017. Some computers that have popen() don't have a declaration for it in their
  8018. <stdio.h> files, for example the TRS 6000.  Added this in ckufio.c within 
  8019. #ifdef TRS16 (Jay Rouman).
  8020.  
  8021. Cleaned up the makefile a bit more.
  8022.  
  8023. Commented out all (2) invocations of ttclos() from ckudia.c.  There is no
  8024. reason why the DIAL command should close the line if dialing fails.  When it
  8025. does, the program becomes confused about what the current line is, what its
  8026. speed and other parameters are, etc.
  8027.  
  8028. ------------------------------
  8029.  
  8030. 5A(137) Wed Apr 11 22:15:56 1990
  8031.  
  8032. Fill in ttgmdm() for BSD 4.3 and SUNOS 4.0, which have the TIOCMGET ioctl
  8033. available.  Doesn't seem to work, though -- always says no modem signals are
  8034. on (at least on SUN).  Added SHOW MODEM command.
  8035.  
  8036. Yesterday's edit broke the Kermit server's response to REMOTE commands because
  8037. an internal reference to zxcmd() (whose argument list just changed) in
  8038. zopeni() in ckufio.c was missed.  ckcpro.w was calling zopeni(ZSYSFN,cmd) when
  8039. it should have been calling zxcmd(ZIFILE,cmd), and relied on a hack within
  8040. zopeni() to pass the request along to zxcmd(), and that call hadn't been
  8041. updated to include the file number.  From now on, let's only call zxcmd when
  8042. we want to read or write a command (pipe) instead of a real file!
  8043.  
  8044. Removed one last (?) stray strchr(), this one from chktok() in ckucmd.c.
  8045. Various other lint-inspired fixes in various modules, some of which might be
  8046. important, like some functions that were called without all their arguments,
  8047. including one strncmp() that was called without a length argument!
  8048.  
  8049. Found an extra sleep(1) in ttres() and removed it.  No wonder closing the
  8050. line was so slow in BSD!  (It's still slow, because there's still one sleep(1)
  8051. in ttres(), plus another one in conres().)
  8052.  
  8053. Added a 30-second timer around the open() call in ttopen(), to prevent Kermit
  8054. from hanging forever if SET LINE is done on a modem-controlled line that is
  8055. not presenting DCD.  I thought of passing the alarm interval as a parameter to
  8056. ttopen(), but why bother?  Another incomprehensible SET command, and calls to
  8057. ttopen() would have to be changed in dozens of places, and what difference
  8058. does it make anyway?  Under what circumstances should carrier be expected to
  8059. appear in 60 seconds rather than 30?
  8060.  
  8061. In ttlock() in ckutio.c, if the SETUID conditional is turned on and look4lk()
  8062. reports that we don't have write access to the lockfile directory, ignore this
  8063. warning and go ahead and try to create the lockfile anyway because the
  8064. access() call in look4lk() checks lockfile permission based on the read uid
  8065. and gid, not the effective uid and gid, and so if we are running setuid to
  8066. uucp in order to access the lock directory (for example) look4lk() will still
  8067. think we don't have access, which defeats the whole purpose.  So in this case,
  8068. skip the check and go on the create the lock file.  If it fails, we'll catch
  8069. it then.  Note, by default the SETUID conditional is not turned on.
  8070.  
  8071. A new bug has surfaced...  Every so often, the version herald will be
  8072. displayed for no reason at all, for example when Kermit goes back to its
  8073. prompt after receiving a file.  The reason is not obvious -- herald() is only
  8074. called from one place (in ckcmai.c), and it's not in a place that gets
  8075. executed more than once.  Check this tomorrow (or Monday)...
  8076.  
  8077. Whoops, I found (but did not yet fix) the problem...  If your .kermrc file
  8078. contains a bad command, the implicit TAKE on the file quits early, and the
  8079. herald is not printed until the next time you enter the command parser.
  8080. What's more, after this happens, your console terminal is left in some kind
  8081. of funny state.  Something to do with cmdini()? ...
  8082.  
  8083. The file ckasys.doc was written a couple days ago (and updated each day since),
  8084. which lists the calling conventions and semantics of each function and global
  8085. variable in the system-dependent modules.
  8086.  
  8087. ------------------------------
  8088.  
  8089. 5A(136) Tue Apr 10 06:19:09 1990
  8090.  
  8091. Remember all the craziness about \fliteral() in the description of the FOR
  8092. command in edit 134?  Forget all that.  A bit a magic was added to the parsing
  8093. of the FOR command to insert the \fliteral() in the right places, so the user
  8094. never needs to know about it.  The reasoning is that if you ever wanted to
  8095. use loop variables in the object command of a FOR you always had to put
  8096. \fliteral() around them in the object command anyway, like this:
  8097.  
  8098.   for \%i 1 3 1 { echo \fliteral(\%i) }
  8099.   for \%i 1 3 1 { for \%j \%i 3 1 { echo \flit(\flit(\%i \%j)) } }
  8100.  
  8101. ...so let the program do it instead.  For other escaped quantities (variables
  8102. other than the loop variables, functions, etc), the presence or absence
  8103. \fliteral() does not make a difference.  So instead of making the user do this
  8104. the program does it automatically, and now:
  8105.  
  8106.   for \%i 1 3 1 { for \%j \%i 3 1 { echo \%i \%j } }
  8107.  
  8108. produces the expected results, namely:
  8109.  
  8110.   1 1
  8111.   1 2
  8112.   1 3
  8113.   2 2
  8114.   2 3
  8115.   3 3
  8116.  
  8117. And there are no more bizarre rules about leaving the \ off the interior loop
  8118. variable, or putting \fliteral() around other things.  The FOR command parser
  8119. in ckuusr.c now changes:
  8120.  
  8121.   for \%i x y z { xxx, yyy, zzz  }
  8122.  
  8123. into:
  8124.  
  8125.   for \%i x y z { \flit(xxx), \flit(yyy), \flit(zzz) }
  8126.  
  8127. And this works recursively, e.g. when xxx (and/or yyy, etc) is another FOR
  8128. command.  It turned out that there was no way to do this in the macro
  8129. definition itself.
  8130.  
  8131. Footnote material: If braces are omitted from around the object command, the
  8132. \flit() is not inserted.  Of course, without the braces, you can only have a
  8133. single-word object command (macro argument-grouping rules).  This lets you
  8134. defeat the insertion of \flit() (not that I can think of any reason why anyone
  8135. would want to do this), for example:
  8136.  
  8137.   def \%i hi there
  8138.   def \%x echo \%i
  8139.   for \%i 1 3 1 \%x
  8140.  
  8141. writes "hi there" three times.
  8142.  
  8143. Our horrible sorting example from edit 134, which looked like this:
  8144.  
  8145.   def swap ass \%t \&a[\%i], ass \&a[\%i] \&a[\%j], ass \&a[\%j] \%t
  8146.   for %i 1 \%m 1 { -
  8147.       for %j \flit(\%i) \%c 1 { -
  8148.       if lgt \flit(\flit(\&a[\%i] \&a[\%j])) do swap -
  8149.       } -
  8150.   }
  8151.  
  8152. Now can be written as:
  8153.  
  8154.     def swap ass \%t \&a[\%i], ass \&a[\%i] \&a[\%j], ass \&a[\%j] \%t
  8155.     for %i 1 \%m 1 { -
  8156.     for %j \%i \%c 1 { -
  8157.         if lgt \&a[\%i] \&a[\%j] swap -
  8158.     } -
  8159.     }
  8160.  
  8161. Note that the "swap" macro still cannot be replaced by the statements
  8162. themselves in the IF statement.  This is not because of any quoting or
  8163. evaluation problems, but because IF only works on single commands.  To get
  8164. around this, we need to change IF to allow grouped statements in the IF and
  8165. ELSE parts.  This is now possible using the same method that was used for FOR
  8166. loops.  The IF command will not be changed; it must remain as-is for
  8167. compatibility with MS-DOS Kermit.  But there could be a second, "extended IF"
  8168. command, maybe called XIF, which might look like:
  8169.  
  8170.   XIF ( condition ) { list of commands } ELSE { list of commands }
  8171.  
  8172. which means I can rip out all of the disgusting code that was needed for
  8173. the current ELSE command, and only allow ELSE to be used with XIF (???).
  8174.  
  8175. Moved the code that executes the ! and RUN commands from ckuusr.c to a new
  8176. function, zshcmd(), in ckufio.c.  This code is loaded with system-dependent
  8177. #ifdef's and did not belong in the user interface module.
  8178.  
  8179. Changed the calling convention for zxcmd(), the function which opens a pipe
  8180. instead of a file, to include a Kermit file number.  So now it is possible to
  8181. READ from a pipe or WRITE to a pipe, or even (in theory) to SEND from a pipe
  8182. or RECEIVE or GET to a pipe.
  8183.  
  8184. Added two new options to the OPEN command:
  8185.  
  8186.   OPEN !READ command 
  8187.   OPEN !WRITE command
  8188.  
  8189. These open a system command (via call to zxcmd) for reading and writing,
  8190. respectively.  Some pretty useful applications for OPEN !READ spring to mind,
  8191. like:
  8192.  
  8193.   open !read ls ck[cuw]*.{doc,bwr,upd}
  8194.   echo Enter SERVER mode to receive multiple sends...
  8195.   pause 2
  8196.   set tak error off
  8197.   :loop
  8198.   read \%f
  8199.   if fail goto done
  8200.   send \%f    
  8201.   goto loop
  8202.   :done
  8203.   finish
  8204.  
  8205. Suddenly all of the system shell's fancy wildcarding is available to us.
  8206. Define this code to be a macro, say SSEND, and then you can use it pretty much
  8207. the same as you would use regular SEND.  The above example is from the
  8208. C-Shell.  OPEN !WRITE may find some uses (writing text to sort or grep???) but
  8209. mainly it's there for symmetry.  It uses popen(), which is hopefully available
  8210. in all versions of UNIX.  If not, add -DNOPOPEN to the makefile entry for your
  8211. system.  Note: popen() uses sh (not csh or ksh) to run the command.
  8212.  
  8213. Added a new function ttwmdm() to ckutio.c, to allow the WAIT command to be
  8214. implemented, as in MS-DOS Kermit.  This function waits for any of the
  8215. specified DCE signals: DSR, CTS, and/or CD to appear on the currently selected
  8216. communication device.  Various return values are given.
  8217.  
  8218. Added a similar command, ttgmdm(), that returns the status of DSR, CTS, and CD
  8219. in a bit mask.  In the UNIX version, ttwmdm() or ttgmdm() merely return -2
  8220. for a network connection, or -3 (= not implemented) for a tty connection.
  8221. This function, if it could be made to work, could have many valuable
  8222. applications, as well as supporting the more mundane SHOW MODEM command, as in
  8223. MS-DOS Kermit.
  8224.  
  8225. ------------------------------
  8226.  
  8227. 5A(135) Mon Apr  9 22:34:21 1990
  8228.  
  8229. A couple minor glitches were fixed in ckucmd.c, ckutio.c, and maybe a couple
  8230. other places.  These are obvious to anyone who tried to compile the program in
  8231. a non-BSD environment: undefined variables, etc.
  8232.  
  8233. Also, I put the code back into tthang() that closes and reopens the line in
  8234. System-III/V non-HPUX implementations, but it's done a little more carefully
  8235. this time than it was before.  Without this code, it appears that vanilla
  8236. System V versions of UNIX do not bring DTR back up (hangup is supposed to drop
  8237. DTR for about half a second, not forever).  This code, however, has the
  8238. potential risk of losing some of the mode settings on the line, and so should
  8239. not be used if it isn't needed.  Therefore it is enclosed within #ifdef
  8240. CLOSEOPEN..#endif conditionals, and won't be activated unless you add
  8241. -DCLOSEOPEN to your makefile entry.  If the DIAL command doesn't work for you,
  8242. then you need this.  Otherwise, leave it out.
  8243.  
  8244. Finally, from today's mail...
  8245.  
  8246.   Date: Mon, 9 Apr 90 00:45:48 -0400
  8247.   From: djm@eng.umd.edu (David J. MacKenzie)
  8248.   To: fdc@watsun.cc.columbia.edu
  8249.   Subject: script language
  8250.  
  8251.   The script language is a welcome addition to C-Kermit, but is there a
  8252.   philosophy behind its design?  I don't have your Kermit book, and I don't
  8253.   have much of a background in timesharing OS's other than Unix, but the
  8254.   impression I get is that C-Kermit's script language is sort of a
  8255.   Frankenstein's monster language, with a piece from here, a piece from
  8256.   there, and not very coherent.
  8257.  
  8258.   Certainly from a Unix hacker's point of view, it's just what we don't need
  8259.   -- another unique language syntax and set of conventions.  I wish the
  8260.   C-Kermit script language had been designed to closely resemble some common
  8261.   existing language and set of conventions, like Quick Basic, Lisp, AWK, or
  8262.   the Korn shell.  It seems to have all sorts of weird ways to quote things,
  8263.   for example.  It reminds me a bit of Dan Lawrence's MicroEMACS script
  8264.   language, but more chaotic.  And what is the justification for supporting
  8265.   only single-character variable names?
  8266.  
  8267. A major goal of C-Kermit's script language is backwards compatibility with
  8268. MS-DOS Kermit: that is, MS-DOS Kermit scripts should be executable by C-Kermit
  8269. with very little conversion required.  There is a large body of MS-DOS Kermit
  8270. script programs, so why invent "another unique language syntax and set of
  8271. conventions"?  The MS-DOS Kermit language is unarguably restrictive
  8272. (single-character variable names, etc), but it is simple and consistent.
  8273. C-Kermit has sacrificed some of that simplicity in its new features, a fact
  8274. amply illustrated by the FOR-loop story below.  So...  see edit 136, which, I
  8275. hope, smooths out the terrain a bit in this new territory.
  8276.  
  8277. ------------------------------
  8278.  
  8279. 5A(134) Sun Apr  8 23:08:51 1990
  8280.  
  8281. Applied fixes from Bo Kullmar in Sweden for OPEN APPEND and SET FILE COLLISION
  8282. APPEND.  Turns out once again that my SUN compiler was too forgiving; code
  8283. that worked here caused core dumps elsewhere.  Fix was to make the fcb
  8284. structure be static and to pass it to functions by reference rather than by
  8285. value.
  8286.  
  8287. At Kristoffer's suggestion, added code to ttvt() to check not only the tvtflg,
  8288. but also compare the parameters it was called with against the last parameters
  8289. that it set before deciding whether to return right away or to actually
  8290. perform the requested functions.  This is all quite ugly, but at least the
  8291. logic is localized within ttvt() and related functions so that others can call
  8292. these functions repeatedly without having to keep track of whether they've
  8293. been called before.  ckutio.c.
  8294.  
  8295. Cleaned up tthang().  Don't know if this will alleviate the drop-DTR-forever
  8296. problems on DIAL at AT&T, but it can't hurt.  If Peter Mauzey still can't dial
  8297. then put back the close ( open() ) bit and try again.  That should do it for
  8298. ckutio.c (???).
  8299.  
  8300. Fixed SET DEBUG ON to actually open the debug log instead of core dumping, ha
  8301. ha.  ckuus3.c.  Changed dumpsbuf() and dumprbuf() in ckcfn3.c to only print
  8302. the first 72 characters of the packet, rather than the whole thing.  This had
  8303. been another source of core dumps when very long packets were being debugged.
  8304.  
  8305. Put #ifndef UXIII..#endif around split-speed support, since AT&T UNIX does
  8306. not and can not support it.
  8307.  
  8308. Added code from Warren Tucker to ckudia.c to better interpret CONNECT response
  8309. to dial command from Hayes modem.  It will now attempt to change Kermit's
  8310. speed to any speed that the modem reports in its CONNECT message.  Warren said
  8311. he might also add Telebit Traiblazer support, which would be pretty neat,
  8312. since the Trailblazer has a "Kermit spoof" built into it.  But you've got to
  8313. set register S111 to use it: values are 10 (Kermit with no parity), 11 (Kermit
  8314. with odd parity), 12 (K w/even), 13 (K w/mark), and 14 (K w/space).  Other
  8315. values are 0 (no protocol), 20 (Xmodem/Ymodem), 30 (UUCP "g"), and 255 (use
  8316. protocol specified by other modem).  Also S112 is used for the packet start
  8317. character - this must be changed if Ctrl-A (SOH) is not used.  See pp.4-31 and
  8318. 4.32 of the Telebit Commands and Registers Reference Manual.  I'm putting
  8319. these notes here because Warren seems to be disconnected from e-mail at the
  8320. moment.
  8321.  
  8322. In doing edit 133, I saw that there was redundant code scattered all over
  8323. ckuus*.c that parses and otherwise validates variable names and array
  8324. references.  Consolidated these sections into a single compact function,
  8325. parsevar(), and replaced the code in DEFINE, ASSIGN, INCREMENT, DECREMENT,
  8326. READ, ASK, and ASKQ with calls to this function.
  8327.  
  8328. Converted the code used by the INCREMENT and DECREMENT commands into a
  8329. function that can also be called from elsewhere.  The new function, incvar(),
  8330. can be used to increment or decrement any variable or array member by any
  8331. number.  ckuus5.c.
  8332.  
  8333. Considered adding BEGIN..END blocks for use in IF..ELSE statements.  But given
  8334. the current structure of the command parser, in which IF..ELSE, GOTO, and so
  8335. forth work only by ugly kludges, decided against it.  Statement grouping can
  8336. be accomplished using macros, or by invoking TAKE files.  /dev/null.
  8337.  
  8338. Also considered adding a subroutine mechanism (as in Fortran) with CALL and
  8339. RETURN.  Decided against this because a subroutine is no different from a
  8340. macro: it's a procedure consisting of one or more statements, which can be
  8341. invoked with parameters, and which returns to the statement past the one that
  8342. invoked it, but does not return a value.  The coding complications would not
  8343. have been worth the negligible benefit.  /dev/null.
  8344.  
  8345. Added ASG as an invisible synonym for ASSIGN.  Because of the ASK command,
  8346. the minimum unique abbreviation for ASSIGN is ASS.  Now, if you prefer, you
  8347. can type ASG instead of ASS in your commands.  ckuusr.c.
  8348.  
  8349. Fixed problem in RETURN statement which was causing core dumps if a null
  8350. return value was given within a macro and debugging was turned on.
  8351.  
  8352. FOR LOOPS
  8353.  
  8354. (warning - the following is a long story, in which the conditions keep
  8355. changing, so don't believe anything you read till you get to the end.)
  8356.  
  8357. Then I spent three solid days trying to add a FOR-loop mechanism, but after
  8358. writing and rewriting hundreds of lines of code and adding many new K of
  8359. buffers and stacks, I concluded there was no way to make it work
  8360. satisfactorily given the current structure of the program and the command
  8361. parser.  What I did worked just fine so long as its object command was a
  8362. simple Kermit command, not a compound command like IF or IF..ELSE, not a macro
  8363. invocation, and not a TAKE command.  It could even be nested to great depths.
  8364. But without being able to execute a group of commands in the FOR loop, the
  8365. command was next to useless.  So I removed it (evidence of budding maturity).
  8366.  
  8367. Anyway, loops can be constructed using the current mechanisms: DEFINE, ASSIGN,
  8368. IF, GOTO, and arithmetic.  For example, to sort an array \&a[] of strings
  8369. having \%n elements, using the bubble sort algorithm, we would write something
  8370. like this in a typical programming language (that doesn't have \-variables):
  8371.  
  8372.   m = n - 1;                       /* outer loop limit */
  8373.   for (i = 1; i <= m; i++) {       /* outer loop */
  8374.       for (j = i; j <= n; j++) {   /* inner loop */
  8375.       if (a[i] > a[j]) {       /* compare */
  8376.           t = a[i];            /* exchange */
  8377.           a[i] = a[j];
  8378.           a[j] = t;
  8379.       }
  8380.       }
  8381.   }
  8382.  
  8383. In the Kermit script language, it goes like this:
  8384.  
  8385.   ass \%m \feval(\%n-1)    ; Loop limit for outer loop
  8386.   def \%i 1                ; Outer loop.  Assign initial value to loop control.
  8387.   :itop                    ; Where to come back to when iterating.
  8388.   if > \%i \%m goto ibot   ; Completion test.
  8389.   def \%j \feval(\%i+1)    ; Inner loop, same deal.
  8390.   :jtop
  8391.   if > \%j  \%n goto jbot
  8392.     if not lgt \&a[\%i] \&a[\%j] goto skip  ; Compare elements i and j.
  8393.     ass \%t \&a[\%i]                        ; Out of order, so exchange them. 
  8394.     ass \&a[\%i] \&a[\%j]
  8395.     ass \&a[\%j] \%t
  8396.   :skip
  8397.   incr \%j                  ; Increment the inner loop control variable
  8398.   goto jtop                 ; and go back for next iteration, if any.
  8399.   :jbot                     ; Increment outer loop variable
  8400.   incr \%i                  ; and re-iterate.
  8401.   goto itop
  8402.   :ibot                     ; Come here when done.
  8403.   echo sort complete
  8404.  
  8405. This is definitely ugly compared to real FOR loops (it looks like compiler
  8406. output), but it gets the job done.  Not that you would want to sort any very
  8407. large files in a Kermit script anyway...  The overwhelming benefit is that
  8408. you can put any number and combination of commands inside the loop.
  8409.  
  8410. But notice how mechanical the elaboration of the FOR-loop is.  Maybe a Kermit
  8411. macro could be written that does the bookkeeping.  Here's a first attempt.
  8412. A macro called FOR is defined which accepts as arguments a variable name,
  8413. an initial value, a final value, an increment, and an object command.  It then
  8414. constructs a new macro from these arguments and executes it.  The reason a
  8415. secondary internal macro must be defined is so that variable names (rather
  8416. than their values) can be dealt with.
  8417.  
  8418.   def for assign xxx define \\\%1 \%2,-
  8419.   :top,-
  8420.   if > \\\%1 \%3 goto bot,-
  8421.   \%5,-
  8422.   incr \\\%1 \%4,-
  8423.   goto top,-
  8424.   :bot, return,-
  8425.   do xxx \%1 \%2 \%3 \%4 \%5
  8426.  
  8427. This first try did not work at all because the very first comma cut off the
  8428. interior ASSIGN command, and all the subsequent commands became part of the
  8429. FOR definition rather than the XXX definition.  So... ckuus5.c was changed
  8430. slightly to allow another kind of grouping, namely if a macro definition
  8431. starts with a curly bracket, then commas are treated as ordinary text rather
  8432. than command separators up until the matching closing curly bracket.  Now we
  8433. can write:
  8434.  
  8435.   def for assign xxx { define \\\%1 \%2,-
  8436.   :top,-
  8437.   if > \\\%1 \%3 goto bot,-
  8438.   \%5,-
  8439.   incr \\\%1 \%4,-
  8440.   goto top,-
  8441.   :bot, return },-
  8442.   do xxx \%1 \%2 \%3 \%4 \%5
  8443.  
  8444. And this works.  As an example of its use, the following statement echoes the
  8445. word "oofa" ten times:
  8446.  
  8447.   for %i 1 10 1 { echo oofa }
  8448.  
  8449. The brackets around "echo oofa" group these two words together as a single
  8450. macro argument.  To print the elements of an array \&a[] of size \%n, you
  8451. might expect to be able to write:
  8452.  
  8453.   for %i 1 10 1 { echo \&a[\%i] }
  8454.  
  8455. But this doesn't work because the array subscript gets evaluated too early;
  8456. it is turned into a constant (the null string if \%i has not been defined yet
  8457. elsewhere, otherwise whatever \%i's current definition is).  To postpone its
  8458. evaluation until the proper moment, put it in a macro definition:
  8459.  
  8460.   define xx echo \&a[\%i]
  8461.   for i 1 10 \%n xx
  8462.  
  8463. or use the \fliteral function:
  8464.  
  8465.   for %i 1 10 1 { echo \fliteral(\&a[\%i]) }
  8466.  
  8467. What about nested FOR-loops?  There remains one obstacle.  The FOR macro
  8468. defines another macro which is the "compilation" of the FOR statement, and
  8469. then executes the generated macro.  As you can see above, the name of this
  8470. interior macro is "xxx".  A FOR-loop within a FOR-loop will thus redefine the
  8471. exterior loop's xxx macro out from under it.  How do we create a new macro
  8472. that won't destroy the old one?  We must save and restore the old macro's
  8473. definition upon entry and exit.
  8474.  
  8475. For this we need two new built-in functions: \fdefinition(macro) and
  8476. \fcontents(variable).  The former returns the definition of the macro whose
  8477. name is given as the argument, the latter returns the definition of the given
  8478. variable.  Both results are unexpanded (i.e. variables, functions, and other
  8479. backslash codes are not interpreted).  Without these functions, the text of
  8480. the macro definition would be changed at the time it is saved and restored.
  8481. We just want the plain text.  Here is the new (and final?) version of the FOR
  8482. macro:
  8483.  
  8484.   def for if def _floop assign \%9 \fdefinition(_floop),-
  8485.   else define \%9,-
  8486.   assign _floop { define \\\%1 \%2,-
  8487.   :top,-
  8488.   if > \\\%1 \%3 goto bot,-
  8489.   \%5,-
  8490.   incr \\\%1 \%4,-
  8491.   goto top,-
  8492.   :bot, return },-
  8493.   do _floop \%1 \%2 \%3 \%4 { \%5 },-
  8494.   assign _floop \fcontents(\%9)
  8495.  
  8496. This one checks to see if a FOR-loop is already active.  If so, it fetches its
  8497. definition and stores it in its own local variable \%9 (an unused "macro
  8498. parameter").  Remember, \%0..9 are on the macro stack, so nested FOR loops do
  8499. not have to worry about writing over each other's \%0..9 variables, and labels
  8500. are also local to each macro invocation, so there is no confusion over having
  8501. ":top" and ":bot" labels in each macro.
  8502.  
  8503. Let's use the new FOR macro to bubble-sort our array \&a[] of \%n strings
  8504. again:
  8505.  
  8506.   ; First define macros
  8507.   def compare if lgt \&a[\%i] \&a[\%j] do swap
  8508.   def sort do for %j \%i \%c 1 { compare }
  8509.   def swap ass \%t \&a[\%i], ass \&a[\%i] \&a[\%j], ass \&a[\%j] \%t
  8510.  
  8511.   ass \%m \feval(\%c-1)        ; Loop limit for outer loop
  8512.   for %i 1 \%m 1 { do sort }   ; Sort the array.
  8513.  
  8514. This works, good.  But after passing this hurdle, I realized that it would not
  8515. be "user friendly" to give users a FOR macro if they wanted FOR loops; it had
  8516. to be built into the program, and had to work like other commands.
  8517.  
  8518. So I restored the parsing of the FOR command to ckuusr.c, so now it looks like
  8519. a built-in command, "?" works on each field, etc.  The final FOR definition
  8520. listed above was added to C-Kermit's list of predefined macros under the
  8521. internal name of "_forg" (and another one called "_forl" for backwards
  8522. looping, see below).  This setup has the added benefit that the object command
  8523. can be a list of commands, almost like in C.  Example:
  8524.  
  8525.   for \%i 1 3 1 { echo foo, echo bar }
  8526.  
  8527. Variables or functions on the FOR command line, except for the loop control
  8528. variable (\%i in the example above) are evaluated before the loop begins.  So:
  8529.  
  8530.   def \%i xxx
  8531.   for \%i 1 3 1 { echo \%i }
  8532.  
  8533. will print 'xxx' three times, instead of '1', '2', '3', as you might expect.
  8534. To get the name of a variable or function rather than its value into a loop's
  8535. object command, use \fliteral(), as in:
  8536.  
  8537.   for \%i 2 10 2 { echo \flit(\%i) }
  8538.  
  8539. Within the loop, you can't use \fliteral() on the loop initial value, final
  8540. value, or increment, which means you can't refer to them by name within the
  8541. loop, so you can't change them from inside.  For example, if you do this:
  8542.  
  8543.   def \%x 10
  8544.   for \%i 1 \%x 1 { echo \flit(\%i), if = \flit(\%i) 2 assign \flit(\%x) 5 }
  8545.  
  8546. the loop will still print 1 to 10, rather than stopping at 5.  The assignment
  8547. of 5 to \%x will indeed occur, but the loop is not using this variable for the
  8548. loop limit, but rather its value at the time the loop started.  If you want to
  8549. escape from a loop early, use the RETURN command, as in:
  8550.  
  8551.   for \%i 1 10 1 { if > \flit(\%i) 5 return, else echo \flit(\%i) }
  8552.  
  8553. Nested FOR loops work, too:
  8554.  
  8555.   for %i 1 3 1 { for %j 1 3 1 { echo oofa! } }
  8556.  
  8557. This writes "oofa!" 3 x 3 = 9 times.  For readability, you can break the
  8558. command up into multiple hyphenated lines and indent, like in a structured
  8559. language:
  8560.  
  8561.   for %i 1 3 1 { -
  8562.       for %j 1 3 1 { -
  8563.           echo oofa! -
  8564.       } -
  8565.   }
  8566.  
  8567. Here's a more complicated example, illustrating that multiple statements can
  8568. be grouped at different levels.  This kind of thing will work only if you get
  8569. the braces, commas, and dashes just right.  (The commas are somewhat like
  8570. Algol semicolons -- they are command SEPARATORS, not terminators like C
  8571. semicolons.)
  8572.  
  8573.   for \%i 1 3 1 { -
  8574.       echo oofa,-
  8575.       for %j 1 2 1 { -
  8576.       echo foo, -
  8577.       echo foo again -
  8578.       },-
  8579.       echo bar -
  8580.   }
  8581.  
  8582. Notice that loop control variables are written without the "\" prefix.  The
  8583. "\" can be omitted in contexts where only variable names are allowed, and in
  8584. fact it is NECESSARY to omit the backslash on the inner loop variable, or else
  8585. the \%j would be evaluated and replaced by whatever the current value of \%j
  8586. is at the time the command is executed.  You can also use \fliteral() here:
  8587.  
  8588.   for \%i 1 3 1 { -
  8589.       for \fliteral(\%j) 1 3 1 { -
  8590.           echo oofa! -
  8591.       } -
  8592.   }
  8593.  
  8594. \fliteral() is also used to refer to loop variables inside the object command.
  8595. But in nested loops, one is not enough.  You need one \fliteral() for each
  8596. level of loop nesting:
  8597.  
  8598.   for %i 1 3 1 { -
  8599.       for %j 1 3 1 { -
  8600.           echo \flit(\flit(\%i:\%j)) -
  8601.       } -
  8602.   }
  8603.  
  8604. When you have more than one level of FOR-loop, it can be a little clearer to
  8605. define the loop's object command (or commands) as a macro:
  8606.  
  8607.   define print_loop_vars echo \%i:\%j:\%k
  8608.   for %i 1 3 1 { -
  8609.       for %j 1 3 1 { -
  8610.           for %k 1 3 1 { -
  8611.               print_loop_vars -
  8612.           } -
  8613.       } -
  8614.   }
  8615.  
  8616. As a practical example, let's reconstruct our sorting loop to use a nested FOR
  8617. loop (you might need special glasses to read it):
  8618.  
  8619.   def swap ass \%t \&a[\%i], ass \&a[\%i] \&a[\%j], ass \&a[\%j] \%t
  8620.   for %i 1 \%m 1 { -
  8621.       for %j \flit(\%i) \%c 1 { -
  8622.       if lgt \flit(\flit(\&a[\%i] \&a[\%j])) do swap -
  8623.       } -
  8624.   }
  8625.  
  8626. Note that in order to make the inner loop variable's initial value become the
  8627. outer loop variable's current value, one level of "literalization" is needed,
  8628. whereas within the inner loop two levels are needed.  The "swap" function is
  8629. defined as a macro only to keep the the function minimally readable.
  8630.  
  8631. Finally, it should be mentioned that negative values are allowed in the loop
  8632. parameters, and so is backwards looping:
  8633.  
  8634.   for %i +5 -5 -1 { echo \flit(\%i) }
  8635.  
  8636. Kermit reverses the loop test automatically if the loop increment is negative.
  8637. Increments of zero are not allowed.
  8638.  
  8639. And the last addition to edit 134, two new functions: \fcount(filespec), which
  8640. returns the number of files that match the given file specification, and
  8641. \fnextfile(), which returns the next file name (it returns the null string if
  8642. (a) \fcount has not been called yet, (b) there are no more matching
  8643. filenames).  Here's an example of using these functions:
  8644.  
  8645.   def list if not def \%1 def \%1 *,-
  8646.   ass \%n \fcount(\%1),-
  8647.   if < \%n 0 goto bad,-
  8648.   declare \&a[\%n],-
  8649.   for %i 1 \%n 1 { \fliteral(assign \&a[\%i] \fnext()) },-
  8650.   echo matching files: \%n,-
  8651.   for %i 1 \%n 1 { \fliteral(echo \&a[\%i]) },-
  8652.   return,-
  8653.   :bad,-
  8654.   echo Too many files match!
  8655.  
  8656. This defines a LIST macro, which gives a directory listing of files that match
  8657. the given file specification, and stores each filename in an array element so
  8658. that the list could be sorted or otherwise manipulated.  The array is
  8659. allocated to be exactly the right size for the number of files.
  8660.  
  8661. This mechanism has some potentially useful applications.  For example, suppose
  8662. you wanted to send a mixed group of text and binary files in one command.  If
  8663. you had some way of telling a file's type from its name you could send each
  8664. file in the appropriate mode.  For instance, suppose all files that had ".exe"
  8665. in their names were binary and all others were text, and their names (\%n of
  8666. them) were stored in the array \&a[]:
  8667.  
  8668.   def text set file type text, send \%1
  8669.   def binary set file type binary, send \%1
  8670.   def typesend if > \findex(.exe,\%1) 0 binary \%1, else text \%1
  8671.   for \%i 1 \%n 1 { typesend \flit(\&a[\%i]) }
  8672.  
  8673. This example assumes that the other Kermit is in server mode, and is capable
  8674. of setting its receiving file mode based on C-Kermit's attribute packets.
  8675. With MS-DOS Kermit 3.0 (or another C-Kermit 5A, or Kermit-370) as the server,
  8676. this actually works.
  8677.  
  8678. Left as a trivial exercise for the reader: use a the same trick that made FOR
  8679. loops work to implement WHILE loops, DO..UNTIL loops, etc.
  8680.  
  8681. ------------------------------
  8682.  
  8683. 5A(133) Wed Apr  4 08:08:02 1990
  8684.  
  8685. ARRAYS.  Added the DECLARE command to ckuusr.c (you may also use DCL, which is
  8686. an invisible synonym for DECLARE).  This command is used to declare an array
  8687. of the form \&a[n], where a is a letter a-z (upper and lower case treated the
  8688. same, i.e. as lower) and n is the size of (number of elements in) the array
  8689. (any positive number).  Arrays are global and have one dimension, with
  8690. subscripts ranging from 0 to n (so really the array has n+1 elements).  Like
  8691. other Kermit variables, array element values are always strings.  Examples of
  8692. declarations:
  8693.  
  8694.   DECLARE \&A[20]    ; Declare array "a" with elements 0-20.
  8695.   dcl \&b[20]        ; Can use "dcl" instead of DECLARE (case doesn't matter)
  8696.   DECL \&C[\%B]      ; Can use variables, etc, for dimension.
  8697.   decl &e[100]       ; Can omit '\' in DECLARE statement (see below).
  8698.  
  8699. Array data structures are as follows:
  8700.  
  8701.   int a_dim[26];     /* declared dimensions (sizes) of the 26 arrays */
  8702.   char **a_ptr[26];  /* pointers to element-lists for each array */
  8703.  
  8704. These two structures are compiled into the program -- a total of 208
  8705. additional bytes on most machines (26 * ((sizeof int) + (sizeof char **))).
  8706. These arrays are initialized to all 0's and NULL's, respectively.  Any array
  8707. whose a_dim is zero or whose a_ptr is NULL has not been declared.  The indexes
  8708. of the a_dim and a_ptr arrays are 0 thru 25, corresponding to a-z.
  8709.  
  8710. Whenever an array is actually declared, an "element list" is dynamically
  8711. allocated (malloc'd).  This is an array of string pointers (char *) whose
  8712. length is equal to the declared size of the array plus one, that is
  8713. (sizeof(char *) * (n + 1)).  These are all initialized to NULL.  The address
  8714. of array x's element list is stored in a_ptr[x], and the size of array x is
  8715. stored in a_dim[x].
  8716.  
  8717. Whenever an array element is defined, space is malloc'd for it and the new
  8718. address is stored in the array's element list at the position corresponding
  8719. to the index given in the array reference.
  8720.  
  8721. Storage for an array element is reworked when the array element is redefined,
  8722. and storage is freed when the array element is defined to be the empty string.
  8723.  
  8724. Storage for an array can be freed by issuing a second DECLARE command for the
  8725. same array.  If the declared dimension is zero, the array and all its elements
  8726. are effectively "undeclared" and all storage deallocated:
  8727.  
  8728.    DECLARE \&A[0]
  8729.  
  8730. There are three kinds of array references.  The first occurs in the DECLARE
  8731. command, where any array name \&a-\&z can be given, regardless of whether the
  8732. array exists.  Second is any command that assigns a value to an array element,
  8733. like DEFINE, ASSIGN, READ, ASK, ASKQ, INCREMENT, DECREMENT, or IF DEFINED.
  8734. References in these commands require that the given array already be declared
  8735. and that the subscript be within bounds.  Both the first and second kind of
  8736. references allow the '\' to be omitted from the array reference.  Examples:
  8737.  
  8738.   DECLARE \&A[99]   ; These two
  8739.   DECLARE &A[99]    ; are the same
  8740.  
  8741.   IF DEF &A[99] INCR &A[99]
  8742.  
  8743. The third kind of array reference occurs in any other context, in which the
  8744. array reference is substituted by its value.  In this case, the '\' must be
  8745. present, and any reference to an undeclared array or an out-of-bounds element
  8746. is simply replaced by the null (empty) string.  Examples:
  8747.  
  8748.   ECHO Good \&t[\%a], \&n[\%x], how are you today\63
  8749.  
  8750. An array index can be any C-Kermit expression, including a numeric constant, a
  8751. variable or function that evaluates to a numeric string, or even another array
  8752. reference, nested to any reasonable level, for example:
  8753.  
  8754.   DCL \&D[\fmax(\%a,\&c[\x0f])]
  8755.  
  8756. There is no special mechanism for initializing arrays, but the READ command
  8757. does the trick nicely.  For example:
  8758.  
  8759.   def \%d 200
  8760.   dcl &a[\%d]                ; Declare a 200-element array.
  8761.   set take error off            ; So EOF on READ won't stop the TAKE command.
  8762.   open read numbers.dat         ; Open the "numbers.dat" file for reading.
  8763.   def \%i 1                     ; Make our array 1-based.
  8764.   :loop                         ; Loop to read lines.
  8765.   read &a[\%i]                  ; Read a line into current array element.
  8766.   if fail goto inited           ; If EOF, done.
  8767.   incr \%i                      ; Otherwise, increment array index.
  8768.   if not > \%i \%d goto loop    ; If array not exceeded, go back for next line.
  8769.   echo Array overflow: \%d!     ; Too many lines, give message.
  8770.   dcl &a[0]                     ; Free the storage.
  8771.   goto fin                      ; Go clean up.
  8772.   :inited                       ; Array initialized successfully.
  8773.   echo Array initialized.       ; Give message.
  8774.   :fin                          ; Common exit.
  8775.   close read                    ; Close the READ file.
  8776.   set take error on             ; Put TAKE ERROR back on (if you want it).
  8777.   echo Done.
  8778.  
  8779. Exercises left for the reader: print the resulting array in reverse order,
  8780. or sort it (numerically, lexically), or convert it to upper case and OUTPUT
  8781. each line to a remote host, etc etc.
  8782.  
  8783. Other methods for initialization were considered.  Most natural would be
  8784. something like this:
  8785.  
  8786.   DCL &A[6] = null, foo, bar, baz, oofa, hello, goodbye
  8787.  
  8788. Unfortunately, the length of the initialization list is limited by the size
  8789. of Kermit's command buffer -- something we cannot keep expanding indefinitely!
  8790. Other methods (like READ and DATA statements as found in BASIC) are just too
  8791. complicated, and C-Kermit is too big already.
  8792.  
  8793. Coding for arrays involved:
  8794.  
  8795. 1. Parse DECLARE command.  ckuusr.c.
  8796. 2. Add new array handling functions to ckuus5.c: arraynam(), arrayval(),
  8797.    dclarray(), chkarray().
  8798. 3. Add array references to parsing of DEFINE, ASSIGN, READ, ASK, ASKQ,
  8799.    INCREMENT, DECREMENT, IF DEFINFED.  ckuusr.c. 
  8800. 4. Add array member definition to addmac() and deletion to delmac().  ckuus5.c.
  8801. 5. Add array reference expansion to xxstring().  ckuus4.c.
  8802. 6. Clean up & remove extraneous code in a lot of places.
  8803.  
  8804. OTHER CHANGES IN 5A(133)
  8805.  
  8806. In ttpkt() and ttres(), set tvtflg = 0 after successful changing of tty
  8807. mode bits so that subsequent calls to ttvt() will take effect!  (Thanks,
  8808. Kristoffer.)
  8809.  
  8810. Change #ifdef XENIX, #undef NGROUPS_MAX, #endif to #ifdef M_UNIX in ckutio.c
  8811. (Warren Tucker).
  8812.  
  8813. A while back I changed all index() calls to strchr() calls because some ATT
  8814. systems did not have index().  Now it seems that some BSD systems don't have
  8815. strchr().  To get around this without a pile of #ifdefs, I added a function
  8816. xindex() to ckufio.c, and windex() to ckuus5.c.  These two are identical, and
  8817. both do what index() -- a.k.a. strchr() -- does.
  8818.  
  8819. Removed the code that was added to ckutio.c:ttres() in edit 130 that would
  8820. have tried to do an ioctl() instead of stty() in BSD implementations if
  8821. TCSETAW was defined.  Wrong kind of struct (sgttyb vs termio).  (Thanks,
  8822. Kristoffer!)
  8823.  
  8824. Kristoffer's myread() code now seems to be pretty stable, so it has been
  8825. inserted into ckutio.c, and the external #include file ckumyr.c is retired.
  8826. makefile updated too.
  8827.  
  8828. ------------------------------
  8829.  
  8830. 5A(132) Tue Apr  3 18:23:46 1990
  8831.  
  8832. It turns out that some C compilers absolutely refuse to allow long constants
  8833. in case expressions.  So, once again, I changed ttsspd().  Now, you pass the
  8834. desired speed to it in characters per second rather than bits per second, so
  8835. that even 38400 is expressible in a 16-bit int.  Converted all calls to ttsspd
  8836. to pass cps instead of bps.  ckutio.c, ckuus*.c.  Note: it is not possible to
  8837. put the UNIX speed symbols (B75, B2400, B9600, etc) directly in the ckuus3.c
  8838. spdtab[] keyword table because this table is also used in VMS, OS/2, Amiga,
  8839. etc, which probably don't have these symbols defined.
  8840.  
  8841. In ckuus3.c, rearranged speed keyword table to be alphabetical so that ESC
  8842. recognition and abbreviation work correctly in all cases.  This makes the "?"
  8843. menu a little bit confusing, but that's how the command package works.  Also I
  8844. added 75/1200 to the list of permissible speeds, to support split-speed modems
  8845. still used in Britain, Scandinavia, and Europe.  However, the supporting code
  8846. in ckutio.c:ttsspd() only works for BSD (stty/gtty) implementations, not for
  8847. AT&T.  AT&T UNIX does not allow split speeds.
  8848.  
  8849. Finished porting the program to AIX/370 on an IBM mainframe.  Aside from
  8850. numerous lint-like changes required to keep the Metaware High C R2.1n compiler
  8851. from complaining, the major hurdle was that the loader could not find _ftime
  8852. and was trying to use the wrong dir.h material.  This was fixed by adding
  8853. "$LIBS = -lbsd" to the make entry to request the "BSD compatibility library",
  8854. libbsd.a.  The result was tested from a PC running MS-DOS Kermit 3.01, rsh'd
  8855. through a SUN to the IBM mainframe using even parity.  Up- and downloaded a
  8856. 100K file using 2K packets.  Worked just fine, file dates set correctly, etc.
  8857. REMOTE commands work, telnet (SET HOST) works.
  8858.  
  8859. Fixed SET LINE code to restore all defaults (tty name, local/remote mode,
  8860. speed) upon failure.  ckuus3.c.
  8861.  
  8862. Filled in the chktok() function in ckucmd.c.  Previously, it didn't do
  8863. anything.
  8864.  
  8865. Added an optional third argument to \findex(), namely starting position in
  8866. the target string, where 1 (beginning of the string) is the default.  So now:
  8867.  
  8868.   def \%a abcxxxabcyyy
  8869.   \findex(abc,\%a)                              returns 1
  8870.   \findex(abc,\%a,1)                            returns 1
  8871.   \findex(abc,\%a,2)                            returns 7
  8872.   \findex(abc,\%a,\feval(\findex(abc,\%a)+1))   returns 7
  8873.  
  8874. Also made sure that \findex() returns 0 in all cases of error, or where the
  8875. search string can't be found in the target string.
  8876.  
  8877. CLS command reconsidered.  It seems like it is a bad idea to include this.
  8878. The implementation is highly system-dependent, and it opens the door to a
  8879. demand for more generalized screen control, which should not be done in the
  8880. way the CLS was done.  In BSD we can do system("clear") (pretty high
  8881. overhead!).  In AT&T System V (but not earlier) we can do system("tput
  8882. clear"), but not in System III.  In non-UNIX systems it's going to be even
  8883. more different.  So if we really want to achieve screen clearing without
  8884. another 20K of ifdef's in ckufio.c, we'll just have to require the user to
  8885. define a macro.  For example, for the VT100:
  8886.  
  8887.   define cls write screen \27[H\27[J
  8888.  
  8889. or for OS/2 (assuming it's like DOS):
  8890.  
  8891.   define cls run cls
  8892.  
  8893. For UNIX in general, a Kermit macro can be defined to read the termcap entry,
  8894. find the clear-screen sequence, and echo it.  Here is such a macro, which uses
  8895. many of the recently added features (especially the new \findex()):
  8896.  
  8897. def cls ass \%t \$(TERMCAP),-
  8898.  ass \%x \findex(:cl=,\%t),-
  8899.  incr \%x 4,-
  8900.  ass \%y \findex(:,\%t,\%x),-
  8901.  decr \%y \%x,-
  8902.  ass \%t \fsubstr(\%t,\%x,\%y),-
  8903.  def \%u,-
  8904.  def \%x 1,-
  8905. :strip,-
  8906.  ass \%c \fsubstr(\%t,\%x,1),-
  8907.  if not def \%c return,-
  8908.  if < \find(\%c,0123456789) 1 goto loop,-
  8909.  incr \%x,-
  8910.  goto strip,-
  8911. :loop,-
  8912.  ass \%c \fsub(\%t,\%x,1),-
  8913.  if not eq \%c \\ goto next,-
  8914.  incr \%x,-
  8915.  ass \%c \fsubstr(\%t,\%x,1),-
  8916.  if eq \%c E def \%c \27,-
  8917. :next,-
  8918.  ass \%u \%u\%c,-
  8919.  incr \%x,-
  8920.  if not > \%x \flen(\%t) goto loop,-
  8921.  write scr \%u,-
  8922.  define cls echo \%u
  8923.  
  8924. This looks pretty awful, but it shows that with patience, you can program just
  8925. about anything in C-Kermit macros!  Unfortunately, it's impossible to put
  8926. commentary in a macro definition, so it's doubly hard to follow what is going
  8927. on.  Briefly, we get the TERMCAP environment variable, find the part between
  8928. ":cl=" and the next ":", which is the clear-screen definition, strip the
  8929. leading digits from it (which denote padding), and translate the remainder
  8930. into a string suitable for Kermit's ECHO command (in this case just converting
  8931. \E (escape) into \27).
  8932.  
  8933. Notice the use of ASSIGN vs DEFINE.  When a variable is being redefined in
  8934. terms of itself (that it, its name appears in both the left-hand and
  8935. right-hand side of the definition) you must use ASSIGN or else you'll get a
  8936. circular definition.
  8937.  
  8938. So now the CLS command is removed, and the CLRCMD definition is removed from
  8939. ckufio.c.
  8940.  
  8941. ------------------------------
  8942.  
  8943. 5A(131) Mon Apr  2 13:27:05 1990
  8944.  
  8945. Removed function chkspd() (check speed) from ckuus3.c, and replaced all calls
  8946. to it by calls to ttsspd().  These two functions had become redundant.
  8947. ttsspd() continues to actually set the speed, but now it also updates the
  8948. tttvt and ttraw structures with the new speed.  Added missing speeds (like 50,
  8949. 75, 200) to the tables of legal speeds.  Needed special handling for 75, since
  8950. it is the only rate that's not a multiple of ten.
  8951.  
  8952. Removed test from ckuus3.c that forbids the use of "set file collision append".
  8953. Tested the result locally and it seems to work, but I don't understand how
  8954. this old code snuck back into the working version after it was removed before!
  8955.  
  8956. Changed code for READ command to allow for the text-file line termination
  8957. conventions of different operating system via the symbol NLCHAR as defined in
  8958. ckcdeb.h, more or less the same way that the encode() function does when
  8959. sending files.
  8960.  
  8961. Changed SET FILE COLLISION REPLACE to SET FILE COLLISION OVERWRITE at John
  8962. Chandler's suggestion.  The new name for this option is more explicit about
  8963. what it does.
  8964.  
  8965. Added variable \v(success), whose value is 0 or 1, depending on current
  8966. SUCCESS value.  ckuus4.c.
  8967.  
  8968. Added variable \v(line), current communication line or network host.  ckuusr.c.
  8969.  
  8970. Removed debugging code associated with \v(input).  Now this variable simply
  8971. expands to the null-terminated contents of the circular INPUT buffer.  Let the
  8972. nulls and wraparounds fall where they may!  Added code to make sure there is
  8973. always a null character at the end of the buffer.  ckuus4.c.
  8974.  
  8975. Made cmpop() return new depth after popping, and make dostop() call cmpop()
  8976. in a loop until parser is back at top level.  ckucmd.c, ckuus5.c.
  8977.  
  8978. Added new function zchkspa(name,bytes) to ckufio.c, and added code to gattr()
  8979. in ckcfn3.c to call it.  The intention is to check available disk space for an
  8980. incoming file whose attribute packet tells its length.  The function returns 0
  8981. if there is not enough space, 1 if there is enough space, and -1 upon any kind
  8982. of error.  The new gattr() code will reject the file if zchkspa() returns 0.
  8983. However, zchkspa() in ckufio.c is, for now at least, a dummy function that
  8984. always returns 1.  Contributions welcome.
  8985.  
  8986. Removed the END command.  The use of this word should be reserved for future
  8987. constructions like BEGIN..END.  Changed the RETURN command to allow its use in
  8988. both TAKE files and macros, but a return value can only be specified in a
  8989. macro (because that's the only construction supported by the \fexecute()
  8990. function).
  8991.  
  8992. Fixed a bug in the READ command.  Previously, it only worked if the backslash
  8993. was left off the variable name.  Now both "READ %A" and "READ \%A" work.
  8994.  
  8995. Added two new IF conditions for string comparisons:
  8996.  
  8997.  IF LGT s1 s2 command -- lexically greater than.
  8998.  IF LLT s1 s2 command -- lexically less than.
  8999.  
  9000. We already had IF EQUAL for lexically equal.  All three of these treat
  9001. alphabetic case according to SET INPUT CASE { IGNORE, OBSERVE }, with the
  9002. default action being to ignore case.
  9003.  
  9004. Added changes to the makefile, pluse ckufio.c and ckutio.c, to support the two
  9005. varieties of RTU 4.x (which apparently have ndir.h in two different places).
  9006.  
  9007. ------------------------------
  9008.  
  9009. 5A(130) Fri Mar 30 02:13:12 1990
  9010.  
  9011. Another new feature: The ability to read and write to local files with Kermit
  9012. commands.  Here are the new commands:
  9013.  
  9014. OPEN { READ, WRITE, APPEND } filename
  9015.   Opens the named file in the given mode.
  9016.  
  9017. READ variable
  9018.   Reads the next line from the OPEN READ file into the named variable.
  9019.   If a line is read successfully, SUCCESS is set.  Otherwise (like upon end 
  9020.   of file), FAILURE is set.  Once you have the line stored in a variable,
  9021.   you can do anything you like to it using Kermit's string functions.  One
  9022.   useful application would be to have a file of phone numbers that you want
  9023.   to call.
  9024.  
  9025. WRITE FILE text
  9026.   It was already possible to write to the various logs using this command.
  9027.   WRITE FILE now lets you write the given text into the OPEN WRITE or OPEN
  9028.   APPEND file.
  9029.  
  9030. CLOSE { READ, WRITE }
  9031.   The READ and WRITE options were added to the CLOSE command.
  9032.   If you get an end of file while READing, the READ file is closed
  9033.   automatically, but it does no harm to close it after it is already closed.
  9034.  
  9035. A READ and a WRITE file may be open at the same time, but not WRITE and
  9036. APPEND, which is just a special kind of WRITE.  Here's an example of READ and
  9037. WRITE, which copies the input file, uppercasing it and adding line numbers:
  9038.  
  9039.   set take error off             ; So EOF doesn't bomb out the file.
  9040.   open read foo                  ; Open input file "foo".
  9041.   open write bar                 ; Open output file "bar".
  9042.   def \%c 0                      ; Make a line counter.
  9043.   :loop                          ; Loop to read all lines.
  9044.   read %a                        ; Read one line into variable \%a.
  9045.   if fail goto done              ; Catch EOF this way.
  9046.   increment \%c                  ; Count the line.
  9047.   write file \%c. \fupp(\%a)\10  ; Format the text and write it out.
  9048.   goto loop                      ; Go back and get more.
  9049.   :done
  9050.   close read                     ; Finished,
  9051.   close write                    ; close the files.
  9052.   echo end of file               ; Print a message.
  9053.  
  9054. The READ command required the addition of a new function to ckufio.c: zsinl(),
  9055. which calls upon zchin() to build a line in the caller's space (without adding
  9056. this function, READ would have needed to be called for each character in the
  9057. file!).  Turns out that zchin() had some problems, so these were fixed too.
  9058.  
  9059. Added new functions, \flpad(string,length,char) & \frpad(string,length,char),
  9060. like in SNOBOL, used for printing variable-length data in nicely lined-up
  9061. columns.  Example:
  9062.  
  9063. def \%n 1                      ; print orders of magnitude
  9064. :loop                          ; aligned by decimal point
  9065. echo \flpad(\%n,8).0           ; note that trailing arguments can be omitted
  9066. ass \%n \feval(\%n * 10)       ; next order of magnitude
  9067. if < \flen(\%n) 9 goto loop    ; from one to ten million
  9068.  
  9069. Back to the old "why does it take so long to exit?" topic...  I added code
  9070. to use ioctl(ttyfd, TCSETAW, ...) in ttres() for BSD, but only if TCSETAW is
  9071. defined, otherwise to use the old sleep(1)+stty() method.  Unfortunately,
  9072. this code will probably never be executed because TCSETAW is defined in
  9073. termio.h, which most BSD systems do not have, and which therefore we cannot
  9074. risk putting an #include for in ckutio.c.  Too bad.
  9075.  
  9076. Added some #ifdef's to ckutio.c from John Dunlap to differentiate between
  9077. HP-UX on the 9000 model 500 and the other models (300 and 800).  Apparently
  9078. the 500's don't have <sys/bsdtty.h> or TIOCGPGRP but the others do (???).
  9079. Worked from non-context diffs, so may have done it wrong.
  9080.  
  9081. ------------------------------
  9082.  
  9083. 5A(129) Wed Mar 28 11:16:23 1990
  9084.  
  9085. Because int is a 16-bit quantity in some C implementations, and because speed
  9086. is not allowed to go up to 38400 or higher, which is too big for a 16-bit
  9087. number, changed the speed variable and the ttgspd() function from int to long.
  9088. This required changes all over the program, and has implications for all the
  9089. other versions too: Mac, Amiga, OS/2, etc etc.
  9090.  
  9091. Changed statistics report to use ints and longs rather than floats, because
  9092. some computers might not have floating point support.  ckuus4.c.
  9093.  
  9094. Fixed the problem with commas in functions that have multiple arguments.
  9095. Previously, such a function worked only once.  Now they work all the time.
  9096. ckuus4.c.
  9097.  
  9098. Began to add user-defined functions.  Until now, we had macros which could
  9099. perform arbitrary actions but return no value, variables which return a value
  9100. but do no actions, and built-in functions that do specific actions and return
  9101. a value, but no way for the user to define a valued function that performs
  9102. actions not available in the built-in functions.
  9103.  
  9104. The mechanism chosen for this is the addition of a RETURN statement that can
  9105. be used within a macro.  The RETURN statement is just like END or POP, except
  9106. it also takes an optional argument, which becomes the return value of the
  9107. macro.  The RETURN argument can be any valid Kermit expression: a character,
  9108. a line of text, a complicated function call.
  9109.  
  9110. The RETURN value can be accessed in two ways: (1) via the \fval() function (no
  9111. arguments), which is replaced by the value of the function most recently
  9112. called from the current level, and (2) somewhat more useful (but also more
  9113. cryptic), the \Fexecute() function.  This function takes a macro invocation as
  9114. its argument, and returns the macro's return value, if any.  Thus, \Fexecute
  9115. turns any macro into a callable function.
  9116.  
  9117. With this mechanism, it is possible to write functions to perform most any
  9118. operation.  For example, here is a recursive function, "sum", to add all the
  9119. numbers from 1 to the function's argument (e.g. "sum 6" = 21):
  9120.  
  9121.   def sum if = \%1 1 return 1,-
  9122.     else return \feval(\%1 + \fexecute(sum \feval(\%1 - 1)))
  9123.  
  9124. Recursion is possible because macro arguments and return values are stacked.
  9125. Kermit presently limits the depth of recursion to a rather small number.  You
  9126. can alleviate the typing by using macro definitions:
  9127.  
  9128.   def xx echo \fexec(sum \%1)
  9129.  
  9130. Now to see the sum of all the numbers from 1 to 5, just type "xx 5".  Also
  9131. notice that you don't have to spell out the whole name of the function.
  9132.  
  9133. Here's another example, handy for asking yes/no questions and
  9134. parsing the user's responses (which can be Y, N, y, n, Yes, No, YES, NO,
  9135. OK, etc), and keeps asking them till they give a valid response:
  9136.  
  9137.   def yesno :loop, ask \%a \%1\63,-
  9138.     if not def \%a goto loop,-
  9139.     ass \%a \flower(\%a),-
  9140.     if equal \%a ok return YES,-
  9141.     if equal y \fsubstr(\%a,1,1) return YES,-
  9142.     if equal \fsubstr(\%a,1,1) n return NO,-
  9143.     echo Please answer Yes or No, goto loop
  9144.  
  9145. This one could be invoked within an IF statement, like this:
  9146.  
  9147.   if equal YES \fexec(yesno {Want to play}) goto play
  9148.   echo So serious!
  9149.   stop
  9150.  
  9151. [ *** This note entered much later (Sept 90):
  9152.   No it can't!  The parser breaks on the first space in the function
  9153.   call.  You have to do this:
  9154.  
  9155.   if equal YES \fexec(yesno {Want to play}) goto play
  9156.   echo So serious!
  9157.   stop
  9158. *** (end of this note) ]
  9159.  
  9160. A macro function definition itself can contain any Kermit commands, but only
  9161. "non-action" commands will actually be executed when the macro is invoked
  9162. inside the \Fexec() function (the action commands are SEND, RECEIVE, CONNECT,
  9163. SERVER, GET, REMOTE, FINISH, BYE, MAIL, etc -- anything that invokes Kermit
  9164. protocol; these commands are ignored) (maybe later this restriction will be
  9165. lifted).  If the executed macro fails or does not include a RETURN statement,
  9166. then the \fexec() function is replaced by the null string.
  9167.  
  9168. Addition of \fexec() required that the command package become reentrant, since
  9169. it will normally be in the middle of parsing one command when called upon to
  9170. parse a whole series of other commands via \fexe(), and then must return to
  9171. where it left off in the original command, and this process can be nested.
  9172. Reentrancy was achieved in the cheapest possible way: two new functions were
  9173. added, cmpush() and cmpop(), which simply save and restore all of the command
  9174. package's global variables and buffers in memory which is malloc'd and free'd.
  9175.  
  9176. ------------------------------
  9177.  
  9178. 5A(128) Tue Mar 27 10:00:10 1990
  9179.  
  9180. Fix DNIX entries in the makefil (again).
  9181.  
  9182. Moved file renaming code from ckcfns.c to a new function in ckufio.c:
  9183. zrename(old,new).  There is no portable way to rename a file.  The zrename()
  9184. function will have to be added to all ck*fio.c modules.
  9185.  
  9186. Added the RENAME command.  This simply changes the name of an existing file
  9187. (not a file group).  Creation date and other attributes are not changed.
  9188. ckuusr.c.
  9189.  
  9190. Added code to CONNECT command to output SO and SI if user types an 8-bit
  9191. character while transmitting in the 7-bit environment.  This code is within
  9192. #ifdef SOSI conditionals, and presently not enabled.  Untested.
  9193.  
  9194. Made a tiny but important change to ttpkt() in ckutio.c for BSD versions of
  9195. UNIX (stty/gtty).  Previously, Kermit always used rawmode for packets.  Now,
  9196. rawmode is used only if parity is NONE.  This allows Xon/Xoff flow control to
  9197. actually work, but only if the user asks for parity (which also means she also
  9198. gets 8th-bit quoting).  I don't know if Xon/Xoff ever did work for AT&T
  9199. versions.  If not, the AT&T section of ttpkt() needs a similar change.
  9200.  
  9201. Fixed INPUT command.  Took hours to track down the problem.  It was that we
  9202. forgot to change the variable that is returned by ttinc() in the timed
  9203. myread() case from ch to n.
  9204.  
  9205. Replaced all references to index() by strchr().  HP-UX and maybe some other
  9206. systems do not have index() defined.  Index is just a synonym for strchr().
  9207.  
  9208. Changed RS definition in ckcasc.h to XRS, because RS is used for something else
  9209. in HP-UX.  RS is not used in Kermit anyway.
  9210.  
  9211. Added "extern errno;" to ckucmd.c.  Some pure BSD systems require this because
  9212. this statement is not in <errno.h>.  Having it twice doesn't hurt anything.
  9213.  
  9214. Fixed references to HZ in msleep() for Tandy 16/6000.
  9215.  
  9216. Made default carrier state be "auto", rather than "on".  Defined symbols for
  9217. carrier states in ckcdeb.h, and replace numeric references to them throughout
  9218. the program by the new symbols.
  9219.  
  9220. Fixed zoutdump() to define the variable x correctly before using it as its
  9221. return code!  ckufio.c.
  9222.  
  9223. Added \Frepeat(string,number) function.  Handy for writing banners, etc,
  9224. as in "echo +\Frepeat(-+,39)".
  9225.  
  9226. Commas that separate function arguments were interfering with the expansion of
  9227. macros, because the commas were converted to CRs.  Changed it so that commas
  9228. within parens are accepted literally.  So now you can give commands like
  9229. "echo \fmod(\%a,\fmax(\%b,3))".  Also fixed SHOW MACROS to ignore commas
  9230. within parens.
  9231.  
  9232. ------------------------------
  9233.  
  9234. 5A(127) Mon Mar 26 10:24:17 1990
  9235.  
  9236. Put #ifdef NETCONN around new '-j' material.
  9237.  
  9238. Added window size, packet length, transmission speed to Ctrl-A status report.
  9239. Added transmission speed to STATUS efficiency report.
  9240.  
  9241. Added built-in functions.  These are of the form \Fname(args).  The F may be
  9242. upper or lower case.  The name may be abbreviated (it's a keyword).  The
  9243. args are strings, numbers, variables, or anything else that Kermit can
  9244. evaluate.  The function is replaced by its value.  If it fails, the value is
  9245. is null (the empty string).  The functions are:
  9246.  
  9247. String functions that return a string:
  9248.  \Fliteral(arg1)    - Copies its argument literally, without any evaluation.
  9249.  \Fsubstr(arg1,arg2,arg3) - Substring of arg1 starting at arg2, length arg3.
  9250.  \Flower(arg1)      - Converts arg1 to lowercase.
  9251.  \Fupper(arg1)      - Converts arg1 to uppercase.
  9252.  \Freverse(arg1)    - Reverses the string argument.
  9253.  
  9254. String functions that return a number:
  9255.  \Flength(arg1)     - Returns the length of the string arg1.
  9256.  \Findex(arg1,arg2) - Returns the position of string arg2 in string arg1.
  9257.  
  9258. Integer arithmetic functions:
  9259.  \Fmax(arg1,arg2)   - Returns the maximum of its two numeric arguments.
  9260.  \Fmin(arg1,arg2)   - Returns the minimum of its two numeric arguments.
  9261.  \Fmod(arg1,arg2)   - Returns numeric modulus of arg1 and arg2.
  9262.  \Feval(arg1)       - Evaluates the enclosed arithmetic expression.
  9263.  
  9264. The latter two categories return a decimal numeric string, or else the null
  9265. string if they are given bad arguments or if they fail in any other way.  The
  9266. arguments are also numeric decimal strings, like "123", "-234", "+345".  They
  9267. cannot be backslash codes like \7 or \x7f unless the backslash codes evaluate
  9268. to ASCII digits.  For example \Feval(\o61 + \d49) is legal and returns "3".
  9269.  
  9270. \Feval was adapted from a short program written by Howie Kaye of CUCCA.  It
  9271. only adds about 4K to Kermit (as compiled on the SUN).  \Feval supports the
  9272. following operators:
  9273.  
  9274.   Operator  Fix   Precedence   Operation          Example
  9275.  
  9276.    (   )              1         Group             ( \%a + 3 ) * (\%1-5)
  9277.      !      Post      2         Factorial         \%x! - (\%x-2)!
  9278.  
  9279.      ~      Pre       3         Logical NOT       ~\%n
  9280.      -      Pre       3         Negative          -\%n
  9281.  
  9282.      ^      In        4         Raise to power    2^\%p
  9283.  
  9284.      *      In        5         Multiply          \%c * 5
  9285.      /      In        5         Divide            \%c / 5
  9286.      %      In        5         Modulus           \%c % 5
  9287.      &      In        5         Logical AND       \%c & 5
  9288.  
  9289.      +      In        6         Add               \%t + \%u
  9290.      -      In        6         Subtract          27 - \%x
  9291.      |      In        6         Logical OR        \%z | 4
  9292.      #      In        6         Exclusive OR      \%z # 4
  9293.      @      In        6         Greatest Common   \%z @ 30
  9294.                                 Divisor
  9295.  
  9296. The operands of the expression can be numeric strings or variables, or
  9297. functions that evaluate to numeric strings.  The precedence is the normal,
  9298. intuitive algebraic (or programming) precedence, and can be altered by the
  9299. use of parentheses, which have higher precedence than any other operator.
  9300. Spaces may be used to separate operators from operands, but they are not
  9301. required.
  9302.  
  9303. ------------------------------
  9304.  
  9305. 5A(126) Sun Mar 25 13:11:22 1990
  9306.  
  9307. Add makefile entry for DIAB DNIX 5.3 (like sys5r3hdb, but without -i).
  9308. Various other changes to the makefile.
  9309.  
  9310. From Kristoffer: support in ckutio.c for SET CARRIER { AUTO, OFF, ON }.
  9311. Works only for System V, does nothing in BSD.  ON means require carrier during
  9312. CONNECT (but not during DIAL), OFF means ignore carrier at all times, AUTO
  9313. means choose ON or OFF automatically depending on whether the line has modem
  9314. control.  On Xenix, this command must be given before SET LINE, but on other
  9315. System V systems it also seems to work after SET LINE.  Added support for this
  9316. in ckuus3.c (SET) and ckuus4.c (SHOW).
  9317.  
  9318. Fix STATISTICS command to show efficiency as a floating point number instead
  9319. of truncating it to a multiple of 10 percent.
  9320.  
  9321. Fix SET PROMPT to strip enclosing doublequotes, as in SET PROMPT "HP=Kermit> ".
  9322. This lets you add trailing spaces to the prompt.
  9323.  
  9324. Allow speed 38400 to be specified.  Use at your own risk!
  9325.  
  9326. Replaced myread() and friends with a new version from Kristoffer.  Also
  9327. applied many edits to ckutio.c, sent in by Kristoffer several days ago.
  9328.  
  9329. Added support for HST Courier modem to ckudia.c, from Tye McQueen at the USU
  9330. Math Dept.  Untested.  ckudia.c.
  9331.  
  9332. Added setuid support, also from Tye McQueen, to ckufio.c so that files are
  9333. opened under user's real uid, in case the program is running setuid to uucp or
  9334. some other uid.  This code has been included within #ifdef SETUID conditionals
  9335. and is untested, not even compiled.  See ckuker.bwr for additional comments.
  9336.  
  9337. Added another contribution from Tye: an option to the SHELL ("!") command to
  9338. pipe its output to the remote system, invoked like this: "!>command", rather
  9339. than simply "!command".  Works if you have previously SET LINE.
  9340.  
  9341. Tye sent in lots of other changes too, but I think most of them are covered
  9342. already by contributions from Kristoffer, Bo, and Warren.
  9343.  
  9344. Changed ckutio.c to always put permission of lockfile at 444.  Nobody knew of
  9345. any reason why it should be 644.  Let's see who hollers.
  9346.  
  9347. Changed ckutio.c to call offgetty for the ATT7300 BEFORE it opens the device,
  9348. rather than after, as JRD suggested in msg of 14 Mar 90.  Also added code to
  9349. put getty back on the line in case the open() fails.  I have no idea if this
  9350. will make the UNIX PC work again.  Joe?
  9351.  
  9352. Added code to tthang() to hang up a network connection.  Previously, hangup
  9353. was a no-op for network connections.  ckutio.c.
  9354.  
  9355. Banged on sliding windows a bit.  Found one case where they would consistently
  9356. fail, namely when the receive packet-length is adjusted downwards if the
  9357. window slots are increased.  It wasn't being adjusted far enough, so the
  9358. receiver was asking for more characters than it could store in its buffers.
  9359. This is now fixed.
  9360.  
  9361. In response to a complaint from Kristoffer that C-Kermit once core-dumped in
  9362. nack() because of a reference to r_pkt[j] when j was badly out of range, put a
  9363. test in getsbuf() to catch when it is called with an invalid argument.  Found
  9364. several other cases where a bad array or structure index could be used on the
  9365. packet data structures, including the bit in nack() where a bad index was used
  9366. to access the packet structure retry count.  Hopefully, all of these are fixed.
  9367. ckufn[23].c.
  9368.  
  9369. Further investigation showed that C-Kermit, when told to change its window
  9370. size or its receive packet length, would sometimes calculate a new receive
  9371. packet length that was longer than its receive packet buffer, which would
  9372. cause horrible protocol failures.  Made this calculation more conservative,
  9373. and now the problem seems to have gone away.  ckuus3.c, ckcfns.c.
  9374.  
  9375. Started up a multi-file multi-megabyte sliding-window/long-packet transfer
  9376. with debug log on to see how long it would go before it failed.  Failure
  9377. occurred at 3/4 megabyte.  Found and fixed the cause: if C-Kermit got a
  9378. timeout waiting for the ACK to the last packet of a file, it would attempt to
  9379. resend all unACK'd packets.  But at this point, there is a slot allocated
  9380. for the Z packet, but the Z packet is not formed yet.  The attempt to transmit
  9381. this unformed packet caused the problem.  This is now fixed, I hope.  ckcfn2.c
  9382.  
  9383. More work with sliding windows.  Found several other sources of error.  For
  9384. example, if a NAK is received for a packet that hasn't been sent yet, Kermit
  9385. would give up.  Now it just ignores the NAK.  Several others too hard to
  9386. explain.  All fixed.  Transferred several megabytes successfully with 4 window
  9387. slots, packet length 746.
  9388.  
  9389. Commented out the code in ckuus3.c that prompts the user for a password when
  9390. she types REMOTE CD dirname.  The only computer that ever required a password
  9391. for changing directories was the DEC-20, and they're practically all gone now.
  9392. Add -DDIRPWDRP to your makefile entry if you want this behavior restored.
  9393.  
  9394. Added -j to command line options to request a network host (like SET HOST).
  9395.  
  9396. Changed zgtdir() to declare a static buffer in the Sys V case, to prevent Sys V
  9397. getcwd() from malloc'ing more memory each time it is called, and never freeing
  9398. it (Bo Kullmar, Warren Tucker).  ckufio.c.
  9399.  
  9400. ------------------------------
  9401.  
  9402. 5A(125) Fri Mar 23 19:39:41 1990
  9403.  
  9404. Tried to compile C-Kermit under the IBM AIX/370 v50 prerelease on an IBM 370
  9405. mainframe using "make bsd".  The AIX compiler (MetaWare High C), picked up a
  9406. lot of lint, which I fixed.  Found that AIX/370 is a lot like NeXT or SUNOS4
  9407. -- BSD, but with signal() type void rather than int, but also with getuid()
  9408. having a different type (unsigned long) than most other Unixes, and something
  9409. to do with dir.h and struct direct vs struct dirent.  Made a new makefile
  9410. entry, aix370.  Not finished, to be continued when/if AIX comes up again.
  9411.  
  9412. Changed ttsspd() to actually set the speed of the terminal device, provided
  9413. the speed is legal, and the device is not the controlling terminal.  Changed
  9414. ttgspd() to actually read the speed of the terminal device.  It looks like now
  9415. we can actually rely on knowing the transmission speed, at least in UNIX.
  9416. This business still needs a little cleaning up because the speed is still set
  9417. (redundantly but, I think, harmlessly) in some other places, like ttpkt() and
  9418. ttvt().  ckutio.c.
  9419.  
  9420. Added code to SET RECEIVE PACKET-LENGTH to adjust the receive timeout based on
  9421. the packet length and the (now known) transmission speed, and to issue a
  9422. message.  This alleviates the problem with insufficient timeout interval when
  9423. using very long packets.  ckuus3.c.
  9424.  
  9425. Discovered that MS-DOS Kermit 3.01 has a bug in which it sometimes sends
  9426. badly formed generic server commands.  For example, REMOTE SPACE and REMOTE
  9427. HELP send "^A# G,", i.e. a generic command without a command field.  C-Kermit
  9428. never expected this to happen and became terribly confused.  Added a couple
  9429. lines of defensive code to ckcpro.w to handle this case, and it now recovers
  9430. nicely.
  9431.  
  9432. Improved handling of errors in TAKE files and macros.  SET TAKE ERROR ON is
  9433. the default, meaning that TAKE files should be terminated upon any kind of
  9434. error.  Previously this occurred only upon parse errors.  Now it happens
  9435. whenever a command sets SUCCESS to zero.  Same deal for SET MACRO ERROR ON.
  9436. ckuus5.c.
  9437.  
  9438. Added changes to ckutio.c to better support background operation, from Tor
  9439. Lillqvist in Finland.  In his words: "At least on HP-UX, doing a TCSETAW
  9440. ioctl() when in background causes a SIGTTOU signal.  I put a test in concb()
  9441. to check if we are in a TAKE file.  I added testing for background operation
  9442. for HP-UX in the same manner as for BSD.  Additionally, IMHO, if we are
  9443. running under a job control shell, there is no need to ignore signals, as we
  9444. will not get them when we are not in the terminal's active process group."  I
  9445. moved Tor's take-file test out of concb, because ckutio.c must not depend on
  9446. external variables.  Also from Tor, in ckucmd.c: "If you suspend an
  9447. interactive Kermit, when you fg it again, getchar() returns -1 with errno ==
  9448. EINTR.  I check for this in gtword()".  I put this code under #ifdef EINTR
  9449. for portability.
  9450.  
  9451. ------------------------------
  9452.  
  9453. 5A(124) Wed Mar 14 22:29:55 1990
  9454.  
  9455. Edit 124 is confined to the addition of one new command:
  9456.  
  9457.   SET FILE COLLISION { APPEND, BACKUP, DISCARD, RENAME, REPLACE, UPDATE }
  9458.  
  9459. Nothing else was touched.  SET FILE COLLISION tells what to do if a file
  9460. arrives with the same name as an existing file.  See Christine Gianone's
  9461. specification in Info-Kermit V11 #1.
  9462.  
  9463. Step 1: Parse the command, add info to SHOW FILE.
  9464.  
  9465. Step 2: Implemented REPLACE, RENAME, and BACKUP (easy).  REPLACE is the same
  9466. as WARNING OFF, RENAME is the same as WARNING ON.  BACKUP (rename the existing
  9467. file, rather than the incoming file) required a change to ckcpro.w, to allow
  9468. for the case where rcvfil() fails to rename (haven't figured out how to
  9469. actually make this happen).  Used link() and unlink() library calls to do the
  9470. renaming, rather than the newer rename() call, which is not portable (some
  9471. systems don't have it, some systems reverse the order of the arguments).
  9472. Assume link() and unlink() are available in all C environments.  Coordinated
  9473. SET FILE WARNING and SET FILE COLLISION to take each other into account.
  9474.  
  9475. Step 3: Made BACKUP be the default collision action.  No more accidentally
  9476. destroyed files.  It's just like having DEC-20 or VAX/VMS generation numbers.
  9477.  
  9478. Step 4: Implemented DISCARD.  This one means: don't accept the incoming file
  9479. and don't touch the existing file.  This is very handy for resuming
  9480. interrupted wildcard transfers - only accept the ones that don't exist yet.
  9481. Seems to work fine in both the attribute and non-attribute cases.  But it
  9482. needs to be tested by sending files to it from a computer that does not
  9483. implement the file interruption mechanism (X in ACK to D packet).  For the
  9484. latter case, additional code was added to ckcpro.w to receive and acknowledge
  9485. the packets, but to not open, write to, or close the file.  If anyone tests
  9486. this and finds problems, let me know.  I also considered just replacing the
  9487. real filename by /dev/null, but then I would have to add system-dependent
  9488. names for the null device for each kind of system that C-Kermit supports, and
  9489. I have no idea how to do this for Macintosh, Data General, etc.
  9490.  
  9491. Step 5: Implemented APPEND.  This required definition of a new file
  9492. information structure which is set up in opena() and passed through openo() to
  9493. zopeno().  Kermits like VAX/VMS that want to use this information will have to
  9494. add this structure (as well as the attribute structure) to zopeno().  (The
  9495. filinfo structure contains all the VMS-like file attributes: type,
  9496. organization, blocksize, record length, etc, as well as disposition - new,
  9497. old, append.)  zopeno() should now be called with 4 arguments, and if you
  9498. don't have attribute and file info structures to call it with, then use NULL,
  9499. as in zopeno(n,name,NULL,NULL).  If you're working on ck?fio.c (where ? != u),
  9500. make sure that any internal references to these structures first check to make
  9501. sure the structure pointer is not NULL, otherwise, core dump city.
  9502.  
  9503. The APPEND option should be used with caution: appending a text file to a
  9504. binary file or vice versa, appending anything to an executable program image,
  9505. etc, could ruin things.  But it's also handy for accumulating data in log
  9506. files.
  9507.  
  9508. There is now yet another new header file: ckcfil.h.  This contains the symbols
  9509. for values of the file-related variables (organization, carriage control,
  9510. disposition, etc).  Updated the makefile dependencies, etc.
  9511.  
  9512. Step 6. SET FILE COLLISION UPDATE.  This turned out to be a lot easier than
  9513. I expected, thanks to code Bo Kullmar contributed for setting the file date
  9514. from the attribute packet.  I simply made a minor modification to this
  9515. function, zstime(), adding a third argument which is a function code.  If 0,
  9516. it sets the file's creation date (as now).  If 1, it compares the creation
  9517. date of the given file with the one in the attribute packet, and returns the
  9518. result of the comparison as the value of the function.  The function is called
  9519. in this new way from gattr() in ckcfn3.c.  Preliminary tests show it to work
  9520. just fine, even if the sender does not get an attribute refusal (because then
  9521. the file interruption mechanism kicks in).  The date comparison for UNIX is
  9522. done by simply comparing the two internal date formats (time_t data items)
  9523. arithmetically.  This works properly on the SUN in the BSD environment, but
  9524. needs testing elsewhere.
  9525.  
  9526. ------------------------------
  9527.  
  9528. 5A(123) Mon Mar 12 13:55:21 1990
  9529.  
  9530. The news from Sweden is good, the various pointer referencing/dereferencing
  9531. foulups are fixed.  In ckutio.c, removed a redundant second copy of the
  9532. "close( open() ) magic" in ttopen(), which was causing problems, and added
  9533. parity stripping to ttxin(), which apparently was lost in the previous
  9534. activity.
  9535.  
  9536. Added fixes from Jay Rouman at U of Michigan for Tandy/TRS16/16000 Xenix 3.0.
  9537.  
  9538. Added fixes to the makefile for SCO/UNIX 3.2 from Warren Tucker.
  9539.  
  9540. Generalized the network support structure, so that whoever adds in ATT streams
  9541. or DECnet support will have an easier time -- the commands are already there,
  9542. and a new header file, ckunet.h, was added to make the network type symbols
  9543. available to all modules.
  9544.  
  9545. Made SET BLOCK use cmnum() instead of cmkey().
  9546.  
  9547. Added CLS command (clear screen), for use in interactive scripts.
  9548.  
  9549. Added SET DEBUG SESSION to display control characters graphically.  Also, on
  9550. telnet connections, to display telnet negotiation characters rather than act
  9551. on them.  Works like in MS-DOS Kermit: A = A, ^A = Ctrl-A, ~A = A with 8th bit
  9552. set, ~^A = Ctrl-A with 8th bit set.  Screen output is one long line, so we
  9553. must rely on the terminal to wrap (this can be fixed later).  This display
  9554. can, of course, be ambiguous (e.g. is ^^ Ctrl-^ or is it two ^'s in a row?).
  9555. Later maybe we can make some use of termcap to use various kinds of
  9556. highlighting.
  9557.  
  9558. Experimented with telnet some more, still can't figure out why connections to
  9559. the IBM mainframe don't work right.  I don't see the ECHO negotiation...  How
  9560. does UNIX telnet know it's supposed to echo?  Logging its negotiations didn't
  9561. show anything about the Telnet ECHO option.  Added WONT ECHO to initial
  9562. options sent by netopen().  Added lots of debug log information in doopt() in
  9563. ckucon.c, but it doesn't help.  Maybe echo setting occurs in the telnet
  9564. subnegotiations, but the log doesn't reveal any subnegotiations!  Also,
  9565. another problem with telnetting to IBM mainframes: blank lines (e.g. when you
  9566. type two carriage returns in a row) are not sent at all.  You have to type a
  9567. space first, then carriage return.  If you do this, and also SET DUPLEX HALF
  9568. before telnetting to an IBM mainframe, it'll work pretty much OK.
  9569.  
  9570. Added { SET, REMOTE SET } ATTRIBUTES to control all the individual attributes
  9571. that C-Kermit supports, as in [ REMOTE ] SET ATTRIBUTE DATE OFF.  See
  9572. Christine Gianone's article in Info-Kermit V11 #1 for a description.  Did not
  9573. make separate cases for IN and OUT (this is compatible with MS-DOS Kermit),
  9574. even though the variables are set up that way internally.  Also added SHOW
  9575. ATTRIBUTES.  Also added server end of REMOTE SET ATTRIBUTES.  Also added code
  9576. to MAIL and REMOTE PRINT commands to give a parse error if the DISPOSITION
  9577. attribute (or all attributes) are set to OFF...  A lot of harmless busy-work.
  9578. Did some testing with packet log on, and it seems to work right; more testing
  9579. needed.  REMOTE SET ATTRIBUTES is not implemented very well; since the IN /
  9580. OUT cases are not separated, the "IN" case is chosen.  Worry about this later.
  9581.  
  9582. ------------------------------
  9583.  
  9584. 5A(122) Sun Mar 11 12:00:22 1990
  9585.  
  9586. In Sweden, the compilers were upset by "if (*f)" in the ckucmd.c functions,
  9587. where they are checking to see if they were called with a pointer to a
  9588. preprocessing function.  Changing this to "if (f)" seems to fix it.
  9589.  
  9590. Fixed GOTO label parser to not allow space or dot after :, nor to allow a
  9591. label that consists only of a colon.  The dot is reserved for future use
  9592. (internal labels for use with FOR/WHILE loops, etc).
  9593.  
  9594. Add fancy file system support via new parameters to SET FILE and REMOTE
  9595. SET FILE commands:
  9596.  
  9597. Command                                                  Variable
  9598.    ORGANIZATION { INDEXED, RELATIVE, SEQUENTIAL }         forg
  9599.    FORMAT { FIXED, RCW, STREAM, UNDEFINED, VARIABLE }     frecfm
  9600.    CARRIAGE-CONTROL { FORTRAN, NEWLINE, MACHINE, NONE }   fcctrl
  9601.    BLOCKSIZE number                                       fblksiz
  9602.    RECORD-LENGTH number                                   frecl
  9603.  
  9604. 1. Symbols defined in ckuusr.h.
  9605. 2. Global variables declared to ckuusr.c and extern'd in ckuus*.c where needed.
  9606. 3. Keyword tables and parse routines added to ckuus3.c.
  9607. 4. Display added to shoparf() in ckuus4.c (screen space is getting tight!).
  9608. 5. Added handling of blocksize when reading or sending attribute packets.
  9609.    Unfortunately, the attribute mechanism does not really allow for any of
  9610.    the other file parameters.  The Kermit protocol will have to be extended
  9611.    before we can do this.  ckcfn3.c.
  9612. 6. Added server end of REMOTE SET for the new file variables in ckcfns.c.
  9613.    Had to define new codes for some of them on the fly!
  9614.  
  9615. So now the file parameter information can get into and out of the program.
  9616. I'll leave it to Mark Buda to actually make use of it in the VMS version.  In
  9617. UNIX, none if it does anything.  Later, all the code and commands for these
  9618. things will be ifdef'd for VMS only, so as not to clog up memory on UNIX
  9619. needlessly, or throw UNIX users into a panic.
  9620.  
  9621. Also, added SET NETWORK { DECNET, TCP }.  For now, it just sets a variable,
  9622. nettype, and if you say DECNET, it won't let you SET HOST or CONNECT.  Mark
  9623. can fill in the DECNET support for VMS if he wants to, and maybe somebody else
  9624. could fill in DECNET support for Ultrix (I wonder if it uses the sockets
  9625. interface...).
  9626.  
  9627. More help from Sweden.  Turns out that an innocent-looking debug() statement
  9628. in xxstring() was causing core dumps.  Don't know why, but I removed it and
  9629. the core dumps went away.
  9630.  
  9631. Various people complained that CBREAK was undefined when compiling on an
  9632. AT&T-based system.  My fault, I put a reference to it in a bad place in
  9633. ckutio.c.  Removed, fixed, apologies.
  9634.  
  9635. Added SET CARRIER { ON, OFF } command.  The intention is to tell Kermit
  9636. whether to pay attention to carrier.  Default should be ON, as it behaves
  9637. presently.  If OFF, Kermit should not refuse to communicate in the absence of
  9638. a carrier signal on the SET LINE device (CLOCAL mode in Sys V, not sure how to
  9639. do this in BSD).  For now this command does nothing.
  9640.  
  9641. Removed side effects of SET LANGUAGE (i.e. the setting of file and transfer
  9642. character sets).  Too confusing.
  9643.  
  9644. Added SET and SHOW TRANSMIT commands.  SET TRANSMIT FILL allows a fill
  9645. character to be specified for empty lines, LINEFEED says send linefeeds too,
  9646. PROMPT specifies the host turnaround character to wait for.  Problem: if file
  9647. type is TEXT, but last line of file does not end with linefeed, then last line
  9648. is not sent.  Fix later.
  9649.  
  9650. Added optional numeric operand to INCREMENT and DECREMENT, so now you can
  9651. add or subtract any number (not just 1) to/from any variable.  The operand
  9652. can be positive or negative, e.g. INC \%a, DEC \%a 100, INC \%a -33.
  9653.  
  9654. Added two new variables, "xitsta" (exit status, initially zero) and "what"
  9655. (what I was doing).  The latter can be SENDing (1), RECEIVING or GETTING (2),
  9656. or REMOTEing (4).  If any of these fails, the "what" that failed is OR'd into
  9657. the exit status, except for VAX/VMS which has its own wierd set of program
  9658. exit status codes.  So now UNIX Kermit exits with 0 if all protocol operations
  9659. worked, 1 if one or more SENDs failed, 2 if one or more RECEIVEs or GETs
  9660. failed, and 4 if one or more REMOTE commands failed, and if more than one kind
  9661. of command failed, their what's are OR'd together (is this English?), just
  9662. like in MS-DOS Kermit.  For VMS, if any of the failure bits are set in xitsta,
  9663. Kermit exits with BAD_EXIT.  Mark B. can figure out what to do about the
  9664. message and other fields that go into the VMS return code.
  9665.  
  9666. Spent the rest of the evening moving the code to a NeXT, an Encore, a
  9667. VAX/Ultrix system, and a VAX/VMS system, and compiling it on each one, and
  9668. removing minor compilation problems at each step.  Updated CKVKER.COM to
  9669. compile all the new modules that have appeared since 4E.  Meanwhile, another
  9670. report of core dumps arrived from Bo Kullmar in Sweden, who is compiling the
  9671. program on an AT&T System V system.  Thanks to his digging, it turned out the
  9672. culprit was (once again) xxstring() in ckuus4.c.  Constructions like *(*s2)++
  9673. and (*n)-- seemed to be causing memory faults on his system.
  9674.  
  9675. I finally managed to make the program compile and link on the SUN using the
  9676. /usr/5bin version of cc (the problem was that /usr/5include/ctype.h has some
  9677. very strange definitions for tolower() and toupper() -- see new makefile entry
  9678. for sunos4s5) and was then able to reproduce Bo's core dumps, but only in this
  9679. environment, not in any of the others.  Tentative diagnosis: the System V C
  9680. compiler must be generating different code for these references.  So I rewrote
  9681. xxstring() not to write to variables through pointers, and could no longer get
  9682. the core dumps.  I can't imagine why this would make a difference, and only
  9683. time will tell if it really does...
  9684.  
  9685. ------------------------------
  9686.  
  9687. 5A(121) Sat Mar 10 12:02:23 1990
  9688.  
  9689. Changes to ttres() in ckutio.c.  Restore separate stty() and ioctl() for
  9690. AT&T and BSD, respectively.  Also, in BSD versions there is a sleep(1) before
  9691. restoring the file descriptor to its old modes to allow pending i/o to finish
  9692. first, otherwise the stty() could cut it off.  What is really needed here is
  9693. an fflush() to force out all pending output, but fflush() wants a file
  9694. pointer, and we have a file descriptor.  For SUNOS4 only, which is what I have
  9695. here to work with, changed the sleep(1) to fflush(&_iob[ttyfd]).  If
  9696. everybody's stdio.h uses the same structure and names for file pointers, then
  9697. this will work elsewhere too.  If so, it can speed up exit from Kermit
  9698. noticeably.
  9699.  
  9700. In ckucon.c (CONNECT command), pause() if coninc() returns -1 to prevent
  9701. endless loop when Kermit run from cron jobs and gets EOF on stdin.  This
  9702. should do no narm, as there was already another pause() elsewhere in this
  9703. function.
  9704.  
  9705. Began adding in Kristoffer Eriksson's recent changes.  First, remove the
  9706. business about errno 9999 from the CONNECT command.  According to Kristoffer,
  9707. ttinc() now should return -1 only upon a real error, in which case the CONNECT
  9708. session should be terminated.  In other words, ttinc() should now always
  9709. behave like a blocking read().
  9710.  
  9711. Next, a new ttchk() which takes myread() buffers into account, and which uses
  9712. the rdchk() system call on systems where it is available: currently, only
  9713. known to be available on Xenix/286 and Xenix/386, so a new symbol RDCHK is
  9714. defined in the makefile for them and used in ttchk().
  9715.  
  9716. Next, in ttinc(), in the untimed-read case for network connections, return -1
  9717. immediately if an error is encountered.
  9718.  
  9719. Next, extensive changes to ttopen().  Probably still far from done, but at
  9720. least I hope this brings local code in sync with Kristoffer.  Sent him the
  9721. changes so far.  Now, hands off system-dependent code for a while.
  9722.  
  9723. Fixed REMOTE SET BLOCK-CHECK.
  9724.  
  9725. Change xxstring to take a length argument, and all calls to it to pass a
  9726. length argument.  Since it's recursive, we have to pass the address of a
  9727. common int that each incarnation of xxstring can update.  If the evaluated
  9728. string has reached the end of the expansion buffer, xxstring returns -1.
  9729. Seems to work.  ckucmd.c functions changed to return -2 whenever xxstring
  9730. returns -1, so user gets the usual parse error message (?Invalid).  Not
  9731. terribly informative, but better than a core dump.
  9732.  
  9733. Add new doopt() function to ckucon.c, within #ifdef NETCONN conditionals, to
  9734. read and process telnet negotiation options, so that they don't appear on the
  9735. screen as curly braces and similar noise-like characters.  This might cause
  9736. problems if the user has set host to a service other than telnet, but this is
  9737. an undocumented feature, and other services probably don't use telnet IACs
  9738. anyway.  Also, add telnet protocol to send BREAK to ckutio.c ttsndb().
  9739. Tested, it works.
  9740.  
  9741. The doopt() function makes a minimal attempt to read and reply to telnet
  9742. negotiation options from the host.  In particular, it tries to set the duplex
  9743. flag according to the host's WILL/WONT ECHO command.  However, in the one
  9744. place where we really need this to work, it doesn't seem to: telnetting to an
  9745. IBM mainframe.  For some reason, some (not all!) of the IACs come across with
  9746. their 8th bit lopped off, so the WONT ECHO command is not recognized at all
  9747. (see fancy "telnet" entries in debug.log).  Oh well, it's better than it was
  9748. before.
  9749.  
  9750. Fix SHOW MACROS to (a) change comma into comma-dash-newline, and (b) give
  9751. a "more?" prompt after each screenful.  Might also need to give this treatment
  9752. to some other SHOW commands.
  9753.  
  9754. Added WRITE command: WRITE { DEBUGGING, PACKET, SESSION, TRANSACTION } string
  9755. Different from MS-DOS Kermit's version: no extra keywords (like DATE,
  9756. DIRECTORY, etc) are required because you can imbed \V(xxx) variables in the
  9757. string.  Like in MS-DOS Kermit, WRITE does not add a newline at the end.
  9758.  
  9759. ------------------------------
  9760.  
  9761. 5A(120) Thu Mar  8 22:22:41 1990
  9762.  
  9763. Fix parsing of TRANSLATE command.  It was core dumping, thanks to a typo.
  9764. Also, change function cmofi() in ckucmd.c to not object to opening the
  9765. job's controlling terminal as an output file (just skip the check for write
  9766. permission if the filename is equal to CTTNAM as defined in ckcdeb.h).
  9767.  
  9768. Found and fixed a missing closing comment delimiter in ckcxla.c, which was
  9769. causing Latin-1 to ASCII translations to come out as total garbage.
  9770.  
  9771. Add to xxstring() the ability to expand environment variables.  Syntax:
  9772. \$(name), e.g. \$(TERM), \$(HOME), etc.  This was done in ckuus4.c using
  9773. getenv().  I'm assuming that any C compiler that builds a C-Kermit that uses
  9774. the ckuu*.* modules will have a getenv() function (it's even in the C book).
  9775. If not, it can be conditionally compiled, or even moved to ck*fio.c.  Should
  9776. also actually produce results for VMS, OS/2, and DOS, as well as UNIX.
  9777.  
  9778. Added builtin named variables.  Syntax is \V(name), where 'name' is one of:
  9779. argc, count, date, directory, time, version.  The name is case independent,
  9780. and can be abbreviated like other keywords: \V(ARGC), \v(argc), \v(Cou), etc.
  9781. The contents of the parens are taken literally and not further expanded.  For
  9782. example, you can't "define \%a count" and then "echo \v(\%a)".  The \V()'s are
  9783. read-only variables, expanded by xxstring().  Their values can, of course, be
  9784. assigned to ordinary read/write variables.  Later, it might be worth expanding
  9785. this capability to many more of Kermit's built-in variables, like block check
  9786. type, receive packet length, parity, speed, etc.
  9787.  
  9788. ------------------------------
  9789.  
  9790. 5A(119) Fri Mar  2 13:35:34 1990
  9791.  
  9792. Discovered that having command-parsing functions run xxstring ruined macro
  9793. argument grouping via braces, because xxstring was stripping enclosing
  9794. brackets from its argument.  Removed the code from xxstring that does this.
  9795. There's no reason to do it anyway, except that MS-DOS Kermit does (compare
  9796. "echo {oofa}").
  9797.  
  9798. Changed variable rules to allow \%0...\%9 to be global variables when no
  9799. macros are active.  Within macros, each macro level still has its private set
  9800. of \%0..\%9 arguments on the stack, so the only difference is these variable
  9801. names are now available at top level too (in interactive commands or take
  9802. files).
  9803.  
  9804. In ckutio.c, changed congm() (get console tty modes) to open CTTNAM (typically
  9805. "/dev/tty") and get its modes, rather than using file descriptor 0.  This
  9806. should solve the problems with restoring improper tty modes after running with
  9807. standard i/o redirected.  Suggested by Frank Prindle.
  9808.  
  9809. Put changes into ckufio.c and ckutio.c from Warren Tucker for SCO UNIX 3.2,
  9810. and added an entry to the makefile.
  9811.  
  9812. Other minor cleanups to ckutio.c.
  9813.  
  9814. NOTE: I did NOT get around to doing anything with Kristoffer's ckutio code,
  9815. myread(), etc.  It is still in place as originally sent.  In particular, no
  9816. changes were made to the business about how errors and communications
  9817. disconnect are returned to the conect() function (terminal emulator).
  9818.  
  9819. ------------------------------
  9820.  
  9821. 5A(118) Thu Mar  1 18:51:47 1990
  9822.  
  9823. Changed the rules a bit for backslash codes: \\ now becomes one backslash
  9824. rather than remaining two.  This allows for constructions like the following,
  9825. in which variable names can be constructed on the fly, as in the following
  9826. macro that displays its arguments (a poor person's substitute for arrays or a
  9827. shell-style FOR loop):
  9828.  
  9829.   def xx set count argc,def %c 0,-
  9830.   :loop,-
  9831.   increment %c,-
  9832.   assign %a \\%\%c,-
  9833.   echo \\%\%c = "\%a",-
  9834.   if count goto loop
  9835.  
  9836. The use of backslash to quote special characters, introduce variable names,
  9837. command line continuation, etc, is pretty inconvenient for OS/2 or DOS users,
  9838. where backslash is a directory separator.  So I changed all references to
  9839. backslash as a quote character from literal '\\' to the symbol CMDQ, which is
  9840. defined in ckcdeb.h.  So the OS/2 version can have a different quote character
  9841. like, for instance, accent grave or circumflex (but not ampersand, percent,
  9842. star, question mark, atsign, pound sign, brace, etc., which all have other
  9843. uses already, or may soon).  It would also be possible to introduce a runtime
  9844. command like SET COMMAND-QUOTE to let the user specify it herself, but this
  9845. could easily lead to inconsistent and unportable Kermit command files.  The
  9846. best solution to this problem might be to change calls to cmofi() and cmifi()
  9847. from the OS/2 version to use an expansion function other than xxstring() --
  9848. this way backslashes can be used for quoting everywhere but in filenames.
  9849.  
  9850. Discovered that Ctrl-R redisplay gets in trouble from the quoting mechanism.
  9851. Example: Type a\^Bc (where ^B is the character Ctrl-B).  This echoes as a\c
  9852. but is stored in the buffer as a^Bc, so when you redispay the buffer by typing
  9853. Ctrl-R, all you see is ac, even though there are 3 characters there.  So when
  9854. you delete backwards, you get an inaccurate display of what was deleted.  Of
  9855. course, typing Ctrl-R again gives you a corrected picture.
  9856.  
  9857. Added command synonyms for MS-DOS Kermit compatibility: PUSH and RUN are
  9858. synonyms for ! (shell escape), REPLAY = TYPE, POP = END.
  9859.  
  9860. Fix command parser not to show the top-level token table when "?" typed and
  9861. user has already typed some characters.  Removed % from the token table as a
  9862. comment introducer, because this conflicts with variable names.  We still have
  9863. ! = shell escape, # and ; as comment introducers, & = echo, and : to introduce
  9864. a label.
  9865.  
  9866. Added the DISABLE and ENABLE commands for the server, plus SHOW SERVER to
  9867. display their status, along with the current SERVER TIMEOUT.  Moved the SHOW
  9868. command to ckuus5.c, to trim ckuusr.c a little more.
  9869.  
  9870. Added REMOTE SET command.  Support was already in the server, this is the
  9871. client end.  Rather than have a whole new tree of commands and keywords,
  9872. used the doprm() function for this, and added a second parameter to the
  9873. dorprm() call, 0 = SET, 1 = REMOTE SET.  Some of the commands seem to work,
  9874. some don't (REMOTE SET BLOCK-CHECK apparently doesn't, and there is some kind
  9875. of protocol foulup after using it, see ~/packet.log).  More testing & fixing
  9876. needed.
  9877.  
  9878. ------------------------------
  9879.  
  9880. 5A(117) Wed Feb 28 23:57:10 1990
  9881.  
  9882. Change OUTPUT command to work in both remote and local mode.  Move OUTPUT
  9883. command code from ckuusr.c to ckuus5.c (ckuusr.c weight reduction program).
  9884. Add code to OUTPUT command to accept \b or \B in the output string to send a
  9885. BREAK.
  9886.  
  9887. Change ttopen() to also clear the CBREAK bit in the ttold structure if
  9888. standard i/o is redirected.  Kermit has no way of obtaining the real tty mode
  9889. bits when stdio is redirected because the shell changed them before it started
  9890. Kermit, and apparently does not restore them when Kermit exits.  This solution
  9891. is inadequate.  Another possibility might be to not manipulate the tty bits at
  9892. all if stdio redirected, on the assumption that raw unprocessed characters are
  9893. used in that case anyway???  Might have to make separate cases for standard
  9894. input and output.  Worry about this later.
  9895.  
  9896. Frank Prindle noticed that 'kermit -k' is VERY SLOW on a loaded system (I
  9897. didn't notice because my system isn't).  There is a 'setbuf(stdout,NULL)' in
  9898. concb() to make writes to the console be unbuffered, so that the interactive
  9899. command parser will work right and dots will show up promptly during
  9900. local-mode file transfer.  But this turns file-transfer writes to stdout into
  9901. single-character write()'s, which cause the process to be dismissed, in the
  9902. worst case, after every character on a loaded system.  Several solutions are
  9903. possible; Frank suggested changing the fwrite() in ckufio.c: zoutdump() to
  9904. fflush() followed by write().  He reports that this makes 'kermit -k' FIVE
  9905. TIMES faster on his loaded system, and that Kermit's CPU time (as reported by
  9906. lastcomm) went down by the same factor.  No difference seen on the local
  9907. (unloaded) SUN-4 between either the old and new strategy, or writing to a file
  9908. vs stdout, but when transferring files over a telnet ("set host") connection,
  9909. the improvement was about fourfold -- nearly 200,000 bps (fastest Kermit file
  9910. transfer yet!  not as fast as ftp, but ftp doesn't have to do per-character
  9911. quoting, etc).
  9912.  
  9913. Still some lingering problems in this area.  Can't seem to make things like:
  9914.  
  9915.   kermit -k < cmdfile > outfile
  9916.  
  9917. work, where cmdfile contains commands to set modem, speed, dial out, etc.
  9918. This just hangs my job.  Worry about this another day.
  9919.  
  9920. FINALLY... started work on the command parser.  The new strategy is to pass
  9921. a function pointer to each cm???() call, or else NULL.  If a function is
  9922. given, then the cm???() call will use that function to expand the atom buffer
  9923. before evaluating it.  In Kermit's case, it will expand variables and
  9924. translate backslash escapes.
  9925.  
  9926. Rewrote xxstring() and xxesc().  xxstring() is now a simple recursive
  9927. function, which is part of the Kermit application.  xxesc() was moved to the
  9928. command parser, so that backslash escapes are now an integral part of command
  9929. parsing, rather than something peculiar to the Kermit application.
  9930.  
  9931. Converted cmnum() to work like this:
  9932.  1. try to parse a string of decimal digits.
  9933.  2. if that fails, try to parse a backslash escape.
  9934.  3. if that fails, call the user-provided conversion function, if any.
  9935.  4. try again to parse a string of decimal digits.
  9936.  
  9937. The user-provided function is, of course, xxstring, which expands variables
  9938. via recursive descent.  So now once the cmnum() calls in the whole program are
  9939. converted, then users can type not only a decimal number, but also \nnn,
  9940. \Dnnn, \Onnn, or \Xnn, or \%x (variable name) as in MS-DOS Kermit. 
  9941.  
  9942. The specification for the user-provided function is:
  9943.  
  9944.   int fn(s1,&s2);
  9945.  
  9946. where s1 is the source string (to be processed), and &s2 is the address of
  9947. where to put the result, which the function can update in case it wants to
  9948. call itself.  The function must return a negative number on failure and 0 or a
  9949. positive number on success.
  9950.  
  9951. The new cmnum is not completely and totally general.  Here are some things
  9952. that you can and can't do (using SET DELAY as an example):
  9953.  
  9954. These Work:           These Don't:
  9955.   set delay 3          define %a \7
  9956.   define %a 7          set delay \%a
  9957.   set delay \%a        set delay \{\o77}
  9958.   set delay \23        set delay \{5}4
  9959.   set delay \x1f       set delay 4\{5}
  9960.   set delay \o33       set delay 4\5
  9961.   set delay \{42}      define %b 6
  9962.   set delay \{x0f}     set delay \1\%b
  9963.  
  9964. The incompatibility between C-Kermit and MS-DOS Kermit (the latter permits
  9965. some, but not all of the right-hand forms) is because the C-Kermit command
  9966. parser (ckucmd.c) must be kept independent of the Kermit application and
  9967. command set, so that it can be used for other applications.  Variables, macro
  9968. arguments, etc, are set and controlled by the Kermit application.
  9969.  
  9970. The particular difficulty with with cmnum is that xxesc (the backslash escape
  9971. sequence interpreter, which is part of the command package) cannot call the
  9972. variable expander (xxstring) because it's part of the Kermit application.  
  9973. The difficulty is compounded by the fact that a backslash escape is converted
  9974. to an int in the range 0-255, whereas xxstring builds a character string.  If
  9975. xxstring were the only one to process cmnum's input, then it would be
  9976. impossible to tell if it were returning an int (stored in a character string)
  9977. or a numeric character string.  For example, would a byte of value 48 be the
  9978. integer 48, or the numeric character '0'? 
  9979.  
  9980. The remaining command parsing functions were converted with much less trouble:
  9981.  . cmofi() (parse an output file -- now you can say "log debug \%a" etc.
  9982.  . cmifi() (input file -- works fine, but ESC and ? are a bit of a surprise)
  9983.  . cmdir() (directory, no problem)
  9984.  . cmfld() (arbitrary field, ok)
  9985.  . cmtxt() (line of text, ok) 
  9986.  . cmkey() (keyword...)
  9987.  
  9988. cmkey() also works, for example you can do:
  9989.  
  9990.   C-Kermit>def %a set
  9991.   C-Kermit>def %b block
  9992.   C-Kermit>def %c 3
  9993.   C-Kermit>\%a \%b \%c
  9994.  
  9995. but as with cmifi(), ESC and ? behave differently that in MS-DOS Kermit.  The
  9996. C-Kermit command parser leaves the characters that you type on the screen,
  9997. whereas the MS-DOS parser actually rewrites them out from under you.  C-Kermit
  9998. does not necessarily have this control (e.g. you might be running it on a
  9999. hardcopy terminal).  So in C-Kermit if you have the definitions above and
  10000. type:
  10001.  
  10002.   \%a \%b<ESC>
  10003.  
  10004. you will see
  10005.  
  10006.   \%a \%b-check
  10007.  
  10008. rather than
  10009.  
  10010.   set block-check
  10011.  
  10012. Not a big deal, I think, since very few people will use variables
  10013. interactively this way.
  10014.  
  10015. The other major difference is that you can't define a variable to stand for
  10016. more than one word in a command.  For example, you can't do this (as you can
  10017. in MS-DOS Kermit):
  10018.  
  10019.   define \%e echo this is pretty neat
  10020.  
  10021. and then give \%e as a command.  Only the first word ("echo" in this case) is
  10022. executed.  But this is not a big deal either, because that's what macros are
  10023. for.
  10024.  
  10025. After designing, coding, and testing the various cm*() functions, I went
  10026. through all the cku*.c modules and changed every invocation of each of these
  10027. functions to include either xxstring as a variable expander, or else NULL when
  10028. variable expansion was not desired, for example in the command:
  10029.  
  10030.   define %a echo foo
  10031.  
  10032. the variable name "%a" should NOT be expanded.
  10033.  
  10034. Obviously these fundamental change in the user interface will need a lot of
  10035. testing and refining.
  10036.  
  10037. Finally, fix a couple problems pointed out by Frank Prindle: (1) the use of
  10038. the symbol O_NDELAY needed to be conditionalized on its existence in ckutio.c
  10039. (4.1BSD doesn't have it), and (2) a malloc() was removed from the setatm()
  10040. function in ckucmd.c last week, without the corresponding free() also being
  10041. removed!
  10042.  
  10043. ------------------------------
  10044.  
  10045. 5A(116) Mon Feb 26 11:28:45 1990
  10046.  
  10047. Change ttopen() in ckutio.c to use stdin (ttyfd = 0) if not local AND if
  10048. standard i/o is not redirected, so that UNIX idle-time monitors won't think
  10049. that Kermit is idle while it is transferring files over the job's controlling
  10050. terminal.  To accomplish this, ckutio sets a flag "fdflag" if (!isatty(0) ||
  10051. !isatty(1)).  Then, if ttopen() determines that Kermit is in remote mode, it
  10052. substitutes file descriptor 0 for the one obtained by open() but only if
  10053. fdflag == 0.  Suggested in a different form by Frank Prindle,
  10054. <prindle@NADC.ARPA>.
  10055.  
  10056. Discovered that there's something wrong with sending from stdin, as in 'kermit
  10057. -s -'.  If there's no .kermrc file, everything works fine.  If there is a
  10058. .kermrc file, something in ckucmd.c sends several hundred beeps, then sends an
  10059. empty file.  Discovered this is because of the code that checks for keyboard
  10060. interruption during take-file execution.  Changed this code to not read from
  10061. the "keyboard" if !isatty(0).  Everything seems to work now, except:
  10062.  
  10063. 'kermit -k | command' works, but leaves the terminal in no-echo mode after it
  10064. exits.  Spent many hours tracking this down.  Finally realized it was because
  10065. gtty(ttyfd,&ttold) (or in Sys V ioctl(ttyfd,TCGETA,&ttold)) sees the ECHO bit
  10066. turned off when standard output is redirected, and so upon exit restoring the
  10067. tty mode bits gotten in this way turns off the echo bit.  So ttopen now tests
  10068. isatty(0) and isatty(1) to see if stdio is redirected, and if so, it ORs in
  10069. the ECHO bit.
  10070.  
  10071. So now, 5A works as it should when sending from standard input or receiving to
  10072. standard output, and restores the terminal properly upon exit.  It also can
  10073. read its commands from redirected stdin, as in 'kermit < commandfile'.  AND,
  10074. unlike previously, file descriptor 0 is used in remote mode for file transfers
  10075. except when stdio is redirected, so now UNIX idle-line monitors won't be
  10076. fooled into thinking that file transfer == inactivity.  Whew!
  10077.  
  10078. And now on to the INPUT command.  It wasn't really interruptible from the
  10079. keyboard after all.  Changed the entire strategy.  Now, instead of having the
  10080. input command within a timer, INPUT calls the character input functions with
  10081. 1-second timers that add up to the total input timeout.  This allows the
  10082. program to sample the keyboard every second so the user can interrupt the
  10083. INPUT.  An interrupted INPUT fails, as it should.  Also I noticed and fixed
  10084. two other related problems.  The INPUT search string, after case conversion,
  10085. was not properly terminated, and the OUTPUT command was not working at all
  10086. because it was outputting the wrong character from its string (the old ++
  10087. mistake).
  10088.  
  10089. Moved this version to the NeXT and compiled it.  The NeXT compiler found an
  10090. unterminated string constant in ckudia.c, within #ifdef's that it shouldn't
  10091. even have been looking at the contents of.  Wow, what a compiler.
  10092.  
  10093. Added the MAIL and REMOTE PRINT commands.  The receiving end was already
  10094. present.  Now C-Kermit can mail or print to itself.  Both commands take either
  10095. a single file or multiple files.  The client end just uses the SEND code,
  10096. but sets special flags so that the right stuff is put into the Attribute
  10097. packet.  Also added code to make sure that an A-packet isn't sent that is
  10098. longer than the receiver's declared buffer size.  But this whole business
  10099. needs to be generalized to allow long attribute data to be split up into
  10100. multiple A packets.
  10101.  
  10102. ------------------------------
  10103.  
  10104. 5A(115) Sun Feb 25 22:15:19 1990
  10105.  
  10106. Add ASKQ (ask quietly, don't echo what user types) command.
  10107.  
  10108. Let WAIT parse material after timeout, but still don't do anything with it.
  10109.  
  10110. Let WAIT and PAUSE be interrupted from keyboard.  BSD, any keystroke; AT&T,
  10111. Ctrl-\.  Gobble up whatever characters were typed so that upon return to
  10112. command prompt, extraneous characters are not left in command buffer (needs
  10113. testing on Sys V).  Set SUCCESS if PAUSE or WAIT completes its time, set
  10114. FAILURE if interrupted from keyboard.  For now, WAIT always fails, since it
  10115. cannot sense the modem signals.  Make WAIT an invisible keyword.
  10116.  
  10117. Add SHOW STATUS command to show the status (SUCCESS or FAILURE) of the most
  10118. recent command.
  10119.  
  10120. Went through ckuusr.c and had each command set success/failure appropriately.
  10121. All parse errors set success = 0.  Making this work involved changing the
  10122. return codes of many functions that are called from here, particularly
  10123. conect(), login(), ckdial(), transmit(), dotype(), xlate(), etc.  In general,
  10124. it is no longer a good idea for an action routine to return -2 upon failure,
  10125. because that makes it look like a parse error.  From now on, action routines
  10126. should return 0 on failure, 1 on success.  It will probably take some time to
  10127. get this consistent throughout the program.
  10128.  
  10129. There is no explicit setting of success in protocol-related commands.  That is
  10130. done in ckcpro.w.
  10131.  
  10132. JRD reports that new code works great on ATT 7300 -- very fast windowed
  10133. transfers, etc.  BUT...  When dialing out, it gets a "communications
  10134. disconnect" immediately upon ttinc() via myread() not getting any characters.
  10135. In other words, the distinction which used to be made between no chars
  10136. available (as in EWOULDBLOCK) and carrier loss seems not to be working in the
  10137. new code.  Message sent to Kristoffer about this.
  10138.  
  10139. Tested JRD's complaint on SUN4 in Sys V R3 environment.  Connect worked just
  10140. fine, no problem with "communications disconnect" at all.  But EXIT command
  10141. hung forever.  Traced problem to msleep(), which is called from tthang().  My
  10142. guess is that this problem is peculiar to SUNOS4/SysV, so added a special
  10143. symbol -DSUN4S5 to makefile entry, and within msleep() replace fancy system
  10144. calls by a busy loop.  (Tracking this down and fixing it took hours, grrrrr.)
  10145.  
  10146. Changed INPUT command to let it work in remote mode, for testing the timeout
  10147. and string matching code.  Everything seems to be OK, but Chris Armstrong
  10148. reported some problems with INPUT in OS/2.
  10149.  
  10150. Fix protocol bug noticed by JRD: When sending a file, and the receiver 
  10151. requests cancellation by putting 'X' in the ack to the data packet, C-Kermit
  10152. would properly stop sending the file, but would fail to put a 'D' in the data
  10153. field of the Z packet.  This was because the cxseen flag was being reset in
  10154. clsif(), before it could be tested in the protocol module.  Moved clearing of
  10155. this flag to the protocol module, state <seof>Y.  Tested, works, and also
  10156. confirmed that success flag is set correctly.
  10157.  
  10158. File creation date now set for incoming files when they arrive with a date
  10159. attribute, and attributes are not set to OFF.  Changes from Bo Kullmar, Kista,
  10160. Sweden <bk@kullmar.se>.  ckcpro.w, ckcfns.c (in these two, the function reof()
  10161. had the filename added as a new first argument); ckufio.c (new function
  10162. zstime() added).  Tested in in BSD and Sys V environments on the SUN, works
  10163. fine (BSD version needed some changes).
  10164.  
  10165. Added @echo messages to makefile.
  10166.  
  10167. Added VERSION command.
  10168.  
  10169. ------------------------------
  10170.  
  10171. 5A(114) Sat Feb 24 12:51:07 1990
  10172.  
  10173. Fixed UNIX DIRECTORY command, which was changed a while back to use cmdir()
  10174. rather than cmtxt() to allow for tilde expansion.  After this change, it did
  10175. not wait for user to confirm the command before executing it, and it didn't
  10176. copy the resulting string out of the atom buffer before calling cmcfm(), so
  10177. the string would be wiped out if the user typed something like "dir xyz  <cr>"
  10178. instead of "dir xyz<cr>".
  10179.  
  10180. Fixed program to quit properly from current macro or take file if INPUT
  10181. command fails, and input timeout-action is set to QUIT.  Fix program not to
  10182. print a spurious syntax error message if INPUT fails.  Make INPUT and REINPUT
  10183. print a "failed" message only if the failure causes the program to pop to top
  10184. command level.
  10185.  
  10186. Started putting "success =" statements in various parts of the program.  In
  10187. ckcpro.w, added them anywhere that a file transfer concluded.  Put one in
  10188. errpkt() in ckcfn2.c.  This should allow IF SUCCESS/FAILURE to work after
  10189. SEND, RECEIVE, GET, and similar commands.
  10190.  
  10191. Changed the SET SPEED command to complain if the current "line" is a network
  10192. host connection.
  10193.  
  10194. To remove confusion about what symbol gets defined where for ASCII control
  10195. characters (previously some were defined in ckuker.h, others in ckucmd.h),
  10196. I moved all of them into a single file, ckcasc.h, which is included in
  10197. addition to the other include files by all modules that need these symbols.
  10198.  
  10199. Fix an #endif that still had trailing text in ckuus3.c.  Correct the grouping
  10200. of SET TERMINAL commands within/outside #ifdef OS2.  Add OS/2-specific forward
  10201. declaration of zfindfile() in ckuus5.c.  (Chris Armstrong)
  10202.  
  10203. Get rid of compile-time symbol ATT3BX.  Add explicit -DHDBUUCP definitions
  10204. to each entry in the makefile for versions that use Honey-DanBer UUCP lockfile
  10205. conventions.  Now it's easy to add this for others, just include -DHDBUUCP in
  10206. any makefile entry.
  10207.  
  10208. Add bsd210ov entry to makefile, to make Kermit for 2.10 BSD on small PDP-11
  10209. without separate I&D space by using overlays; from Dennis Flaherty.  Probably
  10210. will not work, since many modules have been added or increased in size since
  10211. he sent in this submission (based on version 4F).  This might also help for
  10212. MINIX, if its linker supports overlays.
  10213.  
  10214. In ckufio.c for Masscomp/Concurrent RTU 4.0 or later,
  10215. #include "/usr/lib/ndir.h" rather than <sys/dir.h>.
  10216.  
  10217. In ckutio.c add conditionals for #ifndef is68k (whatever that is) to not
  10218. include sys/file.h or fcntl.h (from Ray Moody <ray@maxwell.physics.purdue.edu).
  10219.  
  10220. Made massive and profound changes to ckutio.c, from Kristoffer Eriksson,
  10221. Peridot Konsult AB, Oerebro, Sweden.  As I had recoded ttinl() for sliding
  10222. windows in 5A(100), it did not work well with System V, because it depended
  10223. upon ttchk() being able to look in the system's input buffer to see if any
  10224. characters were waiting, but System V can't do that without myread(), so it
  10225. wound up always doing single-character read()'s -- very bad for performance.
  10226. Kristoffer, with advice from Warren Tucker, Tridom Corp, Mt Park, GA, on
  10227. BSD/ATT tty driver differences, reinstated myread() as a macro a`la zinchar()
  10228. and made it apply to both AT&T and BSD based systems.  Still in experimental
  10229. form.  Preliminary tests show that the changes work (SYS5R3 is the System V R3
  10230. environment on the SUN under SUNOS 4.x):
  10231.                  SUNOS4    SYS5R3   ATT7300
  10232.   compile                      OK        OK        OK
  10233.   set line  / connect          OK        OK        OK
  10234.   set host  / connect          OK       (no)      (no) <-- (no telnet)
  10235.   send file / window 1         OK        OK        OK
  10236.   send file / window 4         OK        OK        OK
  10237.   rcv file  / window 1         OK        OK        OK
  10238.   rcv file  / window 4         OK        OK        OK
  10239.  
  10240. Also tested the program in the BSD environment with MYREAD defined and
  10241. undefined, works OK.  JRD's tests on ATT7300 in remote mode show a threefold
  10242. (!) speed improvement when myread() is used on a Starlan network (where
  10243. RS-232 is not the bottleneck).
  10244.  
  10245. Added function ttgspd() to ckutio.c to return the speed of the currently
  10246. selected tty line, so that better timeouts could be calculated, and SHOW SPEED
  10247. command in ckuusr.c to call it.  Doesn't work.  In normal remote mode (no SET
  10248. LINE given), always returns -1.  After SET LINE, it returns an actual speed,
  10249. but not the real speed.  Apparently it always returns the line's nominal speed
  10250. from /etc/ttytab.  Even if you SET SPEED to something else, this function
  10251. doesn't notice.  Anybody know the secret of getting the real, actual speed?
  10252. Reminds me of the old PDP-11 DH11 multiplexer in which the line speed was
  10253. stored in a write-only register...  Made SHOW SPEED an invisible command.
  10254.  
  10255. Fixes from Steve Walton <ecphssrw@afws.csun.edu>: Put signal(SIGINT,...)
  10256. calls, which are already within #ifndef OS2 conditionals, also within #ifndef
  10257. AMIGA conditionals.  Fix a bad print statement in ckuus2 (two %s's, only one
  10258. string to print).  Fix blank-line bug in TRANSMIT command.  Fix conflicting
  10259. definitions of string buffers in ckuus3.c.  Change "if (nambuf) ..." in
  10260. ckufio.c zsattr() function to "if (*nambuf) ...".
  10261.  
  10262. Changes to ckudia.c from Peter Mauzey to improve support for AT&T modems.
  10263.  
  10264. Add support for Silicon Graphics System V R3 with BSD file system (IRIS)
  10265. from Robert Adsett, U of Waterloo <semicon@watsci.uwaterloo.ca>.  ckufio.c,
  10266. makefile.
  10267.  
  10268. ------------------------------
  10269.  
  10270. 5A(113) Thu Feb 22 12:00:18 1990
  10271.  
  10272. Increase maximum receive packet size from 1K to 2K.  Use at your own risk!
  10273. Many UNIX systems have small terminal input buffers.  Always use block check
  10274. type 2 or 3 with long packets.
  10275.  
  10276. Add code to spar() and rpar() to automatically increase timeout interval if
  10277. (a) we know the line speed, (b) the connection is not on a network, and (c)
  10278. the product of the speed and the timeout is less than the packet size.  But
  10279. with packet length of 2000 and unknown speed, it's still very easy to have a
  10280. too-short timeout, in which case nary a data packet will ever get through.
  10281.  
  10282. If user types SET SEND or RECEIVE PACKET-LENGTH n, where n > 1000, issue
  10283. warnings about timeout and block check type if they have not already set
  10284. these appropriately, and not in take file, macro, or background.
  10285.  
  10286. Change outer loop in ttinl() to terminate if received packet is longer than
  10287. the receive-buffer length.  And in ttinc(), make sure parity is stripped in
  10288. all cases.  Thanks to Kristoffer Eriksson for both these fixes.
  10289.  
  10290. Also from Kristoffer: several malloc's were done based on strlen() of the
  10291. string for which the space was being allocated, which didn't leave room for
  10292. the trailing null byte.  Fixed these to be like malloc(strlen(x) + 1).
  10293. (This apparently fixes the memory protection violation problems for OS/2!)
  10294.  
  10295. Kristoffer's fixes were based on his experiences building the program on
  10296. SCO Xenix/386, so that's a good sign.
  10297.  
  10298. From Chris Armstrong: Various changes to many modules to accommodate OS/2.
  10299. Mainly switching order of include files (again), addition of SET TERMINAL
  10300. TYPE { VT100, TEK4010 }.
  10301.  
  10302. ------------------------------
  10303.  
  10304. 5A(112) Wed Feb 21 15:54:58 1990
  10305.  
  10306. Today was a day of testing on different systems, with the minor cleanups and
  10307. fixes that were necessary.  Still waiting for the final verdict on OS/2, and
  10308. we haven't even begun to look at this program on Xenix or other PC-based
  10309. UNIXes.
  10310.  
  10311. Tried to build on VAX/Ultrix 2.0.  Found two symbols from netopen() in
  10312. ckutio.c (new network support) undefined.  Added some extra #ifndef's and
  10313. #ifdef's and it compiled and worked just fine, including set host (telnet).
  10314.  
  10315. Tried to build on NeXT, got several pages of compilation errors.  The NeXT C
  10316. compiler is almost as good as lint, and picked up many typos that slipped by
  10317. the SUN and VAX compilers.  In particular, NULL (the null pointer) was used in
  10318. several places where NUL (the null character, i.e.'\0') should have been.
  10319. Also, removed the "-fwriteable-strings" from the NeXT makefile entry (because
  10320. Kermit no longer has the typo that caused it to write into string constants).
  10321. Fixed compilation errors, defined a -DNEXT symbol for the NeXT, and in
  10322. ckcdeb.h typedef'd signal-related things to be void rather than int, like Sys
  10323. V R3.  This made most of the signal-related compiler warnings go away.  Also,
  10324. added a special version herald for NeXT.  Tested in remote and local mode,
  10325. works fine.  Tested with "set host" (telnet) and that works too.
  10326.  
  10327. Built the program on an Encore 510 with Umax 4.3 using "make bsd43".
  10328. Compiled, linked, and ran without a hitch.  Tested briefly in remote mode
  10329. (tty), and with "set host" over Ethernet.  Both worked OK.
  10330.  
  10331. Built it on a SUN-4 using the AT&T System V R3 environment, using "make
  10332. sys5r3".  No problems, except some warnings about compiler switches being
  10333. ignored.  Tested it with sliding windows, and it worked fine.  No telnet
  10334. support in this version.  
  10335.  
  10336. JRD tested it on his AT&T 7300 UNIX PC.  No compiler or linker complaints
  10337. and it ran fine at 9600 bps, but had some problems at 19200.
  10338.  
  10339. ------------------------------
  10340.  
  10341. 5A(111) Tue Feb 20 21:08:46 1990
  10342.  
  10343. Version 5A cannot be built in the OS/2 environment without using certain
  10344. obscure undocumented compiler and linker options.  Even then it seems to crash
  10345. during execution when malloc() is called.  Removed the malloc() call from
  10346. ckucmd.c, so the whole program does not depend on it, at the cost of yet
  10347. another 1/4 KB buffer.  Remaining calls to malloc() are in ckuus4.c (INPUT and
  10348. REINPUT commands) and ckuus5.c (all over the place in anything related to
  10349. macros or variables).  All malloc() calls are checked for failure.  In the
  10350. UNIX version, there are also malloc's in ckutio.c and ckufio.c (but they've
  10351. been there forever).
  10352.  
  10353. Also, for the benefit of OS/2, changed all ck*.c files except cku[tf]io.c
  10354. to #include all system files (#include <file>) before non-system files
  10355. (#include "file"), so that the OS/2 code can #undef puts() and then define a
  10356. new one.
  10357.  
  10358. Next frontier seems to be that there is too much initialized data in the
  10359. program for some C compilers or linkers to cope with, e.g. on PC-based systems
  10360. the initialized data might actually have to fit into a 64K segment (e.g. OS/2
  10361. linker says "DGROUP exceeds 64k").  Not clear yet whether this is per module
  10362. or for the whole program.  Presently there are tons of initialized data in
  10363. ckuusr.c (command tables) and ckcxla.c (character translation tables).
  10364.  
  10365. ------------------------------
  10366.  
  10367. 5A(110) Mon Feb 19 18:51:24 1990
  10368.  
  10369. ckuusr.c has become much too big, causing problems with some C compilers and
  10370. UNIX linkers (e.g. AT&T's on the UNIX PC, Microsoft on OS/2, etc).  Moved
  10371. functions from ckuusr.c to ckuus4 until the latter grew to about the same size
  10372. as ckuus2 and ckuus3 (as reported by "size ck*.o").  Then created ckuus5.c and
  10373. moved everything left in ckuusr.c to it except the major command keyword
  10374. tables and the docmd() function.  Results (as seen on SUN-4):
  10375.  
  10376.         BEFORE           AFTER
  10377.           text   data     text   data
  10378.   ckuusr.c   36816  11464    20880   9576  (smaller)
  10379.   ckuus2.c    4905  15616     4905  15616  (no change)
  10380.   ckuus3.c   16528   4656    16528   4656  (no change)
  10381.   ckuus4.c   14016   3112    19056   4024  (bigger)
  10382.   ckuus5.c       0      0    10944    976  (new, infinitely bigger)
  10383.  
  10384. There still could be some problems here.  First, those who attempt to compile
  10385. and link the new files should add whatever compiler/linker options are
  10386. available to use the 'large', 'huge', or 'humongous' model.  If that doesn't
  10387. help, the next thing to do would be to move some pure code from the modules
  10388. that have large text sizes (like ckuusr.c and ckuus4.c) into those that have
  10389. small text sizes (like ckuus2.c).  The only way to move code out of ckuusr.c
  10390. at this point is to convert in-line code into function calls, and move the
  10391. code into new functions that are defined elsewhere.
  10392.  
  10393. Added support for TCP/IP connections using Berkeley UNIX sockets, from Ken Yap
  10394. at the University of Rochester (ken@cs.rochester.edu).  Changes confined to
  10395. ckutio.c, enclosed within #ifdef NETCONN ... #endif brackets.  New syntax
  10396. allows SET LINE hostname or SET LINE hostname:service, where service can be a
  10397. named service (like smtp) or a socket number (like 119 for nntp).  If the
  10398. service is omitted, it defaults to telnet (23).  Makefile changed to add
  10399. -DNETCONN for some of the BSD variants.  Initial tests between a SUN-4 and
  10400. various VAX, SUN and Encore (UNIX), VAX (VMS), and IBM mainframe (VM/CMS)
  10401. systems show the basic code to be working, but there are several glitches:
  10402.  
  10403.  1. Speed is spuriously reported as 38400, when in fact it's "unknown".
  10404.  2. If user has a symbolic link from an ordinary filename (like "foo") to
  10405.     a terminal device (like "/dev/tty05"), this code will try to open a
  10406.     network connection to host "foo" instead of following the symbolic link.
  10407.  3. A short burst of garbage appears upon initially connecting.  This is the
  10408.     telnet option negotiation, which is ignored.
  10409.  4. Since telnet options (like ECHO) not negotiated, you must use SET commands
  10410.     (like SET DUPLEX) just as you would for ordinary tty-style connections.
  10411.  5. Can't send BREAK.   
  10412.  6. Various problems in telnetting to half-duplex systems like VM/CMS, like
  10413.     "blank lines" are not transmitted (workaround: type SP CR instead of CR).
  10414.  7. Error messages are uninformative.
  10415.  
  10416. File transfer with various kinds of hosts seems to work OK, using all
  10417. defaults, except that IBM mainframe Kermits behave strangely when sending
  10418. files over a telnet connection (they receive files OK).  Initial tests from a
  10419. SUN-4 show effective data rates in the 25-55 Kbps range.  Support for
  10420. AT&T-based TCP/IP implementations must still be added (streams instead of
  10421. sockets).
  10422.  
  10423. Later, change user interface to fix glitches 1 and 2 above.  Add new command,
  10424. SET HOST <hostname>, to prevent misinterpretation of a symbolic link to a tty
  10425. device name as a network host name.  SET HOST with no args is just like SET
  10426. LINE with no args (puts Kermit back to default, normal line & mode).  Changed
  10427. SHOW and CONNECT commands to report network vs tty connection appropriately,
  10428. and to ignore speed setting for network connections.  For future expansion,
  10429. added a command SET NETWORK, so that the SET HOST command could know what kind
  10430. of network connection to open.  For now this command does nothing; eventually
  10431. it can be expanded when support for new networks (like DECnet) is added.
  10432. Note: To avoid adding new things to many files, made a sneaky change: when
  10433. calling ttopen(), set modem type to -1 if it's a network.
  10434.  
  10435. Another note: there is no way (and there *should* be no way) to set Kermit up
  10436. as a network file transfer server.  This opens up too many potential security
  10437. loopholes.
  10438.  
  10439. While I was in the area, added an invisible command SET PORT, which is just
  10440. a synonym for SET LINE (for compatibility with MS-DOS Kermit).
  10441.  
  10442. ------------------------------
  10443.  
  10444. 5A(109) Tue Feb 13 09:56:51 1990
  10445.  
  10446. Make sure all calls to malloc() are checked for error: ckuusr.c, ckuus4.c,
  10447. ckucmd.c.
  10448.  
  10449. Make sure all calls to free() are prechecked to not feed it a null pointer.
  10450. This was causing core dumps on ATT7300.
  10451.  
  10452. Add WAIT command.  For now, it's just a synonym for PAUSE, there only for
  10453. compatibility with MS-DOS Kermit.
  10454.  
  10455. Add EVALUATE command.  Takes its text argument, runs it through xxstring(),
  10456. stuffs it into the command buffer, and then tries to execute it as a Kermit
  10457. command.
  10458.  
  10459. Change scoping rules for GOTO.  Previously, GOTO could only find a label
  10460. in the current TAKE file (if invoked from a take file) or current macro (if
  10461. invoked from a macro).  Now, if it fails to find the given label in the
  10462. current command-source (take file or macro), it pops up to the invoking level
  10463. and looks there, and continues until the first occurrence of the label is
  10464. found, or level 0 (interactive command level) is reached.  So now you can
  10465. define macros that contain GOTOs into the mainline script program code, like
  10466.  
  10467.   define errexit echo Error: \%1, goto foo
  10468.   input 10 Login:
  10469.   if failure errexit {No login prompt}
  10470.   output myid\13
  10471.   input 10 password:
  10472.   if failure errexit {No login prompt}
  10473.   input 10 $\32
  10474.   echo Logged in!  
  10475.    ...
  10476.   :foo
  10477.    ...
  10478.  
  10479. Note: obviously, GOTO does not work in a command file which is directed into
  10480. Kermit's standard input, as in 'kermit < commandfile'.  This could be changed
  10481. to allow forward GOTOs only, but probably not worth it.
  10482.  
  10483. PROBLEM: Variable expansion does not occur everywhere within a macro body
  10484. when the macro is invoked.  For example:
  10485.  
  10486.   define errexit echo Error: \%1, goto \%2
  10487.  
  10488. It's up to the individual commands to expand their arguments.  Right now,
  10489. ECHO does, GOTO doesn't.  So "errexit {bad thing} foo" winds up printing
  10490. "Error: bad thing" and then saying "Can't find label :\%2".  Oops.
  10491.  
  10492. Solutions?  (a) Make GOTO and similar commands expand their args; (b) Make
  10493. macro expander expand variables that occur anywhere in macro definition during
  10494. macro execution; (c) push entire macro definition string through xxstring()
  10495. before execution.  None of these seems right.  (a) would miss a lot (like in
  10496. "define xx set \%1 \%2" -- certainly SET should not call xxstring() on its
  10497. parameter keyword and all arguments???); (b) would ruin certain statements
  10498. within macros (as in "define xx def \%a echo \%1" or "if defined \%1 echo foo")
  10499. and (c) would recursively grind any script into plain ascii characters...
  10500.  
  10501. Add ELSE command.  Effective only immediately after IF.  Tested ok
  10502. interactively, in TAKE file, and in macro execution.  Done as follows: define
  10503. two more variables on the command-level stack: ifcmd[] and iftest[].  They
  10504. have to be on the stack because the argument of an IF command can be a macro
  10505. invocation or a TAKE command.  The ifcmd[] variable counts the number of
  10506. statements that have been encountered since the IF clause.  When this is 1, we
  10507. are executing the THEN part.  If the THEN-part is another IF, it goes back to
  10508. 1.  If the number is 1 or 2, then an ELSE can be parsed successfully, and this
  10509. sets it back to zero.  If it is 0 when an ELSE command is encountered, a parse
  10510. error occurs.  If it is 1 or greater and a non-ELSE, non-COMMENT, non-IF
  10511. command is encountered, it goes back to zero.  Simple, eh?  The iftest[]
  10512. variable carries the result of the IF-condition, so that the program knows
  10513. whether to execute the THEN-part or the ELSE-part, if any.  Formal syntax:
  10514.  
  10515.   IF [NOT] <condition> [ <command> ]
  10516.   ELSE [ <command> ]
  10517.  
  10518. ELSE must be on a separate line, and there is no word THEN.  <command> can be
  10519. any single command, or a macro invocation, or nothing at all.  And of course,
  10520. there need not be an ELSE at all.  You can also have multiple IFs to achieve
  10521. and AND effect:
  10522.  
  10523.   IF [NOT] <condition> IF [NOT] <condition> IF ... [ <command> ]
  10524.   ELSE [ <command> ]
  10525.  
  10526. And you can have cascaded IF-ELSE constructions:
  10527.  
  10528.   :loop
  10529.   ask %a Command\63\32
  10530.   IF eq \%a end end
  10531.   ELSE IF eq \%a stop stop
  10532.   ELSE goto loop
  10533.  
  10534. Since there is no block structure in this language (yet!), we don't have to
  10535. worry about matching ELSEs with IFs.  The ELSE always goes with the
  10536. immediately preceding IF.
  10537.  
  10538. One final syntax note: If an IF statement has a null THEN-part, then the
  10539. next command (ELSE or otherwise) is always executed:
  10540.  
  10541.   IF = 1 2
  10542.   ECHO foo
  10543.  
  10544. This echoes "foo", unlike "IF = 1 2 ECHO foo", which does not (same as MS-DOS
  10545. Kermit).  You can't say "IF = 1 2 ELSE echo foo" (well, you can, but it won't
  10546. do anything).  Also, the ELSE part can be empty:
  10547.  
  10548.   IF = 1 2 echo Impossible!
  10549.   ELSE
  10550.  
  10551. The ELSE command is presently invisible, to discourage use of IF-ELSE until it
  10552. is also supported by MS-DOS Kermit, so that we don't have a crop of C-Kermit
  10553. scripts that can't be easily adapted to MS-DOS Kermit (Chris's concern).
  10554.  
  10555. So finally, the really really formal syntax of the new IF command is (things
  10556. in UPPERCASE are taken literally, things in <brackets> are metasymbols,
  10557. + means 1 or more repetition of, * means zero or more repetitions of, and
  10558. ::= means "is replaced by"):
  10559.  
  10560.   <nl>     ::= newline (linefeed or CR or CRLF)
  10561.   <not>    ::= NOT
  10562.   <cmd>    ::= any C-Kermit command except ELSE, including no command at all
  10563.   <cond>   ::= EXISTS filename | < n1 n2 | = n1 n2 | EQUAL s1 s2 | etc etc
  10564.   <ifpart> ::= IF <not>* <cond>
  10565.   <ifcmd>  ::= <ifpart>+ <cmd> <nl> | <ifcmd> ELSE <cmd> <nl>
  10566.  
  10567. Note the left-recursive definition of <ifcmd>.  Now let's run this thru lex &
  10568. yacc and let them write this program for us!
  10569.  
  10570. ------------------------------
  10571.  
  10572. 5A(108) Mon Feb 12 21:59:24 1990
  10573.  
  10574. When reading commands from a file, convert tabs to spaces.  This is stupid,
  10575. but at least it allows normal use of tabs for aligning comments.  But it
  10576. will also affect ECHO strings, quoted tabs, etc.  Need a smarter approach.
  10577.  
  10578. Add help text for new commands.
  10579.  
  10580. Add SHOW SCRIPTS.
  10581.  
  10582. Allow user to type the single character x or X during TAKE file or macro
  10583. execution to stop and return to C-Kermit prompt level.
  10584.  
  10585. If any character is typed at the keyboard while an INPUT command is active,
  10586. cancel the INPUT command and set the FAILURE code.
  10587.  
  10588. Remove previous change; it doesn't work because it requires an alarm within an
  10589. alarm, which seems to wipe out the overall INPUT timer.  So for now, there's
  10590. no way to manually interrupt an INPUT command (but if it's being executed from
  10591. a macro or TAKE file, use 'X' to cause an interruption immediately after the
  10592. INPUT completes or times out).
  10593.  
  10594. Change chkint() to allow X, Z, etc, to interrupt file transfer, a`la MS-DOS
  10595. Kermit, so users don't have to type control characters for this.
  10596.  
  10597. Add IF EQUAL, string comparison for use with ASK, etc:
  10598.  
  10599.   Syntax: IF EQUAL <word1> <word2> <command>
  10600.  
  10601. where <word1> and <word2> contain no spaces.  They can be plain character
  10602. strings, variable names (but must begin with backslash), or strings containing
  10603. one or more variable names.  Variables within <word1> and <word2> may expand
  10604. to anything at all except null, which terminates the string.  The two
  10605. expanded <word>s may therefore contain embedded spaces.  They are compared as
  10606. follows: if their lengths are different, then they differ.  Otherwise, if
  10607. INPUT CASE is set to IGNORE, a case-independent comparison is done (using new
  10608. function xxstrcmp()).  Otherwise, an exact match is required.
  10609.  
  10610. Add IF <, IF =, and IF > for comparison of numeric strings.  Arguments can
  10611. be numeric strings, variables containing numeric strings, or the words COUNT,
  10612. VERSION, or ARGC.
  10613.  
  10614. Modify SET COUNT to accept numeric variables or ARGC as an argument, as well
  10615. as ordinary numbers.
  10616.  
  10617. Add INCREMENT, DECREMENT.  These work on \%1..9, \%a..z, but only if they
  10618. have numeric contents.
  10619.  
  10620. ------------------------------
  10621.  
  10622. 5A(107) Sun Feb 11 13:57:24 1990
  10623.  
  10624. Allow trailing comments.  This was a big production.  The major difficulty was
  10625. in finding the right place to trim trailing blanks off a command after the
  10626. comment had been removed, since the part before the command had already been
  10627. parsed.  This process uncovered a longstanding bug that nobody had ever
  10628. reported: cmtxt, which is used to parse all sorts of things (like the "set
  10629. line" device name) left trailing blanks on, so that if you said "set line
  10630. /dev/tt0a ", Kermit would tell you "no such device".  This is now fixed.
  10631.  
  10632. Rules for trailing comments:
  10633.  0. They may be used in interactive commands as well as take files. 
  10634.  1. They begin with semicolon (;) or pound-sign (#).
  10635.  2. The comment introducer (; or #) must have at least one space preceding it
  10636.     unless it's at the start of a command.  Note: space, not tab (see 6 below).
  10637.  3. If semicolon or pound sign is to be included in a command:
  10638.       a. Put it immediately after a non-space character, as in "get foo.x;17".
  10639.       b. Quote it with \, as in "echo oofa \; afoo".
  10640.       c. Enter numerically, as in "echo oofa \59 afoo".
  10641.  4. Backslash notation (like \7, \%1, etc) is ignored within comments.
  10642.  5. A comment, like any other command, can be continued by ending it with -.
  10643.     But all subsequent continued lines will be part of the same comment, since
  10644.     there is no "comment terminator" other than an unquoted CR or LF.  This
  10645.     means you can't put comments on each line of a multiline macro definition.
  10646.     But you can't do it in MS-DOS Kermit either.
  10647.  6. Sad to say, tabs cannot be used to line up comments.  You must use spaces. 
  10648.     This is because:
  10649.       a. It's not possible for this program to keep track of your cursor
  10650.          position, since it doesn't have control over the screen.  Therefore,
  10651.          editing (DEL, Ctrl-W, Ctrl-U) of commands containing tabs would mess
  10652.          up the screen display and confuse users horribly.
  10653.       b. Tab is already used for keyword and filename completion.  But even
  10654.          if it weren't, problem (a) would remain.
  10655.  7. Trailing comments can be used freely even on GOTOs, labels, and DEFINEs.
  10656.  
  10657. Other changes:
  10658.  
  10659. Turn SET PROMPT argument into an "xxstring", so that it can contain embedded
  10660. backslash escapes, including variables.  Now you can put VTxxx escape
  10661. sequences, etc, into your Kermit prompt for highlighting, color, sound
  10662. effects, confidence tests, etc.
  10663.  
  10664. Add SET TAKE ERROR ON/OFF.  Until now, any syntax error in a TAKE file would
  10665. terminate execution of the file and return to the level that invoked it.  This
  10666. is still the default behavior, but now you can say SET TAKE ERROR OFF and
  10667. Kermit will simply proceed to the next command, if any, in the take file.
  10668.  
  10669. Add SET MACRO ERROR ON/OFF.  If a statement in a macro is in error (fails at
  10670. the parse level), the macro normally proceeds to the next statement, if any,
  10671. in the definition (compatibly with MS-DOS Kermit).  SET MACRO ERROR ON makes
  10672. it quit the current macro and return to the level that invoked it.
  10673.  
  10674. Add SET INPUT { DEFAULT-TIMEOUT, TIMEOUT-ACTION, CASE, ECHO }.
  10675. DEFAULT-TIMEOUT currently has no effect because the timeout field must be
  10676. specified in the INPUT command.  The others seem to work OK, as in MS-DOS
  10677. Kermit, et al.
  10678.  
  10679. Add REINPUT.  Parses just like INPUT, timeout is required but it is not used
  10680. at all.  This command just looks in the circular buffer that INPUT has been
  10681. storing its characters in.  Seems to work OK.
  10682.  
  10683. Increase command buffer length, CMDBFL, from 256 to 1000, so that longer
  10684. macros can be defined.
  10685.  
  10686. ------------------------------
  10687.  
  10688. 5A(106) Sat Feb 10 13:01:34 1990
  10689.  
  10690. Add "none" as a synonym for "direct" in SET MODEM.
  10691.  
  10692. Remove explicit references to stdin/stdout and other file descriptors in
  10693. ckcpro.w, ckc*.c, and cku*.c (except ckutio.c and ckufio.c):
  10694.  - fputs --> printf in function hmsga() in ckuus2.c 
  10695.  - putc  --> printf (same place)
  10696.  - fprintf(stderr,...) -> printf in ckuusr.c functions ermsg(), fatal(), etc.
  10697. This should make it easier on OS/2, VMS, & other non-UNIX C-Kermit developers.
  10698.  
  10699. Add SET MACRO ECHO ON/OFF, separate from TAKE ECHO.  Note: presently, both
  10700. of these print commands when turned on, regardless of quiet or background
  10701. settings.  Should this be changed?
  10702.  
  10703. Move a lot of #ifdef's out of gtword() in ckucmd.c into new functions defined
  10704. at the end of that file, to make gtword be mostly system-independent and
  10705. easier to read.  This is only a first step.  Next step is to move these
  10706. functions to each and every ck?tio.c file.
  10707.  
  10708. Discovered & fixed bug that has been in command parser forever: If user types
  10709. a control character that is not an editing character, such as Ctrl-B, the
  10710. command parser silently puts it in the buffer, but since it does not echo on
  10711. the screen, subsequent erasures (DEL, BS, Ctrl-W, Ctrl-U) wipe too many
  10712. characters off the screen.  Now any non-quoted, non-editing control character
  10713. simply causes Kermit to beep.  gtword(): ckucmd.c.
  10714.  
  10715. Allow '-' at end of line as command continuation character in both TAKE files
  10716. and interactively.  '\' at end still works too.  If you really need a line
  10717. to end with '-', use \44.  ckuusr.c and ckucmd.c.
  10718.  
  10719. In ckucmd.c, simplified the character quoting mechanism.  Rules:
  10720.  1. The low-level command parser treats \ as a quote for control characters,
  10721.     space, and question mark only.  Removes the \, leaves the quoted char.
  10722.  2. If you follow \ by any other character, the \ and the following chars are
  10723.     left in for the higher level command-specific code to interpret, namely
  10724.     the xxstring() function.  This way commands like INPUT, OUTPUT, ECHO, ASK,
  10725.     etc, no longer require you to double the \. 
  10726.  
  10727. Changed xxstring(), whose purpose is to expand backslash codes embedded within
  10728. strings, to handle nested variable definitions via recursive descent.  Deeply
  10729. nested or circular definitions are caught and recovered from.
  10730.  
  10731. Added ASSIGN command, like MS-DOS Kermit.  When a variable is DEFINEd, the
  10732. names any other variables appearing in the definition are simply copied.  When
  10733. a variable is ASSIGNed, variable names on the right hand side are evaluated,
  10734. and their values assigned.  To demonstrate:
  10735.   def %a foo
  10736.   def %b \%a
  10737.   ass %c \%a
  10738.   def %a oofa
  10739.   echo \%b, \%c
  10740. This echoes "oofa, foo" because b's value changes with a's, but c's doesn't.
  10741.  
  10742. Tried to separate the system-independent and system-dependent aspects of the
  10743. character set translation.  Results are in ckcxla.h (supposedly system
  10744. independent), ckuxla.h (specific to UNIX and VAX/VMS), ckcxka.c (actual C
  10745. code, translation functions and tables).  This work is best completed by
  10746. somebody who is actually trying to make the character set stuff work in a
  10747. totally different environment, like OS/2 or Macintosh.  If this was done
  10748. right, then people would only have to (a) create a ck?xla.h file for any new
  10749. system that is to be supported, and (b) add any necessary translation
  10750. functions and/or tables to ckcxla.c.  But unfortunately it's not quite that
  10751. easy to separate this stuff.  At least it still compiles and runs...
  10752.  
  10753. Also, make C-Kermit send I6/100 as the transfer character set designator for
  10754. Latin-1, rather than I2/100.  The former is correct and works with patched
  10755. versions of MS-DOS Kermit 3.00, the latter is incorrect but it's the only one
  10756. that will work with unpatched MS-DOS Kermit 3.00.  Ugh!  Workaround for
  10757. unpatched 3.00: SET ATTR CHAR OFF, SET TRANSF CHAR LATIN1.
  10758.  
  10759. ------------------------------
  10760.  
  10761. 5A(105) Sun Jan 28 12:02:02 1990
  10762.  
  10763. Much work on macros and take files today, almost entirely in ckuusr.c.
  10764.  
  10765. Debug macro argument assignment.  Here are the rules:
  10766.  0. name of macro is assigned to %0.
  10767.  1. value of argument 1 is assigned to variable %1, arg 2 to %2, up to %9.
  10768.  2. arguments past 9 are ignored.
  10769.  3. leading spaces in args are stripped.
  10770.  4. arguments are separated by one or more spaces
  10771.  5. multiple words can be grouped into one arg by { using braces }.
  10772.  6. all spaces within braced args are preserved, but the braces are discarded.
  10773.  7. chars after closing brace of braced arg begin a new arg even if no space.
  10774.  8. interior braces within an arg are kept.
  10775.  9. %0..%9 are cleared at each macro invocation, before argument assignment.
  10776.  
  10777. Made a call stack for macro invocations.  %1..%9 are local to each macro.
  10778. Use the (invisible) TEST command (within a macro) to dump the macro stack.
  10779. Treat macro args, global variables, and macro definitions as three separate
  10780. kinds of variables.  Macro args are in the macro-arg stack; global variables
  10781. are in a direct-access table, and macro definitions are in a lookup table.
  10782.  
  10783. Rules for variable names:
  10784.  1. Start with %.
  10785.  2. Commands that parse variable names also allow them to start with \%,
  10786.     for compatibility with MS-DOS Kermit.  Internally the \ is discarded. 
  10787.  3. Only a single character can follow the %.
  10788.  4. If it's a digit 0-9 then it's a macro argument, on the stack.
  10789.  5. If it's any printable other than a digit, it's a global variable.
  10790.  6. Uppercase letters are lowered, so %a is the same variable as %A.
  10791.  7. Variable names embedded in strings must begin with \, like "echo A\%bC".
  10792.  
  10793. Maximum length for a macro definition is the command buffer length, CMDBL,
  10794. defined in ckucmd.h as 255.  This can be increased.
  10795.  
  10796. OK so now we have a TAKE-file stack and macro stack.  Next problem: a TAKE
  10797. command didn't work from within a macro.  Why? because the code says "I'm
  10798. executing a macro so that's where I look for the next command".  So we also
  10799. need a general command stack to record every TAKE file or macro invocation.
  10800. Every time we exit from or otherwise finish executing a macro or a take file,
  10801. we pop this stack so that we go back to the right place.
  10802.  
  10803. The COUNT variable used to be stacked for take-files.  Now it is stacked
  10804. by command level, since SET COUNT / IF COUNT can be used in both take files
  10805. and macros.  Note: COUNT-loops cannot be nested within the same take file
  10806. or macro (nor can they be in MS-DOS Kermit).
  10807.  
  10808. What if a deeply-nested take file or macro DEFINEs a new macro, thus changing
  10809. the macro table?  Will we return to the right places while popping up the
  10810. stack?  Yes - the command stack is totally independent of the macro table. 
  10811.  
  10812. Remove requirement to type DO before macroname in order to execute the macro.
  10813. This was done as follows: in the main parse loop, if ckmkey2 returns -2 (no
  10814. match on keyword), then look up the word in the macro table and if it is
  10815. found, stuff a "do" before it in the command buffer and reparse.  This didn't
  10816. work for macros without arguments, however, so yet another ugly modification
  10817. was required to ckmkey2(): if an invalid keyword is typed and terminated by CR
  10818. or LF, then return -6 rather than -2.  In that case, the main parse loop
  10819. stuffs "do" before it and CR after it.  ckmkey2() was also changed to not
  10820. print "invalid" when keywords don't match.  Leave that to the caller.  Doesn't
  10821. seem to work all the time: sometimes we get two "invalid" messages (e.g. "set
  10822. foo<cr>").  Built-in commands have precedence over macros with same name.  To
  10823. override this precedence, specify "do".  ckuusr.c, ckucmd.c.
  10824.  
  10825. Other changes today:
  10826.  
  10827. Add SET DEBUG ON as invisible synonym for LOG DEBUG.  ckuusr.c.
  10828.  
  10829. Added -d to the command-line switches looked for by prescan(), so that
  10830. debug() statements can be added to the startup sections of the code.
  10831.  
  10832. Added ASK command.  Only works at terminal, not from command files (same as
  10833. MS-DOS Kermit).  Allows backslash escapes in prompt.  No ASKQ yet, need to
  10834. modify cmd package for this.
  10835.  
  10836. Added help messages for tokens like !, #, &, etc.
  10837.  
  10838. Add POP as synonym for END for compatibility with MS-DOS Kermit.
  10839.  
  10840. ------------------------------
  10841.  
  10842. 5A(104) Sat Jan 27 15:13:43 1990
  10843.  
  10844. Removed restriction that prevented GET, BYE, FINISH, and REMOTE commands
  10845. from working in remote mode.  Now you can issue these commands from a TAKE
  10846. file on your remote system, escape back to your PC, put it in server mode,
  10847. and everything works.  ckuusr.c.
  10848.  
  10849. Or does it?  Discovered that GET, BYE, FINISH, and REMOTE commands don't work
  10850. at all!  Problem was in the very tricky (and stupid) area where packet numbers
  10851. are not incremented from 0 when a client sends an I packet, then a G or R
  10852. packet, then gets an S packet.  Had to put a couple window-specific statements
  10853. into ckcpro.w, in the <ipkt>Y case.  This is really ugly, because the
  10854. application layer should not have to know anything about transport-layer
  10855. issues.  The reverse alternative would have been just as bad.  There still
  10856. seems to be one case of a send-buffer not being freed after ACKing the S
  10857. packet, but no harm is done by it.  Will have to come back to all this later.
  10858. At least now it works.  ckcpro.w.
  10859.  
  10860. Changed the message "Unimplemented generic server function" to "Unimplemented
  10861. REMOTE command".  ckcpro.w.
  10862.  
  10863. Removed vestigial packet buffer management functions from ckcfn3.c.
  10864.  
  10865. When receiving a file, pass the attribute structure to opena() in ckcfn3.c,
  10866. which in turn passes it to openo() in ckcfn3.c, which in turn passes it to
  10867. zopeno() in ck*fio.c, so that the system-depended function that actually opens
  10868. the file can use any received attributes when deciding how to open it.  All
  10869. ck*fio files should be changed accordingly.  But probably no harm is done if
  10870. some are not, because this is an informational trailing argument, and only
  10871. "lint" will complain.  ckufio.c has this change, but the UNIX version of
  10872. zopeno() does not use the attribute information for anything.
  10873.  
  10874. Allow I6/100 as a designator for ISO Latin-1 in attribute packets.  Previously
  10875. only I2/100 was recognized, but in reality I6/100 is more correct (2 =
  10876. International Reference Version of ISO-646; 6 = US ASCII, which is indeed the
  10877. true left half of ISO 8859-x alphabets).  (untested)  ckcfn3.c.  
  10878.  
  10879. Add server-end support for REMOTE SET commands from PC client (new Kermit
  10880. protocol feature, specified in Info-Kermit Digest V11 #1 by Christine M.
  10881. Gianone, Jan 1990).  The C-Kermit server responds correctly to the following
  10882. REMOTE SET commands: ATTRIBUTES {IN, OUT} ALL { ON, OFF }; FILE TYPE,
  10883. FILE NAMES, FILE COLLISION (partially), FILE INCOMPLETE, BLOCK-CHECK, RECEIVE
  10884. PACKET-LENGTH, RECEIVE TIMEOUT, RETRY, SERVER TIMEOUT, TRANSFER CHARACTER-SET,
  10885. and WINDOW-SLOTS.  ckcfns.c.
  10886.  
  10887. Fill in HELP messages for new commands.  ckuus2.c.
  10888.  
  10889. Add expansion of variable names %0, %1, ... %9, %a, %b, ... %z, etc, to
  10890. xxstring, which is called by ECHO, INPUT, OUTPUT.  A variable is % followed by
  10891. any single character.  Uppercase letters are folded to lowercase.  You don't
  10892. have to (but you may) include the backslash in the DEFINE command, but you
  10893. must prefix the % by a backslash when referencing it (really, two
  10894. backslashes).  So far we're not doing this recursively.  ckuusr.c.
  10895.  
  10896. When a macro is invoked, assign its name to %0, and its arguments, if any,
  10897. to %1..%9.  As in MS-DOS Kermit, allow grouping of words into a single
  10898. argument using braces, as in "first {this is the second} third".  Unlike
  10899. MS-DOS Kermit, C-Kermit clears variables %0..%9 when a macro is invoked,
  10900. so that there are no leftover values to be misinterpreted.  ckuusr.c.
  10901.  
  10902. Add IF [NOT] DEFINED, so that macros can check which arguments they were
  10903. called with and which were left off, so they can supply defaults reliably.
  10904.  
  10905. ------------------------------
  10906.  
  10907. 5A(103) Sun Dec 31 20:19:55 1989
  10908.  
  10909. Add '-y' command-line option for specifying an alternate initialization file
  10910. name.  Argument to -y is assumed to be in current directory or else filename
  10911. must include path.  Changes in ckuusr.c for parsing command line including new
  10912. prescan() function, ckuus4.c for SHOW command, ckuus2.c for usage message,
  10913. ckcmai.c for call to prescan().
  10914.  
  10915. In SHOW command, display "unknown" for speed, rather than -1, when the speed
  10916. is less than zero.
  10917.  
  10918. Fix error in ckuscr.c, function recvSeq(), changed:
  10919.   got_it = (!strncmp(seq_buf, got, l) ) ;
  10920. to:
  10921.   got_it = (!strncmp(e, got, l) ) ;
  10922. Before this fix, an "expect" string longer than 7 characters could cause
  10923. problems: the function would compare the first 7 characters, rather than the
  10924. last 7 (from Pawan Misra, Bellcore).
  10925.  
  10926. ------------------------------
  10927.  
  10928. 5A(102) Mon Dec 25 16:59:37 1989
  10929.  
  10930. Remove "2" attribute, put the transfer character set into the encoding
  10931. attribute after "C" -- rule modified by concensus of ISO-Kermit group.
  10932. In gattr(), set rx to be the address of the input translation function
  10933. after getting the transfer character set from the attribute packet.
  10934. In ckcxla.c, correct an error in the Latin-1 to German NRC translation table.
  10935. Tested with MS-DOS Kermit 3.0 prerelease.  Picks up transfer character set
  10936. correctly when receiving files, and translates OK.  Also puts the appropriate
  10937. encoding attribute into outbound attribute packets.
  10938.  
  10939. ------------------------------
  10940.  
  10941. 5A(101) Mon Aug 28 22:33:16 1989
  10942.  
  10943. OK, time to start getting specific again.  Today's changes: Fill in and
  10944. correct translation tables in ckcxla.c.  Changed the symbols TC_LATIN1,
  10945. TC_LATIN2, etc, to TC_1LATIN, TC_2LATIN, etc, because some preprocessors
  10946. ignore past the 8th character.
  10947.  
  10948. Remove timeout alarm from tthang - it was causing core dumps, don't know why.
  10949.  
  10950. ------------------------------
  10951.  
  10952. 5A(100) July 14 - Aug 25, 1989
  10953.  
  10954. Version 5A has four major new features, and many minor ones.  The major ones
  10955. are sliding windows, international character sets, a regular Kermit-style
  10956. script language, and macros.
  10957.  
  10958. SLIDING WINDOWS
  10959.  
  10960. Changes too numerous to describe in detail.  Briefly: a new module, ckcfn3.c,
  10961. was added which includes the sliding window buffers and buffer management
  10962. functions.  ckuus*.c were modified to support the SET WINDOW <n> command.
  10963. ckcfn[s2].c contain numerous modifications; the biggest changes were to the
  10964. input() function in ckuus2.c, which effectively acts as Kermit's transport
  10965. layer by managing the sequencing, allocating and freeing packet buffers, and
  10966. feeding incoming packets in order to the application layer state switcher in
  10967. ckcpro.w, which needed only minor modification to support windowing.
  10968.  
  10969. Windowing occurs only during the transmission of data (D) packets.  This is
  10970. because (a) it cannot take place until after it is negotiated in the S/I/Y
  10971. packet exchange, and (b) because a file is preceded by Attribute (A) packets,
  10972. based upon which the file receiver may elect to refuse the file.  In ckcfn2.c,
  10973. the sdata() function was modified to send up to a windowful of packets at once,
  10974. instead of just one one packet.
  10975.  
  10976. The sliding window option is fully compatible with Kermit's other options,
  10977. including long packets.  The user may elect to have a window of any size, from
  10978. 1 to 31, and packets of any length so long as the packet size times the window
  10979. size does not exceed the total buffer size BIGRBUFSIZ defined in ckuker.h
  10980. (this restriction could be relaxed in the future by using malloc to get buffer
  10981. space).  Window size takes precedence, so that if the user specifies packets
  10982. that are too long or too many window slots, the program will adjust the packet
  10983. size downwards.
  10984.  
  10985. Sliding windows tested locally against MS-DOS Kermit 3.0 prerelease, Crosstalk
  10986. Mk.4, ProComm, etc.  There is some minor performance increase.  Tested across
  10987. Telenet with Prime Kermit at The Source (just before The Source shut down for
  10988. good), and performance is dramatically better than stop-and-wait over the same
  10989. connection, as expected.  There was not time to make detailed measurements
  10990. before The Source was turned off.
  10991.  
  10992. INTERNATIONAL CHARACTER SETS
  10993.  
  10994. Addition of 'set file character-set', 'set transfer', and 'set language',
  10995. commands.  Installation of numerous translation functions and tables.
  10996. Addition of local 'translate' command to translate a local file according to a
  10997. given table.
  10998.  
  10999. Creation of new module, ckcxla.c and ckcxla.h, for international language
  11000. support.  Currently includes the various 7-bit ISO 646 National Replacement
  11001. Character sets (NRC's), plus regular ASCII, DEC MCS, and ISO Latin-1, as local
  11002. file character sets, and ASCII and Latin-1 as transfer character sets.
  11003.  
  11004. In gattr(), check incoming transfer character set designator if specified in
  11005. '2' attribute, and if not known, refuse the file, citing '2' in the attribute
  11006. refusal.  If it is known, set the the transfer character set accordingly.
  11007. (This may need more work -- e.g. after the transfer is over, should the
  11008. transfer character set revert to what the user said?)  (Note added later: this
  11009. approach was voted down by the ISO/Kermit committee - there is no longer a '2'
  11010. attribute; character set is given in the '*' encoding attribute.)
  11011.  
  11012. Some changes will probably be made as the iso/kermit proposal evolves.
  11013.  
  11014. Things to do:
  11015.  - Add Macintosh character set
  11016.  - Add commands to modify a translation table.
  11017.  - Add LOAD/DUMP/MODIFY/etc CHARACTER-SET facility.
  11018.  
  11019. SCRIPTS
  11020.  
  11021. Addition of INPUT, OUTPUT, PAUSE, IF, and GOTO commands, plus labels as
  11022. targets of GOTOs.  Works approximately as in MS-DOS Kermit, except timeout
  11023. parameter on INPUT statement is required, not optional.  If a goto is
  11024. encountered, nothing happens unless we're in a take file (or macro, see
  11025. below).  The take file is rewound and searched from the beginning for the
  11026. label.  The IF command currently has the options: NOT, COUNT, EXIST, SUCCESS,
  11027. and FAILURE.  The latter two correspond to the most recent INPUT command.
  11028. Operates slightly differently in TAKE files and interactively (like
  11029. MS-DOS Kermit).  IF commands can be combined, as in IF COUNT IF EXIST FOO.BAR
  11030. ECHO AHA!.
  11031.  
  11032. Also added SET COUNT <n>, SET TAKE ECHO { ON, OFF }, CLEAR, STOP, END, plus
  11033. SHOW COUNT.
  11034.  
  11035. Added a new function xxstring() in ckuus4.c, which interprets \-escapes in
  11036. strings similarly to MS-DOS Kermit -- allows radix specification, grouping 
  11037. inside braces, etc.  Made ECHO, INPUT, and OUTPUT command use it.  Thanks to
  11038. Christine Gianone for some of this code.
  11039.  
  11040. Wrote a complicated script and it didn't work.  After several hours of
  11041. debugging, figured out that there was no call to ttvt() or ttpkt() in
  11042. preparation for INPUT and OUTPUT.  For now, I put a call to ttvt() in both
  11043. INPUT and OUTPUT, and set a flag the first time it's called so it needn't be
  11044. called again.  Later, have to find a better way -- like just go ahead and set
  11045. the RAW and ~ECHO bits right inside of ttopen().  What harm can there be in
  11046. that?
  11047.  
  11048. Still to do:
  11049.  - Make sure it's ok for ttopen() to call ttvt(), then make this change.
  11050.  - Occasionally get core dumps with SET DEB ON and HANGUP (maybe fixed already)
  11051.  - Maybe allow some pattern matching in the INPUT string???
  11052.  
  11053. MACROS
  11054.  
  11055. Added DEFINE command, similar to MS-DOS Kermit.  "define <name> <string>"
  11056. defines the variable <name> as <string>.  "do <name>" executes the associated
  11057. string (on the assumption it is a valid command).  The <string> can be a comma
  11058. separated list of commands, and Kermit will do them one after the other,
  11059. replacing commas with carriage returns, and storing each command in the
  11060. command buffer as if the user had typed it.  A macro may invoke other macros,
  11061. up to a level defined by MACLEVEL (currently 20).  "define <name>" undefines
  11062. the macro.  One macro "ibm-linemode" is predefined.  "show macros" lists the
  11063. named macro, or if none named, all the defined macros.
  11064.  
  11065. All of the support for macros is in ckuusr.c and .h.  No changes were required
  11066. to ckucmd.c.  When macros are defined, space for the name and definition is
  11067. malloc'd, and they are inserted into an alphabetical keyword table.  When
  11068. undefined, they are removed from the table and the rest are moved up, so the
  11069. table is always sorted alphabetically and has no holes.
  11070.  
  11071. Special code was required in several places to handle GOTOs and IFs within
  11072. macros.
  11073.  
  11074. OTHER CHANGES
  11075.  
  11076. Also install attribute refusal for unknown file types (i.e. other than A
  11077. and B), unknown encodings (other than A and C), unknown dispositions (other
  11078. than M and P).
  11079.  
  11080. As part of the label-recognizing code, also found a way to allow a command
  11081. line to begin with a token, followed by arbitrary text without any intervening
  11082. spaces.  So now you can have "%foo", "!foo", etc, as well as ":foo" (the new
  11083. label syntax).  Added ; and # as synonyms for % (whole-line comment
  11084. introducer).  The way this works is really ugly -- if cmkey fails to match a
  11085. keyword, then it searches a string of single-character tokens, and then sets
  11086. the command buffer pointers & flags to allow reparsing of the text past the
  11087. token on the next call to gtword().  Actually, a special version of cmkey(),
  11088. called cmxkey or something like that, is used for this, leaving cmkey() more
  11089. or less the way it was.
  11090.  
  11091. Reorganization of many modules, to even out their sizes.  Movement of some
  11092. non-sliding-windows related functions to ckcfn3.c.  Creation of new ckuus4.c
  11093. and movement of many functions from the other ckuus*.c modules to it.
  11094. "size *.o" no longer shows several disproportionately huge object modules.
  11095.  
  11096. Decomposition of 'show' command in various subcommands -- 'show
  11097. communications', 'show protocol', 'show file', 'show languages', 'show
  11098. versions', 'show count', etc.
  11099.  
  11100. Addition of TYPE command, interruptible by Ctrl-C.
  11101.  
  11102. Addition of DELETE command (invokes system's delete function).
  11103.  
  11104. Add invisible synonyms: RM for DELETE, LS for DIRECTORY.
  11105.  
  11106. Total recoding of the ttinl() (packet reading) function in ckutio.c, to
  11107. make it as tight and efficient as possible, and not to read ahead
  11108. destructively as the old version used to (which would prevent successful
  11109. input of a chain of packets in sequence).  
  11110.  
  11111. More detailed statistics reporting.
  11112.  
  11113. Move system-dependent mail and print string-making into ckufio.c, into
  11114. new functions called zmail() and zprint().  These must be added to all the
  11115. other ck*fio.c files (they can just return the null string if they don't
  11116. do anything).  This is still not ideal, however.  Instead of mailing/printing
  11117. the file after it is received, the program should handle the disposition
  11118. attribute before receiving the file, and then (for Unix anyway) pipe the file
  11119. to the command.  That way, the receiver wouldn't need disk space/access, etc.
  11120. Unfortunately, not all operating systems have pipes, so this would not be
  11121. portable.
  11122.  
  11123. Allow 'set speed' command in remote mode as well as local.  In remote mode,
  11124. this lets you tell C-Kermit what your line speed is (as opposed to letting
  11125. you change it), so "percent efficiency" can be reported.  Later, this can
  11126. also be used to calculate better timeouts, etc.  (It might be preferable to
  11127. have the program ask the OS for the current speed.)
  11128.  
  11129. Make the terminal speeds into keywords, so now you can do "set sp 9<esc>"
  11130. to get 9600, etc.  (ckuus3.c)
  11131.  
  11132. ------------------------------
  11133. *****************
  11134. End of CKU178.UPD
  11135.