home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / c-kermit / ckc200.txt < prev    next >
Text File  |  2020-01-01  |  605KB  |  12,261 lines

  1. C-KERMIT CHANGE LOG (Changes since 7.0.197 of 8 February 2000)
  2.  
  3. Wed Dec 12 09:27:41 2001
  4.  
  5. ---7.0.197---
  6.  
  7. EVERYTHING FROM HERE DOWN was done after ckermit2.{txt,html} was last
  8. updated.
  9.  
  10. FreeBSD 4.0 came out 16 March 2000.  Building C-Kermit under it resulted in a
  11. version that lost CBREAK mode after return from curses.  Adding -DCK_WREFRESH
  12. didn't fix it, as it does on other platforms where this happens.  Building
  13. with curses instead of ncurses didn't fix it because in FreeBSD 4.0 curses
  14. *is* ncurses.  It's the old curses-changes-console-buffering-but-endwin()-
  15. doesn't-restore-it problem.  The only way around it is to re-enable the old
  16. setbuf(stdin,NULL) code in concb().  By Murphy's Law, there was no way to do
  17. this with the #ifdefs that were already there, so I had to add a new one:
  18. #ifdef NONOSETBUF.  makefile, ckutio.c, ckuver.h, 16 March 2000.
  19.  
  20. For Interactive UNIX System V/386 R3.2 V4.1.1, had to #ifdef out the #include
  21. of <netdb.h> in ckcnet.c to avoid duplicate declarations of hostent, etc.
  22. Also added -DNOREALPATH to is5r3* targets, makefile.  19 Mar 2000.
  23.  
  24. The binary produced for Interactive was not portable to generic SV/386 R3.2
  25. because it contained calls to dup2().  Made a new target, sys5r3is, that
  26. builds on Interactive and produces a binary with no dup2() calls (by adding
  27. NOFDZERO, NOREDIRECT, NOZEXEC).  This required removing the #ifndef NONAWS
  28. around extern int tt_rows, ttcols; in ckutio.c, which is safe, since the
  29. global declarations in ckcmai.c are not #ifdef'd.  20 Mar 2000.
  30.  
  31. ---7.0.198---1.1.20---
  32.  
  33. 16 Apr 2000, the big Jeff/Frank code reconciliation.  From small to big:
  34.  
  35.  . ck_ssl.h - Took Jeff's.
  36.  . ckcpro.w - Fix a comment that caused problems with some compilers.
  37.  . ckcker.h - Take Jeff's (some #ifdefs for PWDBUF size).
  38.  . ckuver.h - Fix typos in comments, add FreeBSD 4.0.
  39.  . ckcuni.c - Hebrew-7 fix.
  40.  . ckwart.c - Copyright, improved debugging.
  41.  . ckclib.c - makestr() bulletproofing and debugging.
  42.  . ckufio.c - Debug / buffer-initialization for zinfill().
  43.  . ckuath.c - Took Jeff's.
  44.  . ckucns.c - Some changes to select() setup.
  45.  . ckupty.c - Debugging added.
  46.  . ckuusr.h - Fix VT102 oversight, add security stuff, fix delmac() prototype.
  47.  . ckuusx.c - Improvements to session logging, debugging, 
  48.  . ckuus6.c - Update delmac() calls, fix some text messages.
  49.  . ckcmai.c - Update version numbers & dates, add some OS2 text patterns,
  50.               initialize zinbuffer & zoutbuffer to NULL.
  51.  . ckucmd.c - Better handling of directory-name completion.
  52.  . ckuus4.c - delmac(), K5/FwdX msgs, Telnet debugging, 
  53.  . ckucon.c - no change (didn't tackle BEBOX stuff).
  54.  . ckuusy.c - IKSD for K95, improved detection of -s with no files to send. 
  55.  . ckuusr.c - Make some TELNET keywords visible, fix some glitches,
  56.               don't look for infodir in OS2.
  57.  . ckcdeb.h - Shuffle lots o' #ifdefs.
  58.  . ckudia.c - Fixes to ANSWER, etc.
  59.  . ckuus5.c - K95 IKSD, fixes to Win95 short names, fix for local variable
  60.               names that are prefixes of longer global names, add parameter
  61.               to delmac() that says whether it requires exact name match,
  62.               make IBM 3151 termtype visible, 
  63.  . ckctel.h - Took Jeff's.
  64.  . ckuus2.c - New HELP KVERB + lots of new or updated help text.
  65.  . ckuus3.c - Fix SET DIAL METHOD, update Telnet commands, fix SET PRINTER,
  66.  . ckutio.c - 100 little things + make ttinl() ignore non-packet incoming
  67.               when sending and streaming.
  68.  . makefile - Jeff's secure-entry additions and changes reconciled with all
  69.               my 7.0.197 changes.
  70.  . ckuus7.c - Make IBM3151 visible, fixes for download directory selection,
  71.               ensure no K95 popups vs startflags, updates to SHOW AUTH, 
  72.  . ckctel.c - Took Jeff's but added some casts to squelch compiler warnings.
  73.  . ckcnet.c - Toof Jeff's but added #ifdef around #include <netdb.h> for
  74.               Interactive UNIX SVR3 from my copy and fixed some ANSI compiler
  75.               assumptions.
  76.  . ckuath.c - Took Jeff's.
  77.  
  78. Checked out Jeff's new directory completion code.  It's great, except for
  79. the case where the string matches exactly one directory that has no
  80. subdirectories.  In this case Kermit should do full completion rather than
  81. partial.  Added a rather crude hack to take care of this; it works and does
  82. not seem to have any bad side effects, but it's kind of scary anyway -- it
  83. does another nzxpand() (which should be OK since no znext()s follow), and
  84. it executes a GOTO into a parallel block of code, which from my memory of
  85. compiler construction might be expecting too much of some compilers.  But
  86. it works fine with gcc and dumb old SunOS cc.  ckucmd.c, 16 Apr 2000.
  87.  
  88. Will look at BEBOX later, after we have BeOS 5.0 installed on a PC.
  89. Meanwhile, keep BeOS 4.5 up on BeBox so we can still support both.
  90.  
  91. From Jeff: fix -M command-line option.  ckuus[4y].c, ckcnet.c, 17 Apr 2000.
  92.  
  93. Noticed that "help ." was rather unhelpful, because internally we recycle
  94. the XXDEF command code for it, so it just prints the HELP DEFINE text, which
  95. is not appropriate.  I added a new variable, char * hlptok, which contains
  96. the string they are actually requesting help for, so we can disambiguate
  97. requests like this, and added new help text for ".".  ckuus[r2].c, 17 Apr 2000.
  98.  
  99. Added DIR /SUMMARY, which just prints the number of files and total size.
  100. ckuusr.h, ckuus[26].c, 17 Apr 2000.
  101.  
  102. Added IF KBHIT.  ckuusr.h, ckuus[26].c, 17 Apr 2000.
  103.  
  104. Discovered, however, that "if kbhit getc %c" didn't get the character that
  105. caused IF KBHIT to succeed.  Why?  An intervening call to concb() has the side
  106. effect of clearing the console buffer, at least in SunOS (BSD).  Which also
  107. explains why command typeahead doesn't work either -- concb() is called at the
  108. beginning of each command parse.  But concb() doesn't clear the buffer in
  109. Solaris (System V) or Linux (POSIX).  So it looks like the BSD/V7 version 
  110. needs attention: (a) don't call concb() if the state didn't change from last
  111. time (messy); or (b) ckutio.c should remember the state and concb()/conbin()
  112. etc should do nothing if state didn't change; or (c) concb()/conbin() have to
  113. read in any pending characters first and stash them for later requests before
  114. calling stty() to change modes, and then conin()/conchk() and any other
  115. console input routines have to check the stash first.
  116.  
  117. The question is: what to do about this?  (a) gives the best performance boost,
  118. but requires changing code everywhere and anyway is not reliable since we will
  119. still lose characters when the state actually changes.  (b) is like (a) except
  120. without changing code everywhere (and without the performance boost).  (c) is
  121. a whole big deal, but still not reliable since there is a window between the
  122. time we read the characters and do the stty() or ioctl() to change modes.
  123.  
  124. I implemented (b), but it doesn't help because in the test case, we actually
  125. do change modes (GETC calls conbin()).  At least it saves us some redundant
  126. system calls.  So I implemented (c) too.  ckutio.c, 17 Apr 2000.
  127.  
  128. Note: The (c) implementation is only for BSD/V7.  It shouldn't make any
  129. functional difference elsewhere, but it might make a performance difference.
  130. Is it worth the risk?  On the other hand, if we always did this, it would
  131. catch any other oddball platforms we might not know about.  We can revisit...
  132. search for "conbuf".
  133.  
  134. Speaking of jumping into the middle of a block, I checked to see if Kermit
  135. lets you do that.  It shouldn't but it does, e.g.:
  136.  
  137.   echo ONE
  138.   goto xxx
  139.   if true {
  140.      echo TWO
  141.   :xxx
  142.      echo THREE
  143.   }
  144.   echo blah
  145.   :xxx
  146.   echo FOUR
  147.  
  148. Why?  The GOTO code is calling fread() directly.  Instead it should be
  149. calling getnct() (Get Next Command from TAKe-file).  Fixed in dogoto():
  150. ckuus6.c, 17 Apr 2000.
  151.  
  152. When defining a variable or macro (with addmac()), we always call delmac()
  153. and then allocate new space for the new value.  But we don't need to do this
  154. if the new value is no longer than the old one; we can just copy the new
  155. value over the old one.  This could make certain loops run a lot faster.  But
  156. a look at the code shows that it's just as hard to find out the length of the
  157. current value as it is to do what we do now.  But let's see if it makes a
  158. difference with a loop that replaces two variables 10,000 times each:
  159.  
  160.   echo \v(time)
  161.   for \%i 1 10000 1 {
  162.       asg \%m \%i
  163.   }
  164.   echo \v(time)
  165.  
  166. Trials with and without the purported optimization on an unloaded (but slow)
  167. Linux PC show no significant difference in elapsed time: about 84 sec.
  168. Obviously the bottleneck is elsewhere.  I backed off on the change (see
  169. USE_VARLEN in ckuus5.c) and built a profiling version (linuxp) and ran the
  170. loop again.  Results:
  171.  
  172.   %   cumulative   self              self     total
  173.  time   seconds   seconds    calls  ms/call  ms/call  name
  174.  25.67      8.86     8.86    70045     0.13     0.25  lookup
  175.  24.43     17.29     8.43  9774786     0.00     0.00  ckstrcmp
  176.   9.07     20.42     3.13   190082     0.02     0.03  gtword
  177.   7.16     22.89     2.47  6374111     0.00     0.00  dodebug
  178.   5.01     24.62     1.73   350133     0.00     0.00  setatm
  179.   4.03     26.01     1.39   140068     0.01     0.01  zzstring
  180.   3.91     27.36     1.35        3   450.00 11483.16  parser
  181.  
  182. lookup() can call ckstrcmp() as many as 3 times per table entry.  So we should
  183. be able to get a big boost out of fixing lookup() not to do string comparisons
  184. if it doesn't have to.  It certainly doesn't have to if the first letter of
  185. the target is not the same as the first letter of the table entry (caseless).
  186. This brings the runtime down to 66 seconds:
  187.  
  188.  32.76      7.95     7.95    70045     0.11     0.12  lookup
  189.  10.47     10.49     2.54   190082     0.01     0.02  gtword
  190.   8.90     12.65     2.16  6374099     0.00     0.00  dodebug
  191.   5.97     14.10     1.45   350133     0.00     0.00  setatm
  192.   5.64     15.47     1.37        3   456.67  8069.83  parser
  193.  
  194. That's a 27% improvement -- not bad for five minutes work.  Next: what is
  195. dodebug() doing up there at number 3?  Hmmm I thought I had defined IFDEBUG if
  196. BIGBUFOK but apparently not.  It seems the debug() macro was defined in
  197. ckcdeb.h before defining BIGBUFOK.  Moved the debug() definition to the right
  198. place and rebuilt.  Executable size (on Linux, with profiling) before:
  199. 1481306; after: 1516266, a 34K increase.  Now the loop executes in 56 seconds:
  200.  
  201.  32.90      7.40     7.40    70045     0.11     0.11  lookup
  202.  11.38      9.96     2.56   190082     0.01     0.02  gtword
  203.   7.56     11.66     1.70        3   566.67  7479.84  parser
  204.  
  205. That's a 50% speedup.  The next thing would be to add a lookup() cache, which
  206. I started to do but didn't have time to finish.  ckucmd.c, 17 Apr 2000.
  207.  
  208. New files from Jeff: ckctel.c ckcmai.c ckuath.c ckuusy.c, implementing the
  209. options that make up the secure Telnet personality command line.  17 Apr 2000.
  210.  
  211. Cleaned up ckuusy.c formatting and added a needed prototyp for dotnarg().
  212. 18 Arp 2000.
  213.  
  214. Back to the lookup cache...  I can't think of a good (portable, efficient) way
  215. to maintain a dynamic cache.  The question is when to replace an existing item
  216. by a new one.  This can be done only with some combination of hit count and
  217. timestamp.  But a timestamp requires a nonportable high-overhead system call,
  218. and the format of the timestamp is nonportable too.
  219.  
  220. So let's try a static cache.  By running a few nontrivial script programs
  221. and having lookup() collect statistics, and then running them through our
  222. all-purpose associative array builder, we find a short list of items that
  223. consistently get the most hits (IF, NOT, GOTO, etc), so we can build our
  224. cache from these when Kermit starts.  Here are the top ones, with counts
  225. from a typical run:
  226.  
  227.   if        602       =         106
  228.   not       247          lit        97
  229.   cmdlevel  241          do         83
  230.   goto      231       _getargs   82
  231.   >         230          <          79
  232.   incr      173       _putargs   77
  233.   def       172          asg        69
  234.   _assign   159          xecho      59
  235.   echo      120          else       56
  236.   eval      112
  237.  
  238. Adding a 16-element cache results in not much speedup: 53 seconds, down from
  239. 56, even though the cache hit rate was over 70%.  Reducing the size to 8
  240. lowers the hit rate to 57% but does not lower the elapsed time.  Reducing the
  241. cache to 4 gives a hit rate of 28% and increases the elapsed time to 55
  242. seconds.  So there is no special benefit to reducing the cache size.  Some
  243. hand-tuning of the cache-search loop brings elapsed time down to 52 sec with
  244. the original cache of 16, and:
  245.  
  246.   %   cumulative   self              self     total
  247.  time   seconds   seconds    calls  ms/call  ms/call  name
  248.  25.16      4.69     4.69    70065     0.07     0.07  lookup
  249.  14.91      7.47     2.78   190084     0.01     0.02  gtword
  250.   7.24      8.82     1.35   140071     0.01     0.01  zzstring
  251.   6.76     10.08     1.26   350142     0.00     0.00  setatm
  252.   6.28     11.25     1.17    60024     0.02     0.15  docmd
  253.   5.58     12.29     1.04        3   346.67  6192.79  parser
  254.  
  255. This still beats the non-cache version by 8-10%, so let's keep it.  Anyway,
  256. it's demonstrably a better lookup() than the one that has all the other
  257. improvements but no caching:
  258.  
  259.  33.48      7.65     7.65    70048     0.11     0.12  lookup
  260.  11.55     10.29     2.64   190084     0.01     0.02  gtword
  261.   7.61     12.03     1.74    60024     0.03     0.16  docmd
  262.   5.43     13.27     1.24   350142     0.00     0.00  setatm
  263.   5.08     14.43     1.16        3   386.67  7603.16  parser
  264.  
  265. Execution of the script goes down to 46 sec with no profiling, an 83% speed
  266. improvement.  The lookup() caching code is selected by USE_LUCACHE, which is
  267. defined in ckuusr.h if NOLUCACHE is not defined.  The cache is initialized in
  268. ckuus5.c, and searched in lookup() in ckucmd.c.  To get the cache hit rate, do
  269. whatever you want in C-Kermit, and then "log debug" and "exit", then look for
  270. "cache" in the debug log.  18 Apr 2000.
  271.  
  272. Giving a BYE command to a Kermit program that's in remote mode never does
  273. anything useful, but can easily do something bad.  Added a test for this to
  274. the BYE code in ckuusr.c, 18 Apr 2000.
  275.  
  276. EXIT (QUIT) could, under certain circumstances (which I can't reproduce but
  277. can still see how it might have happened), fail to return the saved-up exit
  278. status.  Changed the code to put ckitoa(xitsta) in the cmnum() default field
  279. instead of using the old hokey way of doing it.  Also fixed the HELP EXIT
  280. message which never mentioned the new text argument.  ckuusr.c, 18 Apr 2000.
  281.  
  282. Changes from Jeff to allow a NOLOCAL build of K95.  ckctel.c ckuus3.c ckcdeb.h
  283. ckuath.c ckuus4.c ckuus6.c ckuus7.c, 18 Apr 2000.
  284.  
  285. From Jeff: More changes for K95 IKSD.  ckuus4.c ckctel.c ckuus5.c ckcnet.c
  286. ckuus3.c ckuath.c ckuus7.c ckuus6.c ckwart.c ckcdeb.h ckcpro.w ckuusr.c
  287. ckuusx.c ckuscr.c.  20 Apr 2000.
  288.  
  289. Fixed long lines and trailing blanks in all source files.  20 Apr 2000.
  290.  
  291. Added STREAMING notation to CRT and SERIAL displays.  ckuusx.c, 20 Apr 2000.
  292.  
  293. Added IF KERBANG.  ckuusr.h, ckuus[26].c, 20 Apr 2000.
  294.  
  295. From Jeff, changes mostly to avoid confusion when trying to use Zmodem with
  296. IKSD: ckuusr.c ckcdeb.h ckuus4.c ckcpro.w ckuath.c ckudia.c ckuusy.c ckuus6.c
  297. ckuscr.c ckuus2.c ckuusx.c, 22 Apr 2000.
  298.  
  299. Filled in a skeleton for user-mode chroot, so far just the parsing and
  300. setting.  Still have to fill in the actions for all zblah() routines (about 24
  301. of them) that take filenames as arguments, which is not so bad, but then we
  302. also have to worry about every fopen() call in the mainline code.  I'm not
  303. sure this is really practical the way the code is now structured; even if we
  304. cover every single call, we'll forget when adding new ones.  And we can't
  305. really front-end fopen() by yet another z...() routine (really, a whole bunch
  306. of them) without changing all the ck*fio.c modules.  Maybe I'll have to give
  307. up on this (again) (or as Jeff suggests, make an fopen() replacement like we
  308. did for printf, etc).  Files touched today: ckcdeb.h, ckuusr.h, ckuusr.c,
  309. ckufio.c.  Everything is in #ifdef CKROOT.  22 Apr 2000.
  310.  
  311. Discovered something wrong with cmifi2() when parsing a wildcard that expands
  312. to a list of file or directory names, if it is given the name of a directory.
  313. If the directory has no subdirectory, it matches nothing.  If the directory
  314. has one or more subdirectories, it matches directory/first-subdir.  The same
  315. is true when calling cmifi2() to match only directory names (as opposed to
  316. cmdir(), which matches only one name).  Example: "dir /dir subdir".  The
  317. problem is quite deep in traverse(), which I swore never to touch again
  318. without a total rewrite, so I added an ex-post-facto fixup to nzxpand(): if
  319. the diractive flag is not set (a pre-existing disgusting hack) and zxpand has
  320. been given a not-wild directory name, it should just return it.  However, this
  321. was rather tricky since we had to fake all the fgen()/traverse()/addresult()
  322. data structures, even when they had not been initialized yet.  A fundamental
  323. change that needs watching...  ckufio.c, 23 Apr 2000.
  324.  
  325. Even with this fixup, it is not (and never has been) possible to get a
  326. directory listing of a single directory file if that directory contains any
  327. files.  But with the above fix, it's now possible to overload the /NORECURSIVE
  328. DIR switch to force this: "dir subdir" lists all the files in subdir, but
  329. "dir /norecursive subdir" lists subdir itself.  ckuus6.c, 23 Apr 2000.
  330.  
  331. Discovered the code in UNIX addresult() to append a directory separator to the
  332. end of a directory name if one wasn't there already never worked (this was
  333. masked by higher levels of code and not noticeable until the fix just above).
  334. Fixed in ckufio.c, 23 Apr 2000.
  335.  
  336. Discovered ckradix() did not fail when given illegal input.  Fixed in
  337. ckclib.c, 23 Apr 2000.
  338.  
  339. Changed cmnum() to allow specification of octal radix.  Fixed cmfdb() to allow
  340. passing of radix to cmnum().  This could be easily extended to any radix 2-36.
  341. ckucmd.c, 23 Apr 2000.
  342.  
  343. Noticed that cmifi() listed directories in its "?" file list even when
  344. files-only is specified, even though it actually returns only regular files
  345. once the field is terminated.  Fixed in ckucmd.c, 23 Apr 2000.
  346.  
  347. Added CHMOD command for UNIX only.  Operates on single or multiple files or
  348. directories, or any mixture.  Accepts the normal assortment of switches:
  349. files-only, directories-only, recursive, verbose, page, etc.  HELP CHMOD for
  350. the list.  The permission code is strictly an octal number, no "chmod g+x"
  351. etc, although it would not be hard to add if anybody cared.  ckuusr.[ch],
  352. ckuus[23x].c, 23 Apr 2000.
  353.  
  354. To extend this to other operating systems requires a more general design:
  355.  
  356.   SET FILE PERMISSIONS (or PROTECTION) { /UNIX, /VMS, ... } <code> <filespec>
  357.  
  358. (plus the other switches of course), which tells Kermit how to interpret the
  359. code, the default being either the native format or some new portable format
  360. that we devise.  Implementation of the client/server version of this is a big
  361. deal since it has to account for the semantics of every known file system, not
  362. just the simplistic one used by Unix.  For example, in VMS we have four
  363. categories of user, not just three, and we have delete permission in addition
  364. to RWE.  Execute permission has different meaning on different platforms, and
  365. sometimes even on the same platform (e.g. directory search).  VMS, AOS/VS, and
  366. NT have ACLs, etc etc.  A protocol must be designed that accounts for
  367. everything, and also is extensible to accommodate future developments (or
  368. discoveries).  Kermit's current model (as used in A packets) is totally
  369. inadequate.  Also this begs the question of "wildcards" in the cross-platform
  370. client/server environment.  We've always required that client commands
  371. understand the server's wildcard syntax, which has its good and bad points.
  372. But if we don't want to allow platform-specific protection codes in the
  373. protocol, why should we allow platform-specific wildcard syntax?  Worse, how
  374. could we add REMOTE SET FILE PROTECTION commands that mixed the two?
  375.  
  376. From Jeff: SET IKS commands (executable only in IKSD.CONF):
  377.   set iks anonymous { on, off }
  378.   set iks bannerfile <filename>
  379.   set iks cdfile <filelist>
  380.   set iks cdmessage { on, off }
  381.   set iks helpfile <filename>
  382.   set iks initfile <filename>
  383.   set iks userfile <filename>
  384.   set iks xferlog { on, off }
  385.   set iks xferfile <filename>
  386.  
  387. Also:
  388.   . Added "ktelnet" as synonym for I_AM_TELNET
  389.   . changed --privid to be Unix only.
  390.  
  391. ckcmai.c ckuus[r356y].[ch], 24 Apr 2000.
  392.  
  393. Some debug logs showed that isdir() is often called twice in a row on the
  394. same file.  Rather than try to sort out clients, I added a 1-element cache
  395. to Unix isdir().  ckufio.c, 24 Apr 2000.
  396.  
  397. Another refinement to directory-name completion: "cd bl<Esc>" completes to
  398. "blah/ " if there is only one directory name that starts with "bl" and it
  399. contains no subdirectories.  However, "chmod 664 bl<Esc>" completes to
  400. "blah/" and then beeps.  Why?  Because in this case we are parsing either
  401. a filename OR a directory name, whereas CD parses only directory names.
  402. So the real test for whether to beep is: in the directory-only case, beep
  403. if the directory contains subdirectories; in the directory-or-file case,
  404. beep if the directory contains any files at all; otherwise complete and add
  405. a space.  cmifi2(): ckucmd.c, 24 Apr 2000.
  406.  
  407. More from Jeff: ON_LOGIN macro for IKSD, make SHOW MACROS terminate lines
  408. correctly in IKSD.  ckcmai.c, ckuus5.c, 24 Apr 2000.
  409.  
  410. From Jeff: More SET IKSD commands, rlogin ID swap, etc.  ckcnet.c, ckctel.c,
  411. ckuusy.c, 25 Apr 2000.
  412.  
  413. More fooling around with user-level chroot.  There is now an invisible CHROOT
  414. command, which sets the user's access root and CDs to it, done internally by
  415. zsetroot().  The zinroot() function checks to see if its argument is in the
  416. root, if any.  zinroot() calls have been added to zopeni(), which is called by
  417. (e.g.) TYPE, TRANSMIT, and XLATE, and to zchdir() for CD.  As a proof of
  418. concept, it seems pretty solid; it's like the Roach Motel.  Next steps:
  419.  
  420.  . Put the checks everywhere they are needed in ckufio.c.
  421.  . Make a front end for fopen() to be used in the mainline code.
  422.  . Give appropriate error messages when root violations occur.
  423.  . Don't show full paths, e.g. in zgtdir(), zfnqfp(), etc.
  424.  . Consider allowing multiple roots rather than just one.
  425.  
  426. ckufio.c, 25 Apr 2000.
  427.  
  428. IKSD changes from Jeff, ck_ssl.c ckcmai.c ckcnet.c ckuus4.c ckuus5.c ckuusy.c,
  429. 26 Apr 2000
  430.  
  431. Got rid of homdir variable.  It was totally unreliable since it was being set
  432. to whatever pointer zhome() happened to return at some time in the past, which
  433. might no longer be valid in the present, plus now with CHROOT it can change
  434. after C-Kermit starts.  Replaced all references to homdir to zhome() calls.
  435. ckuus[57].c, 26 Apr 2000.
  436.  
  437. Discovered that realpath() fails with ENOENT if given a wildcard, even though
  438. it does its job.  Added a check for this.  zfnqfp(): ckufio.c, 26 Apr 2000.
  439.  
  440. Found lots of ckufio.c functions didn't check their string-pointer arguments
  441. for NULL.  Fixed in ckufio.c, 26 Apr 2000.
  442.  
  443. Discovered that if zxpand() returned 0 because of an argument check, it left
  444. all its counts and pointers intact from the previous time it was called.
  445. Fixed in ckufio.c, 26 Apr 2000.
  446.  
  447. Added setroot checks to zopeno(), zchki(), zchko(), zdelet(), zrename(),
  448. zcopy(), zgperm(), zfcdat(), zstime(), zmail(), zprint(), zmkdir(), and
  449. zrmdir() (this was already in zchdir() and zopeni()).  Made zhome() return the
  450. root directory.  We now have a pretty solid access restriction mechanism that
  451. works as long as we go thru ckufio.c for file access.  ckufio.c, 26 Apr 2000.
  452.  
  453. What we don't have is a way to make the path left of the root invisible.
  454. Doing that would be a very big deal, involving conversion of every filename in
  455. every spot where they are referred to or displayed -- not worth the trouble or
  456. the risk.
  457.  
  458. Also note that CHROOT has to set NOPUSH because there is no way it can control
  459. what the user does if she PUSHes, or gives a system command.  This is another
  460. difference from system chroot.
  461.  
  462. Still to do:
  463.  . Make a front end for fopen() to be used in the mainline code.
  464.  . Give appropriate error messages when root violations occur.
  465.  . Consider allowing multiple roots rather than just one.
  466.  
  467. Multiple roots are simple in theory -- just change zsetroot(), zinroot(),
  468. and the CHROOT command parser to account for them.  But in practice this
  469. could be quite confusing -- which root is "home", etc.  Plus in UNIX, this
  470. whole idea would be very foreign.  Maybe it would make sense in Windows.
  471.  
  472. Now for fopen()...  The trick would be something like this in ckcdeb.h:
  473.  
  474. #ifdef CKROOT
  475. #ifdef fopen
  476. #undef fopen
  477. #endif /* fopen */
  478. #define fopen ckfopen
  479. /* and then a prototype for ckfopen */
  480. #endif /* CKROOT */
  481.  
  482. and like this in ckufio.c:
  483.  
  484. #ifdef CKROOT
  485. static FILE *
  486. ckfopen(name,mode)  char * name, * mode; {
  487.     if (!zinroot(name)) {
  488.     debug(F110,"ckfopen setroot violation",name,0);
  489.     return(0);
  490.     }
  491.     debug(F110,"ckfopen setroot ok",name,0);    
  492. }
  493. #endif /* CKROOT */
  494.  
  495. But some experimentation shows that zinroot() always succeeds because C-Kermit
  496. never tries to open a file without first parsing its name, and the parse has
  497. already made the check thru zxpand(), zchko(), or other ckufio.c function.
  498. The only exception is for filenames hardwired in the code: the init file, the
  499. IKSD conf file, the fwdx_xauthfile.  Do we care about these?  Init file: No,
  500. because there would be no way to set the root before executing the init file
  501. anyway, not even if there was a chroot command-line option, since the init
  502. file is executed first (if the init file itself includes a CHROOT command, of
  503. course it will be effective for all subsequent commands in the init file).
  504. The IKSD conf file?  No, because IKSD does a real (system) chroot(), so Kermit
  505. CHROOT is irrelevant.  How about fwdx_xauthfile?  Assuming we don't care about
  506. it either, we're done except for cosmetics, testing, and documentation.
  507.  
  508. Added zgetroot() to return the root directory.  ckufio.c, 27 Apr 2000.
  509.  
  510. Added root display to SHOW FILE.  ckuus4.c, 27 Apr 2000.
  511.  
  512. Added SET ROOT (visible) as a more proper name for CHROOT (invisible).
  513. ckuusr.h, ckuus[r3].c, 27 Apr 2000.
  514.  
  515. Made zinroot() set a global flag, ckrooterr, to its result.  Higher level
  516. clients of zopeni(), zxpand(), etc, can check this flag to see if the error
  517. was a normal one (e.g. that sets errno) or a root violation, and tailor their
  518. error messages accordingly.  ckufio.c, 27 Apr 2000.
  519.  
  520. Added prototypes for new functions to ckcdeb.h and ckuusr.h, 27 Apr 2000.
  521.  
  522. Fixed up most error messages.  ckcker.h, ckuus[r7x].c, ckucmd.c, 27 Apr 2000.
  523.  
  524. Added SET ROOT / CHROOT help text.  ckuus2.c, 27 Apr 2000.
  525.  
  526. "type" with no filename didn't give an error message.  Fixed in ckuusr.c,
  527. 27 Apr 2000.
  528.  
  529. A user noticed that the QNX 32-bit binary did not have BIGBUFOK set, and so
  530. couldn't handle large loops.  Fixed in ckcdeb.h, makefile, 28 Apr 2000.
  531.  
  532. From Jeff, 28 Apr 2000:
  533.  . Fix problems with TYPE, askmore(), etc, while executing IKSD.CNF, ckuusx.c.
  534.  . Enable CKROOT for K95.  ckcdeb.h.
  535.  . Add zinroot(init-file) checks.  ckuus5.c.
  536.  . Improved wording of some login error messages.  ckcmai.c.
  537.  . Some code-shuffling in ckufio.c.
  538.  
  539. Reformatted Jeff's ckcmai.c messages since they were longer than 80 columns.
  540. 28 Apr 2000.
  541.  
  542. Changed Jeff's changes to doinit() to not peek at private variables.  There's
  543. no need; just call zinroot() on the filename.  The checks to ckrootset, etc,
  544. are just micro-performance-enhancers.  ckufio.c, ckuus5.c, 28 Apr 2000.
  545.  
  546. From Jeff: SET IKS ANONYMOUS commands, including ROOT.  ckuusy.c, 28 Apr 2000.
  547.  
  548. Added PROMPT command.  This is like DO or TAKE, but it enters a new command
  549. stack frame with the command source pointed at the keyboard.  This is useful
  550. for debugging scripts.  Use the END command to return to the previous command
  551. stack level.  ckuusr.[ch], ckuus2.c, 28 Apr 2000.
  552.  
  553. Fixed SHOW STACK and RETURN to allow for non-zero command levels to be PROMPT,
  554. rather than DO or TAKE.  Thus either END or RETURN can be used to return from
  555. the prompt to the level that invoked it, with their usual effects (END 1, END
  556. 0, etc; RETURN <value>).  STOP and EXIT have their usual effects too, as do
  557. Ctrl-C and TRACE.  ckuus[r5].c, 28 Apr 2000.
  558.  
  559. Changed VMS, AOS/VS, VOS zfnqfp's to set the len member of the returned struct
  560. to the actual length of the full pathname.  For some reason I never bothered
  561. doing that before.  The length was never used until the SET ROOT code needed
  562. it.  ck[vdl]fio.c, 28 Apr 2000.
  563.  
  564. Added -DPOSIX_CRTSCTS to Solaris entries 2.4 and later, since it appears
  565. a switch was made from the SVR4 hwfc API to the POSIX one, and reports
  566. indicate the SVR4 one doesn't work at all in Solaris 2.4 and later, but the
  567. POSIX one does.  makefile, 28 Apr 2000.
  568.  
  569. Added DELETE /SUMMARY (only lists the summary, no heading, no file lines).
  570. ckuusr.h, ckuus[26].c, 28 Apr 2000.
  571.  
  572. Added a cast to rlog_ini() to squelch a compiler warning, ckcnet.c,28 Apr 2000.
  573.  
  574. Changed PROMPT command to include optional text to print.  ckuus[r2].c,
  575. 28 Apr 2000.  (NOTE: might want to make it actually set the prompt.)
  576.  
  577. Changed previous PROMPT command change to make the optional text be the prompt
  578. string itself, which goes on the stack, so that END/RETURN from this level
  579. restores the previous prompt automatically.  This involved adding a new
  580. cmgetp() routine to the command module.  ckucmd.[ch], ckuus[r2].c, 30 Apr 2000.
  581.  
  582. Added \v(iprompt), the current interactive prompt string ("\v(prompt)" was
  583. already used by SET LOGIN).  ckuusr.h, ckuus4.c, 30 Apr 2000.
  584.  
  585. HELP FUNCTION blah was messed up for the last 4 or 5 functions because
  586. break; statements were missing from the switch().  ckuus2.c, 30 Apr 2000.
  587.  
  588. Jeff: SHOW CONNECTION should not display encrypted status of a closed
  589. connection, since we don't know it any more.  ckuus3.c, 1 May 2000.
  590.  
  591. Discovered that CP1252 is erroneously equated with ISO Latin 1 in ckuxla.[hc].
  592. I'll have to fix this later.  Meanwhile, because of this, any loop that looked
  593. up the file character-set name from its index would return "cp1252" when the
  594. file character-set was Latin-1.  I added a special case for this in TRANSLATE
  595. and SET TERMINAL LOCAL-CHARACTER-SET.  Also, consolidated the various
  596. repetitive switch statements and loops that get the local display charset name
  597. into a new routine, getdcset().  ckuusr.[ch], ckuus7.c, 1 May 2000.
  598.  
  599. Added TYPE /TRANSLATE-FROM:cset /TRANSLATE-TO:cset (Synonyms: /XLATE-FROM to
  600. /XLATE-TO, /CSIN and /CSOUT).  By default no translation is done, as before.
  601. The default target character set, which is used if the /TRANSLATE-TO: switch
  602. is not given, or if <Tab> is typed after the colon, is the one returned by
  603. getdcset(), which in Unix is the file charset, and in Windows is the console
  604. character set.  Getting this to work (such as it does) wasn't easy, at least
  605. not without duplicating hundreds of lines of hairy code from xlate().  The
  606. object was to find a clever way to reuse (and not touch) existing code, and I
  607. seem to have done this in a roundabout way.  Still, the result is far from
  608. perfect:
  609.  
  610.  . For sanity, this code is included only if UNICODE is defined.
  611.  . /MATCH and /WIDTH might not work right, especially for multibyte sets.
  612.  . You can't TYPE a UCS-2 file.
  613.  
  614. It's also less than satisfying on Windows, since there is really no good way
  615. to know how to default the file character set: an OEM code page, a Windows
  616. code page, or UCS-2.  Or even (in Win 2000) UTF-8.  What does Microsoft do?
  617. They actually look at the contents of the file and decide what it is from
  618. statistics, yuk.  ckuusr.[ch], ckuus[26].c, 1 May 2000.
  619.  
  620. Adjusted TYPE command code to never assume that a buffer is NUL-terminated, or
  621. that the file to be typed does not contain NUL characters.  This was another
  622. substantial rewrite of dotype(); no more [ck]str[n]cpy(), no more strlen(), no
  623. more printf(), etc.  Replaced the printf() used to display each line with a
  624. call to a new function, typeline(), that can be filled in for each OS (it's
  625. currently blank for K95).  I also made some adjustments for /WIDTH vs UCS-2.
  626. Plus now you can TYPE a UCS-2 file and see something, even if it's only
  627. gibberish (at least the ASCII comes out right).  ckuus6.c, 2 May 2000.
  628.  
  629. Changed the TYPE switch syntax.  /CHARACTER-SET:name identifies the file's
  630. character set.  /TRANSLATE-TO: identifies the target character set; in K95,
  631. this is ignored; the typeout() routine automatically converts to the
  632. appropriate screen character-set.  Elsewhere, /TRANSLATE-TO: is used if given,
  633. and defaults to the current file character-set. ckuus[r2].c, 2 May 2000.
  634.  
  635. Made sure that TYPE /MATCH works, at least for single-byte sets.  It is
  636. applied after translation to the target set.  There's no way to specify a
  637. UCS-2 pattern anyway.  2 May 2000.
  638.  
  639. From Jeff: Better charset defaults for TYPE command in K95.  ckuusr.h,
  640. ckuus[r6].c, 3 May 2000.
  641.  
  642. Added code to handle TYPE'ing in K95 when the source charset is unknown.
  643. ckuus6.c, 3 May 2000.
  644.  
  645. Discovered that "for \%i 1 \%n 1 { echo \frandom(4) }" printed 0 1 2 3
  646. 0 1 2 3 0 1 2 3, etc -- not random at all -- on SunOS but not on Linux or
  647. Solaris (didn't test elsewhere).  Added an additional randomizer for this
  648. case.  ckuus4.c, 4 May 2000.
  649.  
  650. Discovered that COPY /SWAP didn't work right because of sign extension.
  651. Made it treat the characters as unsigned.  Sigh.  ckuus6.c, 5 May 2000.
  652.  
  653. The problem with TYPE in K95 is definitely byte-order related.  We have two
  654. global variables, byteorder and ucsorder.  What are they?
  655.  
  656.   byteorder = machine's natural byte order.
  657.   ucsorder  = SET FILE UCS BYTE-ORDER value, supersedes byteorder.
  658.  
  659. If no SET FILE UCS BYTE-ORDER command has been given, ucsorder takes the
  660. value of byteorder.
  661.  
  662. But neither of these says what the byte order of the actual file is, in case
  663. it was switched because of the BOM, which supersedes both byteorder and
  664. ucsorder.  So I added a new one:
  665.  
  666.   fileorder = byte order of current file.
  667.  
  668. (Turns out this wasn't actually needed.)
  669.  
  670. But there is still more confusion.  In which order does xgnbyte() return its
  671. bytes when translating to UCS2?
  672.  
  673.   Bigendian: If filling packets (what == W_SEND) or if ucsorder == BE.
  674.   Little endian: Otherwise.
  675.  
  676. OK, so on the Sun (BE) TYPE gets the bytes back from xgnbyte() in BE order,
  677. and TYPE /CHAR:xxx works right for UCS-2 files that are either BE or LE, as
  678. well as for UTF-8 and all other character sets.
  679.  
  680. But no TYPE /CHAR:xxx command works on Linux/Intel, which is Little Endian.
  681. Why?  We send bytes to xpnbyte() in the order we receive them from xgnbyte().
  682. But xpnbyte() assumes that incoming UCS-2 bytes are in BE order; in this case,
  683. they aren't.  Evidently we must be taking some path through the code that was
  684. never taken before because all the other translation methods work (file
  685. transfer, TRANSLATE, and TRANSMIT).
  686.  
  687. Finally, it turned out that byte-swapping was not applied consistently by
  688. xgnbyte().  There was one place where it let the end of line slip through
  689. without swapping, even though it was swapping all the other bytes, and this is
  690. what was clobbering TYPE, since it looks for the end-of-line.  Fixed in
  691. ckcfns.c, 5 May 2000.
  692.  
  693. All kinds of TYPE /CHAR: combinations were tested on both Sun (BE) and Linux
  694. (LE) successfully.  However, it's possible that a last-minute byte-swap of the
  695. line buffer might be needed for K95 in typeline().
  696.  
  697. Fixed bad parser recovery from "type /char:<SP>".  ckuusr.c, 5 May 2000.
  698.  
  699. Jeff built new K95G and found that:
  700.  
  701. > TYPE ckctel.h:
  702. > . line counts are completely off but otherwise appears to display the
  703. >   file correctly
  704. The non-charset-aware part of typegetline() was looking for CRLF but K95
  705. zchin() was never returning CR.  Changed to look only for LF.
  706.  
  707. > TYPE /char:utf8 utf-8-test.txt
  708. > . displays nothing
  709. Debug log shows that typeline() is being given a buffer in proper UCS-2
  710. Little Endian format.  So this problem must be in the K95 section of
  711. typeline().  However, I did notice that there was junk at the end of the
  712. buffer and the length was an odd number (but this would not cause the
  713. void display).  Fixed typegetline() to properly detect and lop CRLF,
  714. and fixed the debug(F011) format to produce a more useful result.
  715.  
  716. > TYPE /char:utf8 ckctel.h
  717. > . displays garbage
  718. As it should.
  719.  
  720. > SET TERMINAL UNICODE OFF
  721. > TYPE ckctel.h:
  722. > . displays data as NUL char NUL char NUL char ....
  723. I changed typegetline() to check tt_unicode.  If set, it always translates
  724. to UCS-2.  If not set, it translates to whatever outcs is.
  725.  
  726. From Jeff: Fixes to K95 aspects of TYPE command.  ckuus6.c, 7 May 2000.
  727.  
  728. Tested latest K95G.EXE on Win95.  It works for all cases except /CHAR:UCS2.
  729. In this case it looks like synchronization is lost on alternate lines.  So the
  730. first line comes out OK, but the second line is appended to it as bunch of
  731. blobs, and so on through the file.  Debug log shows the following buffer
  732. passed to typeline() (for the latin1.txt file):
  733.  
  734.   I<NUL>S<NUL>O<NUL> <NUL>8<NUL>8<NUL>5<NUL>9<NUL>-<NUL>1<NUL> <NUL>L<NUL>
  735.   a<NUL>t<NUL>i<NUL>n<NUL> <NUL>A<NUL>l<NUL>p<NUL>h<NUL>a<NUL>b<NUL>e<NUL>
  736.   t<NUL> <NUL>1<NUL><CR><LF><NUL>c<NUL>h<NUL>a<NUL>r<NUL> <NUL>d<NUL>e<NUL>
  737.   c<NUL> <NUL>c<NUL>o<NUL>l<NUL>/<NUL>r<NUL>o<NUL>w<NUL> <NUL>o<NUL>c<NUL>
  738.   t<NUL> <NUL>h<NUL>e<NUL>x<NUL> <NUL> <NUL>d<NUL>e<NUL>s<NUL>c<NUL>r<NUL>
  739.   i<NUL>p<NUL>t<NUL>i<NUL>o<NUL>n<NUL><CR>
  740.  
  741. Notice the <CR><LF> with no intervening NUL, which puts the next line out of
  742. phase, and the trailing <CR> with no <NUL> after it.  A closer look at the
  743. debug log shows that in this case, the wrong (non-translating) section of
  744. typegetline() is being executed, probably because incs == outcs.  So I
  745. rearranged the code to ensure that the translating section of typegetline()
  746. would be executed if the source character set is UCS-2.  It works fine in Unix
  747. but I can't test it in K95 until the next build.  ckuus6.c, 7 May 2000.
  748.  
  749. Fixed some parsing glitches in TYPE /CHAR:xxx.  ckuusr.c, 7 May 2000.
  750.  
  751. Because the default character-set in C-Kermit is ASCII, TYPE /CHAR: tended to
  752. show lots of ?'s if you started C-Kermit without specifying a file
  753. character-set or /TRANSLATE-TO switch.  Added a new environment variable,
  754. K_CHARSET.  This sets the file character-set when Kermit starts up, before
  755. reading the init file (if it does).  This allows the file character-set to be
  756. set even when the init file is not executed.  ckuus5.c, 7 May 2000.
  757.  
  758. Added SIGINT handler to TYPE, since it was liable to malloc arbitrary amounts
  759. of space that would never be freed if regular SIGINT trap was used.  ckuus6.c,
  760. 7 May 2000.
  761.  
  762. So for the record, here's how the character-set stuff in TYPE works:
  763.  
  764. If you TYPE a file without giving a /CHARACTER-SET switch, it simply dumps
  765. the lines to the screen and all the other switches apply normally.
  766.  
  767. If you give a /CHARACTER-SET:xxx switch, this tells Kermit that the file's
  768. character set is xxx, and it should translate it to the character-set
  769. specified in the /TRANSLATE-TO:yyy switch, or if none given, to the current
  770. file character set.  Except that in K95, the /TRANSLATE-TO switch is ignored
  771. and the file is always translated to the code page appropriate to your
  772. screen.
  773.  
  774. If the source character-set is UCS-2, then the byte order is determined as
  775. follows:
  776.  
  777.  1. If the file begins with a Byte Order Mark (BOM), this determines the
  778.     byte order; otherwise:
  779.  
  780.  2. If a SET FILE UCS BYTE-ORDER command was given, the specified byte order
  781.     is used; otherwise:
  782.  
  783.  3. The natural byte order of the underlying computer hardware is used.
  784.  
  785. If the target character-set is UCS-2, the byte order is the natural hardware
  786. byte order.
  787.  
  788. File lines are identified based on the source-file character set.  Switches
  789. such as /MATCH, however, are applied on the translated line.
  790.  
  791. New K95G build from Jeff.  TYPE /CHAR:UCS2 now works fine, except the line
  792. counts are bit off.  Actually, this happens no matter what the character set,
  793. and even if /CHAR: not specified.  It's not a factor-of-two thing either -- it
  794. stops at 16 lines on a 25-line screen.  Debug log shows cmd_rows is correct
  795. (25).  Problem: The askmore() code checks the length of a line to see if it
  796. will wrap.  But if it's UCS-2, the length is double.  Fixed in dotype().  Also
  797. noticed a potential problem in tab expansion versus UCS-2, also fixed in
  798. dotype().  ckuus6.c, 8 May 2000.
  799.  
  800. From Jeff: HTTP CONNECT.  Built-in SOCKS support for K95.  ckcnet.[ch],
  801. ckcmai.c, ckuus[r5].c, 8 May 2000.
  802.  
  803. From Jeff: Minor changes to HTTP CONNECT & SOCKS, SHOW FEATURES.
  804. ckcdeb.h, ckuusr.h, ckuus[235].c, ckuath.c, ckcnet.c, 9 May 2000.
  805.  
  806. From Jeff: Change TYPE command not to show UCS BOM.  ckuus[r6].c, 9 May 2000.
  807.  
  808. From Jeff: HTTP proxy support, SHOW TCP command.  ckcnet.c ckuus4.c ck_ssl.c
  809. ckuath.c ckuus2.c ckuus3.c ckuusr.c ck_ssl.h ckuusr.h ckcmai.c ckcdeb.h,
  810. ckuus5.c, 10 may 2000.
  811.  
  812. Added a new routine: chkfil(name,flags).  Given the name of a file, analyzes
  813. the first 4K of its contents to see if it is text or binary and, if text,
  814. whether it is 7-bit text, 8-bit text, UTF-8, UCS-2/LE, or UCS-2/BE.  On a
  815. Sparc-20, this routine takes about 0.025 second to execute, primarily due to
  816. the file open/read/close sequence, which does not seem too painful.  Can be
  817. built with or without Unicode support; if built without, simply tells whether
  818. the file is text or binary.  ckuusr.h, ckuusx.c.  10 May 2000.
  819.  
  820. If UNICODE is defined at compile time, call chkfil() from TYPE if
  821. /CHARACTER-SET was not specified.  This allows TYPE to recognize and handle
  822. Unicode files automatically.  Also made some corrections for the non-Unicode
  823. case.  ckuusr.c, 10 May 2000.
  824.  
  825. Cleaned up and fixed NOUNICODE build.  ckuus6.c, 10 May 2000.
  826.  
  827. chkfil() can have other uses too -- for example, it can be used instead of, or
  828. to supplement, filename patterns for SET TRANSFER MODE AUTOMATIC.  In a way,
  829. it's better than patterns, so it really could replace them.  But since
  830. patterns are already in use, this would be an incompatible change, so all we
  831. can do is call chkfil() if no patterns match.  So if users want to skip the
  832. hokey name patterns and use chkfil() instead, they can simply SET FILE
  833. PATTERNS OFF and then not only will every file be sent in text or binary mode
  834. based on its actual contents, regardless of its name, but also Kermit will
  835. switch character sets automatically for text files:
  836.  
  837.  . If file is UTF-8, it switches the transfer charset to whatever
  838.    is associated to UTF-8 -- if anything -- otherwise to the currently
  839.    selected transfer character set.  Ditto for UCS-2.
  840.  
  841.  . If the file is not UTF-8 or UCS-2, it switches back to the prevailing
  842.    file and transfer character sets.
  843.  
  844.  . When receiving, and the transfer character set has suddenly switched
  845.    to (say) UCS-2, the receiving Kermit handles this based on all its
  846.    preexisting settings: SET UKNOWN CHARACTER-SET, its association for
  847.    UCS-2 (if any), or else its current file character-set.
  848.  
  849. Added code for all this to sfile().  ckcfns.c, 10 May 2000.
  850.  
  851. As matters stand, there is no way to restore the C-Kermit 7.0 behavior for
  852. files whose names don't match any patterns.  For this we need Yet Another
  853. SET Command: SET FILE INSPECTION { ON, OFF }, with its status displayed in
  854. SHOW FILE.  ckcker.h, ckuus[247].c, 10 May 2000.
  855.  
  856. Added a chkfil() call to DIRECTORY /XFERMODE, so now it really can show what
  857. mode each file would be transferred in.  ckuus6.c, 10 May 2000.
  858.  
  859. Suppose we have FILE PATTERNS ON, FILE INSPECTION ON, and FILE CHARACTER-SET
  860. LATIN1, and we "send *".  Now suppose we have a UTF-8 or UCS-2 file with a
  861. text filetype like utf8.txt.  The pattern code will switch to text mode, but
  862. not to UTF-8 -- it will misinterpret the file as Latin-1.  So this means we
  863. should probably call chkfil() even if the pattern check succeeded and found
  864. text.  For that matter, we should call chkfil() if it found binary too, in
  865. case the pattern was wrong or inappropriate (e.g. a VMS .COM file (text) on a
  866. Windows computer where .COM files are binary, or on a .DOC file that can be
  867. either plain text or MS Word).  So in other words, we should always call
  868. chkfil(), which in turn makes "set file patterns" useless:
  869.  
  870.  . If patterns and chkfil() agree, we didn't need patterns.
  871.  . If patterns and chkfil() disagree, chkfil() takes precedence.
  872.  
  873. There really is no reason to keep patterns, but they are already documented
  874. and in use.  What's the graceful way out of this?  State that inspection takes
  875. precedence over patterns, so if inspection is on, patterns are ignored.  If
  876. inspection is off but patterns are on, patterns are used.  OK done: ckcmai.c,
  877. ckcfns.c, ckuus[457].c, 11 May 2000.
  878.  
  879. (Actually, there is one benefit to patterns: users can change them, whereas
  880. they can't change the chkfil() algorithm except by changing the code.)
  881.  
  882. Next problem: we need a new set of associations for when chkfil() finds a
  883. 7- or 8-bit text file and its current file character-set is not appropriate:
  884.  
  885.  . What is the default character-set for 7-bit text?
  886.  . What is the default character-set for 8-bit text?
  887.  
  888. And new commands for them:
  889.  
  890.  SET FILE DEFAULT 7BIT-CHARACTER-SET xxx
  891.  SET FILE DEFAULT 8BIT-CHARACTER-SET xxx
  892.  
  893. Done.  The default default 7-bit character set is ASCII; the default default
  894. 8-bit one is the same as the default file character-set, which depends on the
  895. platform.  ckcker.h, ckuxla.c, ckuus[27].c, 11 May 2000.
  896.  
  897. SET FILE CHARACTER-SET also must set this: if the name given is that of a
  898. 7-bit set, this also sets the default 7-bit set; ditto for 8-bit.  ckuus7.c,
  899. 11 May 2000.
  900.  
  901. Added the default 7- and 8-bit sets to SHOW FILE and SHOW CHARACTER-SET.
  902. ckuus4.c, 11 May 2000.
  903.  
  904. Now the real stuff: in sfile(), we now switch automatically to the default
  905. 7-bit set if chkfil() said FT_7BIT and to the default 8-bit set if it was
  906. FT_8BIT.  This allows, for example, a mixture of binary, UCS-2, UTF-8,
  907. Latin-1, and German ISO 646 files to be sent in a single group.  Obviously,
  908. however, we can't switch automatically between (say) Latin-1 and Latin-2, or
  909. German and Spanish.  I didn't do anything special about Kanji -- if anybody
  910. notices, then I'll worry about it (I haven't heard a peep about Kanji
  911. conversions since 1994, when we first put them in, so I truly doubt if anybody
  912. is using them).  ckcfns.c, 11 May 2000.
  913.  
  914. Fixed a typo in HELP PURGE.  ckuus2.c, 11 May 2000.
  915.  
  916. Fixed a problem with FSEEK /LINE \%c LAST.  It failed to work if it was
  917. already at or after the beginning of the last line.  ckuus7.c, 11 May 2000.
  918.  
  919. K95 TYPE is broken again.  It can't handle a Big-Endian UCS-2 file.
  920. Furthermore, once I try to type such a file, then it can't type any other kind
  921. of file thereafter.  It doesn't matter if the BE file has a BOM or not.  The
  922. problem is that we set the ucsorder flag based on the chkfil() result (in case
  923. this file didn't have a BOM, so the subsequent open() and xgnbyte() sequence
  924. won't detect it).  But ucsorder is a global and persistent flag.  Remember:
  925.  
  926.   byteorder = native byte order for hardware (doesn't change)
  927.   ucsorder  = SET FILE UCS BYTE-ORDER value (only changed by user)
  928.   fileorder = byte order detected for current file (detected per file)
  929.  
  930. I was using ucsorder in some places where I should have been using fileorder.
  931. Plus some other mistakes.  Fixed in ckuus[r6x].c, ckcfns.c, ckuxla.c,
  932. 12 May 2000.
  933.  
  934. Tightened up the Ctrl-C handling in dotype().  ckuus6.c, 12 May 2000.
  935.  
  936. Here, by the way, is a command file that sends a mixture of files (Unix):
  937.  
  938.   set xfer mode auto     ; This is the default
  939.   set xfer char latin1   ; Because TRANSPARENT is the default
  940.   set file char german   ; This sets the default for 7-bit text files
  941.   set file char latin1   ; This sets the default for 8-bit text files
  942.   assoc file ucs2 utf8   ; Because there is no association by default
  943.   assoc file utf8 utf8   ; Ditto
  944.   send *
  945.  
  946. Everything works perfectly on the Sun, as usual, but in Windows we still can't
  947. type Big-Endian UCS-2 files (but, as usual, TRANSLATE works on the same files).
  948. But oddly enough, everything works fine on PC Linux, which is Little Endian.
  949.  
  950. The difference is that in Linux, we are outputting in Latin-1, whereas in
  951. Windows, it's in UCS-2...
  952.  
  953. Aha, here's the problem: we read the first two bytes of the file and put them,
  954. left to right, into a USHORT.  Then we compare the USHORT with 0xFEFF and if
  955. equal, then we say the file order is 0, i.e. BE.  If it's 0xFFFE, we say it's
  956. 1 (LE).  The fallacy is that if we read FF and then FE on an LE machine, the
  957. USHORT will look like FEFF, not FFFE.  And vice versa.  So...
  958.  
  959.   Machine  File Bytes   USHORT   Fileorder
  960.     BE       FE FF       FEFF       BE     <-- Machine order
  961.     BE       FF FE       FFFE       LE
  962.     LE       FE FF       FFFE       BE
  963.     LE       FF FE       FEFF       LE     <-- Machine order
  964.  
  965. In other words, whenever the BOM, saved in a USHORT, is 0xFEFF, the file is
  966. in the machine's native byte order.
  967.  
  968. Well, that sounds good, but it's not enough.  Now K95G does the opposite of
  969. what it did before.  After uncovering & fixing several layers of problems now
  970. all that's left is is xpnbyte().  What was wrong?  We were outputting the
  971. bytes in fileorder rather than ucsorder.  Remember:
  972.  
  973.  fileorder: applies to input file.  Set by chkfil or xgnbyte, used by xgnbyte.
  974.  ucsorder:  applies to output file. Set by user & used by xpnbyte.
  975.  
  976. (ucsorder is also used for input when we don't have BOM and detection is not
  977. active.)
  978.  
  979. ucsorder is the same as byteorder by default, but can be changed by the user
  980. in case they want to write out a file opposite to the machine's natural order.
  981. Of course that wouldn't make much sense when TYPEing...  But never let it be
  982. said we didn't let users do what they want.
  983.  
  984. Files changed: ckuus6.c, ckcfns.c, ckuxla.c, 12 May 2000.
  985.  
  986. To do:
  987.  . Clean out most of the debug calls.
  988.  . Check file transfer.
  989.  . Uncouple CP1252 from Latin-1.
  990.  . Maybe add an ANALYZE command.
  991.  
  992. From Jeff: Change inappropriate #ifdefs (NOICP) around hints to NOHINTS.  Fix
  993. TYPE to work in K95 with stdout.  Fix TRANSLATE and TYPE commands on
  994. Little-Endian platforms.  Add hint when Telnet negotiations are taking more
  995. than 15 sec.  SSL changes.  cku{con,cns}.c, ckuus[46].c, ckctel.c, ck_ssl.c,
  996. 16 May 2000.
  997.  
  998. Changed version number to 7.1.199, since we are now contemplating making the
  999. new sources public to testers.  ckcmai.c, 16 May 2000.
  1000.  
  1001. xgnbyte() was originally intended for reading bytes from a file and
  1002. translating to Kermit's transfer character set.  Let's make sure this still
  1003. works:
  1004.                            Platform
  1005.   FCS      TCS    FCS      LE    BE
  1006.   latin1   ucs2   latin1   ok    ok
  1007.   ucs2     ucs2   latin1   ok    ok
  1008.   latin1   latin1 latin1   ok    ok
  1009.   ucs2     latin1 latin1   ok    ok
  1010.  
  1011. Why does this work, despite all the recent confusion?  Because there is a
  1012. special test for (what == W_SEND) to use a translation function that returns
  1013. the bytes in Big Endian order.  Added a note to this effect to the xgnbyte()
  1014. heading.  ckcfns.c, 16 May 2000.
  1015.  
  1016. So when we are not sending a file with Kermit protocol (what != W_SEND),
  1017. inspection of the code seems to indicate that xgnbyte() returns UCS-2 bytes 
  1018. in native order, i.e. byteorder (not fileorder, not ucsorder).
  1019.  
  1020. But In typegetline(), we are using fileorder, rather than byteorder, to decide
  1021. whether to swap bytes before sending them to xpnbyte().  And yet the TYPE code
  1022. seems to work.  Does it really?  Using the current code:
  1023.  
  1024.   Arch   File
  1025.    BE    Latin-1          OK
  1026.    BE    UCS2 BE BOM      OK
  1027.    BE    UCS2 BE No BOM   OK
  1028.    BE    UCS2 LE BOM      OK
  1029.    BE    UCS2 LE No BOM   OK
  1030.    BE    UTF8             OK
  1031.    LE    Latin-1          OK
  1032.    LE    UCS2 BE BOM      OK
  1033.    LE    UCS2 BE No BOM   OK
  1034.    LE    UCS2 LE BOM      OK
  1035.    LE    UCS2 LE No BOM   OK
  1036.    LE    UTF8             OK
  1037.  
  1038. The LE ones were done both in Linux and K95G.  So I guess I still don't
  1039. understand how xgnbyte() works!  But it does.  Will revisit this as needed.
  1040.  
  1041. Meanwhile, XLATE <file> <cset1> <cset2> didn't work if cset1 == cset2 when
  1042. Kermit was built with UNICODE defined.  Fixed in xlate(), ckuus4.c,
  1043. 16 May 2000.
  1044.  
  1045. From Jeff: In IKSD, don't let guests use the ENABLE command.  Add code for
  1046. mouse debugging.  Replace lots of strcat()'s with new ckstrncat().  Add K95
  1047. command-window status line.  Better checking of guest status in zmkdir().
  1048. Added SET TELOPT LOGOUT.  Add --account: command-line option for IKSD.  Fix
  1049. SET IKS ANON ROOT to parse directory rather than file name.  Make default
  1050. language for SNI 97801 be German rather than North-American.  Adjust to new
  1051. Microsoft NTLM formats.  ckuath.c ckctel.c ckcnet.c ckuus7.c ckuus3.c ckuusy.c
  1052. ckuus5.c ckuusx.c ck_ssl.c ckuusr.c ckufio.c ckuus2.c ckuus4.c ckcmai.c
  1053. ckuusr.h ckcpro.w ckcdeb.h ckuus6.c ckctel.h, 20 May 2000.
  1054.  
  1055. There was still one place in the help text where the term "regular
  1056. expressions" was used (HELP INPUT).  These are patterns, not regular
  1057. expressions (true regular expressions let us match, e.g. zero (or one) or more
  1058. digits; patterns can't do that).  Changed the text to say "help patterns", and
  1059. added an invisible "help patterns" command.  Fixed all other references to
  1060. "regular expression".  ckuus[r2].c, 20 May 2000.
  1061.  
  1062. CL used to be sufficient to abbreviate CLOSE; fixed it so it is again.  Ditto
  1063. for CL[OSE] P[ACKET-LOG].  ckuusr.c, 20 May 2000.
  1064.  
  1065. From Jeff: corrections to new K95 command-window status line code, plus some
  1066. auth stuff.  ckcmai.c, ckuus[7x].c, ckuath.c, 21 May 2000.
  1067.  
  1068. The DELETE command lacked a /RECURSIVE option.  Added the switch and runtime
  1069. actions to dodel().  This allows deleting of all (or selected) files in a
  1070. tree, but not directories.  ckuus6.c, 21 May 2000.
  1071.  
  1072. Added a /DIRECTORY switch, which means "delete directories too".  The
  1073. objective is to do what DELTREE does in DOS, or "rm -Rf" does in Unix.  For
  1074. this to work, all files must be deleted from each directory before the
  1075. directory itself can be deleted.  I thought this was going to require the
  1076. construction of an in-memory tree and depth-first traversal of it, and
  1077. therefore an arbitrary amount of memory, which is why I had been putting it
  1078. off.  But then I realized that given the recursive file list, I can simply
  1079. sort it in reverse order, which guarantees files will be deleted before their
  1080. containing directories.  This is trivial in Unix, where we have direct access
  1081. to the "mtchs" array; I don't know about other platforms.  Anyway, this works
  1082. fine in Unix.  So:
  1083.  
  1084.   DELETE /RECURSIVE /DIRECTORY /DOTFILES *
  1085.  
  1086. deletes all the files in the current directory and all the directory trees
  1087. rooted in the current directory.  In K95, of course, the /DOTFILES switch
  1088. isn't necessary.  ckuus6.c, 21 May 2000.
  1089.  
  1090. Added DELETE /ALL as a shortcut for DELETE /RECURSIVE /DIRECTORY /DOTFILES.
  1091. ckuusr.h, ckuus[26].c, 21 May 2000.
  1092.  
  1093. Of course there are minor hitches, like:
  1094.  
  1095.   DELETE /RECURSIVE /DIRECTORY /DOTFILES foo
  1096.  
  1097. where "foo" is the name of a directory, deletes everything in foo but not
  1098. foo itself.  That's because zxpand(), when given a directory name, treats it
  1099. as "name/*", so in this case we add the name of the directory to the end of
  1100. the list.  ckuus6.c, 21 May 2000.
  1101.  
  1102. Next hitch (Unix only): DELETE /ALL xxx, where xxx is a symlink to a
  1103. directory, follows and expands the symlink instead of deleting it, and
  1104. therefore deletes the directory tree pointed to by the symlink, not good.
  1105. That's because when 'recursive' is set, we open directories, and a symlink to
  1106. a directory passes the isdir() test.  DELETE xxx (no /RECURSIVE) deletes the
  1107. only symlink itself, which is what we want in the recursive case too.  To get
  1108. around this required defining a new ZX_NOLINKS flag bit for nzxpand(), which
  1109. we must test in traverse().  To pass this option from the user interface to
  1110. nzxpand() required changing argument 5, 'd', to cmifi2(), to be a bitmask.
  1111. Bit 0 (still) says whether directories should be included, and the new bit 1,
  1112. if set, means "don't follow symlinks".  Then cmifi() and friends (cmdir(),
  1113. cmifip()) can form the appropriate flags argument for nzxpand().  ckcdeb.h,
  1114. ckucmd.c, ckufio.c, ckuus6.c, 21 May 2000.
  1115.  
  1116. I looked at COPY and RENAME to see what it would take to allow them to accept
  1117. wildcards.  The idea would be that if the destination was a directory name,
  1118. wildcards in the source would be OK since the destination files could have the
  1119. same name (I did NOT consider fancier options, such as "rename *.doc *.txt").
  1120. But COPY is tough because some of options, like /APPEND, would not fit, and
  1121. also because of the mixed modes of copying (zcopy() versus inline
  1122. fopen/fread/fwrite/fclose loops)...
  1123.  
  1124. RENAME looks more manageable.  But in poking at it I noticed a bug:
  1125. "rename foo bar", where foo is a directory that contains exactly one file,
  1126. renames that file to bar, rather than the directory itself, oops.  This
  1127. was easily fixed by setting 'd' to 1 in the cmifi() call.  ckuus6.c,
  1128. 21 May 2000.
  1129.  
  1130. Changed RENAME to allow wildcards in first argument if second argument is a
  1131. directory name, and then put the zrename() call in a loop, so now RENAME
  1132. handles multiple files (including directories).  Incidentally, nothing would
  1133. be gained by adding a /RECURSIVE switch, because when you rename a directory,
  1134. you "move" its contents -- the entire subtree -- to a new location.
  1135. ckuus[26].c, 21 May 2000.
  1136.  
  1137. Added checks to zrename() and zcopy() for IKSD with DISABLE DELETE when
  1138. target file already exists.  ckufio.c, 21 May 2000.
  1139.  
  1140. Discovered that Unix zcopy() could truncate the last character of the
  1141. destination if it was a directory.  Fixed in ckufio.c, 21 May 2000.
  1142.  
  1143. Discovered that COPY never worked if the target was a directory name and any
  1144. of /APPEND, /SWAP, /FROMB64, or /TOB64 was given.  Fixed in ckufio.c,
  1145. 21 May 2000.
  1146.  
  1147. Discovered that COPY, when given the /APPEND, /SWAP, /FROMB64, or /TOB64
  1148. options, did not check if the source and destination files were identical; if
  1149. they are, the original file is clobbered.  Fixing this required adding a new
  1150. API: zcmpfn(s1,s2) - "compare two filenames"; returns 1 if they refer to the
  1151. same file.  ckufio.c, ckuus6.c, ckcplm.txt, 21 May 2000.
  1152.  
  1153. Discovered that zcopy(), when it discovered the source and destination files
  1154. were identical because they had the same inode, returned the wrong error
  1155. code (-3 instead of -5).  Fixed in ckufio.c, 21 May 2000.
  1156.  
  1157. Now back to COPY.  Rewrote the whole docopy() routine to allow multiple files
  1158. if the /APPEND switch is not given and the target is a directory.  Reworked
  1159. all the messages and feedback to be like DELETE.  ckuus[26].c, 21 May 2000.
  1160.  
  1161. From Jeff: Corrections to K95 Command-window status line.  ckuusx.c,
  1162. 22 May 2000.
  1163.  
  1164. Added code to dodel() for K95 to make a copy of the file list and sort it,
  1165. since in K95, znext() does not return filenames in any particular order,
  1166. nor is there a mtchs array that we can sort directly.  Also changed the
  1167. SORT /DIRECTORY switch to /DIRECTORIES, for consistency with the DIR command.
  1168. ckuus[26].c, 22 May 2000.
  1169.  
  1170. From Jeff: Changes for HTTP proxies, K95 URL highlighting, Telnet Uservars,
  1171. Telnet Env Location, SSL things, K95 Command-window status line, ON_LOGOUT
  1172. macro, fixes to MKDIR permission checking, simplification of WIKSD init file
  1173. search, disable IKSD user redefinition/deletion/display of ON_EXIT or
  1174. ON_LOGOUT.  ckctel.c ckuus7.c ckuus3.c ckuus5.c ckuus4.c ckufio.c ckcnet.c
  1175. ckuusx.c ckcmai.c ckuus2.c ckuusr.h ckcnet.h, 25 May 2000.
  1176.  
  1177. SET COMMAND HEIGHT and WIDTH were broken in non-K95 builds.  Fixed in
  1178. ckuus3.c, 25 May 2000.
  1179.  
  1180. Fixed "take ?" message not to look wrong in K95.  ckuusr.c, 25 May 2000.
  1181.  
  1182. Fixed expression evaluator to set error indication upon attempt to divide
  1183. by zero.  termp(): ckuus5.c, 25 May 2000.
  1184.  
  1185. This prevents \feval(\%x/0) from returning a value and makes it give an error,
  1186. but the error message is misleading ("argument not numeric").  Fixed evalx()
  1187. to set a special flag whenever divide-by-zero is attempted, and then retooled
  1188. fneval() to check the flag everywhere that evalx() is called, and return the
  1189. appropriate message (divide by zero versus arg not numeric).  Also caught a
  1190. couple functions that never did handle evalx() errors right, such as \flpad().
  1191. ckuus4.c, 25 May 2000.
  1192.  
  1193. Also discovered that \fn2hex() and \fn2oct() did not accept expressions, only
  1194. numbers.  Fixed in fneval(), 25 May 2000.
  1195.  
  1196. From Jeff: Force a prompt in IKSD if negotiated authentication fails; fix
  1197. resetting of command timer in cmkey(); fix extended cmdline options keywords
  1198. (xferlog,xferfile were switched) and add "--default-domain" for NT.
  1199. ckcmai.c, ckucmd.c, 27 May 2000.
  1200.  
  1201. SEND /COMMAND didn't work because it was checking the command with zchki() for
  1202. read-accessibility.  Fixed that, but it still didn't work because in this case
  1203. cmarg was not changed to point to the command.  Fixed that too.  doxsend():
  1204. ckuusr.c, 27 May 2000.
  1205.  
  1206. But now sfile() was having zfnqfp() put a full path on the front of the
  1207. F-packet name.  There was a lot of confusion in sfile() about when the thing
  1208. it was sending was or was not an actual file.  Simplified all the decisions by
  1209. adding a new variable, notafile, which is nonzero when whenever we SEND
  1210. /CALIBRATE, /COMMAND, /FILTER, or /ARRAY, and then replacing all the
  1211. complicated tests with tests of just this variable.  ckcfns.c, 27 May 2000.
  1212.  
  1213. But that's not all.  We were also putting bogus size & date info into the
  1214. A-packet.  Oops, this is a tough one.  sattr() is called after sfile().
  1215. sattr() calls zsattr() to fill in the attributes.  But zsattr() ASSUMES that
  1216. it is only used when sending actual files and that the file has already been
  1217. opened, its size has already been obtained, etc; the zsattr() API does not
  1218. include the file name.  Boy was that dumb.  So all this time, whenever we
  1219. called zsattr() when sending something other than a file, it was filling the
  1220. A-packet with garbage.  The easy way out is to simply not call zsattr() if
  1221. it's not a real file.  But we WANT certain items filled in, like text/binary
  1222. mode, etc, and (in the case of calibration) the size (since we know it in
  1223. advance).  Since we can't change the API, we'll have to make sattr() fill in
  1224. the attribute structure itself if it's not a real file.  ckcfn3.c,
  1225. 27 May 2000.
  1226.  
  1227. By the way, the bogus data in A-packet problem occurred not only with SEND
  1228. /COMMAND, etc, but also with *all* server responses to REMOTE commands, since
  1229. the beginning of time.  A day for discoveries!
  1230.  
  1231. Here's another: Noticed that chkfil() was being called by sfile() on commands,
  1232. calibration runs, etc.  Fixed sfile() to call chkfil() only for real files,
  1233. and chkfil() itself to return -1 if called during calibration runs or for
  1234. commands or filters.  ckcfns.c, ckuusx.c, 27 May 2000.
  1235.  
  1236. Dat Nguyen complained about not being able to define macros with names that
  1237. start with & or %.  This goes all the way back to C-Kermit 5A; the \%x and
  1238. \&x[] variables are kept internally without the \.  I thought it might be easy
  1239. to change this, but it wasn't and I backed off.  Way too dangerous.
  1240.  
  1241. From Jeff: #ifdef's for yesterday's changes because pipesend variable not
  1242. declared #ifndef PIPESEND.  Changed pipesend to be declared always to cut down
  1243. on the many #ifdefs.  ckcfn[s3].c, ckuusx.c, 28 May 2000.
  1244.  
  1245. At Dat Nguyen's suggestion, added a mechanism for handling unknown commands.
  1246. If a macro called ON_UNKNOWN_COMMAND is defined, and a top-level command is
  1247. given that does not match a top-level keyword, token, or macro name, we call
  1248. cmtxt() to gather operands and then invoke ON_UNKNOWN_COMMAND with \%1 set to
  1249. the unknown command, and \%2, etc, set to the operands, if any.  At Jeff's
  1250. suggestion, we also take care not to recurse in case the ON_UNKNOWN_COMMAND
  1251. definition itself contains an unknown command.  ckuusr.c, 28 May 2000.
  1252.  
  1253. Samples:
  1254.  
  1255.   DEF ON_UNKNOWN_COMMAND telnet \%1 ; Treat unknown commands as hostnames
  1256.   DEF ON_UNKNOWN_COMMAND dial \%1   ; Treat unknown commands phone numbers
  1257.   DEF ON_UNKNOWN_COMMAND take \%1   ; Treat unknown commands as filenames
  1258.   DEF ON_UNKNOWN_COMMAND !\%*       ; Treat unknown commands as shell commands
  1259.  
  1260. Note that this trick does not work for strings that are prefixes of existing
  1261. commands or macros, e.g. "a" is not picked up as an unknown command.  Should
  1262. it be?  I think it would be more than a little reckless.  In case anybody ever
  1263. brings it up, though, we can always add ON_AMBIGUOUS_COMMAND.
  1264.  
  1265. Made ERASE an invisible synonym for DELETE.  ckuusr.c, 28 May 2000.
  1266.  
  1267. Improved "dir ?" message text.  ckuus6.c, 28 May 2000.
  1268.  
  1269. Having DIAL spit out error messages in mid-command if LINE or MODEM TYPE not
  1270. set was too annoying so I moved them to after cmcfm().  ckuus6.c, 28 May 2000.
  1271.  
  1272. Added CM_PSH flag definition for keyword flags, meaning "invisible and
  1273. disabled if nopush/NOPUSH", and CM_LOC for "invisible and disabled if
  1274. nolocal/NOLOCAL".  ckucmd.h, 28 May 2000.
  1275.  
  1276. Tagged all top-level commands, SET commands, and SHOW commands, SEND and GET
  1277. switches, with CM_LOC and/or CM_PSH as appropriate.  ckuus[r6].c, 28 May 2000.
  1278.  
  1279. Changed kwdhelp() to not show CM_LOC commands if nolocal is set or NOLOCAL is
  1280. defined, and not show CM_PSH commands if nopush is set or NOPUSH is defined,
  1281. ckucmd.c, 28 May 2000.
  1282.  
  1283. Changed docmd() to check command keyword flags, so even if user types a CM_PSH
  1284. or CM_LOC command (which is still possible even though it's invisible), it
  1285. won't be executed.  ckuusr.c, 28 May 2000.
  1286.  
  1287. Thus IKSD, since it sets nolocal and nopush, should now have all connection
  1288. and system-access oriented commands both invisible and disabled.
  1289.  
  1290. Changed SHOW FEATURES to show only program name & version ("name, rank, and
  1291. serial number") if IKSD.  ckuus5.c, 28 May 2000.
  1292.  
  1293. Discovered that a command like this: "remote dir | command" given at the IKSD
  1294. prompt crashes IKSD.  I'm not sure why it crashes, but (a) the command parser
  1295. is supposed to catch this if nopush is set or NOPUSH is defined, and (b) even
  1296. if the parser doesn't catch it, zxcmd() should simply fail.  The reason the
  1297. parser didn't catch it was that nopush wasn't being tested in remtxt() (as it
  1298. was in remcfm()).  Fixed in ckuus7.c, 28 May 2000.
  1299.  
  1300. Added SHOW HISTORY to show the command recall buffer contents.  ckuusr.h,
  1301. ckuus5.c, ckucmd.c, 28 May 2000.
  1302.  
  1303. Fixed addcmd() (which adds a command to the recall buffer) to check first that
  1304. last command is not the same -- I assumed it did this, but it never did.  Also
  1305. changed cmhistory() to list commands in normal order rather than reverse
  1306. order; this way, the user sees the "nearest" command on the bottom, the next
  1307. nearest above it, etc, in the order that ^P would work.  ckucmd.c,
  1308. 29 May 2000.
  1309.  
  1310. Added SAVE COMMAND HISTORY <file> [ <disp> ].  ckucmd.c, ckuus[r7].c,
  1311. 29 May 2000.  (Check to make sure SAVE { TERM, COMMAND } SCROLLBACK and
  1312. SAVE KEYMAP still work.)
  1313.  
  1314. Updated HELP SAVE text.  ckuus2.c, 29 May 2000.
  1315.  
  1316. Added an IKSD version of the top-level help text that does not say
  1317. inappropriate things, like "Type HELP OPTIONS for help with command-line
  1318. options", "Type MANUAL to access the K95 manual," etc.  ckuus2.c, 29 May 2000.
  1319.  
  1320. Changed INTRO text to not include hardwired uparrow an downarrow characters
  1321. in K95 since these don't work in IKSD and also fixed up the formatting and
  1322. added a warning about using backslashes in PC pathnames. ckuus2.c, 29 May 2000.
  1323.  
  1324. Worked on TAP/IXO script for AcIS paging:
  1325.  
  1326.  . I had to fix the Multitech init string: %E1 and #L0 not supported by
  1327.    this model.
  1328.  . Something was wrong with the setting of LINE, which I fixed, so now it
  1329.    can dial successfully.
  1330.  . I can get the ID= prompt when I CONNECT and type CR, but the script
  1331.    never gets it.  Apparently there is no DSR wire in the cable; no matter
  1332.    whether I set &S0, &S1, or &S2, there is never a DSR signal, and this
  1333.    might have something to do with ttchk() never finding any chars waiting.
  1334.  . But I can dial other numbers, like the CU modem pool, and scripts work
  1335.    just fine, so that's not it either.  So maybe it's parity?
  1336.  
  1337. Aha, the problem was that INPUT calls ttvt() each time, which can be rather
  1338. disruptive.  In this case we have INPUT in some tight loops.  Well, ttvt()
  1339. is supposed to return without doing anything if it's already in ttvt state,
  1340. but that wasn't working because we were testing too many things.  Removing
  1341. the test for carrier control did the trick -- now the page works.  This is
  1342. probably a 4.2BSD-specific thing, otherwise I'd have have been lynched by now.
  1343. Fixed in ckutio.c, 29 May 2000.
  1344.  
  1345. From Jeff: Add missing return() statement to savhistory(), clean up 
  1346. SAVE HISTORY switch statement.  ckucmd.c, ckuus7.c, 30 May 2000.
  1347.  
  1348. Removed %E1 and #L0 from Multitech command strings since they cause errors
  1349. in the Multitech 224E EC model.  ckudia.c, 30 May 2000.
  1350.  
  1351. Jeff discovered a problem with \fexec(), which can be boiled down to this: If
  1352. a macro A returns some material concatenated with the return value of another
  1353. macro B, the leading material is written over by the return value of macro B.
  1354. Example:
  1355.  
  1356.   define foo return B
  1357.   define bar return A\fexec(foo)C
  1358.   echo \fexec(bar)
  1359.  
  1360. Prints BBC instead of ABC.  Evaluation of \fexec() in bar's RETURN statement
  1361. causes some stack action, and therefore the return value pointer moves right
  1362. in the middle of writing the result.  Anything to the right of \fexec() is
  1363. safe, but anything on the left gets overwritten.  It turns out that we were
  1364. using the global line[] buffer and lp pointer to it on the mistaken assumption
  1365. cmpush()/cmpop(), used by \fexec(), would take care of it.  The solution is to
  1366. use a local automatic buffer (big) and pointer in doreturn() rather than
  1367. global line[] and lp.  I could also have added line[] and lp to cmpush() and
  1368. cmpop() but that might have had side effects and would have been just as
  1369. expensive.  ckuus6.c, 30 May 2000.
  1370.  
  1371. Back to TAP/IXO script.  Part of the ritual is to send <ESC>PG1<CR> at the
  1372. ID= prompt.  But if you have INPUT ECHO ON, the <ESC>P echoes back and, if
  1373. you have VT220 or above terminal or emulator, it "hangs" because <ESC>P is
  1374. DCS.  Changed INPUT to use the TERMINAL DEBUG setting to determine how to
  1375. echo echaracters.  Thus if TERM ECHO is ON and INPUT ECHO is ON, the terminal
  1376. will receive ^[P (three chars) rather than <ESC>P, and no harm is done.
  1377. ckuus4.c, 30 May 2000.
  1378.  
  1379. However, this doesn't work in practice and I'm totally stumped.  If I view
  1380. the session through K95 in debug mode, what I see (this doesn't come across
  1381. very well in monochrome) is:
  1382.  
  1383.   WAITING FOR ID= PROMPT...MJ
  1384.   M^JNO "ID=" PROMPT (1)[0A] - TRYING AGAINMJ
  1385.   MNO "ID=" PROMPT (1)[0A] - TRYING AGAINMJ
  1386.   M^M^JID=[\RCVD ID=(3)...MJ
  1387.   JENT <ESC>PG1(1)...M
  1388.  
  1389. The M's and J's are (red) control chars.  At this point, K95 shifts into "I'm
  1390. in an escape sequence" mode (between the J and ENT), obviously because it
  1391. received the echo to <ESC>PG1<CR>.  But then why doesn't it show it?
  1392. Meanwhile, note that all the other control characters received by INPUT are
  1393. correctly echoed as ^J, ^M, ^F, ^B, etc:
  1394.  
  1395.   J10 1.8^M114 Processing - Please Wait^M^F^MRESULT=1M
  1396.   JENT BLOCK (1)...Mn.M
  1397.   JJ^?{u^_+^^SOw^[^?211 Alphanumeric Page 1 Accepted.^M^F^MRESULT=1M
  1398.   J[^D^M+++M
  1399.   JTQ0H0M
  1400.   JTK!@5e\P}]M
  1401.   JO CARRIERM
  1402.   Jlosing /dev/ttyb...OKM
  1403.  
  1404. A mystery, but before I could get any further the system went down.  Anyway,
  1405. I checked the change on an ordinary Telnet connection, in which I had INPUT
  1406. echo a stream of all 256 possible bytes, and it worked perfectly.
  1407.  
  1408. Most of the character-set translation functions that convert from a 7-bit set
  1409. were failing to check if the source character had its 8th bit set, and in that
  1410. case would return something incorrect (at best) or make a wild array reference
  1411. (at worst).  Fixed in ckuxla.c and ckcuni.c, 31 May 2000.
  1412.  
  1413. Added symbols for \fjoin() and FOREACH to ckuusr.h, 31 May 2000.
  1414.  
  1415. Added \fjoin(&a[,s]), joins the elements of array a together, separated by
  1416. optional separator s.  The array name can include an optional range specifier.
  1417. If none is given, elements 1 through <dimension> are joined:
  1418.  
  1419.   decl \&a[] = one two three four five six seven eight nine ten
  1420.   echo \fjoin(&a)          all elements, no separator
  1421.   echo \fjoin(&a,:)        all elements, separator = ':'
  1422.   echo \fjoin(&a,][)       all elements, separator = "]["
  1423.   echo \fjoin(&a[3],:)     elements 3 through end, separator = ':'
  1424.   echo \fjoin(&a[3:5],:)   elements 3 through 5, separator = ':'
  1425.   echo \fjoin(&a[3:5],{,}) elements 3 through 5, separator = comma.
  1426.   echo \fjoin(&a[3:5],...) elements 3 through 5, separator = "...".
  1427.  
  1428. ckuus[24].c, 31 May 2000.
  1429.  
  1430. From Jeff: fix a typo in HELP FUNC JOIN, minor fix to Pragma Systems
  1431. Telnet client, Add --syslog: cmdline option for IKSD.  ckctel.h, ckuus[2y].c,
  1432. 1 Jun 2000.
  1433.  
  1434. Here is a really interesting problem.  "send /command { xxx }".  If "xxx"
  1435. contains an equal sign or colon, it is doubled.  Why?  Because we are still in
  1436. cmfdb() and are trying to parse a switch; therefore "=" and ":" are break
  1437. characters and gtword has to double break characters for reasons that are too
  1438. hard to explain.  In this case, gtword() has been called by cmswi() with brk=1
  1439. so what else can it do?  It can be a little smarter about when to obey the brk
  1440. argument.  If the first character in the field that it's parsing is not a
  1441. slash (/), then the field can't possibly be a switch, and therefore the brk
  1442. arg can be ignored (note that this determination is made *before* stripping
  1443. braces).  ckucmd.c, 1 Jun 2000.
  1444.  
  1445. Spaces around function arguments should be ignored, but they were not being
  1446. ignored in all cases, e.g. in "echo \freplace(abc, {b}, x)".  Fixed in
  1447. fneval(): ckuus4.c, 1 Jun 2000.
  1448.  
  1449. Added \fsubstitute(s1,s2,s3), which is just like Unix 'tr'.  s1 is the source
  1450. string; s2 is a list of characters to be translated, s3 is the list of
  1451. characters to translate them to; s2 and s3 can be (or contain) ASCII ranges,
  1452. like \fsubstitute(\%a,[a-z][A-Z]).  If s2 is shorter than s3 (after expansion
  1453. of ranges), then any characters in s2 that don't have corresponding characters
  1454. in s3 are removed from the result.  If s3 is longer than s2, the excess
  1455. characters are ignored.  Examples:
  1456.  
  1457.   echo \fsubstitute(abcdefg,c,x)               ; Changes "c" to "x"
  1458.   echo \fsubstitute(abcdefg,cd,xy)             ; c -> x, d -> y.
  1459.   echo \fsubstitute(abcdefg,[c-e],[C-E])       ; Uppercase c thru e
  1460.   echo \fsubstitute(abcdefg,a[c-e]g,A[C-E]G)   ; Uppercase acdeg
  1461.   echo \fsubstitute(abcdefg,c,)                ; Removes "c"
  1462.  
  1463.   define \%a abcdefghijklmnopqrstuvwxyz
  1464.   echo \fsubstitute(\%a,[f-h][p-r],[F-H][P-R]) ; Multiple ranges OK
  1465.   echo \fsubstitute(\%a,[p-z])                 ; Can delete a range
  1466.  
  1467.   assign dosline This is a DOS line\13\10      ; Handles control chars
  1468.   echo \fsubstitute(\m(dosline),\10\13,JM)
  1469.  
  1470.   .\%w = a                                     ; Handles variables
  1471.   .\%x = z
  1472.   .\%y = A
  1473.   .\%z = Z
  1474.   echo \%a
  1475.   echo \fsubstitute(\%a,[\%w-\%x],[\%y-\%z])
  1476.  
  1477. Can also be used with 8-bit characters too, so it's quite possible to
  1478. use this function to translate single-byte character sets if you don't mind
  1479. setting up the s2 and s3 strings yourself.  ckuusr.h, ckuus[24].c, 1 Jun 2000.
  1480.  
  1481. From Jeff: minor tweaks to ckuus[5x].c, plus a new linux+pam+shadow makefile
  1482. target.  4 Jun 2000.
  1483.  
  1484. Cleaned up some more confusion with command recall and SHOW HISTORY.
  1485. ckucmd.c, 4 Jun 2000.
  1486.  
  1487. Fixed \v(m_aa_off), which was erroneously returning the value of \v(m_ec_off).
  1488. ckuus4.c, 4 Jun 2000.
  1489.  
  1490. Refer to notes of 24 Sep 1999, in which we introduce the "packet zero hack" to
  1491. alleviate the problem with overloading of Packet 0 in the client/server
  1492. setting, e.g. client sends I packet, server sends ACK(I), client sends G
  1493. Packet (also number 0) but client resents ACK(I).  How does the server tell
  1494. the difference between ACK(I) and ACK(G)?  To do this, we saved a copy of the
  1495. data field of ACK(I), and then when we get an ACK to the next packet (such as
  1496. G) we compare its data field with ACK(I)'s data field, and if they are
  1497. identical, we know that ACK(I) was retransmitted, so we send our G packet
  1498. again.  There was at least one flaw in this reasoning: what if the server
  1499. sends an empty ACK(I), which is perfectly legal?  An empty ACK(I) is identical
  1500. to ACK(G), so we can't use the trick in this case (if we do, the client will
  1501. keep sending packets to the server after the server has quit from packet mode;
  1502. this occurs with KEA!VT340).  Fixed in ckcpro.w, 4 Jun 2000.
  1503.  
  1504. Added an optional 4th argument to \freplace(): a number that specifies which
  1505. occurrence of the target string to replace.  If 0 (the default), all
  1506. occurrences are replaced.  If 1, the 1st occurrence is replaced.  If 2, the
  1507. 2nd occurrence is replaced.  And so on.  If less than 0, occurrences are
  1508. counted from the right.  ckuus[24].c, 4 Jun 2000.
  1509.  
  1510. WIKSD code shuffling from Jeff.  ckcmai.c, 5 Jun 2000.
  1511.  
  1512. Fixed various syntax problems, ifdefs, and missing prototypes for DECC on VMS.
  1513. ckcdeb.h, ckclib.h, ckcnet.c, ckcfns.c, ckuus[24].c, 5 Jun 2000.  The most
  1514. baffling of these was DECC insisting that the zstr, zattr, and filinfo structs
  1515. were being redefined by ckcdeb.h (but only when included from the ckv*.c
  1516. modules) even though they were not.  This is not a conflict with some VMS
  1517. header file, because I'm building on the same VMS system with the same header
  1518. files as before.  Moving these struct definitions up higher in ckcdeb.h cured
  1519. the problem.  It's not science.
  1520.  
  1521. Ditto for no-TCP/IP builds, in which some non-TCP/IP material (like doend())
  1522. was erroneously included in #ifdef TCPSOCKET.  ckuus[r45y].c, ckcnet.c,
  1523. 5 Jun 2000.
  1524.  
  1525. Should C-Kermit, when sending a file group and encountering a file that it
  1526. can't open for reading, fail and stop or just go on to the next file?  I
  1527. thought it should fail and stop (which it does), so as not to mislead the user
  1528. into believing that all matching files were sent, but Jeff argues there should
  1529. at least be an option to proceed to the next file when this happens.  I took a
  1530. look at the code to see what would be involved, and found that the code was
  1531. already written to do this.  In gnfile() (get next file from our internal list
  1532. of files to send), we call zchki() on the file, and if it says the file is not
  1533. readable, we simply go on to the next one.  So the trick is to make sure that
  1534. zchki() always returns the appropriate code (-3) when the file can't be opened
  1535. for reading, e.g. when the file is "locked".
  1536.  
  1537. From Jeff: fix array refs in debug() statements in addcmd(): ckucmd.c; adjust
  1538. #ifdefs in dotnarg(): ckuusy.c, 6 Jun 2000.
  1539.  
  1540. From Jeff: "More work on telnet authentication.  On Unix we can assume that
  1541. if an administrator compiles C-Kermit to support an authentication method
  1542. that the administrator will configure that authentication method so that it
  1543. can successfully be used.  (although if C-Kermit is prebuilt by Linux vendors
  1544. this may not be true.)  On Windows, since we distribute support for all
  1545. authentication types this is never true.  Therefore, there needs to be a
  1546. runtime test to determine if the authentication method has been configured
  1547. for server side use.  The tests installed are rough but they are better than
  1548. nothing."  ckuus2.c, ckuath.c, 6 Jun 2000.
  1549.  
  1550. Looking again at the sending-unreadable files problem.  Suppose we send the
  1551. server a command "get blah", where blah is the name of a file that we can
  1552. list but not read.  The server says "File not found" instead of "Read
  1553. permission denied".  When the server gets the filename (in sgetini()), it
  1554. simply stores it for later retrieval by gnfile().  So later, when sinit()
  1555. calls gnfile(), gnfile() looks at its list and gets "blah" from it, does all
  1556. the GET-PATH and zfnqfp() processing, and then calls zchki() on the result.
  1557. zchki() correctly returns -3 ("read permission denied").  But that doesn't
  1558. make gnfile() return this error.  Instead, gnfile() continues its loop
  1559. through the file list, and finds there are no more filenames in it, so
  1560. returns 0 (it might just as easily have found more files, or switched to a
  1561. different list).  But if gnfile() returns 0 to sfile(), then we know we have
  1562. to send an error packet, so the trick is to make gnfile() set a global status
  1563. variable whenever it gets an error, and then later, if it returns 0, sfile()
  1564. can check the status variable to find out the real error.  Other callers can
  1565. (and should) ignore gnferror, however, because once we have started sending
  1566. files, we skip any that we can't open.  ckcfns.c, 6 Jun 2000.
  1567.  
  1568. In a similar vein, when C-Kermit is in remote mode and you give it a SEND
  1569. command for a file or group that does not cause a parse or zchki() error,
  1570. but for which gnfile() returns 0, it printed no sensible error message, and
  1571. then went on print an obnoxious and misleading hint.  Added another clause
  1572. to sfile() to catch this case.  Example: "send /except:x* x*". ckcfns.c,
  1573. 6 Jun 2000.
  1574.  
  1575. Building on the VAX with VAXC, I got a whole different set of duplicate
  1576. declarations (typedefs this time) in ckcdeb.h when included from ckvfio.c:
  1577. MACRO, KEY, and WAIT_T.  Now I see why (and why I had the trouble with the
  1578. struct redefinitions yesterday): ckvvms.h contained an #include for ckcdeb.h,
  1579. which is entirely unnecessary, since every module already includes ckcdeb.h.
  1580. Now, what's funny about this is that ckcdeb.h protects itself against multiple
  1581. inclusion, and yet these typedefs and struct declarations are being re-executed
  1582. anyway.  What a stupid language.  ckvvms.h, 6 Jun 2000.
  1583.  
  1584. Back to the trying-to-send-an-unreadable-file problem...  What if the original
  1585. filespec passes the gnfile() in sinit(), so we have a list of files to send,
  1586. and then later gnfile() hits a file that zchki() passes (and so gnfile()
  1587. returns it), but sfile() still fails to open it?  This is evidently happening
  1588. in Windows when a file is "locked" (e.g. open, mapped, or whatever, by another
  1589. process), and since some files in Windows are always in this state, any
  1590. attempt to (say) back up your C: disk with "send /recursive c:/*.*" will
  1591. always fail as soon as it hits one of these files.  As noted previously, the
  1592. real solution is to fix zchki() to fail if open() would fail.  But presently,
  1593. the code pretty much assumes that if gnfile() returns a filename, the file can
  1594. be sent, and so recovery from failure to open it is pretty crude.  I replaced
  1595. the code in <sseof>Y{} in the protocol module with a loop that keeps getting
  1596. the next file and trying to open it until (a) a file is successfully opened,
  1597. in which case it is sent; or (b) there are no more files, in which case we
  1598. move on to EOT state.  This also required a small change in sfile(), to not
  1599. call nxtpkt() (which increments the packet number and sets up the buffers)
  1600. until and unless the openi() call succeeds.  The old code remains in #ifdef
  1601. COMMENT.  Needs testing, especially on Windows with locked files.  ckcpro.w,
  1602. ckcfns.c, 6 Jun 2000.
  1603.  
  1604. Note: FTP skips over unsendable files too.
  1605.  
  1606. HELP SET IKS text from Jeff.  ckuus2.c, 7 Jun 2000.
  1607.  
  1608. Jeff noticed that chkfil() was diagnosing Linux i386 binaries as UCS-2.  Added
  1609. another criterion to chkfil(): if a file contains a run of 3 or more NULs, it
  1610. can't possibly be text of any kind.  A UCS-2 text file, however, can easily
  1611. contain 2 NULs in a row (e.g. U+2500 U+0041).  This test takes precedence over
  1612. the BOM.  Also, if the file starts with a UTF-8 BOM, the BOM is not believed
  1613. if the file contains any NULs at all, since text files don't have NULs.  This
  1614. change also handles the case where a non-Unicode file happens to start with
  1615. the UCS-2 or UTF-8 BOM bytes -- wouldn't it be funny if these showed up
  1616. somewhere in (e.g.) /etc/magic?  Also, added debug() statements to chkfil()
  1617. to indicate reason for result.  ckuusx.c, 7 Jun 2000.
  1618.  
  1619. Changed DIR /XFERMODE to show the result of chkfil() if FILE INSPECTION is ON.
  1620. This gives a very easy way to test chkfil() on a huge number of files.
  1621. ckuus6.c, 7 Jun 2000.
  1622.  
  1623. This revealed two more problems with chkfil().  First, certain hex files were
  1624. diagnosed as UCS-2 because of the alternating bytes rule.  But hex files do
  1625. not have NULs or other unusual C0 controls, so before deciding a BOMless file
  1626. was UCS-2, I added the requirement for unusual C0 controls.  Second, JIS-7
  1627. files were being diagnosed as binary because they contained non-textual C0
  1628. controls (Esc, SO, and SI).  Added these three chars to the list of C0 chars
  1629. OK in text files.  ckuusx.c, 7 Jun 2000.
  1630.  
  1631. For docs: Here is some reasons why you might want to SET FILE INSPECTION OFF:
  1632.  . A file contains some other kind of file, e.g. an email message
  1633.    containing a Kermit packet log of a UCS-2 file transfer.
  1634.  . A Postscript file (text) has an embedded graphic (binary).
  1635.  
  1636. From Jeff: adjust NOLOCAL vs DNS_SRV ifdefs in ckcnet.h; change "set term
  1637. print transparent" to "set term print user" in ckuus[27].c, initialize
  1638. file-list elements to NULL in dodel() ckuus6.c, eliminate some cutesy
  1639. capitalization in HELP OPTIONS in ckuusy.c, new AIX makefile targets + SSL
  1640. corrections in some others; auth stuff in ckctel.c and ckcnet.c, 11 Jun 2000.
  1641.  
  1642. Added transaction log entries for files transferred with external protocols.
  1643. The external protocol is responsible for the group, so we can only log the
  1644. command and result, but we can't log anything on a per-file basis.  ckcpro.w,
  1645. 11 Jun 2000.
  1646.  
  1647. Updated character-set associations.  FCS UTF8 or UCS2 gets TCS UTF8.
  1648. FCS KOI8U or KOI8R gets TCS Latin/Cyrillic.  ckuxla.c, 11 Jun 2000.
  1649.  
  1650. Changed SET FILE INSPECTION to SET FILE SCAN.  Added an optional size parameter
  1651. after ON, e.g. SET FILE SCAN ON 8192.  The default is 4096, as before.  If a
  1652. size of -1 is given, the entire file is read.  A size of 0 makes little sense,
  1653. but is accepted.  Changed chkfil() to accept the scan length as a third
  1654. parameter.  ckcker.h, ckuus[r2467x].c, 11 Jun 2000.
  1655.  
  1656. Jeff noticed that ckcdeb.h blew up if you tried to build with -DNODEBUG.
  1657. There was a missing #endif at the end of the IFDEBUG section, but supplying it
  1658. threw the rest of the file out of whack.  A rather prolonged search revealed
  1659. the following fragment at line 1723:
  1660.  
  1661.   _PROTOTYP(int dodebug,(int, char *, char *, long));
  1662.   _PROTOTYP(VOID dohexdump,(CHAR *, CHAR *, int));
  1663.   #endif /* DEBUG */
  1664.  
  1665. These three lines just simply did not belong there.  They had been "moved" to
  1666. around line 4182, but somehow this fragment was left behind.  So what does the
  1667. #endif match?  The #ifndef CKCDEB_H directive at the beginning.  So this
  1668. explains the typedef and struct errors I got in VMS recently.  Luckily it
  1669. should have no other affect since this fragment was located at "top level".
  1670. And yes, it has been sitting there for some time, at least since 7.0.197.
  1671. ckcdeb.h, 12 Jun 2000.
  1672.  
  1673. Renamed chkfil() to scanfile().  Moved filename-pattern code to matchname(),
  1674. and changed scanfile() to call matchname itself, so that all decisions about
  1675. which methods to use and how to use them are in one place.  Increased default
  1676. file-scan size to 48K (from 4K).  ckcker.h, ckuusx.c, 12 Jun 2000.
  1677.  
  1678. Now, what about the relationship of scanfile() and matchname()?  scanfile()
  1679. always comes to a conclusion, so there's no point in considering patterns if
  1680. FILE SCAN is ON.  If scanfile() is wrong, you can either increase the size of
  1681. the scan or disable scanning altogether and use patterns (or force an explicit
  1682. transfer mode).  I can't think of any reason to do both, rather than one or
  1683. the other; even if the two methods get different results, which would you
  1684. choose?  File scan, of course, because it's based on detailed information
  1685. specific to each file.  Therefore, changed scanfile() to call matchname() only
  1686. if FILE SCAN is OFF.  This required adding another file type, FT_TEXT, meaning
  1687. "some unspecified kind of text".  ckcker.h, ckuusx.c, 12 Jun 2000.
  1688.  
  1689. Moved all pattern-related code and definitions from ckcmai.c to ckuusx.c so
  1690. everything relating to patterns is one place.  12 Jun 2000.
  1691.  
  1692. Simplified sfile(), DIR /XFERMODE, and ADD SEND-LIST to call only scanfile().
  1693. ckcfns.c, ckuus[r6].c, 12 Jun 2000.
  1694.  
  1695. Changed matchname() to handle filenames with backup suffixes correctly, which
  1696. it never did.  So now if "*.txt" is a text pattern, "foo.txt.~1~" is properly
  1697. recognized as text.  ckuusx.c, 12 Jun 2000.
  1698.  
  1699. Updated HELP SET FILE text again.  ckuus2.c, 12 Jun 2000.
  1700.  
  1701. Added a rudimentary GREP command.  Just a little bit of parsing in ckuusr.c,
  1702. but cc on watsun dies with "virtual memory exhausted".  False alarm maybe;
  1703. moved the parsing code to ckuus6.c, and after a while it stopped happening but
  1704. maybe it would have anyway.  Anyway, for the first cut, it's simply "grep
  1705. <pattern> <filespec>".  The <pattern> is a ckmatch() pattern, except '*' is
  1706. implied at the beginning unless it starts with '^' and also at the end unless
  1707. it ends with '$'.  Thus "grep ^/ *.c" lists all lines that start with slash,
  1708. and "grep \;$ *.c" lists the lines that end with semicolon (which must be
  1709. quoted, otherwise it starts a comment).  If the pattern contains spaces it
  1710. must be enclosed in braces: "grep {this is a pattern} *.txt".  ckuusr.[ch],
  1711. ckuus6.c, 12 Jun 2000.
  1712.  
  1713. From Jeff, 13 Jun 2000:
  1714.  . Fix NOXFER builds: ckcnet.h, ckuus[r567x].c, ckcfns.c. 
  1715.  . Fix NOGREEK builds: ckuxla.c.
  1716.  
  1717. Checked NOCYRIL, NOKANJI, NOHEBREW, NOLATIN2, all OK.  NOUNICODE needed a few
  1718. fixes: ckuus[6x].c, 13 Jun 2000.
  1719.  
  1720. Added FIND and SEARCH as synonyms for GREP.  GREP is visible in UNIX and OS-9;
  1721. FIND is visible in elsewhere, SEARCH is invisible but included for comfort to
  1722. VMS users (although in VMS the args are backwards).  Made ASKQ invisible so we
  1723. don't overflow the basic 24x80 screen with ? at top level.  Merged ASK and
  1724. ASKQ help text and removed a no-longer-true sentence from it.  ckuus[r2].c,
  1725. 13 Jun 2000.
  1726.  
  1727. Added GREP switches /COUNT, /DOTFILES, /NAMEONLY, /NOBACKUP, /NOCASE,
  1728. /NODOTFILES, /NOLIST, /NOMATCH, /NOPAGE, /LINENUMBERS, /PAGE, and /RECURSIVE
  1729. switches, so now it does pretty much whatever Unix grep does, plus it can
  1730. recurse and skip backup files.  Also added HELP GREP text.  ckuus[26].c,
  1731. 13 Jun 2000.
  1732.  
  1733. In testing the GREP command, I noticed a bizarre phenomenon with askmore(): at
  1734. some point it begins to read characters from who-knows-where.  I discovered
  1735. this with "grep { $} *.txt" in a huge directory -- can't seem to reproduce it
  1736. any other way (if I change the pattern OR the filespec, no problem).  To make
  1737. a long story short, askmore() calls cmdgetc() which (in this case) calls plain
  1738. old C-Library getchar(), and getchar() returns the characters of one of the
  1739. filenames, which obviously have been stuffed into the stdin buffer somehow.
  1740. Now this is pretty strange, because not only would Kermit have to overwrite
  1741. the buffer with a filename (or overwrite the buffer pointer), it would also
  1742. have to set the _cnt variable to the exact length of the filename, which is
  1743. more than a little farfetched.  What seems more likely is that the filename is
  1744. being somehow echoed back to C-Kermit from K95, but the same thing happens if
  1745. I put K95 in debug mode (this is starting to remind me of the unresolved
  1746. problem from May 30 with the pager script putting K95 into DCS mode even when
  1747. the emulator is in debug mode), and anyway, I don't see any funny characters
  1748. coming to K95 from the host (like Ctrl-E).  Could it be a Telnet ECHO glitch?
  1749. I can't catch that happening either.  Another unsolved mystery.
  1750.  
  1751. Removed temporary debug() statements from ckucmd.c, ckuus[4x].c, 13 Jun 2000.
  1752.  
  1753. From Jeff: More NOXFER fixes; a Forward-X tweak; move misplaced #endif so TCP
  1754. port can be specified in SET HOST / TELNET commands in NODIAL builds; don't
  1755. give Telnet negotiation hint if IKSD; #ifdef out a lot of code if built with
  1756. IKSDONLY (X.25, Rlogin, Pipes, NetBIOS, PTYs, LAT, Browser, HTTP, etc); fix a
  1757. lot of #else and #endif comments.  ckcdeb.h, ckcnet.h, ckctel.c, ckuus7.c,
  1758. ckuath.c, 14 Jun 2000.
  1759.  
  1760. After these changes, yesterday's problem vanishes.  If (when) it comes back,
  1761. I'll put some more effort into tracking it down.
  1762.  
  1763. A newsgroup posting this morning said "xlate foo*bar" didn't work if the "*"
  1764. was actually part of the filename.  Of course not, you have to quote the
  1765. asterisk.  But that doesn't work either (it used to in 6.0).  Another day,
  1766. another puzzle.  Well, I'm not sure how it was broken, but I'm also not sure
  1767. how it ever could have worked.  The fix for this has to be at a very low
  1768. level, in the dreaded traverse(), to preserve the distinction between quoted
  1769. and nonquoted metacharacters in case they are mixed in the same filespec
  1770. (something which never worked).  Upon entry, traverse() checks to see if the
  1771. filespec is wild by calling iswild(), which in turn must (and does) check for
  1772. quoted metacharacters, so does not return a false positive for (e.g.)
  1773. "foo\*bar".  So far so good.  Now traverse() knows it has a nonwild filename
  1774. and so can return a one-element list containing only this name, rather than
  1775. opening and scanning the directory for matches.  BUT...  Instead of simply
  1776. copying the name literally to the list, it must strip out backslashes.  Of
  1777. course now we get into trouble with files that have backslashes in their
  1778. names, but at least you can work around this by just typing more of them.
  1779. Examples:
  1780.  
  1781.   C-Kermit>dir foo*
  1782.   -rw-rw----      2246  2000-06-14 17:06:43  foo*bar
  1783.   -rw-rw----      2246  2000-06-14 17:06:47  foo*baz
  1784.   -rw-rw----      2246  2000-06-14 17:13:09  foo\bar
  1785.   -rw-rw----      2246  2000-06-14 17:13:11  foo\baz
  1786.   C-Kermit>dir *\**
  1787.   -rw-rw----      2246  2000-06-14 17:06:43  foo*bar
  1788.   -rw-rw----      2246  2000-06-14 17:06:47  foo*baz
  1789.   C-Kermit>dir *\\\\*
  1790.   -rw-rw----      2246  2000-06-14 17:13:09  foo\bar
  1791.   -rw-rw----      2246  2000-06-14 17:13:11  foo\baz
  1792.   C-Kermit>
  1793.  
  1794. traverse(): ckufio.c, 14 Jun 2000.
  1795.  
  1796. From Jeff: make \v(ip) be an acceptable short form for \v(ipaddress);
  1797. some authorization stuff; some SHOW FEATURES corrections/additions;
  1798. ckuus[r457].c, ckcdeb.h, 15 Jun 2000.
  1799.  
  1800. Several years ago I spent a few minutes trying to enable doublequote enclosure
  1801. of filenames and other fields that might contain spaces, but gave up after a
  1802. series of entanglements.  Let's give it another shot.  First, in gtword() we
  1803. set a flag if the first nonblank character of the field is '"'.  When the flag
  1804. is set, we don't break on space unless the preceding character was also an
  1805. unquoted '"' (and not the first one either!).  Then I changed brstrip() to
  1806. strip not only enclosing {}'s but also enclosing doublequotes.  And then I
  1807. changed setatm() to not break on space if the string starts with a doublequote
  1808. unless the space follows another (not the same) (unquoted) doublequote.  This
  1809. pretty much works:
  1810.  
  1811.  . dir "this file"
  1812.  . cd "this dir"
  1813.  . if equal \%a "a b c" echo blah
  1814.  
  1815. and so on.  The various demo and torture-test scripts still work.  However:
  1816.  
  1817.  . echo "foo" now echoes foo without the quotes, which is an incompatible
  1818.    change from all previous versions.
  1819.  . echo \"foo\" also strips quotes, which is obviously not right.
  1820.  
  1821. Note that doublequotes are not equivalent to matched braces:
  1822.  
  1823.  . They have effect only at outer level; there is no concept of nesting.
  1824.  . They don't work for MINPUT args or macro args.
  1825.  
  1826. Also some open questions:
  1827.  
  1828.  . Should fields enclosed in quotes be immune from \-evaluation?
  1829.  . Should filenames enclosed in quotes be immune from wildcard expansion?
  1830.  
  1831. I'll have to do a lot of testing, debugging, and maybe changing in the next
  1832. few days.  ckucmd.c, ckclib.c, 15 Jun 2000.
  1833.  
  1834. From Jeff: a minor correction to auth parsing.  ckuusr.c, 16 Jun 2000.
  1835.  
  1836. Back to quoting...  Why does 'echo \"foo\"' not print the doublequotes?  For
  1837. the same reason that 'echo \{foo\}' doesn't print its braces.  ECHO sends its
  1838. argument to zzstring() for evaluation, in which \" becomes ", so by the time
  1839. brstrip() gets its hands on it, the backslashes are gone.  Can we live with
  1840. this?  Sure, since the same thing happened before with braces.  Solution:
  1841. put an extra set of doublequotes (or braces) around the text.
  1842.  
  1843. Next, is it OK to introduce this incompatible change?  It affects not just
  1844. ECHO but any other command that takes a text string (cmtxt()) as an operand,
  1845. such as WRITE, FWRITE, etc.  The conservative answer is no, existing behavior
  1846. must be preserved.  But how many times do people really want to echo (write,
  1847. etc) a string enclosed in doublequotes?  More to the point, if we make an
  1848. exception for ECHO, WRITE, etc, then our quoting rules become inconsistent,
  1849. whereas now you can pretty much say that any text string can be enclosed in
  1850. doublequotes to force it to be considered as a single field, which is
  1851. intuitive to users of almost any shell -- DOS, UNIX, etc.
  1852.  
  1853. Let's take a census of where brstrip() is used to doublecheck...
  1854.  
  1855.  . Modem commands and dial strings.
  1856.  . SET KEY and SET TERMINAL KEY definitions.
  1857.  . SET PROTOCOL fields
  1858.  . SET PRINTER device and end-of-job string
  1859.  . SET TELNET PROMPT (for user ID)
  1860.  . SET PROMPT
  1861.  . SET various authentication prompts, login ID & password, etc.
  1862.  . DEFINE variable definition
  1863.  . GREP string and filename <--  Doesn't cmifi() already strip?
  1864.  . SEND/GET /RENAME:string /MOVE-TO:string /AS-NAME:string /FILTER:string
  1865.  . SEND/GET/RECEIVE filenames and as-names
  1866.  . SEND and RECEIVE filters
  1867.  . IF fields
  1868.  . SORT ranges
  1869.  . TEXT and BINARY PATTERNs
  1870.  . REMOTE blah redirection or pipe strings.
  1871.  . SET ROOT string
  1872.  . TRIGGER strings
  1873.  . IDLE-SEND string
  1874.  . ECHO string
  1875.  . RETURN value
  1876.  . EXIT, STOP, and END messages
  1877.  . OUTPUT string
  1878.  . INPUT and MINPUT
  1879.  . EXEC command and args
  1880.  . APC text
  1881.  . TYPE /PREFIX:text
  1882.  . WRITE and FWRITE text
  1883.  . MKDIR, RMDIR directory name
  1884.  
  1885. None of these strike me as particularly dangerous places for doublequoting,
  1886. and most of them are places where people would expect to be able to do it.
  1887.  
  1888. The reason quotes didn't work on MINPUT strings is that the MINPUT parser
  1889. wasn't calling brstrip().  Replaced clunky code with a call to brstrip(),
  1890. now everying is fine.  ckuus4.c, 16 Jun 2000.
  1891.  
  1892. Let's check to see what else isn't calling brstrip().  A search for "'{'"
  1893. in ckuusr.* turns up about 50 hits:
  1894.  
  1895.  . SET DIAL DIAL-COMMAND: Fixed in ckuus3.c.
  1896.  . Function argument parser -- not sure if I should touch this.
  1897.  . Macro block parser -- don't touch.
  1898.  . xwords() -- this makes the macro argument list: ckuus5.c -- deferred.
  1899.  . The DIAL number: No, because of {{xxx}{yyy}{zzz}} notation...
  1900.  
  1901. That's about it.  So now the questions are:
  1902.  
  1903.  . Allow doublequoting of function args?  No, too dangerous for lots of
  1904.    reasons.  It would only muddy the waters as to precedence of braces,
  1905.    quotes, commas, parens, etc, plus braces and parens match up naturally
  1906.    left and right, which is important in a context where nesting is common.
  1907.  
  1908.  . Allow doublequoting of macro args?  This would seem to be less dangerous,
  1909.    worth a try...
  1910.  
  1911. But first, it seems that xwords() has some problems even as it stands.  It
  1912. makes no allowance for quoting of braces, unbalanced braces, etc.  Therefore
  1913. it is impossible to send (e.g.) a literal left brace as an argument to a
  1914. macro; nothing works: \{, \123, etc.  Doublequotes would have the same
  1915. problem.  Maybe the way out of this dilemma is to say that if a field begins
  1916. with a doublequote, we ignore interior braces, and vice versa.  OK, let's
  1917. try that...  Hmmm, yes, it works very nicely: "{" and {"} are both accepted
  1918. as single-char macro arguments.  And now you can also have arguments with
  1919. unbalanced braces like "{{{{", odd numbers of doublequotes like {a"b"c"d}
  1920.  
  1921. But we also get some unexpected effects, like:
  1922.  
  1923.   define xx show args
  1924.   xx a b ""c d e"" f
  1925.  
  1926. The args are passed as a, b, NULL, c, d, e"", and f.  But we had the same
  1927. problem before with:
  1928.  
  1929.   xx a b {}c d e{} f
  1930.  
  1931. The problem is that if a field begins with { or ", it terminates on the
  1932. matching } or " even if it is not followed by space or EOL.  OK, that's easy
  1933. to fix, at least for the quotes.  As for braces, what would we reasonably
  1934. expect the arguments to be in cases like these:
  1935.  
  1936.   xx a b {}c d e{} f
  1937.   xx a {b}c{d} e
  1938.  
  1939. The only sensible thing is to keep it simple and consistent.  If a field
  1940. begins with "{" we always strip it and collect characters (ignoring spaces)
  1941. until we reach the matching "}".  But if the matching right brace is not
  1942. the end of the field, as in the cases above, we can't delete it -- the field
  1943. is not finished yet.  Therefore the second argument in the first case above
  1944. is "}c" and the 4th arg is "e{"  The final right brace is removed because it
  1945. matches the first right brace.  In the second example, the second argument
  1946. is "b}c{d" as expected.
  1947.  
  1948. Other effects:
  1949.  
  1950.    {a b c}  is one argument, a b c
  1951.    "a b c"  is one argument, a b c
  1952.   {{a b c}} is one argument, {a b c}
  1953.   "{a b c}" is one argument, {a b c}
  1954.   ""a b c"" is one argument, "a b c"
  1955.   {"a b c"} is one argument, "a b c"
  1956.  
  1957. This all seems pretty reasonable but needs a lot of testing, but so far so
  1958. good -- the demos and torture tests still work.  xwords(): ckuus5.c,
  1959. 16 Jun 2000.
  1960.  
  1961. Changed the strategy for braces to allow a closing brace to terminate a field
  1962. only if it is followed by whitespace or occurs at the end.  So now:
  1963.  
  1964.   xx {}a b c{}
  1965.  
  1966. has one argument: "}a b c{".  Suggested by Jeff.  This is more consistent with
  1967. doublequotes anyway, since a doublequote doesn't terminate a field unless it
  1968. is followed by whitespace or is at the end.  ckuus5.c, 17 Jun 2000.
  1969.  
  1970. Added a compile-time symbol to disable doublequotes: NODOUBLEQUOTING.
  1971. ckuusr.h, ckuus5.c, 17 Jun 2000.
  1972.  
  1973. Added runtime command to disable/enable doublequoting in case it interferes
  1974. with any existing scripts: SET COMMAND DOUBLEQUOTING, and added it to SHOW
  1975. COMMAND.  ckuusr.h, ckuus[235].c, 17 Jun 2000.
  1976.  
  1977. After xwords() changes (for macro arguments). checked everything else that
  1978. calls xwords(): K_* environment variable parsing (should be fine), SHOW
  1979. CONNECTION (is fine), old/new-format dialing directory conversion (fine),
  1980. dialing- and network-directory lookup (...), and in the KERMIT command (where
  1981. allowing doublequotes is an improvement).  The LOOKUP and DIAL commands now
  1982. can find dialing-directory entries whose names contain spaces and are enclosed
  1983. in doublequotes, but you can't use doublequotes in the DIAL or LOOKUP commands
  1984. themselves.  This was fixed in dodial(): ckuus6.c, 17 June 2000.
  1985.  
  1986. As to the question of whether doublequotes should suppress wildcard expansion
  1987. of the interior string...  No, too much magic and overloading.  Doublequotes,
  1988. like braces, are to group items together that normally would be separate;
  1989. backslashes (and \fliteral(), etc) are to suppress/control evaluation of the
  1990. string itself.  Although one user raised an interesting point: he assumed that
  1991. \fliteral() would suppress wildcard expansion, which would seem to make sense.
  1992. This one would be kind of tough to implement, so let's defer it.
  1993.  
  1994. Added code to fix broken CRTSCTS definition in BSDI, enabled via -DFIXCRTSCTS
  1995. (added to BSDI makefile entries).  Here's what's in BSDI <termios.h>:
  1996.  
  1997. #define CCTS_OFLOW      0x00010000      /* CTS flow control of output */
  1998. #define CRTSCTS         CCTS_OFLOW      /* ??? */
  1999. #define CRTS_IFLOW      0x00020000      /* RTS flow control of input */
  2000.  
  2001. CRTSCTS should be defined as (CCTS_OFLOW|CRTS_IFLOW).  Symptom is massive data
  2002. loss in the incoming direction.  Reported by Steven Schultz.  I checked
  2003. FreeBSD 4.1 (also derived from 4.4BSD) and it has the right definition.  So
  2004. does OpenBSD 2.5.  NetBSD 1.4 uses a different scheme, no change needed; ditto
  2005. for Linux.  Built OK on BSDI, FreeBSD, and OpenBSD but no way to test.
  2006. ckutio.c, makefile, 17 Jun 2000.
  2007.  
  2008. Added FreeBSD 4.1 makefile target to see if 4.1 fixes the setbuf()/ncurses
  2009. foulup.  It doesn't; the -DNONOSETBUF flag is still needed.  makefile,
  2010. 17 Jun 2000.
  2011.  
  2012. In UNIX, file-open error messages printed by perror() were often missing the
  2013. filename.  This was caused by a coding error in zopeni() introduced with the
  2014. syslogging feature.  Fixed in ckufio.c, 18 Jun 2000.
  2015.  
  2016. There's no reason why TRANSLATE (XLATE) should not work on multiple files.
  2017. Added code to allow this, but got "virtual memory exhausted" again in ckuusr.c
  2018. in SunOS.  Evidently docmd() is right on the edge.  In the 7.0 build cycle we
  2019. got a lot of optimizer warnings about it.  For now, just moved all the XLATE
  2020. parsing code to a new routine, doxlate(), in ckuus4.c, and updated HELP XLATE
  2021. text in ckuus2.c.  18 Jun 2000.
  2022.  
  2023. Back to docmd().  Moved inline code for each command that has a lot of it
  2024. out of docmd() to separate static top-level routines in the same module:
  2025. doclear(), doeval(), dotelopt(), doedit(), dobrowse(), doredo(), domanual(),
  2026. doassoc(), dohttp(), dotrace(), doprompt().  ckuusr.c, 18 Jun 2000.
  2027.  
  2028. The filescan() routine opens up an interesting possibility: the ability to
  2029. SEND only binary files (or only text files).  There's no good way to do this
  2030. with wildards, patterns, etc (since filetypes like ".doc", ".hlp", ".ini",
  2031. and ".com" are notoriously ambiguous).  Sending only binary files or only
  2032. text files is desirable for several reasons: the receiver might not support
  2033. A-packets; you might want to send text and binary (e.g. source and object)
  2034. files to separate directories, etc.  Let's try it...
  2035.  
  2036.  . Added SND_TYP definition to ckuusr.h.
  2037.  . Added /TYPE: switch to SEND and MSEND option tables.
  2038.  . Moved fileselect() from ckclib.c to ckuusx.c since it depends too much
  2039.    on other Kermit stuff to be a ckclib routine.
  2040.  . Added code to fileselect() to make the selection.
  2041.  . Updated HELP [M]SEND text.
  2042.  
  2043. Seems to work OK.  ckuusr.h, ckcker.h, ckclib.h, ckuus[rx].c, 18 Jun 2000.
  2044.  
  2045. Added /TYPE: switch to DIRECTORY.  ckuusr.h, ckuus[26].c, 18 Jun 2000.
  2046.  
  2047. Now we can also add /TYPE: switches to DELETE, COPY, PURGE, etc -- any command
  2048. that accepts file-selection switches (I'll do that later).
  2049.  
  2050. Removed some per-character debug() statements from xgnbyte().  ckcfns.c,
  2051. 18 Jun 2000.
  2052.  
  2053. Unicode pasting fixes from Jeff.  ckuus4.c, 19 Jun 2000.
  2054.  
  2055. Corrected a bad typo in ckcmai.c, in which a semicolon after "int xfiletype"
  2056. terminated a declaration list prematurely (this is just a couple days old).
  2057. 19 Jun 2000.
  2058.  
  2059. Some syntax fixing:
  2060.  
  2061.  . Supplied some missing commas to HELP text string arrays. 
  2062.  . Shuffled some #ifdefs to fix NOPATTERNS and no-TCP/IP builds.
  2063.  . Fixed dogrep() not to try initializing its keyword structure -- that's an
  2064.    ANSI-only feature; moved the keyword table to top level.  
  2065.  
  2066. Built OK on HP-UX and VAX/VMS 5.5 (non-ANSI compilers).  Still get optimizer
  2067. warnings about docmd() from VAXC 3.2, oh well.  ckuus[r26].c, ckcpro.w,
  2068. 19 Jun 2000.
  2069.  
  2070. Adapted scanfile() to VMS, crudely.  In this case we have to call zopeni()
  2071. and zclos() on each file.  zopeni() contains the code to get the file's
  2072. record format, and sets the global 'binary' variable to 1 if the record
  2073. format is fixed or undefined (or if FILE TYPE is currently IMAGE or LABELED),
  2074. otherwise to 0.  If the file is binary, we skip the scan.  After testing
  2075. this, though, it seems we must always skip the scan, since text files are
  2076. likely to be stored in records with binary headers.  Anyway, now at least DIR
  2077. /XFERMODE tells the truth (sort of), and SEND /TYPE: works.  The main problem
  2078. is that object files (*.OBJ;*) seem to be text files because they have
  2079. variable-length records.  But this has always been the case, and while
  2080. scanning would properly detect .OBJ files as binary, we still couldn't send
  2081. them correctly since the record boundaries would be lost, plus we'd also get
  2082. a lot of false binaries on text files.  ckuusx.c, 19 Jun 2000.
  2083.  
  2084. From Jeff:
  2085.  . Rearrange DEBUG/NODEBUG/IFDEBUG #ifdefs in ckcdeb.h.
  2086.  . Move new declarations outside #ifndef NOXFER clause in ckuusx.c.
  2087.  . Rearrange some switch/case material in dotelopt(): ckuusr.c.
  2088. 20 Jun 2000.
  2089.  
  2090. A user reported that transparent print (XPRINT) didn't work in Linux.  Due to
  2091. a list-minute "optimization", the printer (fork) was never closed.  OK, easy
  2092. to fix, move one statement, printing works again.  But there's more.  On a
  2093. K95-to-Unix-to-remote connection, if I initiate transparent printing from the
  2094. remote (causing the file to be printed correctly in Unix), K95 hangs.  Recall
  2095. that C-Kermit passes the printer-on and printer-off escape sequences through
  2096. to the screen (to avoid deadlocks, infinite waits, etc), so the terminal sees
  2097. a printer-on-printer-off sequence with no data to print.  K95 hangs because
  2098. these two sequences are coming out in reverse order.  Why?  Because our
  2099. special case for outputting the printer-off sequence (instead of sending it to
  2100. the printer) called conxo() (a front end for write()) directly, rather than
  2101. going through the Unix CONNECT module's internal buffering mechanism.  Fixed
  2102. in ckucns.c (we don't support XPRINT in ckucon.c or in VMS, etc).  Also added
  2103. XPRINT to SHOW FEATURES list.  ckucns.c, ckuus5.c, 20 Jun 2000.
  2104.  
  2105. From Jeff: adjustment to telnet negotiation timeout hint. ckctel.c 23 Jun 2000.
  2106.  
  2107. dncnv() had a memory leak due use of sprintf() -- anybody could give a phone
  2108. number or dialing directory entry name that was longer than about 200 and
  2109. crash C-Kermit.  Fixed in ckuus6.c, 23 Jun 2000.
  2110.  
  2111. There's another memory leak here:
  2112.  
  2113.   set host <1500 A's>
  2114.  
  2115. but the location isn't obvious.  Will look some more later.
  2116.  
  2117. Momentary panic when testing the safeguard against setuid root operation:
  2118. it didn't work on SunOS.  But that's normal -- SunOS has the old 4.2BSD
  2119. s[ug]id facilities.  It's fine on modern OS's.
  2120.  
  2121. A Linux Bugtraq report highlighted the number of sprintf's in C-Kermit.
  2122. Every single one of these that includes a "%s" is a potential buffer exploit.
  2123. This can be avoided by using snprintf(), but snprintf() is not widely
  2124. available, and some of the available versions don't work (e.g. the size
  2125. argument is ignored).  Several people pointed out the existence of the
  2126. plp_snprintf() package by Patrick Powell.  I took a look at it, and concluded
  2127. it would be a full-time job getting it to build everywhere that C-Kermit
  2128. builds.  It will be much easier to redo our own sprintf's one by one, by
  2129. hand, even though there are 881 of them.  OK, here goes.  The general
  2130. strategy is:
  2131.  
  2132.  a. If the data to be sprintf'd is only constant strings and/or numbers,
  2133.     verify that buffer is big enough to accommodate the longest possible
  2134.     result.
  2135.  
  2136.  b. If the sprintf is already length-checked (as many are), check the check
  2137.     and fix if necessary; otherwise:
  2138.  
  2139.  c. If the data includes string pointers or buffers, check that no possible
  2140.     value of a string could cause buffer overflow; e.g. if the string is
  2141.     a file specification that comes from the OS (e.g. from realpath()) it
  2142.     can't be longer than MAXPATHLEN.  If there is any doubt, recode.
  2143.  
  2144. ckcfns.c (55): Many are numeric only, so OK.  Those involving strings were
  2145. checked.  Most of them were sprintfs to funcbuf[], used in server responses
  2146. to REMOTE blah commands.  These usually consisted of fixed and/or numeric
  2147. parts (no problem) and variable string parts, which were usually a pathname.
  2148. However, in all cases funcbuf[] is big enough to hold the longest possible
  2149. result, e.g. a directory listing line with a maximum-size file/pathname,
  2150. because that's what it was designed for.  In some other cases we are
  2151. constructing arbitrary error message strings for E-packets.  For such cases I
  2152. made a new C-Kermit library routine, ckmakmsg(), which writes up to four
  2153. strings into a buffer with length checking, and replaced a number of
  2154. unguarded sprintf's with ckmakmsg() calls.
  2155.  
  2156. ckcfn2.c  (5): Numeric only, OK.
  2157. ckcfn3.c (21): All sprintf's not verified safe were replaced with ckmakmsg().
  2158. ckclib.c  (3): Numeric only, OK.
  2159. ckcmai.c  (2): Version strings only, OK.
  2160. ckcpro.w  (5): All of these needed attention, OK now.
  2161. ckcuni.c  (1): Numeric, OK.
  2162. ckucmd.c (11): Replaced all string-copying ones with ckmakmsg().
  2163. ckucns.c (14): Replaced all string-copying ones with ckmakmsg().
  2164. ckucon.c (13): Replaced all string-copying ones with ckmakmsg().
  2165. ckudia.c (18): Replaced all string-copying ones with ckmakmsg().
  2166. ckufio.c (26): There were quite a few holes in this one, OK now.
  2167. ckupty.c  (4): Replaced all string-copying ones with ckmakmsg().
  2168. ckuscr.c  (1): Replaced all string-copying ones with ckmakmsg().
  2169. ckusig.c  (0): OK
  2170. ckutio.c (38): Lots of holes, OK now.
  2171.  
  2172. Added ckctoa() routine to ckclib: character to string (substitute for "%c"
  2173. printf format descriptor); it returns a pointer to a rotating buffer of 32
  2174. length-1 character strings.  Thus using ckctoa(), ckitoa(), ckltoa(), ckitox(),
  2175. etc, we can pretty much duplicate with ckmakmsg() any (s)printf() call that
  2176. has four args or less and doesn't require padding.  ckclib.[ch], 25 Jun 2000.
  2177.  
  2178. Also added ckmakxmsg(), which is just like ckmakmsg() but takes 12 string
  2179. args instead of 4.  ckclib.[ch], 25 Jun 2000.
  2180.  
  2181. Here's an example sprintf():
  2182.  
  2183.   char tmp[64];
  2184.   sprintf(tmp,"Initial value for \\&%c[%d]",x,v+1); /* Help string */
  2185.  
  2186. and its replacement, which requires two ckmakmsg() calls, or one ckmakxmsg():
  2187.  
  2188.   char tmp[64];
  2189.   int len;
  2190.   len = ckmakxmsg(tmp,64,
  2191.           "Initial value for \\&",ckctoa((char)x),"[",ckitoa(v+1),"]",
  2192.           NULL,NULL,NULL,NULL,NULL,NULL,NULL);
  2193.  
  2194. Back to the modules...
  2195.  
  2196. ckuusr.c (31): All sprintf's checked or replaced with ckmakmsg(), except
  2197.   the K95-specific one that constructs the "takepath" for the TAKE command,
  2198.   which needed to be replaced by a ckstrncpy() followed by 32 cknstrcat()'s,
  2199.   which not only makes it safe but also fixes a mismatch between the number
  2200.   of %s's (19) in the original sprintf() format string and the number (24)
  2201.   of string arguments.
  2202.  
  2203. ckuus2.c  (0): OK  
  2204. ckuus3.c (12): Replaced all unsafe sprintf's.
  2205. ckuus4.c(247): Many \fblah() error message converted to ckmakmsg().
  2206. ckuus5.c (63): Mostly numeric; replaced all unsafe ones.
  2207. ckuus6.c (44): Fixed many many holes in formation of dial strings.  The
  2208.                original sprintf()s were left as comments for checking in case
  2209.                of dialing problems after "%s%s%s%s%s%s%s%s" transcription.
  2210.                Left domydir() directory-listing lines alone for the same
  2211.                reasoning given above for ckcfns.c.
  2212. ckuus7.c (40): Tons of SAVE KEYMAP code.
  2213. ckuusx.c (72): Most sprintf's were already checked.
  2214. ckuusy.c  (3): OK.
  2215.  
  2216. Also in ckuus6.c: Fixed broken DELETE command in VMS (an #else was missing).
  2217.  
  2218. The problem with "set host <1500 A's>" crashing C-Kermit was setlin() using
  2219. strcpy() to write into a local array.  I thought we had caught all those
  2220. months ago...  Fixed now.  ckuus7.c, 25 Jun 2000.
  2221.  
  2222. Cleaned up some of yesterday's changes.  ckclib.c, ckuusr.c, 26 Jun 2000.
  2223.  
  2224. Fixes from Jeff to typos in K95-specific portions of yesterday's changes.
  2225. ckuus[r7].c, 26 Jun 2000.
  2226.  
  2227. New functions for ckclib.c: ckuitoa(), ckultoa(), ckctox().  26 Jun 2000.
  2228.  
  2229. Combed thru ckuus7.c looking for strcat()'s and strcpy()'s -- there were
  2230. dozens of strcpy()'s, only a few of them checked.  Fixed them all.  ckuus7.c,
  2231. 26 Jun 2000.
  2232.  
  2233. Similar treatment for ckuus[r3456xy].c, ckcfns.c, 26 Jun 2000.
  2234.  
  2235. New ckclib.[ch] from Jeff, with const's added to ckmak[x]msg() input-string
  2236. parameters to squelch complaints when used with Kerberos lib strings.
  2237. 27 Jun 2000.
  2238.  
  2239. strcpy/strcat treatment for ckcfn[23].c, ckcmai.c, ckucmd.c, ckudia.c,
  2240. cku[tf]io.c, ckupty.c, ckuscr.c, 27 Jun 2000.
  2241.  
  2242. Changed cvtdir(), the VMS function that converts BLAH.DIR;1 to [BLAH] (etc),
  2243. to have a destination-buffer length argument, and to return the size of its
  2244. result or -1 if the result doesn't fit the destination buffer or any other
  2245. kind of error.  ckvfio.c, 27 Jun 2000.
  2246.  
  2247. Converted all cvtdir() references: ckuusr.h, ckuus[456].c, ckucmd.c, ckvfio.c,
  2248. 27 Jun 2000.
  2249.  
  2250. Discovered a problem in TRANSLATE for VMS: if a directory name was specified
  2251. as the output file, but in BLAH.DIR;1 format, this wouldn't work.  Fixed in
  2252. doxlate() by using (new) length returned by cvtdir(), ckuus4.c, 27 Jun 2000.
  2253.  
  2254. Changed APCBUFLEN definition not to refer to CMDBL, so APCBUFLEN can be used
  2255. in modules (such as ckcfn*.c) that don't also #include ckucmd.h.  ckcker.h,
  2256. 27 Jun 2000.
  2257.  
  2258. Discovered that cmcvtdate() would write into its argument if given a date
  2259. in yyyymmdd format with no time.  Fixed in ckucmd.c, 27 Jun 2000.
  2260.  
  2261. From Jeff: strcat/strcpy/sprintf treatment for ckuath.c, ckcnet.c, ckctel.c,
  2262. ck_crp.c, 28 Jun 2000.
  2263.  
  2264. Cleaned up long lines & trailing blanks ckuath.c, ckcnet.c, ckctel.c,
  2265. ck_crp.c, plus any other modules that had them, but not ckuath.c or ck_*.c.
  2266. 28 Jun 2000.
  2267.  
  2268. Tried building on SCO 5.0.5 and got some warnings on the new code, mainly
  2269. char/CHAR.  Added casts.  ckuus[7x].c, ckcfns.c, ckctel.c, 28 Jun 2000.
  2270.  
  2271. Compiling ckutio.c on SCO 5.0.5 fails because the timeval struct isn't defined
  2272. any more, which is truly bizarre since absolutely nothing has changed in this
  2273. area since 7.0 was released.  Adding -DDCLTIMEVAL and -DNO_DNS_SRV fixed it
  2274. but why didn't I have to do this before?  And SOCKOPT_T has to be size_t.  etc
  2275. etc...  Turns out to be a local problem; builds fine on a different 5.0.5
  2276. system elsewhere, false alarm, put the makefile entry back as it was.
  2277.  
  2278. Some platforms (such as Windows) have a fixed program stack size (256K in
  2279. Windows), therefore you can't use big automatic arrays in functions that might
  2280. be invoked recursively, which we do in \fexecute(); this would make K95 crash
  2281. after just a couple levels of recursion.  The big buffers are vnambuf[] in
  2282. zzstring() and line[] in doreturn().  Jeff changed the code to use malloc's
  2283. for this.  ckuus[46].c, 29 Jun 2000.
  2284.  
  2285. We also had a potential problem with our homegrown printf replacement.  From
  2286. Jeff:
  2287.  
  2288.   I added some checks to the ckx[f]printf() routines and increased the
  2289.   size of the buffers we were using.  The test is of the form:
  2290.  
  2291.     call [vs]printf() routine
  2292.  
  2293.     check strlen() of buffer and enforce a length smaller than the
  2294.     allocated buffer size.
  2295.  
  2296.     call doexit() if test fails.
  2297.  
  2298.   This will work in this case because the buffer being manipulated is
  2299.   not on the stack.  It is important to note that if the buffer was on
  2300.   the stack it would be impossible to perform the test because
  2301.   immediately after the attack the instruction pointer would be set to
  2302.   point to the attacking code.
  2303.  
  2304.   The code as currently written should protect against the abuse of an
  2305.   attack as long as the placement of the buffers in memory does not
  2306.   allow the overwriting the memory pointed to by the instruction pointer
  2307.   stored in the call stack.
  2308.  
  2309. ckutio.c, 29 Jun 2000.
  2310.  
  2311. Also from Jeff: Additional code for handling filenames that contain
  2312. spaces.  ckclib.[ch], ckucmd.c, 29 Jun 2000.
  2313.  
  2314. Corrections to above: keep previous brstrip() function since new one breaks
  2315. the script programming language; add buffer-length argument to dquote() so we
  2316. don't write past the end of a buffer (unless the caller is lying about its
  2317. size).  ckclib.c, ckucmd.c, 29 Jun 2000.
  2318.  
  2319. Peter E made a convincing case that SET SERVER GET-PATH should not convert
  2320. relative names to absolute.  This surprises most people (e.g. if you include
  2321. '.' in your Unix or DOS PATH, this means "my current directory at whatever
  2322. time in the future I search the PATH", not "my current directory at the time
  2323. the PATH was set").  NOTE: This is an INCOMPATIBLE change from 7.0 and
  2324. earlier, but this should be acceptable since there was no way to do this
  2325. before and you can still get the old effect by specifying absolute paths, or
  2326. even by using \fpathname() on relative paths.  parsdir(2): ckuus3.c,
  2327. 29 Jun 2000.
  2328.  
  2329. Peter E noticed that if you SET STREAMING OFF and then make a connection via a
  2330. TCP/IP modem server, transfers stream anyway.  This doesn't happen if you make
  2331. an ordinary Telnet connection.  I don't see how it can happen anyway.  If you
  2332. SET STREAMING OFF, this sets streamrq to 0 (SET_OFF); then when the protocol
  2333. is started, streamok is set to 0, and then is set to 1 only if (a) it is
  2334. negotiated, and (b) streamrq is SET_ON or SET_AUTO.  Streaming is actually
  2335. started by streamon(), which does nothing if streamok is not set.  I do not
  2336. see a hole here.  But if I can reproduce the problem maybe I can find a hole.
  2337. Since I don't have a TCP/IP modem server, the hard part is setting up a
  2338. simulation using a Unix workstation in place of the modem server.  SET HOST,
  2339. SET MODEM TYPE, then CONNECT, start Kermit, CONNECT to the modem port with SET
  2340. CARRIER-WATCH OFF, escape back to the original Kermit and DIAL, then CONNECT
  2341. to the dialed-to system, log in, "kermit -r", escape back to the dialing
  2342. system and send a file.  Streaming is used, as expected.  Then repeat the same
  2343. procedure, but this time SET STREAMING OFF before sending the file.  This
  2344. works fine; the file is sent with windowing.  Maybe it has to do with when the
  2345. SET STREAMING OFF command is given.  Repeat again, this time with SET
  2346. STREAMING OFF done before the SET HOST.  This works too.  So I can't reproduce
  2347. the problem.  In any case, it occurs to me that we should not treat a dialed
  2348. connection as reliable even though it was made over a TCP/IP connection.  So
  2349. in dodial(), I set reliable to OFF if DIAL or ANSWER succeeds.  ckuus6.c,
  2350. 29 Jun 2000.
  2351.  
  2352. Somebody claimed that giving the -a command-line option before the -s option
  2353. didn't work.  It works fine.
  2354.  
  2355. Fixed the program herald; it lost a space in the ckmakmsg() conversions.
  2356. ckcmai.c, 29 Jun 2000.
  2357.  
  2358. Peter E discovered that a very short binary file (7 bytes) could be spuriously
  2359. identified as UCS2: x<NUL>y<NUL><NUL><NUL><NUL>.  It should have been tagged
  2360. binary because it contained a run of more than 2 NULs, but the only such run
  2361. terminated at the end of the file, and the code missed that case.  Fixed in
  2362. scanfile(): ckuusx.c, 29 Jun 2000.
  2363.  
  2364. Fixed ifdefs around Telnet-related keyword tables to be TNCODE rather than
  2365. TCPSOCKET.  ckuusr.c, 29 Jun 2000.
  2366.  
  2367. Added \v(buildid), which is yyyymmdd of the current build, e.g. "20000629",
  2368. useful mainly to developers and testers for whom the version number string and
  2369. test ID strings are not fine-grained enough.  ckcmai.c, ckuusr.h, ckuus4.c,
  2370. 29 Jun 2000.
  2371.  
  2372. Added code to the Unix CONNECT module to discard NUL after incoming CR on
  2373. a Telnet NVT connection.  This makes a difference for transparent printing.
  2374. ckucns.c, ckucon.c, 29 Jun 2000.
  2375.  
  2376. Jeff renamed the experimental version of brstrip() to fnstrip(). ckclib.[ch].
  2377. Also some changes to ckuath.c.  3 Jul 2000.
  2378.  
  2379. Fixed a bug in ttlock() construction of the lockfile name introduced in the
  2380. ckmakmsg() conversion; this one was in the HPUX-specific section and wasn't
  2381. caught because I built & tested it with a non-ANSI compiler (the length arg
  2382. was missing).  ckutio.c, 3 Jul 2000.
  2383.  
  2384. Fixed an external declaration of ttnproto for non-TCPSOCKET builds.
  2385. ckuusr.c, 3 Jul 2000.
  2386.  
  2387. Unix transparent printing, after the recent fixes, was working right, but the
  2388. final "i" of the terminating escape sequence was being printed on the screen.
  2389. Fixed in ckucns.c, 3 Jul 2000.
  2390.  
  2391. Until now, CP1252 has been considered identical to ISO Latin-1, which is not
  2392. the case since it puts graphics (e.g. "smart quotes", Euro symbol, etc) in
  2393. the C1 area.  Added a definition for CP1252 as a separate file character set
  2394. in ckuxla.h.  Added CP1252 to all the tables in ckuxla.c, but still using the
  2395. Latin-1 translations.  3 Jul 2000.
  2396.  
  2397. Added translations from L1, L2, LC, LH, LG, and Latin-9 to CP1252.
  2398. ckuxla.c, 3 Jul 2000.
  2399.  
  2400. Added table entries to the Unicode module.  ckcuni.c, 3 Jul 2000.
  2401.  
  2402. Added translations from CP1252 to L1, L2, LC, LH, LG, and Latin-9.
  2403. ckuxla.c, 4 Jul 2000.
  2404.  
  2405. "/NOBACKUP" is confusing -- it implies that something won't be backed up.
  2406. Changed it to "/NOBACKUPFILES", meaning the action won't be performed on
  2407. backup files (similar to "/NODOTFILES").  ckuus[r26].c, 4 Jul 2000.
  2408.  
  2409. More squelching of warnings from ANSI compilers about whether a string
  2410. arg is const or not.  zinroot(), ckufio.c, 4 Jul 2000.
  2411.  
  2412. More squelching of warnings from ANSI compilers about whether a string
  2413. pointer is to chars that are signed or not.  rlog_ini(), ckcnet.c, 4 Jul 2000.
  2414.  
  2415. Peter E noticed that SET FILE SCAN OFF, DIR /X /TYPE:{TEXT,BINARY} didn't
  2416. work.  Fixed in fileselect().  ckuusx.c, 4 Jul 2000.
  2417.  
  2418. See note from 29 June: "Peter E noticed that if you SET STREAMING OFF...".
  2419. What he really meant to say was simply that if FILE DISPLAY was not FULL,
  2420. the message said STREAMING when streaming actually was not being done.
  2421. Fixed in ckuusx.c, 4 Jul 2000.
  2422.  
  2423. Fixed problems that Jeff reported with ADD SEND-LIST:
  2424.  . GET while SEND-LIST defined didn't work.
  2425.  . CLEAR SEND-LIST, SEND caused a memory exception.
  2426. ckuusr.c, 4 Jul 2000.
  2427.  
  2428. Fixed matchname() (filename pattern-matcher) to strip pathname before
  2429. performing the match.  ckuusx.c, 4 Jul 2000.
  2430.  
  2431. Peter E noticed that if you "set modem command init-string" (to nothing),
  2432. Kermit still waits for a response (to nothing) and this stops dialing in its
  2433. tracks.  Fixed in ckudia.c, 5 Jul 2000.
  2434.  
  2435. Peter E noticed that "kermit -Y -y blah" didn't execute "blah".  Fixed in
  2436. ckuusy.c and prescan(): ckuus4.c, 5 Jul 2000.
  2437.  
  2438. Changed DELETE /ALL to DELETE /TREE (leaving /ALL available but invisible).
  2439. ckuus6.c, 5 Jul 2000.
  2440.  
  2441. There was some kind of confusion regarding the first arg (filename) to
  2442. zstime() in HPUX ANSI C builds.  For HPUX only, it was "const char *" rather
  2443. than just "char *" for some reason, and now because recent changes (SET ROOT)
  2444. we get warnings and failures galore with ANSI builds.  I took the whole thing
  2445. out and it builds fine.  I wonder why I thought we needed the "const" business
  2446. in the first place?  ckufio.c, 5 Jul 2000.
  2447.  
  2448. Several complaints appeared recently about Kermit hanging or going into
  2449. infinite loops, but they are not necessarily related, since one involves IKSD
  2450. (which has no CONNECT mode) and the others involve CONNECT mode.  For CONNECT
  2451. the culprit was this new bit from the transparent printing fixes:
  2452.  
  2453.         if ((c == NUL) && network && (ttnproto == NP_TELNET)) {
  2454.         if (prev == CR)        /* Discard <NUL> of <CR><NUL> if */
  2455.           if (!TELOPT_U(TELOPT_BINARY))    /* peer not in binary mode */
  2456.             continue;
  2457.         }
  2458.  
  2459. Once this code is executed, conect() goes into an endless uninterruptible
  2460. loop, eating all CPU time.  The "continue" should have been a "break" -- it
  2461. was continuing the wrong loop (remind me to get a 500-line screen).  That
  2462. should have fixed it, but it didn't.  The problem was that obc (the screen
  2463. output buffer counter) had already been incremented because of the NUL, but
  2464. since we never output it, the next time through the loop we skipped the
  2465. FD_SET() for the keyboard, and then found the same NUL and did it all over
  2466. again, forever.  Adding a call to ckcputf() to flush the screen output buffer
  2467. before continuing the main loop fixed it.  ckucns.c, 5 Jul 2000.
  2468.  
  2469. So much for the CONNECT problem.  For IKSD, we'll have to wait til next time
  2470. we get a runaway...
  2471.  
  2472. Back in April, I changed conbin(), concb(), etc, to remember the console state
  2473. and not do anything if the state was already the desired one, thus avoiding
  2474. expensive and possibly disruptive system calls when they were not necessary.
  2475. But in shuffling the code, I neglected to include a return() statement at the
  2476. end of conbin(), so it has been returning a random value all this time,
  2477. resulting in "?Sorry, can't condition console terminal" failures at the
  2478. beginning of CONNECT mode in some builds.  Strange that all the picky
  2479. compilers that complain so loudly about signed vs unsigned char didn't pick up
  2480. on this one!  Fixed in conbin(): ckutio.c, 6 Jul 2000.
  2481.  
  2482. The SET DIAL TIMEOUT command was essentially ignored if it was less than 60
  2483. seconds, due to overconservatism.  Better to do exactly what users tell us.
  2484. Fixed and tested in ckudia.c, 6 Jul 2000.
  2485.  
  2486. SHOW MODEM didn't remove the '*' from the AUTOANSWER ON string if the user
  2487. changed it.  Fixed in showmodem(): ckuus3.c, 6 Jul 2000.
  2488.  
  2489. Peter E noticed that some modem commands were not reset if the user changed
  2490. modem types and had previously given SET MODEM COMMAND commands to customize
  2491. the previous modem type.  These included Autoanswer On/Off, Ignore-Dialtone,
  2492. Speaker On/Off, Volume, and Init2.  Fixed in initmdm(): ckuus3.c, 6 Jul 2000.
  2493.  
  2494. There has been a long-standing problem with canceling files during a streaming
  2495. transfer.  If you have a directory with lots of files, "send *" on a streaming
  2496. connection, and type 'X' lots of times, eventually the transfer hangs.  Packet
  2497. logs reveal this happens if you hit 'X' just before the first Data packet of a
  2498. file is sent.  Logs taken of the same transfer on both ends both show that the
  2499. last packet exchanged was the ACK to the A packet, i.e. receiver sent it and
  2500. the sender got it, but then the first data packet is never sent and the sender
  2501. never sends anything else either and since we're streaming, the receiver never
  2502. times out.
  2503.  
  2504. This suggests a problem in the protocol module.  Capturing a case in a pair of
  2505. debug logs, we see the 'X' is actually detected after the F packet is sent but
  2506. before the ACK is received.  At this point we go ahead and send the A packet
  2507. and read its ACK, and after that we hang.  Examination of the protocol state
  2508. table shows no test for interruption in <ssfile>Y and <ssattr>Y states.  Added
  2509. them.  This gets us to <sseof> state, but we still hang.  Now the receiver...
  2510. <rattr>Z state didn't account for interruption either; actually it was kind of
  2511. a mess -- it didn't call reof() at all except by accident.  It still doesn't
  2512. but I added a sufficient workaround for this case.  Finally, <ssatr>Y state
  2513. didn't properly test the return code from sdata().  After fixing all of these,
  2514. you can 'X' a streaming transfer as much as you like and it keeps chugging
  2515. away until it gets to the end of the file list.  However, 'Z' given at the
  2516. sender still didn't work; this required a fix to <sseof>Y state.  Now all is
  2517. well when interrupting the sender.  ckcpro.w, 6 Jul 2000.
  2518.  
  2519. Canceling individual files from the receiver is OK too, but canceling the
  2520. batch does not stop the sender from continuing through to the end (even though
  2521. the receiver refuses all incoming files after 'Z' is hit).  The problem here
  2522. is that the protocol for canceling a batch is for the receiver to put 'Z' in
  2523. the data field of the ACK to a Data packet.  But when streaming, Data packets
  2524. are not ACK'd except when we need to send back an interruption notification,
  2525. and in fact this works fine for per-file interruption but for batch
  2526. interruption we didn't catch all the cases, in particular when the file can be
  2527. fully transferred in one packet.  Fixing this one required a sneaky extension
  2528. to the protocol: allowing X and Z cancellation not only in ACKs to D packets
  2529. but also in ACKs to Z packets.  This won't hurt anything since prior Kermits
  2530. ignore the data field of the Z packet.  ckcpro.w, 6 Jul 2000.
  2531.  
  2532. The hint for GET-Class Command Failed didn't mention the fact that for GET to
  2533. work, the other Kermit has to be in server mode.  Fixed in parser(): ckuus5.c,
  2534. 6 Jul 2000.
  2535.  
  2536. Yesterday's batch cancellation fix for GET had one minor flaw, namely that it
  2537. would not work with preexisting servers.  However, an E packet serves the same
  2538. purpose, so now we try the graceful method once and if that fails, then the
  2539. hammer.  ckcpro.w, 7 Jul 2000.
  2540.  
  2541. Now here's an awful bug we've had for the last 10 years or so...  When IFDEBUG
  2542. is defined then debug() is a macro that expands to "if (deblog) dodebug(...)".
  2543. So what happens here:
  2544.  
  2545.   if (condition)
  2546.     debug(...);
  2547.   else
  2548.     return(-1);
  2549.  
  2550. Answer: Not what you expect.  This becomes:
  2551.  
  2552.   if (condition)
  2553.     if (deblog)
  2554.        dodebug()
  2555.     else
  2556.        return(-1);
  2557.  
  2558. In other words, instead of returning (-1) when the condition is false, we
  2559. return (-1) when the condition is true and not debugging.  This could explain
  2560. an awful lot of those bugs that go away when you "log debug".  Now, I don't
  2561. know how portable this is going to be, but I changed the IFDEBUG definitions
  2562. for debug() and hexdump() from:
  2563.  
  2564. #define debug(a,b,c,d) if (deblog) dodebug(a,b,(char *)(c),(long)d)
  2565. #define hexdump(a,b,c) if (deblog) dohexdump((CHAR *)(a),(CHAR *)(b),c)
  2566.  
  2567. to:
  2568.  
  2569. #ifdef CK_ANSIC
  2570. #define debug(a,b,c,d) ((void)(deblog?dodebug(a,b,(char *)(c),(long)d):0))
  2571. #define hexdump(a,b,c) ((void)(deblog?dohexdump((CHAR *)(a),(CHAR *)(b),c):0))
  2572. #else
  2573. #define debug(a,b,c,d) (deblog?dodebug(a,b,(char *)(c),(long)d):0)
  2574. #define hexdump(a,b,c) (deblog?dohexdump((CHAR *)(a),(CHAR *)(b),c):0)
  2575. #endif /* CK_ANSIC */
  2576.  
  2577. (We can't use (VOID) because of the conflict with <curses.h> in ckuusx.c.)
  2578.  
  2579. It never occurred to me before that you can put numeric constants in C
  2580. programs as if they were statements, but I suppose it's no different from
  2581. invoking a function that returns a numeric value, without assigning the return
  2582. value to anything.  Builds OK with both gcc and non-ANSI cc on Sun.  We'll see
  2583. how it goes in the next build-all.  If there is trouble we can always go back
  2584. to just calling dodebug() all the time.  ckcdeb.h, 7 Jul 2000.
  2585.  
  2586. Anyway, as awful as this one seems, constructions like the sample above are
  2587. extremely rare.  One of them, however, was in dogta() (the _GETARGS/_PUTARGS
  2588. routine), which could affect FOR and WHILE loops, SWITCH statements, and IF {}
  2589. ELSE {} constructions.  Which is where I found myself while trying to figure
  2590. out the following problem: The SHIFT command does not decrement \v(argc) if it
  2591. is used within an IF { } or ELSE { } block, or in a SWITCH case.  But fixing
  2592. the debug() definition made no difference (it did indeed fix one problem with
  2593. _PUTARGS, but that only uncovered a second one).  It turns out there was also
  2594. logic error in dogta() itself, in the section where _PUTARGS propagates the
  2595. changed argument vector array, RETURN value, and \v(argc) back up the stack
  2596. (it was doing this in the wrong direction -- another potential memory leak,
  2597. but not such a horrible one, since it was writing into the correct array, but
  2598. the wrong place in it -- the only "exception" would be if a FOR, WHILE, SWITCH,
  2599. or IF was on the top of the stack AND and stack was full.  dogta(): ckuus6.c,
  2600. 7 Jul 2000.
  2601.  
  2602. \fjoin() needed another option: to put quotes around any elements that
  2603. contained spaces or that were empty (null).  A third arg was added for this: 0
  2604. or missing means don't add quotes; nonzero means quote (enclose in
  2605. doublequotes) any elements that contain spaces or are empty.  ckuus4.c,
  2606. 8 Jul 2000.
  2607.  
  2608. In working on the previous item, I discovered that a loop like:
  2609.  
  2610.     for \%i 1 \fdim(&_) 1 { echo \%i. [\&_[\%i]] }
  2611.  
  2612. adds 1 to the dimension of the argument vector array.  Culprit: popclvl()
  2613. forgot that the array dimension is one less than argc since array dimensions
  2614. don't count element 0.  Fixed in ckuus5.c, 8 Jul 2000.
  2615.  
  2616. Back in Feb 1998 when I did all the work extending the macro arg list,
  2617. creating the \&_[] array and the \%* variable, and then later added the SHIFT
  2618. command, I chickened out of having SHIFT update \%* since by that time all the
  2619. quoting and grouping info had already been lost.  But now that we have the new
  2620. \fjoin() function, we can use that to construct \%* on the fly from the
  2621. current argument vector, no matter how much it's been shifted: \%* is:
  2622.  
  2623.   \fjoin(&_[],{ },1)
  2624.  
  2625. The easiest way to handle this is in doshift(), which I did, works fine (a
  2626. better, but riskier, approach would have been to eliminate the m_line[] array
  2627. and replace all references to it by on-the-fly \fjoin() invocations).  Anyway,
  2628. now it's possible to have a recursive "argument eating" function like this:
  2629.  
  2630.   def xx {
  2631.       show args
  2632.       shift
  2633.       if ( > \v(argc) 1 ) xx \%*
  2634.   }
  2635.  
  2636. Another shortcoming of \%* is that it wasn't available at top level; now it
  2637. is, and SHIFT works on it too, even with quoted/grouped args.  ckuus5,c,
  2638. 8 Jul 2000.
  2639.  
  2640. Discovered that although redefining \%2 also changes \&_[2], the opposite was
  2641. not true.  Fixed in addmac(), ckuus5.c, 8 Jul 2000.
  2642.  
  2643. Similarly undefining \&_[1] did not also undefine \%1 (etc for 0..9), and vice
  2644. versa.  Fixed in delmac(): ckuus5.c, 8 Jul 2000.  (I really should merge these
  2645. into a single array some day...)
  2646.  
  2647. Another possible shortcoming of \%* is that it doesn't reflect redefinitions
  2648. of argument variables.  If it's affected by SHIFT (as it is now) then it
  2649. should also be affected by redefinitions.  If anybody wants to refer to the
  2650. original value, that's easy enough: just put "assign \%x \fcontents(\%*)" at
  2651. the beginning of the macro before changing any of the parameters.  zzstring()
  2652. and fneval(): ckuus4.c, 8 Jul 2000.
  2653.  
  2654. After all this, I went back and removed the m_line[] array, since now we
  2655. always compute \%* on the fly when it is referenced.  Good, one less thing
  2656. to keep track of and one less potentially large array. ckuus[456].c,
  2657. 8 Jul 2000.
  2658.  
  2659. From Jeff: a fix to debug(F011,...) in which malloc() could be called with a
  2660. negative argument, plus an authorization fix, ckuath.c, ckuusx.c, 9 Jul 2000.
  2661.  
  2662. Also from Jeff: an experimental version of ttruncmd() that, instead of setting
  2663. stdin/stdout of the new sub-process to the socket and then starting the
  2664. subprocess and getting out of the way, starts the subprocess and enters a
  2665. select() loop reading data from the socket and writing to the subprocess and
  2666. vice-versa, applying Telnet protocol translations as needed.  This is mainly
  2667. to allow external protocols like Zmodem to work over Telnet connections.  I'll
  2668. hold off on taking this one until it's more finished.  (See ttruncmd-select.c.)
  2669.  
  2670. Jeff reported that the recent changes for file interruption broke attribute
  2671. refusal.  As noted, the <rattr>Z state was a mess.  Upon looking at it more
  2672. closely it turned out to be not just a mess but totally nuts, so I rewrote it,
  2673. hopefully with brain engaged this time, and also cleaned up reof() itself.
  2674. First of all, I enclosed all the material relating to actually closing and
  2675. handling the disposition of the output file in "if (o_isopen) { ... }" so we
  2676. don't have to worry about calling reof() when a file wasn't actually opened.
  2677. Second, I noticed that /RENAME-TO: and /MOVE-TO: failures had been ignored,
  2678. but they should be fatal, so I fixed that (and added messages and transaction
  2679. log entries for failures).  ckcpro.w, ckcfns.c, 9 Jul 2000.
  2680.  
  2681. From Jeff, a correction to SHOW MODEM for TCP/IP modem servers, some
  2682. decryption corrections to Unix CONNECT mode, other minor things.  ckuus3.c,
  2683. ckucns.c, ckucon.c, ckuath.c, 10 Jul 2000.
  2684.  
  2685. If the value of \%a is a string that begins and ends with doublequotes, then:
  2686.  
  2687.   echo \%a
  2688.  
  2689. unexpectedly strips them.  This is a wrinkle of the ECHO command.  I changed
  2690. ECHO to call brstrip() before evaluation, rather than after.  Thus:
  2691.  
  2692.   echo "one two three"
  2693.  
  2694. prints:
  2695.  
  2696.   one two three
  2697.  
  2698. but:
  2699.  
  2700.   define \%a {"one two three"}
  2701.  
  2702. (outer braces are stripped in the definition, as always) and:
  2703.  
  2704.   echo \%a
  2705.  
  2706. prints:
  2707.  
  2708.   "one two three"
  2709.  
  2710. ckuusr.c, 10 Jul 2000.
  2711.  
  2712. The operation of \fsplit() was very confusing in its treatment of arrays that
  2713. were already declared.  At first I thought it might be nice to give the user
  2714. control of the size of the array, but this leads to all kinds of craziness
  2715. when calling \fsplit() repeatedly on different strings but using the same
  2716. array -- old pieces left over from previous calls, new pieces having nowhere
  2717. to go, etc -- all of which is documented, but not especially useful.  So I
  2718. changed \fsplit() to always create a new array (destroying any existing one
  2719. first).  ckuus4.c, 10 Jul 2000.
  2720.  
  2721. If \fjoin() can turn an array into a string and preserve grouping, then
  2722. \fsplit() should be able to do the opposite.  But presently \fsplit() (and
  2723. \fword()) ignore grouping, either with braces or doublequotes.  So now let's
  2724. make \fjoin() and \fsplit() into symmetrical functions such that after:
  2725.  
  2726.   \fsplit(\fjoin(&a[],{ }),&b[])
  2727.  
  2728. \&a[] and \&b[] are identical.  To add grouping capability to \fsplit() and
  2729. \fword() without breaking current behavior, I added an optional 5th argument,
  2730. a grouping mask: 1 = doublequotes, 2 = braces, 4 = singlequotes, 8 = parens,
  2731. 16 = square brackets, 32 = angle brackets; these can be OR'd together to make
  2732. any number 0-63 (-1 is treated the same as 63).  If a bit is on, the
  2733. corresponding kind of grouping is detected.  Thus if \%a is:
  2734.  
  2735.   a "b c" {d e} (f g) h i 'j k' [l m] <n o> p
  2736.  
  2737. then:
  2738.  
  2739.   \fsplit(\%a,&a[])      = 16
  2740.   \fsplit(\%a,&a[],,,0)  = 16
  2741.   \fsplit(\%a,&a[],,,1)  = 15 ("")
  2742.   \fsplit(\%a,&a[],,,2)  = 15 ({})
  2743.   \fsplit(\%a,&a[],,,3)  = 14 ("" and {})
  2744.   \fsplit(\%a,&a[],,,7)  = 13 ("", {}, and '')
  2745.   \fsplit(\%a,&a[],,,15) = 12 (etc...)
  2746.   \fsplit(\%a,&a[],,,31) = 11
  2747.   \fsplit(\%a,&a[],,,63) = 10
  2748.   \fsplit(\%a,&a[],,,-1) = 10
  2749.  
  2750. Doublequotes and braces are the only forms of grouping significant to Kermit;
  2751. I put in the others because it was easy and somebody might find them useful.
  2752. As yet there is no concept of quoting or nesting and I'm not sure there needs
  2753. to be.  Quoting would be devilishly difficult to use and explain.  The main
  2754. idea is to construct, deconstruct, and reconstruct arrays, which generally
  2755. contain plain old up-front data, in which quoting rarely plays a role.
  2756. ckuus4.c, 10 Jul 2000.
  2757.  
  2758. Documentation note:  If you include the same character in the grouping mask
  2759. and the include list, the include list takes precedence.  Example:
  2760.  
  2761.   def \%a  a "b c d" e
  2762.   \fsplit(\%a,&a[],,,-1)  = 3  <-- doublequote used for grouping
  2763.   \fsplit(\%a,&a[],,",-1) = 5  <-- doublequote not used for grouping
  2764.  
  2765. Still do do:
  2766.  . Test
  2767.  . Check \fword().
  2768.  . Add help text.
  2769.  . Give \fjoin() the same options for grouping (except not OR'd)
  2770.  
  2771. Made dohexdump() int instead of VOID so new hexdump() macro definition would
  2772. not result in "incompatible types in second and third operands of conditional
  2773. expression".  ckcdeb.h, ckuusx.c, 10 Jul 2000.
  2774.  
  2775. In FreeBSD 4.1 CVSUP 7/10/2000 20:00 GMT-0500, endwin() now restores buffering
  2776. of stdin (but not stdout), so now we can simply add -DCK_NEWTERM to the
  2777. freebsd41 makefile entry, and everything works again.  makefile, 11 Jul 2000.
  2778.  
  2779. Added straightforward stack-based nesting support to \fsplit()/fword(), but
  2780. it was too straightforward, needs more work, don't use it yet.  ckuus4.c,
  2781. 12 Jul 2000.
  2782.  
  2783. Redid fsplit()/fword() from scratch as a simple FSA to support nesting.  Added
  2784. a new general purpose routine, cksplit(), to ckclib.c that does the work, thus
  2785. removing a fair amount of code from fneval().  The new routine handles
  2786. grouping if asked to, otherwise fnword()/fnsplit() behave as before.  Grouping
  2787. implies nesting.  Any of the following pairs can be used for grouping in any
  2788. combination:
  2789.  
  2790.   "" {} [] '' () <>
  2791.  
  2792. with the restrictions that (a) a closer must match its corresponding opener,
  2793. and (b) you can't expect to be able to use quotes for nesting.  Up to 64
  2794. levels of nesting are allowed, and up to 4096 words in the result string.
  2795. Example:
  2796.  
  2797.   a (b c <d e [f g {h i} j k] l m> n o) p
  2798.  
  2799. is split up in any desired way according to the grouping mask.  Malformed
  2800. strings are handled appropriately, e.g. everything after an unmatched opener
  2801. becomes the last (or only) word.  ckcdeb.h, ckclib.[ch], ckuus4.c, 15 Jul 2000.
  2802.  
  2803. Changed \fjoin() to accept the same kind of grouping mask as \fsplit() and
  2804. \fword(), but in this case only the lowest bit value is used. ckuus4.c,
  2805. 15 Jul 2000.
  2806.  
  2807. Updated help text for \fword(), \fsplit(), and \fjoin().  And now \fsplit()
  2808. and \fjoin() are "reciprocal" functions.  You can split a string up into an
  2809. array and join it back into a new string that is equivalent, except that the
  2810. type of braces might change.  Example:
  2811.  
  2812.   def \%a a {b c [d e] f g} "h i" j <k l> m
  2813.   echo STRING=[\%a]
  2814.   echo WORDS=\fsplit(\%a,&a,,,-1)
  2815.   show array a
  2816.   asg \%b \fjoin(&a,{ },2)
  2817.   echo JOIN  =[\%b]
  2818.   echo WORDS=\fsplit(\%b,&b,,,-1)
  2819.   show array b
  2820.  
  2821. The arrays a and b are identical.  The strings a and b are as follows:
  2822.  
  2823.   \%a: a {b c [d e] f g} "h i" j <k l> m
  2824.   \%b: a {b c [d e] f g} {h i} j {k l} m
  2825.  
  2826. Added a new module: ckcftp.c.  Just an 825-line skeleton for now, containing
  2827. command parsing and tables, definitions, etc, but no actions.  Added built-in
  2828. FTP and {SET, SHOW, HELP} FTP commands to main tables.  Aside from this, all
  2829. code specific to built-in FTP should be confined to ckcftp.c.  Read comments
  2830. at the top of the new module.  ckuusr.[ch], ckuus[235].c, makefile,
  2831. 15 Jul 2000.
  2832.  
  2833. ideas...
  2834.  . Maybe point R-commands at FTP module if an FTP connection is active.
  2835.  . Give error in FTP action commands if FTP connection is not open.
  2836.  . Give error in non-FTP protocol-related commands if FTP connection open.
  2837.  . What about "set protocol ftp"?
  2838.  . Maybe add another CM_flag to disable non-FTP related commands.
  2839.  . Add switches.
  2840.  
  2841. A couple minor corrections to ftp stuff from Jeff.  ckcdeb.h, ckuus2.d,
  2842. 16 Jul 2000.
  2843.  
  2844. Discovered that ckitoa() and friends, even though they were designed to
  2845. be called repeatedly, and use a circular buffer for returning results,
  2846. could sometimes fail to insert the terminating NUL between result values,
  2847. so constructions like printf("%s %s %s....",ckitoa(a),ckitoa(b),ckitoa(c))
  2848. could give junk.  Fixed in ckclib.c, 16 Jul 2000.
  2849.  
  2850. Fixed debug(F001,...) not to print odd-number-digit hex numbers (by calling
  2851. ckitox).  dodebug(): ckuusx.c, 16 Jul 2000.
  2852.  
  2853. Back to character sets.  We had a couple problems in the TRANSLATE command.
  2854. First, it's only supposed to translate character sets, but it was also doing
  2855. record-format conversion.  Fixed in x[gp]nbyte(): ckcfns.c, 16 Jul 2000.
  2856.  
  2857. Second, when translating from any character set that has C1 controls to
  2858. Unicode, it failed to convert the C1 controls.  This was a bug in all the
  2859. blah_u() routines in the Unicode module, where "blah" is any ISO-2022
  2860. conforming 8-bit character set (the Latin alphabets, DEC MCS, etc).  This one
  2861. was actually true not just for TRANSLATE but also file-transfer.  Converting
  2862. in the other direction was OK.  Anyway, now if you create a file with:
  2863.  
  2864.   main() {
  2865.       int i;
  2866.       for (i = 0; i < 256; i++) putchar((char)i);
  2867.   }
  2868.  
  2869. containing all 256 possible bytes, you can convert it from Latin-1 to UTF-8
  2870. (or UCS-2) and back correctly.  ckcuni.c, 16 Jul 2000.
  2871.  
  2872. Added APL-ISO and APL-AIX terminal character sets to the Unicode module for
  2873. use by any Unicode-based terminal emulator, but didn't fill in the tables
  2874. yet.  ckcuni.[ch], 16 Jul 2000.
  2875.  
  2876. Added an optional second argument to \fcvtdate(), a format option number.
  2877. Normally the result is yyyymmdd hh:mm:ss.  Option 1 changes the date format
  2878. to yyyy-mmm-dd, and option 2 to dd-mmm-yyyy (mmm = English 3-letter month
  2879. abbreviation).  ckuus[24].c, ckucmd.[ch], 16 Jul 2000.
  2880.  
  2881. Filled in the APL tables: u_apl1[], u_apl2[], tx_apl1(), tx_apl2().
  2882. ckcuni.c, 17 Jul 2000.
  2883.  
  2884. For docs: Unicode makes no distinction between ASCII ABCs and APL ABCs.
  2885. A special set of "math" ABCs will be added to Plane 1 in Unicode 3.1 or 4.0,
  2886. but they aren't there yet, and we're not supporting nonzero planes yet either.
  2887.  
  2888. The recent changes to the protocol module broke non-streaming transfers.
  2889. After the Z packet, we either hang (long file) or quit early without waiting
  2890. for the B packet (short file).  To reproduce:
  2891.  
  2892.   set streaming off
  2893.   set win 31   <-- or 20, etc.
  2894.  
  2895. on both ends and transfer a file.  The first problem is that the sender's log
  2896. shows a missing block of ACKs.  The culprit?  Our famous call to ttflui() in
  2897. input(): we flush the communications input buffers when the window size is 1
  2898. and we have just read the packet we want.  But the window size isn't really 1;
  2899. we only set it to 1 temporarily around the Z packet.  The test in input() for
  2900. window size should be against the negotiated window size (wslotn), not the
  2901. current window size (wslots).  This 1-letter change cures the ttflui()
  2902. problem, which apparently has always been there, but the B packet still isn't
  2903. sent.  ckcfn2.c, 18 Jul 2000.
  2904.  
  2905. As for the rest, to make a long story short, in <ssdata> state, I had changed
  2906. the test of sdata()'s return code in early July from "== -1" to "< 1" while
  2907. trying to fix a problem we were having with cancellation, which eventually was
  2908. fixed a better way.  But -1 means eof and 0 means "draining" -- two completely
  2909. different things.  Putting the test back as it was fixes the current problem
  2910. and does not seem to reinstate the previous one.  ckcpro.w, 18 Jul 2000.
  2911.  
  2912. From Jeff: a fix to askmore() to prevent it from looping if Kermit is running
  2913. as a TCP server and the connection drops.  ckuusx.c, 18 Jul 2000.
  2914.  
  2915. Minor fixes to typos & ifdefs from Jeff: ckuus[r5].c, 19 Jul 2000.
  2916.  
  2917. \fword(1 2 3,4) returned an error instead an empty string.  Fixed in cksplit():
  2918. ckclib.c, 19 Jul 2000.
  2919.  
  2920. PeterE reported some lingering problems with client/server ops when switching
  2921. between streaming and nonstreaming after yesterday's fixes.  I couldn't
  2922. reproduce them, but I was able consistently get the protocol to hang when
  2923. giving an RDIR command over a nonstreaming connection.  Same problem as
  2924. yesterday...  The sender is not sending the B packet.  Same fix as yesterday,
  2925. except in a different place.  ckcpro.w, 19 Jul 2000.
  2926.  
  2927. APL tables revised in light of newly discovered ISO-IEC/JTC1/SC22N3067,
  2928. 1999-12-28.  ckcuni.c, 20 Jul 2000.
  2929.  
  2930. Noticed that SHOW CONNECTION was getting some of its fields confused.  Reason:
  2931. uidbuf[] was empty.  I don't see why but in any case, I added some safety
  2932. clauses to the connection logging code to fill it in if it's blank.  ckuus3.c,
  2933. ckudia.c, 20 Jul 2000.
  2934.  
  2935. Added a safety clause to Unix sysinit() to make sure that uidbuf[] was set
  2936. to something, in the worst case "UNKNOWN" if all methods of obtaining the
  2937. username fail.  ckutio.c, 20 Jul 2000.
  2938.  
  2939. PeterE noticed that if you transfer a file using C-Kermit 7.1 locally and a
  2940. recent version of C-Kermit on the far end, and then transfer another file
  2941. using an old version of C-Kermit on the far end, the local Kermit does not
  2942. clear the whoareu[] (and sysindex) values from the previous negotiation, and
  2943. therefore might do some inappropriate automatic peer-recognition stuff.  Fixed
  2944. in ckcfns.c, 21 Jul 2000.
  2945.  
  2946. PeterE suggested that "send *blah<Esc>", when "*blah" succeeds in matching a
  2947. filename, should repaint the field with the expansion.  For example, if the
  2948. directory contains one file containing the string "blah", e.g. "theblahfile"
  2949. then "send *blah<Esc>" should be repainted as "send theblahfile".  This is
  2950. important especially for command history/recall.  It was easy enough to do
  2951. since we were already doing it in VMS and K95; however, it didn't work for
  2952. Unix filespecs starting with tilde.  But the calls to tilde_expand() in
  2953. cmifi() were redundant anyway, so I just removed them and all's well.  So now
  2954. "send ~/tmp/x<Esc>" is repainted as "send /usr/olga/tmp/x".  Ditto for all
  2955. other commands that parse input-file names.  (We still need the tilde_expand()
  2956. call in cmofi(), however, since the tilde doesn't get resolved otherwise.)
  2957. ckucmd.c, 21 Jul 2000.
  2958.  
  2959. Fixed the runzero declaration in ckuusx.c to be outside #ifdef UNICODE.
  2960. ckuusx.c, 21 Jul 2000.
  2961.  
  2962. Disabled the built-in FTP code by defining SYSFTP in ckcdeb.h, 22 Jul 2000.
  2963.  
  2964. Adjusted prototypes, ifdefs, etc, for VMS.  ckcdeb.h, ckuusr.h, 22 Jul 2000.
  2965.  
  2966. Built on Linux RH6.1/Intel with various configuration options:
  2967.  
  2968.  Full        1730K        NOPUSH      1689K
  2969.  NOFTP       1730K        NOCMDL      1695K
  2970.  NOUNICODE   1444K        NORECALL    1726K
  2971.  NOCSETS     1362K        NONET       1618K
  2972.  NOXFER      1352K        NODEBUG     1543K
  2973.  NOLOCAL     1373K        NOSHOW      1667K
  2974.  NOHELP      1484K        NOCKXYZ     1725K
  2975.  NODIAL      1599K        NOSERVER    1705K
  2976.  MINIDIAL    1704K        NOIKSD      1683K
  2977.  NOSPL       1466K        IKSDONLY    1408K
  2978.  NOICP        446K
  2979.  
  2980. The gets() function can't be used; modern linkers refuse to link programs that
  2981. use it.  I replaced the call to gets() in readpass() with a getchar() loop:
  2982. ckuus7.c.  The NOCMDL version wouldn't link until I #ifdef'd out the call to
  2983. setiks() in ckuus3.c; major surgery would be required to decouple SET IKS from
  2984. the command-line module.  Minor touchups required in: ckcdeb.h ckcfn3.c
  2985. ckcfns.c ckcker.h ckcmai.c ckucmd.c ckudia.c ckuus2.c ckuus3.c ckuus4.c
  2986. ckuus5.c ckuus6.c ckuus7.c ckuusr.c ckuusr.h ckuusx.c ckuusy.c. 22 Jul 2000.
  2987.  
  2988. Added apl2, apl-plus, and apl-2741 character sets to the Unicode module.
  2989. ckcuni.c, 23 Jul 2000.
  2990.  
  2991. With the new file-scanning feature, there was no way to inhibit character-set
  2992. translation for text-mode transfers, so I added SET TRANSFER TRANSLATION
  2993. { ON, OFF }.  ckuusr.h, ckcmai.c, ckuus[234].c, ckcfns.c, 23 Jul 2000.
  2994.  
  2995. Added a /TRANSPARENT switch to SEND, MSEND, RECEIVE, and GET, disabling
  2996. translation for this transfer only.  ckuusr.[ch], ckuusx.c, ckcfn3.c,
  2997. 23 Jul 2000.
  2998.  
  2999. Looked into adding /TIMEOUT:n to SET HOST and friends.  Conceptually it's
  3000. simple, but in practice it's scary.  First look in ckudia.c at what had to be
  3001. done for dial timeouts (in VOS, OS-9, Amiga, etc).  Then we might also need to
  3002. clean up the TCP/IP operations, depending on how far they'd progressed --
  3003. e.g. the connection is open but Telnet negotiations are stuck, etc.  Well, we
  3004. already handle this (or not?) with Ctrl-C.
  3005.  
  3006. Built full regular versions on assorted platforms:
  3007.  
  3008.  BSDI/OS 4.0:   1643K (Intel)
  3009.  FreeBSD 4.1:   1699K (Intel)
  3010.  SunOS 4.3.1:   1982K (Sparc, gcc)
  3011.  AIX 4.3.2.0:   2037K (RISC)
  3012.  Solaris 2.5.1: 2100K (Sparc, cc)
  3013.  HP-UX 10.20:   2311K (non-ANSI, non-optimized)
  3014.  SINIX 5.52:    2390K (MIPS)
  3015.  
  3016. debug(F011,...) could write past the end of its buffer.  Fixed in dodebug():
  3017. ckuusx.c, 24 Jul 2000.
  3018.  
  3019. Fixed #ifdefs from Jeff for NOXFER vs SHOW CHAR, plus re-enable Kerberos
  3020. ticket forwarding on one-way authenticated connections.  ckuus4.c, ckuath.c,
  3021. 24 Jul 2000
  3022.  
  3023. Added whoami() to OS-9 and Amiga versions.  ck[i9]tio.c, 24 Jul 2000.
  3024.  
  3025. Added code to VOS sysinit() to fill in uidbuf[].  ckltio.c, 24 Jul 2000.
  3026.  
  3027. Looked at enabling the extra Unicode-only charsets in C-Kermit.  Forget it;
  3028. it would be a major rewrite.  Worth doing, but later.
  3029.  
  3030. From Jeff: Improved error handling for K95 disk-space checking.
  3031. ckuus[r4].c, ckcfns.c, 25 Jul 2000.
  3032.  
  3033. Bug of the day: Unix C-Kermit would dump core if you changed the system time
  3034. while it was transferring a file (because of the time-left and CPS
  3035. calculations for the f-t display).  Fixed by telling it to ignore
  3036. floating-point exceptions.  sysinit(): ckutio.c, 25 Jul 2000.
  3037.  
  3038. Fixed an unguarded reference to TELOPT_blah in ckucmd.c, 25 Jul 2000.
  3039.  
  3040. In VMS, responding to the askmore() prompt with Ctrl-Z would throw Kermit
  3041. into an infinite loop.  Fixed by special-casing VMS to use raw binary i/o
  3042. rather than "half-cooked" (otherwise EOF is returned on all subsequent input
  3043. requests and Kermit exits).  ckuusx.c, 25 Jul 2000.
  3044.  
  3045. Added scanfile() call to TRANSMIT if no explicit file-type switches were
  3046. included in the command.  Also made sure that TRANSMIT skipped charset
  3047. translation if TRANSFER TRANSLATION is OFF.  ckuusr.c, 25 Jul 2000.
  3048.  
  3049. Fixed brstrip() to heed COMMAND DOUBLEQUOTING setting.  ckclib.c, 25 Jul 2000.
  3050.  
  3051. Continuation of the filename-completion repainting work from a few days ago...
  3052. Changed cmifi2() to supply doublequotes (or braces if COMMAND DOUBLEQUO OFF)
  3053. around a filename obtained by completion if the name contains spaces.  This
  3054. works fine as long as completion is full, but partial completion doesn't work
  3055. yet.  Also we to handle the case where the user actually types an opening
  3056. quote.  And we need to handle braces as well as quotes.  ckucmd.c, 25 Jul 2000.
  3057.  
  3058. Previous item, cont'd...  By simply advancing the pointer past the opening
  3059. quote (or brace) -- in other words, totally ignoring it -- full completion
  3060. works if the user begins the field with a quote or brace (that's where we left
  3061. off yesterday).  The trick is to remember that we did this, and then when
  3062. repainting the field, we go back one extra space to write over the quote or
  3063. brace that they typed with the one that was subsequently supplied anyway.
  3064. Also, the dquote() routine had to be changed to work for both quotes and
  3065. braces.  Having done this, partial completion now works too, adding quotes or
  3066. braces around if none were provided, and adding the matching closing quote or
  3067. brace if an opening one was given.  I thought about leaving off the closing
  3068. one, but then if the partial completion stops after one or more trailing
  3069. spaces, the user won't see it/them.  This way they see trailing spaces, but
  3070. they have to backspace over the closing quote or brace in order to continue.
  3071. Anyway, now all forms of completion work with filenames that contain spaces.
  3072. Directory names too.  ckucmd.c, 26 Jul 2000.
  3073.  
  3074. Similar treatment for ?-help.  ckucmd.c, 26 Jul 2000.
  3075.  
  3076. Similar treatment for output files (replaced do-it-yourself brace-stripping
  3077. code by a call to brstrip()).  cmofi(): ckucmd.c, 26 Jul 2000.
  3078.  
  3079. Added SET TERMINAL TRANSPARENT-PRINT as in invisible synonym for SET
  3080. TERM PRINT for agreement with some of the docs.  ckuus7.c, 26 Jul 2000.
  3081.  
  3082. Adding optional arguments to the TAKE command was a good idea but had a bad
  3083. side-effect, namely that any arguments given replaced the current argument
  3084. vector at the level where the TAKE command was given, and worse, the new
  3085. values stayed in effect after the command file was complete, which could give
  3086. nasty surprises.  I finally hit on a clean way of fixing this: if the TAKE
  3087. command has arguments, then instead of replacing the current argument vector
  3088. and calling dotake(), we define a temporary macro containing "take
  3089. <filename>", and then execute the macro with the given arguments.
  3090. ckuus[r2].c, 26 Jul 2000.
  3091.  
  3092. After adding function diagnostics for C-Kermit 7.0, "if defined \fblah()"
  3093. gave obnoxious messages for nonexistent functions.  Changed IF DEFINED to
  3094. have a special case for functions.  Also now you no longer have to include
  3095. any arguments: "if defined \fupper()" works ok; so does "if defined \fupper".
  3096. doif(): ckuus6.c, 27 Jul 2000.
  3097.  
  3098. SHOW CHARACTER-SETS could show garbage (or worse) after a SET TRANSFER
  3099. CHARACTER-SET TRANSPARENT command.  ckuus3.c, 27 Jul 2000.
  3100.  
  3101. Implemented \v(exedir) for Unix.  This might come in handy in case we want
  3102. to allow for putting the system-wide init file together with the executable,
  3103. which would certainly simplify finding it.  ckuus[4y].c, 27 Jul 2000.
  3104.  
  3105. HTTP changes from Jeff, mostly stripping leading spaces from messages.
  3106. Plus more filling in of FTP module.  ckcnet.c, ckcftp.c, 30 Jul 2000.
  3107.  
  3108. CRECEIVE was broken, wouldn't parse.  Fixed in ckuusr.c, 30 Jul 2000.
  3109.  
  3110. Added { RECEIVE, GET } /PIPES:{ON,OFF} to override global TRANSFER PIPES
  3111. setting for this command only.  ckuusr.h, ckcmai.c, ckuus[26x].c, 30 Jul 2000.
  3112.  
  3113. PeterE discovered that the autoupload string was broken.  This happened during
  3114. the great conversion sprintf->ckmakmsg conversion.  Fixed in ckcpro.w, 
  3115. 30 Jul 2000.
  3116.  
  3117. Allow the LOG command to accept a directory name, in which case the appropriate
  3118. filename is supplied.  ckuus4.c, 30 Jul 2000.
  3119.  
  3120. Just for fun, added a rudimentary LISP S-Expression (SEXP) parser (cksplit()
  3121. makes this easy).  If a command starts with "(" it is interpreted as an
  3122. S-Expression.  Operators are: = (assignment), +, -, *, /, and ^.  Numbers and
  3123. variables are allowed, and as a special bonus, "long variable" (macro) names
  3124. do not need to be enclosed in \m(...), so you can do:
  3125.  
  3126.   (= a 2)
  3127.   (= b 3)
  3128.   (= c (+ a b))
  3129.   (* (+ a b) (- c a))
  3130.  
  3131. Of course you can also include regular variables and function invocations in
  3132. the normal manner.  S expressions print their result automatically if entered
  3133. at top level.  ckuusr.[ch], ckuus[235].c, 31 Jul 2000.
  3134.  
  3135. Some NOXFER and Forward-X corrections from Jeff: ckcmai.c, ckuusr.c,
  3136. ckctel.c, ckcnet.c,  1 Aug 2000.
  3137.  
  3138. Minor improvements to S-Expression parser:
  3139.  . Added \v(sexpression) and \v(svalue).
  3140.  . Added HELP SEXPRESSION (HELP-only keyword).
  3141.  . Added SET SEXPRESSION ECHO-RESULT { ON, OFF, AUTO }
  3142.  . Fixed handling of negative exponents.
  3143.  . Better detection of invalid S-Expressions.
  3144. ckuusr.[ch], ckuus[234].c, 1 Aug 2000.
  3145.  
  3146. Dat Nguyen noticed a strange bug:
  3147.  
  3148.   asg str xxxxx
  3149.   echo \flen
  3150.   xxxxx
  3151.  
  3152. zzstring() was checking for this (functions with no parens), but not reporting
  3153. an error, and evidently the most recent string definition was sitting in just
  3154. the right place.  Simplified the logic by letting fneval() handle it.  Also
  3155. improved fneval() error messages to show the full proper name of the function
  3156. rather than what the user typed.  ckuus4.c, 2 Aug 2000.
  3157.  
  3158. Just in case anybody wants to extend the S-Expression code to work with other
  3159. data types (float, string), I changed dosexp() to return a string pointer to
  3160. a string result, rather than an int.  Also put the built-in ops into a keyword
  3161. table so they don't have to be single characters; added SETQ, EVAL, and MOD as
  3162. proofs of concept. ckuus3.c, 2 Aug 2000.
  3163.  
  3164. From Jeff, add FORWARD option to TELOPT command, plus various auth changes.
  3165. ckuusr.c, ckctel.c, ckuat*.[ch], 3 Aug 2000.
  3166.  
  3167. Split out the floating-point formatting code from fneval() to a separate
  3168. routine, fpformat(), and improved it by (somewhat crudely) changing results
  3169. that ended in lots of 9's after the decimal point to increment the rightmost
  3170. non-9 digit and lop the rest (but leave a trailing '0' to indicate this
  3171. was done).  So now, for example, \ffpadd(1.5,2.3) is 3.80 rather than
  3172. 3.799999999999999 (as it is in, e.g. EMACS Lisp on the Sun).  ckuus4.c,
  3173. 3 Aug 2000. 
  3174.  
  3175. Added floating-point support to dosexp().  The result is floating-point if any
  3176. of the operands are floating-point, and is formatted with the new fpformat()
  3177. function (which also trims useless trailing 0's, as always), so the results
  3178. are nicer than with most Lisps.  As proof of concept, added built-in EXP, SQRT,
  3179. LOG, and LOG10 functions.  ckuus3.c, 3 Aug 2000.
  3180.  
  3181. Discovered that "if <floating-point-number> <command>" didn't work.  Typo in
  3182. boolval(): #ifndef FNFLOAT should have been #ifdef.  ckuus6.c, 3 Aug 2000.
  3183.  
  3184. Changed "=" to be a predicate rather than an assignment operator, for
  3185. compatibility with Lisp; use SETQ for assignment.  Added "<", "<=", ">", and
  3186. ">=" as additional predicates.  Predicates are operators that that return "0"
  3187. if false and "1" if true (in Lisp they return Nil and T).  ckuus3.c,
  3188. 3 Aug 2000.
  3189.  
  3190. Added ABS, MIN, and MAX, plus FP-to-Int conversion functions FLOOR, CEILING,
  3191. TRUNCATE, ROUND.  ckuus3.c, 3 Aug 2000.
  3192.  
  3193. Broke creation of local variables out of dolocal() loop into a new routine,
  3194. addlocal().  Had dolocal() call addlocal() in its loop.  ckuus6.c, 3 Aug 2000.
  3195.  
  3196. Added LET, which is like SETQ but defines a local, rather than global,
  3197. variable.  This is not exactly like Lisp LET, which creates the variable in
  3198. the scope of the current S-Expression, but we can revisit later if anybody
  3199. cares.  ckuus3.c, 3 Aug 2000.
  3200.  
  3201. Tried adding ?-help for S-Expression operators but didn't get it working.
  3202. Fix it later.  ckuusr.c, 3 Aug 2000.
  3203.  
  3204. Problem: Typing a token (such as "!") at the prompt, immediately followed by a
  3205. question mark, just says "one of the following: '!'", not very helpful.
  3206. Ideally, we would get the same help here as we would if we typed a space
  3207. before the "?".  Did this in cmkey() "?" section by setting cmflgs == 3 ("?")
  3208. before returning.  Works fine if subsequent field is cmtxt() or cmfld(), but
  3209. until now we never had a token followed by a keyword.  Added code in cmkey2()
  3210. to handle this, and -- if you call cmkey2() right -- it works, in that that it
  3211. (a) lets you type "?" after the "(" and gives you a keyword list and then lets
  3212. you continue from there; (b) editing, etc, work fine; and (c) the command
  3213. still executes correctly whether you typed "?" or not.  But it breaks command
  3214. recall, at least in this case, plus it doesn't allow the CAR to be anything
  3215. that's not in the operator table, so (e.g.) "(a)" is not accepted.  So I put
  3216. the parsing back to unhelpful cmtxt().  ckuusr.c, ckucmd.c, 4 Aug 2000.
  3217.  
  3218. Changed S-Expression handler, if given a predicate as its outermost operator,
  3219. to set SUCCESS or FAILURE according to its result.  ckuus[r3].c, 4 Aug 2000.
  3220.  
  3221. Added \fsexpression(), which takes an S-Expression as an argument (outer
  3222. parens are not required) and returns its value.  Normal quoting rules apply.
  3223. ckuusr.h, ckuus4.c, 4 Aug 2000.
  3224.  
  3225. Checked number of operands for each operator as in Lisp; table-driven via
  3226. special keyword flags.  ckuus3.c, 4 Aug 2000.
  3227.  
  3228. Fixed SETQ to allow more than one pair of args, and to undef the variable if
  3229. a definition is missing, and to return NULL if it has no operands (like real
  3230. Lisp).  ckuus3.c, 5 Aug 2000.
  3231.  
  3232. Fixed "(setq a xxx)" not to assign 0 to a if xxx is not defined.  ckuus3.c,
  3233. 5 Aug 2000.
  3234.  
  3235. The following:
  3236.  
  3237.   define baz { assign a XXX, return B }
  3238.   echo A\fexec(baz)C
  3239.  
  3240. prints XBC instead of ABC.  It turns out this problem, unlike the one similar
  3241. one on May 30th, is entirely superficial and was fallout from the change to
  3242. ECHO "foo" to keep the quotes.  I put the code back as it was; the user has to
  3243. type double doublequotes if she wants the quotes echo'd:
  3244.  
  3245.   echo ""foo""
  3246.   "foo"
  3247.  
  3248. ckuusr.c, 5 Aug 2000.
  3249.  
  3250. The LOCAL directive had a flaw; when used for macro names, it only made the
  3251. name local if a macro of the same name was already defined.  Otherwise, the
  3252. LOCAL name became global.  Fixed in addlocal(): ckuus5.c, 5 Aug 2000.
  3253.  
  3254. Fixed chknum() to return 0 if arg NULL or empty.  ckclib.c, 6 Aug 2000.
  3255.  
  3256. Changed \fjoin() to separate array elements with space by default.
  3257. ckuus4.c, 6 Aug 2000.
  3258.  
  3259. Fixed top-level IF command for numeric comparisons to do brace-stripping
  3260. so "if = {\fsexpression(+ 1 1)} 2 <command>" could be parsed.  ckuus6.c,
  3261. 6 Aug 2000.
  3262.  
  3263. Fixed (+) (-) and (*) to return the same values as in Lisp (0, 0, and 1,
  3264. respectively).  ckuus3.c, 6 Aug 2000.
  3265.  
  3266. Added S-Expression operators: FLOAT, IF, NOT, !=, AND, OR, ...
  3267. ckuus3.c, 6 Aug 2000.
  3268.  
  3269. Fixed CEILING and FLOOR to do the right thing if given integer args.
  3270. ckuus3.c, 6 Aug 2000.
  3271.  
  3272. Changed the size of floating-point formatting buffer from 64 to 1024, since
  3273. nothing stops somebody from doing (^ 99999999999999999 99999999999999999999),
  3274. and printf("%f") will merrily expand to any length needed).  IEEE floating
  3275. point on the Sun seems to stop at about 300 decimal places and then prints
  3276. "Infinity", but elsewhere who knows).  ckuus4.c, 6 Aug 2000.
  3277.  
  3278. My clever strategy of doing everything in integer arithmetic until I saw a
  3279. floating-point number was all wrong because it gives wrong answers if (a) the
  3280. magnitude of any operand is greater than MAXINT (and there is no reliable way
  3281. to test for that), or (b) a result would overflow MAXINT.  Therefore, all
  3282. computations have to be in floating point anyway, and therefore there's no
  3283. point in having all the #ifdef CKFLOAT's inside the S-Expression code, so I
  3284. removed them all.  ckuusr.h, ckuus3.c, 6 Aug 2000.
  3285.  
  3286. Updated help text.  ckuu2.c, 6 Aug 2000.
  3287.  
  3288. Updated 7.1 release notes.  ckc71.txt, 6 Aug 2000.
  3289.  
  3290. Built on Sun with -DNOSEXP.  It's only 8K smaller than with.
  3291.  
  3292. TRUNCATE, FLOOR, and CEILING didn't truncate.  Fixed in ckuus3.c, 7 Aug 2000.
  3293.  
  3294. Changed fpformat() to be in #ifdef CKFLOAT rather than #ifdef FNFLOAT.
  3295. ckuus4.c, 7 Aug 2000.
  3296.  
  3297. Initialized malloc'd INPUT match buffer to the empty string.  Previously
  3298. it was not initialized; new strict malloc implementations are deliberately
  3299. writing junk over malloc'd memory, rather than 0's, to force the application
  3300. to initialize.  ckuus4.c, 7 Aug 2000.
  3301.  
  3302. Changed SHOW MACRO to accept a series of macro names rather than just one, and
  3303. to only do an exact match on each one unless it contains metacharacters, in
  3304. which case it does a pattern match, and also to omit blank lines.  So now
  3305. "show mac a b c" is a convenient way to check the results of operations like
  3306. (setq a 1 b 2 c 3).  ckuus5.c, 7 Aug 2000.
  3307.  
  3308. ARRAY LINK <linkname> <arrayname>.  Makes a symbolic link from one array to
  3309. another.  Any changes to the link affect the real array.  Deleting the link
  3310. affects only the link.  Deleting the array deletes all links to it.  Resizing
  3311. a link resizes the real array.  Resizing a real array resizes all links to it.
  3312. This mechanism allows arrays to be passed as parameters to macros.
  3313. ckuus[r25].c, 8 Aug 2000.
  3314.  
  3315. Added UNDECLARE as a top-level command, since we never had a straightforward
  3316. way of undeclaring an array.  ckuusr.[ch], ckuus2.c, 8 Aug 2000.
  3317.  
  3318. Fixed \fdefinition() to require an exact match.  ckuus4.c, 8 Aug 2000.
  3319.  
  3320. Moved setup of PI and E constants to initfloat(), ckuus4,c, 8 Aug 2000.
  3321.  
  3322. Added PI, SIN, COS, and TAN to S-Expression parser.  ckuus3.c, 8 Aug 2000.
  3323.  
  3324. Fixed a typo that broke -DNOFLOAT builds.  ckuusr.h, 8 Aug 2000.
  3325.  
  3326. More conditionalization to allow successful compilation and linking on
  3327. platforms where we have floating-point arithmetic but can't (or don't)
  3328. link with the math library.  ckuus[34].c, 9 Aug 2000.
  3329.  
  3330. Added extensibility to S-Expressions by allowing Kermit macros as operations.
  3331. ckuus3.c, 9 Aug 2000.
  3332.  
  3333. Made "*", when used as an operand, behave as in Franz Lisp: it's the value
  3334. of the last S-Expression (1 initially).  So, for example, (+ * *) executed
  3335. repeatedly gives 2, 4, 8, 16, ...  ckuus3.c, 9 Aug 2000.
  3336.  
  3337. Added IF INTEGER as synonym for IF NUMERIC.  ckuus6.c, 9 Aug 2000.
  3338.  
  3339. From Jeff: Minor fixes to RLOGIN and TELNET command error handling and
  3340. RLOGIN /K5 processing.  ckuusr.c ckuus7.c, 10 Aug 2000.
  3341.  
  3342. Fixed Motorola SV88, FreeBSD, NetBSD, and OpenBSD entries to include -DFNFLOAT
  3343. and -lm, and built OK on those platforms.  Reminder for next time we have
  3344. trouble with this stuff: to get the f.p. math functions, both -DFNFLOAT and
  3345. -lm must be included in the makefile entry.  FNFLOAT is not defined
  3346. automatically.  makefile, 10 Aug 2000.
  3347.  
  3348. Fixed Motorola SV68 makefile entries to include -DFNFLOAT and -lm (verified
  3349. by Gerry B).  makefile, 11 Aug 2000.
  3350.  
  3351. Looked into making the algebraic expression evaluator, evala(), automatically
  3352. lookup macro names like the S-Expression evaluator does.  No dice.  It can't
  3353. work because evala() doesn't require spaces.  Macro names like "a+b" and
  3354. "foo&bar" are perfectly legal, but they would be ambiguous in algebraic
  3355. expressions if we allowed bare macro names.
  3356.  ... But maybe if enclosed in parens?
  3357.  ... But then it might as well be an S-Expression or \m(xxx).
  3358.  ... But it can't be an S-Expression.
  3359. Anyway, this doesn't work either because the algebra parser is strictly
  3360. left-to-right.  Case closed.  11 Aug 2000.
  3361.  
  3362. Changed \v(exedir) setup in Unix to convert to fully qualified pathname in
  3363. case argv[0] is relative.  Also for platforms where argv[0] is not a full
  3364. pathname, I added code to search the PATH for the executable.  In all cases,
  3365. it verifies that the result exists.  In case all of this fails, it sets
  3366. \v(exedir) to "/".  11 Aug 2000.
  3367.  
  3368. S-Expressions: Added &&, ||, ** as synonyms for AND, OR, and ^.
  3369. Added &, |, and # for bitwise AND, OR, and XOR.  ckuus[23],c, 11 Aug 2000.
  3370.  
  3371. addmac() did not return consistent return codes for array errors -- not
  3372. declared, subscript out of range, etc.  Fixed in ckuus5.c, 11 Aug 2000.
  3373.  
  3374. S-Expression parser appeared to allow assignment to undeclared or out of
  3375. range array elements.  Fixed in ckuus3.c, 11 Aug 2000.
  3376.  
  3377. If a command started with "{" but wasn't properly terminated, Kermit would
  3378. recurse until stack overflow.  Fixed in docmd(), ckuusr.c, 12 Aug 2000.
  3379.  
  3380. Unix zfnqfp() was supposed to include a "/" at the end of a directory name,
  3381. and it used to, but this was lost during the conversion to realpath() in
  3382. April 1999.  Fixed in ckufio.c, 12 Aug 2000.
  3383.  
  3384. Noticed that ?-help inside of quoted filename didn't work any more.  Typo
  3385. (trashed comment terminator), fixed in cmifi2().  Also removed all the
  3386. #ifdef OLDHELP code -- we haven't used it in years.  ckucmd.c, 12 Aug 2000.
  3387.  
  3388. cksplit() did not guard against too-deeply-nested strings.  Fixed in ckclib.c,
  3389. 12 Aug 2000.
  3390.  
  3391. Added some small optimizations to mlook() and mxlook() (macro table lookups)
  3392. to speed up scripts and especially S-Expressions.  ckuus5.c, 12 Aug 2000.
  3393.  
  3394. Same optimizations added to xlookup() (which is used for SEXP operators).
  3395. ckucmd.c, 12 Aug 2000.
  3396.  
  3397. Since the SEXP operator table is an xlookup() table, which need not be in
  3398. alphabetic order, I rearranged it to have the most common ops at the top:
  3399. SETQ, +, -, *, /, etc.  ckuus3.c, 12 Aug 2000.
  3400.  
  3401. After this a 5000-iteration test loop full of S-Expressions went about 15%
  3402. faster, not as good as I hoped.  gprof shows we're spending only 2% time in
  3403. xlookup() and mxlook() (good) but still > 37% in regular lookup(), plus nearly
  3404. 10% in cksplit() (not surprising).  Lookup reports 33% cache hits.  Close
  3405. inspection of lookup() does not reveal any further possible optimizations,
  3406. except maybe using a binary search if the table is large.  So the real
  3407. question is: can we reduce the number of calls to lookup() in the first place?
  3408. Yes: In cmkey(), we can check FIRST whether we have a token, then call
  3409. lookup() only if we don't.  Trying this reduces our lookup() calls
  3410. dramatically for a loop full of S-Expressions, raises the lookup() cache hit
  3411. rate to 80%, moves lookup() down in the profile from 37% to < 4%, and
  3412. increases the speed improvement of our test case from 15% to 36%.  ckucmd.c,
  3413. 12 Aug 2000.
  3414.  
  3415. While I was at it...  After the above, docmd() was pretty much the top hog.
  3416. Rearranged it a bit to put the most common commands at the top, to reduce
  3417. the number of comparisons after top-level command lookup.  This didn't make
  3418. any perceptible difference in execution time, but in the profile it reduced
  3419. docmd() from 11.5% to 9.6% of wall time.  The top hogs now are cksplit() and
  3420. gtword(), but there's not much we can do about them.  ckuusr.c, 12 Aug 2000.
  3421.  
  3422. More script optimization: It's very common in a script to change the value
  3423. of a macro -- especially when using SEXPs.  What happens when we do this:
  3424.  
  3425.   define foo 1
  3426.   define foo 2
  3427.  
  3428. the first DEFINE looks it up and, assuming it wasn't already defined, inserts
  3429. it into the macro table.  The second DEFINE looks it up, finds it, deletes it
  3430. (freeing the name the value and moving everything past it up one slot), then
  3431. moves everything down one slot, and allocates the name again and inserts the
  3432. new value in the same place it was before.  Obviously when *replacing* a macro
  3433. definition, we can skip most of that.  Changed addmac() to do so.  Now the
  3434. test script runs 39% faster.  ckuus5.c, 12 Aug 2000.
  3435.  
  3436. Squeezed another few percent out by doing a pre-xlookup() check in dosexp(),
  3437. so now it's 42.5% faster.  ckuus3.c, 12 Aug 2000.
  3438.  
  3439. Added code to actually record a histogram of top-level commands.  To view it,
  3440. "log debug" just before exiting, then "grep CMSTATS debug.log", and look up
  3441. the command indices in ckuusr.h.  Found a couple more frequently used commands
  3442. that needed to be moved up in docmd(), moved them, and now the test script is
  3443. 47% faster.  Hmmm, almost 50...  So now cksplit() dominates the profile...
  3444. A bit more micromanagement (inlining ckstrchr(), fixing isfloat()'s return
  3445. code to indicate whether the argument was an integer or floating-point,
  3446. thus obviating additional calls to chknum() or ckstrchr(), ...) brings us
  3447. up to a 51% improvement.  ckclib.c, ckuus3.c, 12 Aug 2000.
  3448.  
  3449. Jeff noticed some fallout from all the optimizations, mainly that labels are
  3450. sometimes parsed incorrectly; the error is "Not confirmed".  This occurs when
  3451. the label name is left behind after the label parse; when cmcfm() is called,
  3452. gtword() returns the label name again.  This problem goes away when I undo the
  3453. "don't call lookup() if it's a token" optimization.  It turns out that the
  3454. token-handling code in cmkey() and in ckuus5.c had never been used before now;
  3455. the lookup always succeeded because the tokens are also in the main lookup
  3456. table, so cmkey() never actually returned -5 ("it's a token") before.  But
  3457. unfortunately, this was by far the biggest optimization, so undoing it is not
  3458. exactly satisfying.  The new problem has something to do with ungword()
  3459. (cmcfm() still sees the label name in the buffer), but moving or removing the
  3460. ungword() call (or adding an unungw() call at the obvious place) only makes
  3461. matters worse.  Backing off on the offending optimization fixes the problem
  3462. but brings us back down to a 23% improvement.  But I thought of another way to
  3463. optimize lookup() internally, based on the fact that it requires its command
  3464. lists to be in order, allowing an early loop exit, and this brings us back up
  3465. to 49%.  But now keyword lookups fail if the table is out of order, whereas
  3466. previously they might have succeeded.  The new rule is: all letters are
  3467. counted as lowercase.  Therefore characters like ^ and _ come *before* them,
  3468. not after them.  I had to rearrange the top-level keyword table plus a couple
  3469. of others before the demo script would run again.  ckucmd.c, 14 Aug 2000.
  3470.  
  3471. Added code to lookup() to print a big message if the debug log is active
  3472. and a table is out of order, so in case we notice any other funny behavior,
  3473. we can just "log debug" and see if a TABLE OUT OF ORDER message comes out.
  3474.  
  3475. Corrected a bug in the dosexp() prelookup optimization; it was testing the
  3476. index for flags, rather than the flag word pointed to by the index.  ckuus3.c,
  3477. 14 Aug 2000.
  3478.  
  3479. Corrected a bug in macro-name lookup optimization, in which suddenly case
  3480. mattered.  ckuus5.c, 14 Aug 2000.
  3481.  
  3482. OK, back to the real problem...  When I first added tokens (mainly to allow
  3483. shell escapes without a space between "!" and the shell command), it required
  3484. a kludge in which a space was inserted between the token and the next field in
  3485. the internal buffers (#ifdef KLUDGE in ckuus5.c).  Well, now that I fixed it
  3486. so the token-handling code is actually executed instead of just sitting there
  3487. being skipped over, we don't need the kludge any more; commenting out the
  3488. #define KLUDGE statement seems to fix everything, and now the improvement
  3489. jumps to 54%.  And today's speedups apply to all compute-bound scripts, not
  3490. just those that are dominated by token-initiated commands, so it wasn't a
  3491. wasted day.  ckuus5.c, 14 Aug 2000.
  3492.  
  3493. Before leaving lookup(), added one more optimization: if the search object was
  3494. not in the cache and the keyword table size is greater than 4, we do a quick
  3495. binary search to find the first table element whose name starts with the
  3496. desired letter (or higher).  This, plus the other optimizations, boosts
  3497. performance of non-S-Expression compute-bound scripts by up to 100%, reducing
  3498. the number of lookup() loop iterations (and therefore string comparisons) to
  3499. between 0.5 and 4 per lookup() call, depending on the application (that's down
  3500. from an average of around 50).  Added the same code to mlook() and mxlook();
  3501. it doesn't hurt, but it doesn't help much either, at least for small test
  3502. cases.  But it should make a difference for large programs containing many
  3503. macro names.  ckucmd.c, ckuus5.c, 15 Aug 2000.
  3504.  
  3505. OK, back to S-Expressions.  First, SETQ and LET didn't work right when given
  3506. more than one assignment pair and the object of the second or subsequent pair
  3507. was a backslash thing (\%a, \&a[1], etc).  There was a hideous hack in
  3508. dosexp()'s caller that peeked at the op to see if it was LET or SETQ, and then
  3509. doubled the backslash (if any) of the second "word".  So:
  3510.  
  3511.   (setq \%a \%x)
  3512.  
  3513. would become:
  3514.  
  3515.   (setq \\%a \%x)
  3516.  
  3517. But this didn't work for:
  3518.  
  3519.   (setq \%a \%x \%b \%y)
  3520.  
  3521. However, just looping through the string doubling backslashes of every second
  3522. operand doesn't help, because SETQs can be nested:
  3523.  
  3524.   (setq \%a (+ 1 (setq \%b 0)))
  3525.  
  3526. But looping through the string and looking for items following "setq" or
  3527. "let" doesn't work either because that would miss the final two terms in a
  3528. construct like this:
  3529.  
  3530.   (setq \%a (+ 1 (setq \%b 0)) \%c \%x \%d \%y)
  3531.  
  3532. In general:
  3533.  
  3534.  (+ 1 (setq \%r (+ 2 (setq a (setq \%x \%b))) x 4 \%y 5 z (+ \%a 1)))
  3535.  
  3536. the only way we can tell the target of an assignment from the material to be
  3537. assigned is by executing the S-Expression.  And that means we can't pass ANY
  3538. S-Expression through zzstring() at top level, since we don't know yet whether
  3539. it contains any SETQs or LETs.  Therefore, dosexp() has to call zzstring() on
  3540. each and every piece of every S-Expression individually, and poof, there goes
  3541. our good performance.
  3542.  
  3543. The only way to salvage what we have so far is to insist that if the target
  3544. of an assignment is a backslash variable, the backslash must be doubled by
  3545. the user.  So:
  3546.  
  3547.   (setq \%a (+ 1 (setq \%b 0)) \%c \%x \%d \%y)
  3548.  
  3549. must be entered as:
  3550.  
  3551.   (setq \\%a (+ 1 (setq \\%b 0)) \\%c \%x \\%d \%y)
  3552.  
  3553. ckuusr.c, 15 Aug 2000.
  3554.  
  3555. Except for SETQ and LET, S-Expression operators were not being recognized
  3556. if given in uppercase.  Fixed in xlookup(): ckucmd.c, 15 Aug 2000.
  3557.  
  3558. Fixed broken IF command (a couple keywords were misplaced).  ckuus6.c,
  3559. 16 Aug 2000.
  3560.  
  3561. Problem: (setq \%i (setq \\%i 1)) failed to fail.  Reason: \%i is not defined,
  3562. so "setq \\%i 1" became the name of the variable to be SETQ'd, but since no
  3563. value was given it was undefined.  But since it wasn't defined in the first
  3564. place, nothing happened.  To catch this I had to add another check on the
  3565. SETQ/LET target: fail if it has multiple words.  Luckily this doesn't drag
  3566. performance down too much.  ckuus3.c, 16 Aug 2000.
  3567.  
  3568. Feeling adventurous, I tried changing the algebraic expression evaluator
  3569. (evala()) to treat non-numbers as macro names, just as S-Expressions do now.
  3570. 10 minutes later...  Hmmm, that was too easy.  The demo script still executes
  3571. OK, and there's no performance penalty.  The change is in gettok():
  3572. #ifdef COMMENT..(new code)..#else..(old code)..#endif.  ckuus5.c, 16 Aug 2000.
  3573.  
  3574. Now you can use macro names ALMOST anywhere you can use a number: in any
  3575. cmnum() field, as function arguments, as array subscripts, etc.  How about as
  3576. FOR-loop variables?  All I had to do was comment out a check against it
  3577. in dofor(): ckuus6.c, 16 Aug 2000.
  3578.  
  3579. Fixed the algebraic expression evaluator not to spit out multiple error
  3580. messages for one bad expression.  ckuus5.c, 16 Aug 2000.
  3581.  
  3582. Added ++ (increment) and -- (decrement) operators for S-Expressions.  So
  3583. now you can do (++ a) instead of (setq a (+ a 1)).  You can also include a
  3584. value, e.g. (++ a 2) or (-- a 3.14).  You can also increment/decrement
  3585. multiple variables in a single expression.  ckuus[23].c, 16 Aug 2000.
  3586.  
  3587. Added CHMOD /TYPE:{TEXT,BINARY} One-upsmanship on Unix; this lets you do
  3588. things like "chmod /files /type:binary 775 *", i.e. only give execute
  3589. permission to binary files.  Also CHMOD /SIMULATE, which lets you see what
  3590. would happen without actually doing it.  ckuus[23].c, 17 Aug 2000.
  3591.  
  3592. More-prompting didn't work in the DELETE command; del_pag initialization
  3593. was wrong.  Fixed in ckuus6.c, 17 Aug 2000.
  3594.  
  3595. Added DELETE /TYPE:{TEXT,BINARY}.  ckuusr.h, ckuus[26].c, 17 Aug 2000.
  3596.  
  3597. Added GREP /TYPE:{TEXT,BINARY}.  ckuus[26].c, 17 Aug 2000.
  3598.  
  3599. The change on 21 Jul 2000 to repaint the field when completion was done
  3600. on a filename that contained a metacharacter broke recognition of UNIX
  3601. tilde-notation for directory names.  Fixed in cmifi2(), ckucmd.c, 17 Aug 2000.
  3602.  
  3603. Fixed another buffer vulnerability.  "kermit -x xxxxxxxxxxx..." (more than
  3604. 128 x's).  ckuusy.c, 17 Aug 2000.
  3605.  
  3606. Made SUCCEED and FAIL invisible to make top-level ?-menu fit on 24x80 screen
  3607. again.  ckuusr.c, 17 Aug 2000.
  3608.  
  3609. From Jeff: Allow compilation when Kerberos is defined without rlogin: ckuus4.c
  3610. Work on Heimdal support.  NetBSD and SuSe have decided to ship Heimdal
  3611. Kerberos as part of the base package instead of MIT Kerberos.  IBM announced
  3612. yesterday that all Netfinity servers will come with SuSe Linux pre-installed
  3613. side by side with any other OS.  ckuath.c, 18 Aug 2000.
  3614.  
  3615. Changed a "(int) = (float)" assignment to avoid a warning.  ckuus3.c,
  3616. 18 Aug 2000.
  3617.  
  3618. Fixed S-Expressions to handle the situation where only one word is contained
  3619. in the parentheses, and it is the name of a macro whose definition is an
  3620. S-Expression.  ckuus3.c, 18 Aug 2000.
  3621.  
  3622. Fixed S-Expression parser to catch unbalanced expressions up front rather than
  3623. by recursing, and to disallow S-Expressions as operators, and to handle
  3624. "trivial nesting" like ((((((((+ a b)))))))) better, and to ignore spaces
  3625. between parentheses.  ckuus[35].c, 18 Aug 2000.
  3626.  
  3627. Yesterday's directory-name parsing fix wasn't quite right: "cd ~user<Esc>"
  3628. worked, but would back up too far and wipe out part of the prompt.  Fixed in
  3629. cmifi2(), 18 Aug 2000.
  3630.  
  3631. Changed (EVAL) to allow any number of operands (0 or more) rather than
  3632. requiring exactly one, and made "." a synonym for it.  This provides a kind of
  3633. grouping (useful in IF expressions).  ckuus3.c, 18 aug 2000.
  3634.  
  3635. Fixed evaluation of empty S-Expressions to not dump core, and added the
  3636. built-in symbolic constant NIL.  ckuus3.c, 18 aug 2000.
  3637.  
  3638. Added built-in constant T.  Now that we have three of them, put constants into
  3639. a table so we can (a) look them up and (b) disallow assignments to them.
  3640. ckuus3.c, 18 aug 2000.
  3641.  
  3642. Increased maximum number of items in an S-Expression from 32 to 1024 if
  3643. BIGBUFOK defined (as it is on modern platforms).  ckuusr.h, 18 aug 2000.
  3644.  
  3645. Changed evala() to accept floating-point numbers, truncating them to integers.
  3646. ckuus5.c, 18 Aug 2000.
  3647.  
  3648. Fixed a bug I introduced a few days ago when making algebra gettok() accept
  3649. a macro name in place of a number, in which we could dump core if a word was
  3650. given that was not found in the macro table.  Also I discovered there was
  3651. still a way it could give multiple error messages for a bad number, and fixed
  3652. that too.  ckuus5.c, 19 Aug 2000.
  3653.  
  3654. After the last couple days' additions, the test suite runs about 2.9% slower,
  3655. not so bad.  gtword() was now #2; gave it a brief going-over.  The main change
  3656. was to put the entire editing section (character/word/line deletion,
  3657. redisplay, etc) within "if (at-top-level)".  This gains us another few percent
  3658. in the heart of the command parser.  ckucmd.c, 19 Aug 2000.
  3659.  
  3660. The cmdsrc() function (which tells whether the command parser is at top level
  3661. or parsing from a file or a macro) was being called more than almost any
  3662. function, so I reworked the whole business to use a global variable, xcmdsrc,
  3663. which is set whenever the command level or source changes, and replaced all
  3664. calls to cmdsrc() by a simple reference to xcmdsrc.  The function is still
  3665. there, however, in case it is called from any other modules.  This change made
  3666. the test script run several percent faster.  ckuus*.c, ckucmd.c, ckcfns.c,
  3667. ckcpro.w, 19 Aug 2000.
  3668.  
  3669. The scary thing now is makestr(); in our S-Expression benchmark it is called
  3670. 14 million times: 7 times more than gtword() and 4 times more than setatm().
  3671. That seems really excessive.  It's because of cksplit() and dosexp() -- they
  3672. both call it on every word, and then once more to free each word.  First I
  3673. tuned makestr() a tiny bit more, replacing strlen() and strcpy() by tight
  3674. inline loops, which helps a wee bit.  Then in cksplit(), we need to not call
  3675. makestr() when we don't have to.  So the word pointer array gets a parallel
  3676. length array.  Whenever we want to add a word to the array, instead of calling
  3677. makestr(), we check if the new length is less than the current one, in which
  3678. case we just copy over the previous one.  Otherwise we call makestr() and set
  3679. the length word to what makestr() created (makestr() was altered to set a
  3680. secret global variable to the length of the string it created so we don't
  3681. have to do a redundant length counting).  Anyway, in our benchmark the number
  3682. of calls to makestr() from cksplit() was cut about in half, and the
  3683. improvement goes up to 57% (from 54% a few days ago, and about 51% yesterday).
  3684. Take out the profiling and it's 74%.  ckclib.c, 19 Aug 2000.
  3685.  
  3686. Prior to this change our benchmark was calling makestr() 14 million times.
  3687. Now it's still calling it 13 million times.  That's because dosexp() itself
  3688. calls makestr() everywhere it needs to set its return value.  Changed dosexp()
  3689. to copy the result into a static internal buffer (on the call stack) using a
  3690. tight loop (rather than [ck]str[n]cpy()).  Oddly enough, this cuts out only
  3691. another 1.5 million makestr calls.  But the non-profiling improvement is up to
  3692. 76%.  All this will need a lot of testing to make sure I didn't break anything.
  3693. ckuus[3rx].c, 19 Aug 2000.
  3694.  
  3695. Yesterday's changes broke evaluation of () again.  Fixed in cksplit():
  3696. ckclib.c, 20 Aug 2000.
  3697.  
  3698. Discovered that \ffpraise() had its test for domain errors backwards: a
  3699. negative number can be raised to a integral power, but not to fractional
  3700. power.  Fixed in fneval(): ckuus4.c.  Same fix made in dosexp(): ckuus3.c,
  3701. 20 Aug 2000.
  3702.  
  3703. Fix typo in b_to_u() (Byte-to-UTF8) when returning UTF8 version of U+FFFD,
  3704. from Bruno Haible.  ckcuni.c, 21 Aug 2000.
  3705.  
  3706. More SEXP profiling...  In our test case, makestr() is now called 11.8M times:
  3707.  
  3708.                 0.00    0.00      121/11852872     xwords [73]
  3709.                 0.00    0.00      364/11852872     addmac <cycle 1> [23]
  3710.                 0.08    0.00   500060/11852872     docmd [5]
  3711.                 0.23    0.00  1450159/11852872     setword [30]
  3712.                 0.35    0.00  2201168/11852872     parser [3]
  3713.                 0.46    0.00  2900299/11852872     cksplit [9]
  3714.                 0.75    0.00  4800520/11852872     dosexp <cycle 1> [7]
  3715. [18]     4.8    1.86    0.00 11852872         makestr [18]
  3716.  
  3717. setword() calls makestr() 1.4M times but setword() itself is called 2.6M times:
  3718.  
  3719. [30]     1.5    0.37    0.23  2650290         setword [30]
  3720.  
  3721. so the strategy of recycling malloc'd buffers is paying off as expected,
  3722. cutting the malloc()/free() burden for splitting by about 50%.  Now cksplit()
  3723. and dosexp() need some help.  The remaining calls in dosexp() are unavoidable
  3724. since we have to make (and free) a local copy of the word list for reentrancy.
  3725. But calling makestr() just to free a temporary local variable is overkill, so
  3726. the makestr(&blah,NULL) calls at the end can be replaced by simple free()'s.
  3727. This brings the total makestr() calls down to 9.4M.  And then where we make a
  3728. pokeable copy of the argument string, we do the same trick of creating the
  3729. buffer only if it doesn't exist yet, or if the argument string is longer than
  3730. the current buffer, reducing makestr() calls to 6.5M.  ckclib.c, 21 Aug 2000.
  3731.  
  3732. But cksplit() still dominates the profile.  There is always room for more
  3733. optimization...  The next trick is to get the length and copy into the working
  3734. buffer in the same operation.  Only rarely will the buffer be too small (in
  3735. which case we quit the loop early, get a new buffer, and start over), but in
  3736. most cases we accomplish the copy AND get the length in one very tight loop.
  3737. This brings our performance improvement to 80% (up from 76% on Saturday).
  3738. ckclib.c, 21 Aug 2000.
  3739.  
  3740. Discovered that I broke macros-as-opcodes when (a) the macro is given operands
  3741. and (b) does not include a RETURN statement.  Fixed in ckuus3.c, 21 Aug 2000.
  3742.  
  3743. Defining a macro as an S-Expression which is a predicate didn't work if the
  3744. result was False.  Fixed in ckuus3.c, 21 Aug 2000.
  3745.  
  3746. Part of the optimization involved having dosexp() return "" rather than NULL
  3747. sometimes, but in a couple places, I was still checking its return code only
  3748. for NULL.  This prevented certain error checks from working.  Fixed in
  3749. ckuus3.c, 21 Aug 2000.
  3750.  
  3751. A couple more tiny optimizations to dosexp(): 82%.  ckuus3.c, 21 Aug 2000.
  3752.  
  3753. Fixed a problem with "sho mac partialname<Esc> partialname<Esc>...".
  3754. ckuus5.c, 22 Aug 2000.
  3755.  
  3756. Fixed another problem with NULL return values from dosexp() and added some
  3757. more small performance tweaks.  ckuus3.c, 22 Aug 2000.
  3758.  
  3759. While looking at addmac(), noticed a lot of unnecessary work searching thru
  3760. the macro table, so added the well-known speedups.  ckuus5.c, 22 Aug 2000.
  3761.  
  3762. Squeezed a few more cycles out of lookup() by eliminating strlen() calls.
  3763. ckucmd.c, 22 Aug 2000.
  3764.  
  3765. Eliminated 15% of isfloat() calls by going thru a macro, xxfloat().  ckuus3.c,
  3766. 22 Aug 2000.
  3767.  
  3768. More tweaking of cmtxt(), gtword(), ungword().  With these and previous tweaks
  3769. we suddenly shoot up to 162% improvement (the test loop which originally took
  3770. 16.0 seconds to execute now takes 6.1 sec).  ckucmd.c, 22 Aug 2000.
  3771.  
  3772. Fixes for HTTP command (give error message when operands missing) from Jeff.
  3773. ckuusr.c, 22 Aug 2000.
  3774.  
  3775. Added \v(ftime) which returns the time of day in seconds since midnight,
  3776. including a fractional part.  ckuusr.h, ckuus4.c, 22 Aug 2000. 
  3777.  
  3778. And another optimization for dosexp(): if the argument, after stripping any
  3779. outer parens, is less than three characters long, there's no need to call
  3780. cksplit(), since it can't possibly be split.  This reduces cksplit calls in
  3781. our test from 1.40M to 0.85M.  And in this case we don't have to call
  3782. makestr() either, which gets rid of another 0.5M makestr() calls, and brings
  3783. the improvement up to 171%.  ckuus3.c, 22 Aug 2000.
  3784.  
  3785. Updated HELP FUNC JOIN text to describe n2.  ckuus2.c, 23 Aug 2000.
  3786.  
  3787. Fix from Jeff for typo in cksplit() resulting in reference to uninit'd
  3788. variable xx.  ckclib.c, 23 Aug 2000.
  3789.  
  3790. Security & ftp updates from Jeff: ckcmai.c, etc, 23 Aug 2000.
  3791.  
  3792. Fixed one of my last-minute optimizations from last night that broke
  3793. cmtxt(....,NULL) case and therefore clobbered macro definitions.  23 Aug 2000.
  3794.  
  3795. Jeff noticed that ckitoa() didn't work right when called lots of times.
  3796. Fixed in ckclib.c, 23 Aug 2000.
  3797.  
  3798. Fix from Jeff for SET FLOW ? message.  ckuus3.c, 23 Aug 2000.
  3799.  
  3800. There was trouble with S-Expressions which called macros which were themselves
  3801. defined in terms of S-Expressions, when those macros had args.  In this case
  3802. dosexp() has to call itself on each macro arg to get the arg evaluated, and
  3803. then copy the evaluated args to a buffer that holds the macro's argument list,
  3804. so we can pass it to dodo().  The problem was this buffer wasn't on the stack.
  3805. But you can't just put it on the stack because Windows doesn't like automatic
  3806. buffers in routines that might recurse deeply.  So we have to malloc and free
  3807. the buffer at each invocation, so S-Expressions that call macros are not going
  3808. to be very efficient.  ckuus3.c, 23 Aug 2000.
  3809.  
  3810. Added single-word Lisp-like quoting for macro arguments only.  If an arg is
  3811. prepended by a single quote ('), it is not sent to dosexp(), but passed
  3812. literally to the macro.  This allows (e.g.) macro names, operators, etc, to
  3813. passed as arguments to macros -- kind of like function pointers.  ckuus3.c,
  3814. 23 Aug 2000.
  3815.  
  3816. From Jeff: move misplaced #endif in gtword() that broke autoupload at command
  3817. prompt: ckucmd.c; ftp progress: ckcftp.c, ckuusr.h, ckuus[45x].c.  Updated
  3818. SSL modules.  24 Aug 2000.
  3819.  
  3820. Added a QUOTE operator to the SEXP parser (for grouping multiple words /
  3821. character strings as macro arguments).  Programming: easy.  Explaining: hard.
  3822. ckuus3.c, ckc71.txt, 24 Aug 2000.
  3823.  
  3824. Discovered that \fsplit(), if called repeatedly, would dump core.  That's
  3825. because some of this week's optimizations pulled the rug out from under it
  3826. (it used to "move" pointers from the cksplit() result array to the created
  3827. array; now it has to create copies of each string.)  ckuus4.c, 25 Aug 2000.
  3828.  
  3829. Implemented Lisp group-quote shorthand notation: (a '(b c d)), equivalent to
  3830. (a (quote (b c d))).  ckclib.c, ckuus3.c, 26 Aug 2000.
  3831.  
  3832. Discovered that addlocal() was making use of global buffers for intermediate
  3833. results, which is not good for recursion.  Also, it was doing WAY too much
  3834. work due to lazy programming.  Added a new routine, vardef(), to return a
  3835. pointer to the value of any user-defined variable, given its name (\%a, \%1,
  3836. foo).  No more zzstring(), no more needless copying, ...  This should speed up
  3837. any macros that have LOCAL statements.  ckuus5.c, 26 Aug 2000.
  3838.  
  3839. A while back in the gtword() optimizations, I had clobbered the user's ability
  3840. to edit when typing at an ASK prompt.  Fixed in ckucmd.c, 26 Aug 2000.
  3841.  
  3842. In the "allow doublequotes for grouping" changes, I overlooked cmnum().
  3843. Fixed in ckucmd.c, 26 Aug 2000.
  3844.  
  3845. \m(x) returned the definition of any macro whose name started with x, as long
  3846. as it was the only one.  Although it might be dangerous to change this, it's
  3847. even more dangerous to leave it as is, since it can return value of a
  3848. different variable than the one you think you're asking for.  Fixed in
  3849. zzstring() by calling mxlook() rather than mlook().  ckuus4.c, 26 Aug 2000.
  3850.  
  3851. Another nice touch for SEXPs: If the last statement in a macro is an
  3852. S-Expression, its value is returned automatically.  ckuus5.c, 27 Aug 2000.
  3853.  
  3854. Macro setup blindly called delmac() 10 times, once for each argument.  I
  3855. changed it to call delmac() only when it needs to.  ckuus5.c, 27 Aug 2000.
  3856.  
  3857. One final problem for SEXPs.  Currently the dosexp() return value is in a
  3858. static internal 32-byte buffer on the call stack.  This should be big enough
  3859. to hold any reasonable number, and still allow recursion to any reasonable
  3860. depth (like 1000) without filling up memory & swap space, and without any
  3861. special performance penalty.  But then again, what's reasonable?  Anyway, now
  3862. that we have QUOTE, it seems unreasonable to limit its operand to 32 bytes.
  3863. But making the buffer much bigger would be bad for recursion.  The
  3864. alternatives are: (a) make it a little bit bigger, like 80 bytes; or (b) keep
  3865. a stack of return values, which we malloc as needed.  But (b) would mean we
  3866. have to place some limit on the recursion depth in order to know how big to
  3867. make the stack, and that we have to malloc storage for each return value.  So
  3868. there goes performance and flexibility.  So I chose (a) and raised the maximum
  3869. result length to 79.  Anybody who needs to work with numbers longer than that
  3870. probably should be using some other package, and the QUOTE limitation can be
  3871. circumvented by using ' instead of QUOTE.  We can do (b) if we ever come back
  3872. and add string and list processing.  ckuus3.c, 27 Aug 2000.
  3873.  
  3874. The performance improvements gained last week degraded a bit over the last few
  3875. days: 171% down to 148%.  I trimmed away a few excess debug() calls to little
  3876. effect.  Performance is still quite good so let's leave well enough alone.
  3877. Anyway, new improvements that aren't measured in the test case.
  3878.  
  3879. From Jeff: fix Telnet handling of duplex variable, which controls echoing:
  3880. ckuus7.c, ckctel.c.  Auth changes: ckcdeb.h, ckuath.c.  More FTP: ckcftp.c.
  3881. 28 Aug 2000.
  3882.  
  3883. In the "accept macro names as numbers everywhere" change, I overlooked the
  3884. floating-point arguments of the \ffpxxx() functions.  Fixed in fneval(),
  3885. ckuus4.c, 28 Aug 2000.
  3886.  
  3887. Added CHECK SEXPRESSION.  ckuus3.c, 28 Aug 2000.
  3888.  
  3889. Updated HELP SEXP.  ckuus2.c, 28 Aug 2000.
  3890.  
  3891. Built full (but non-crypto, non-profiling) version on Linux/i386.  Size:
  3892. 1777167.  Built with -DNOSEXP, had to add an #ifdef to doexit(): ckuusx.c.
  3893. Size: 1758383.  Total size of SEXP code: 18K.  Also built a NOFLOAT version,
  3894. which required an #ifdef in gettok(): ckuus5.c.  28 Aug 2000.
  3895.  
  3896. Peter E discovered that C-Kermit, when receiving an empty file, no longer
  3897. bothers to create it (ditto for K95).  A chunk of code seems to have
  3898. disappeared from the protocol module's <rattr>Z state some time after C-Kermit
  3899. 7.0 was released.  I copied the exact same code back from 7.0 and all is well.
  3900. ckcpro.w, 29 Aug 2000.
  3901.  
  3902. Peter E pointed out that IF VERSION, though documented in the book, was never
  3903. actually implemented.  Added it.  ckuus6.c, 29 Aug 2000.
  3904.  
  3905. Fixed some signed/unsigned conflicts in ckvfio.c reported by Mark Berryman.
  3906. 29 Aug 2000.
  3907.  
  3908. Made a first pass over the new ftp module; reformatted, fixed long lines,
  3909. removed trailing whitespace, sorted out and fixed prototypes, made some
  3910. progress at removing ANSI C dependencies but didn't finish.  Note definition
  3911. of closesocket() at the top of the file.  This function is called all over the
  3912. place but not defined anywhere.  Seems to build and run OK.  ckcftp.c,
  3913. 29 Aug 2000.
  3914.  
  3915. FTP updates from Jeff.  ckcftp.c, 30 Aug 2000.
  3916.  
  3917. Updated HP-UX makefile entries from Peter E, 30 Aug 2000.
  3918.  
  3919. Changed UNIX ztime() to accept a NULL argument, in which case it only sets
  3920. the global ztmsec and ztusec variables.  ckutio.c, 30 Aug 2000.
  3921.  
  3922. Added a cheap version of gmstime() to ckcftp.c. 30 Aug 2000.
  3923.  
  3924. Dat Nguyen discovered that "echo \fsexp(foo)", where foo is the name of a
  3925. macro that returns a string, returns junk under certain (well, most)
  3926. circumstances.  The sequence is:
  3927.  
  3928.   ECHO "ABC \sexp(foo) XYZ"
  3929.     The ECHO command calls cmtxt() to parse the echo string.
  3930.     cmtxt() calls zzstring().  Now zzstring() is copying ABC to atxbuf;
  3931.     when it hits \fsexp(foo), it calls fneval().
  3932.     fneval() sees that it's \fsexp(), and so calls dosexp().
  3933.     dosexp() sees it's a macro and calls dodo() and then parser().
  3934.     parser() calls cmtxt() to evaluate the RETURN value.
  3935.     But this trounces over the buffer zzstring() was using.
  3936.     
  3937. So dosexp(), when it encounters a macro, has to do exactly what \fexecute()
  3938. does. namely cmpush()/cmpop() around parser() execution.  Of course this is
  3939. HUGELY expensive, so I added an up/down counter in \fsexp(), so dosexp() only
  3940. does cmpush/pop() if \fsexp() is active.  ckuus3.c, 30 Aug 2000.
  3941.  
  3942. While I was chasing this down I also changed dosexp()'s method for returning
  3943. its result to the more general one of malloc'ing a buffer of the needed size,
  3944. no matter how big -- no more artificial size limit on what can be returned;
  3945. using the "only malloc if new value is bigger than previous one" method, the
  3946. performance hit isn't too bad.  ckuus3.c, 30 Aug 2000.
  3947.  
  3948. But having done that, there was no more barrier to supporting string operands
  3949. and results, so I took the few extra steps to enable them:
  3950.  
  3951.  . Store string results internally enclosed in '().
  3952.  . Translate (QUOTE (a b c)) to '(a b c) so the two forms are consistent.
  3953.  . When fetching the value of a macro and it starts with ', don't run it.
  3954.  . Some other stuff like that.
  3955.  
  3956. Now we can do just about anything with strings that we could previously
  3957. do with numbers: use them as operands, store them in variables, pass variables
  3958. having string values as arguments to functions, etc.  ckuus3.c, 30 Aug 2000.
  3959.  
  3960. Noticed that the trick I did for the ECHO command (allowing 'echo "foo"' to
  3961. work as before) wasn't right, so fixed it.  ckuusr.c, 30 Aug 2000.
  3962.  
  3963. From Jeff: ckcftp.c corrections; ckuus7.c updates to show authentication;
  3964. ckuath.c updates for show authentication; optimizations to reduce the number
  3965. of DNS queries that are required for Kerberos 4/5 authentication; ckcnet.c -
  3966. correction to SRV and TXT record queries.  31 Aug 2000.
  3967.  
  3968. As expected, some minor repairs were needed after yesterday's SEXP changes.
  3969. First problem: I broke (setq x) (i.e. assignment of nothing to a variable).
  3970. Fixed in dosexp(), ckuus3.c, 31 Aug 2000.
  3971.  
  3972. Fixed up SET SEXPRESSION DEPTH-LIMIT and added SHOW SEXPRESSION and revised
  3973. update notes for recent S-Expression changes.  ckc71.txt, ckuusr.h,
  3974. ckuus[r35].c, 31 Aug 2000.
  3975.  
  3976. Fixed an unguarded reference to oldplex variable in settrm(): ckuus7.c,
  3977. 31 Aug 2000.
  3978.  
  3979. From Jeff: KRB5_U2U #ifdefs added + other auth changes.  ckcnet.c, ckuath,c,
  3980. ckutio.c, ckcdeb.h, etc.  1 Sep 2000.
  3981.  
  3982. The change I made to UNIX ztime() to allow construction of a gmstimer()
  3983. routine for FTP (a) had a typo, and (b) didn't cover all the cases.  Fixed
  3984. in ckutio.c, 1 Sep 2000.
  3985.  
  3986. It seems xlookup() calls cklower() on its argument, thus lowercasing it IN
  3987. PLACE.  This had the side effect of lowercasing SEXP '(Strings).  Worked
  3988. around in dosexp(): ckuus3.c, 1 Sep 2000.
  3989.  
  3990. Fixed xlookup() not to lowercase its argument.  This gives a slight
  3991. performance hit, but it's the right thing to do.  Btw, the only clients of
  3992. xlookup() were S-Expressions and Kverb lookups.  ckucmd.c, 1 Sep 2000.
  3993.  
  3994. Discovered that my addmac() optimization from last week had a bug that could
  3995. cause core dumps under certain infrequent conditions.  Fixed in ckuus5.c,
  3996. 1 Sep 2000.
  3997.  
  3998. Added ckstrrchr(), ckstrpbrk(), and ckstrstr() to ckclib.[ch], and changed
  3999. FTP code to use them instead of their nonportable non-ckstrxxx() counterparts.
  4000. Also replaced references to other strxxx() routines with calls to ckstrxxx()
  4001. for other functions that were already in ckclib.c, like ckstrchr.  Also
  4002. replaced sprintf()'s by ckmakmsg() calls or direct assignment.  Made all
  4003. routines static that didn't have to be referenced from outside.  Made all
  4004. function declarations and other code independent of ANSI C and finished the
  4005. internal prototypes.  ckcftp.c, 2 Sep 2000.
  4006.  
  4007. Fixed up SHOW FTP command a bit (don't display SYSFTP stuff if NEWFTP defined,
  4008. show current connection, if any).  ckuus5.c, ckcftp.c, 2 Sep 2000.
  4009.  
  4010. Made "ftp <hostname>" a legal command (i.e. "open" can be omitted).
  4011. ckcftp.c, 2 Sep 2000.
  4012.  
  4013. Added "ftp bye" as invisible synonym for "ftp close".  ckcftp.c, 2 Sep 2000.
  4014.  
  4015. Changed the BYE command itself to close the FTP connection if (a) one was
  4016. open, and (b) no other connection was open.  ckuusr.c, ckcftp.c, 2 Sep 2000.
  4017.  
  4018. Put in the FTP PUT/APPEND switch parsing, but most of them don't have any
  4019. effect yet.  ckcftp.c, 2 Sep 2000.
  4020.  
  4021. Integrated MPUT with PUT and APPEND and made it work.  If MPUT was the
  4022. command, and/or if the filespec was wild, we call gnfile() in a loop just like
  4023. in Kermit.  This brings in the full range of file selection (size, date, etc),
  4024. and sending from a file-list file works too.  Got group interruption working.
  4025. ckcftp.c, 2 Sep 2000.
  4026.  
  4027. Implemented [M]PUT /DELETE and /MOVE-TO:<dir>.  ckcftp.c, 2 Sep 2000.
  4028.  
  4029. Implemented automatic text/binary mode switching during PUT.  The hierarchy
  4030. is: if a /TEXT or /BINARY switch was given, that's the mode we use; otherwise,
  4031. if FILE SCAN is on, we use that to pick the mode; otherwise if a SET FTP TYPE
  4032. command was given, we use that; otherwise we use the prevailing SET TYPE TYPE.
  4033. ckcftp.c, 2 Sep 2000.
  4034.  
  4035. Summary: the following (should) all work now:
  4036.  
  4037.   FTP PUT /AFTER:<d-t>
  4038.   FTP PUT /BEFORE:<d-t>
  4039.   FTP PUT /NOT-AFTER:<d-t>
  4040.   FTP PUT /NOT-BEFORE:<d-t>
  4041.   FTP PUT /BINARY
  4042.   FTP PUT /TEXT (= /ASCII)
  4043.   FTP PUT /DELETE
  4044.   FTP PUT /MOVE-TO:<dir>
  4045.   FTP PUT /DOTFILES
  4046.   FTP PUT /LARGER-THAN:<size>
  4047.   FTP PUT /SMALLER-THAN:<size>
  4048.   FTP PUT /LISTFILE:<fn>
  4049.   FTP PUT /NOBACKUPFILES
  4050.   FTP PUT /NODOTFILES
  4051.   FTP PUT /RECURSIVE (sort of)
  4052.   FTP PUT /TYPE
  4053.  
  4054. For FTP PUT and APPEND, there is one source filespec (which may be wild);
  4055. for FTP MPUT there can be any number of source filespecs (like Kermit MSEND).
  4056. Notes at top of ckcftp.c are updated.
  4057.  
  4058. Some corrections from Jeff to yesterday's work: ckcdeb.h, ckutio.c, ckcftp.c,
  4059. 3 Sep 2000.
  4060.  
  4061. Added username to SHOW FTP display.  ckcftp.c, 3 Sep 2000.
  4062.  
  4063. Added SET FTP FILENAMES { LITERAL, CONVERTED }.  For now the default is
  4064. LITERAL (but maybe it should automatically change to CONVERTED if peer is not
  4065. UNIX?)  Implemented filename conversion if FTP FILENAMES is CONVERTED or if
  4066. PUT /FILENAMES:CONVERTED is used.  ckcftp.c, 3 Sep 2000.
  4067.  
  4068. Added SET FTP PATHNAMES { RELATIVE, ABSOLUTE, OFF }; default is OFF for now.
  4069. Implemented pathname handling for this, with override by PUT /PATHNAMES if
  4070. given.  Previously the pathname was left on, but the server rejected incoming 
  4071. files whose names contained paths.  ckcftp.c, 3 Sep 2000.
  4072.  
  4073. Implemented PUT /RENAME-TO:xxx, like SEND /RENAME-TO.  Added transaction log
  4074. entries for PUT.  ckcftp.c, 3 Sep 2000.
  4075.  
  4076. New FTP code from Jeff in support of MGET.  ckcftp.c, 4 Sep 2000.
  4077.  
  4078. Moved oldplex declaration outside of #ifdef NETCONN since now we seem to be
  4079. using it for other things.  ckuus7.c, 4 Sep 2000.
  4080.  
  4081. Fixed ptransfer() to do its CPS calculation in floating point.  It was dropping
  4082. fractions of seconds from the elapsed time.  ckcftp.c, 4 Sep 2000.
  4083.  
  4084. Discovered that the brief-format transaction log format was broken in the
  4085. strncat-to-ckstrncat transition; the time field was left blank.  This is
  4086. because the ckstrncat() length argument is the *buffer* length, not the number
  4087. of chars to copy.  Did a census of ckstrncat() calls (there are about 360 of
  4088. them), and found the following:
  4089.  
  4090.   ckcnet.c: ckstrncat(name,ckuitoa(ntohs(saddr.sin_port)));
  4091.   ckcnet.c: ckstrncat(name,ckuitoa(ntohs(saddr.sin_port)));
  4092.  
  4093. How do these even compile???  (I didn't touch them.)  All the other calls
  4094. look OK.  Fixed and modernized doxlog(), and adapted FTP to use it if SET
  4095. TRANSACTION-LOG BRIEF.  ckuusx.c, 4 Sep 2000.
  4096.  
  4097. Gave fpformat() the circular-buffer treatment (like ckltoa() & friends) so
  4098. it could be called repeatedly, e.g. in a function argument list (like printf,
  4099. ckmakmsg, etc).  ckuus4.c, 4 Sep 2000.
  4100.  
  4101. Changed ptransfer() (even though we're not going to be using it later) to
  4102. print numbers in regular notation (by calling fpformat()) rather than ugly
  4103. scientific notation.  ckcftp.c, 4 Sep 2000.
  4104.  
  4105. SET TRANSACTION-LOG FTP, LOG TRANSACTIONS (which uses the IKSD logging code
  4106. instead of dotlog()) didn't work at all.  It didn't even work in original 7.0.
  4107. Not only did it not work, it corrupted the source file when sending by
  4108. appending the FTP log entry to the end of the source file!  (Only if you gave
  4109. those commands, not when done with --xferlog/--xferfile) It's a good thing
  4110. C-Kermit has so many obscure features that nobody noticed this one.  Fixed in
  4111. traopn(): ckuus4.c, and in doiklog(): ckufio.c, 4 Sep 2000.
  4112.  
  4113. Did not implement the FTP-format transaction log for FTP because it is all
  4114. done in zclose(), so we'll get it automatically when/if we convert the present
  4115. file i/o to use the Kermit APIs.
  4116.  
  4117. Commented out the .netrc processing; I don't think we want it.  ckcftp.c,
  4118. 4 Sep 2000.
  4119.  
  4120. Added connection switches for scripting, to avoid nonscriptable Name: and
  4121. Password: prompts:
  4122.  
  4123.   FTP [ OPEN ] <host> [ switches ] [ <port> ]
  4124.  
  4125. Switches are:
  4126.  
  4127.  /USER:username
  4128.  /PASSWORD:password
  4129.  /ANONYMOUS
  4130.  
  4131. /ANONYMOUS supplies user "anonymous" and the appropriate <user>@<host> as
  4132. password.  openftp(): ckcftp.c, 4 Sep 2000.
  4133.  
  4134. From Jeff: New hexdump(): ckuusx.c; USE_RUSERPASS #ifdefs for ckcftp.c;
  4135. corrections to host:port-building strncat's in ckcnet.c, 5 Sep 2000.
  4136.  
  4137. CLOSE TRANSACTIONS was never coded to handle the FTP-format transaction log.
  4138. Fixed in doclslog(): ckuus5.c, 5 Sep 2000.
  4139.  
  4140. Discovered that the FTP-format log entries always said "o" (for output file)
  4141. even if it was an input file, because I shadowed the zclose() "n" (file ID)
  4142. argument when calculating the length of the record probably in the June 2000
  4143. sprintf() rampage.  Fixed in zclose(): ckufio.c, 5 Sep 2000.
  4144.  
  4145. dotlog() was clobbering tralog() if called when TRANSACTION-LOG format was
  4146. set to FTP, so subsequent SHOW LOG commands would say the log was closed when
  4147. it wasn't.  Fixed in dotlog(): ckuusx.c, 5 Sep 2000.
  4148.  
  4149. Dat Nguyen noticed that (eval a b c ...) stopped after the first operand.
  4150. Fixed in dosexp(): ckuus3.c, 5 Sep 2000.
  4151.  
  4152. While chasing Dat's reported bug, noticed that floating-point ops were spewing
  4153. out "log10: DOMAIN error" messages for any floating-point operation that
  4154. involved a negative number.  That's from yesterday's change to fpformat().
  4155. Fixed in fpformat() by taking the log of the absolute value of the number.
  4156. ckuus4.c, 5 Sep 2000.
  4157.  
  4158. From Jeff, ckcdeb.h ckcnet.c ckcftp.c, 6 Sep 2000:
  4159.  
  4160.   Added missing HTTP Header to the HTTP commands to support virtual hosts.
  4161.  
  4162.   Finally found out why FTP AUTH KRB4 was not working in all builds:
  4163.  
  4164.   . On Windows, there was a bad bug in the KRBV4W32.DLL library which
  4165.     prevented all SAFE and PRIVATE communications from taking place after
  4166.     FTP AUTH KRB4 was negotiated.
  4167.  
  4168.   . On all platforms that use the old K4 distribution there is a conflict
  4169.     in the format of the DES Key Schedule which prevents the
  4170.     krb_mk_priv() / krb_rd_priv() functions from being used to generate
  4171.     PRIVATE messages.  These routines perform their own DES manipulations
  4172.     using an externally provided Key Schedule.  If the Key Schedule was
  4173.     generated from another library with a different format, the
  4174.     computations will be incorrect.  Therefore, it is not possible to
  4175.     support FTP AUTH KRB4 if the old MIT K4 distribution is being used
  4176.     AND either OpenSSL or Eric Young's DES library are in use.  This is
  4177.     now enforced by #defines at the top of ckcftp.c
  4178.  
  4179.   . Fixes for security feedback messages when making FTP connections:
  4180.     ckcftp.c.
  4181.  
  4182. More FTP work, ckcftp.c, 6 Sep 2000:
  4183.  
  4184.  . Filled in FTP PWD command. 
  4185.  . Implemented verbose mode and made it the default.
  4186.  . Fixed FTP to restore default username before opening a new connection
  4187.    instead of reusing the one from the previous connection.
  4188.  . Added FTP PUT /UNIQUE to override global FTP UNIQUE setting.
  4189.  . Fixed gmstimer() -- it was totally wrong, results were complete garbage.
  4190.  . Added authtype to SHOW FTP.
  4191.  . Fixed openftp() parsing code to handle editing correctly.
  4192.  
  4193. Jeff noticed that "http /header:{xxx : ?" gave strange results.  After a wild
  4194. goose chase prompted by the colon (which is used as a break character when
  4195. parsing a switch), I realized the problem was more subtle, and has always been
  4196. with us.  When parsing a field, if it is enclosed in braces, we do not break
  4197. on space.  But if ? is typed, we go back and reparse starting at the point
  4198. where we left off.  But then we lose the brace count, and therefore the next
  4199. space entered (after the ?) causes the field to break prematurely.  Fixed by
  4200. adding code to recalculate the brace level upon entry to gtword() from
  4201. whatever happens to be sitting in the reparse buffer.  Ditto for doublequotes.
  4202. ckucmd.c, 6 Sep 2000.
  4203.  
  4204. Corrections from Jeff to yesterday's changes.  ckucmd.c, ckcftp.c, 7 Sep 2000.
  4205.  
  4206. Created a new symbol FTP_SECURITY, which is defined if any of the security
  4207. methods is selected, and put all security-related keywords, keyword tables,
  4208. and code within it.  This is because the keyword and switch help menus and
  4209. parsing could be rather confusing on non-secure builds; e.g. "set ftp authtype"
  4210. had only one keyword, "automatic", which was invisible.  Rearranged "show ftp"
  4211. to list security methods, and not list security options that were not
  4212. available.  This might need some refinement.  ckcftp.c, 7 Sep 2000.
  4213.  
  4214. Made doexit() call ftpbye() if there is an open FTP connection to shut it down
  4215. gracefully.  ckuusx.c, 7 Sep 2000.
  4216.  
  4217. Added FTP QUOTE (invisibly, just for us to use while developing).  Added
  4218. account field to FTP USER command, plus /ACCOUNT: switch for openftp(),
  4219. not that it will ever be needed.  No time to test any of this.  ckcftp.c,
  4220. 7 Sep 2000.
  4221.  
  4222. From Jeff: SET AUTHENTICATION KERBEROS5 ADDRESSES: ckuusr.h, ckuus[237].c,
  4223. ckcnet.c, ckuath.c;  Corrections to yesterday's work: ckuusx.c, ckcftp.c,
  4224. 8 Sep 2000.
  4225.  
  4226. Peter E sent in a couple of Unix Compress (.Z) files that scanfile()
  4227. misdiagnoses as UCS-2 BE.  Since there is no BOM, the diagnosis is because the
  4228. number of 0 bytes in even positions is about 10 times the number in odd
  4229. positions.  But:
  4230.  
  4231.  . The total number of 0 bytes is only about 2% of all bytes.
  4232.  . The numbers of 7-bit and 8-bit bytes are approximately equal.
  4233.  
  4234. Lesson: In the absence of a BOM, we should be very careful about declaring a
  4235. file to be UCS-2.  At the place where we are about to declare it UCS-2:
  4236.  
  4237.  . If decision is based on ratio of 0's in even/odd positions, require a
  4238.    higher percentage of 0 bytes, like 20%?
  4239.  
  4240.  . If distribution of bytes is fairly uniform, it's probably compressed.
  4241.    In that case, don't call it UCS-2.
  4242.  
  4243.  . If file is short, there's not enough evidence, call it binary unless
  4244.    there is no doubt.
  4245.  
  4246. Did all this in scanfile(), and also weighted the other factors in the non-BOM
  4247. UCS-2 case more heavily against UCS-2 since it's always better to send a UCS-2
  4248. file in binary mode than to send a binary file in text mode.  ckuusx.c,
  4249. 8 Sep 2000. 
  4250.  
  4251. Dat wanted to be able to use S-Expressions in the operator position of an
  4252. S-Expression; I changed the code to allow it.  Also, dosexp() was returning
  4253. a bogus value when evaluating empty parentheses.  ckuus3.c, 8 Sep 2000.
  4254.  
  4255. \fsplit() was broken for non-SEXP uses, another casualty of the optimization
  4256. blitz of a couple weeks ago.  Fixed in cksplit(): ckclib.c, 8 Sep 2000.
  4257.  
  4258. Added top-level command VOID, which is just like ECHO except it doesn't echo.
  4259. Can be used (e.g.) to invoke functions that return values without actually
  4260. doing anything with the value: "void \fsplit(\%a,&a)".  ckuusr.h, ckuus[r2].c,
  4261. 8 Sep 2000.
  4262.  
  4263. Added FTP TYPE (sends TYPE command to server, like other FTP clients, unlike
  4264. FTP SET TYPE, which just sets the variable locally).  Also added FEAT and OPTS
  4265. commands from RFC 2389, though we don't actually do anything with the
  4266. responses yet.  ckcftp.c, 8 Sep 2000.
  4267.  
  4268. Fixed FTP CHMOD, which wasn't sending a properly formed command to the
  4269. server.  ckcftp.c, 8 Sep 2000.
  4270.  
  4271. Moved ftpbye() call in doclean() outside of the "if (local)" clause, since
  4272. opening an FTP connection does not set the "local" variable (and doing so
  4273. would be dangerous, since all code presently assumes that if local is nonzero,
  4274. this indicates a device or connection was opened by ttopen() and must be
  4275. closed by ttclos()).  ckuusx.c, 8 Sep 2000.
  4276.  
  4277. Tested most other commands except MGET, MDEL, and friends; all seem OK.
  4278.  
  4279. Corrections from Jeff to yesterday's work, plus auth changes: ckuath.c
  4280. ck_ssl.c ckcftp.c ckcnet.c ckcmai.c ck_ssl.h, 9 Sep 2000.
  4281.  
  4282. Implemented dynamic as-names for FTP, e.g. "put * \v(filename).new".
  4283. ckcftp.c, 9 Sep 2000.
  4284.  
  4285. Changed \v(ftp_msg) to not include the numeric code, since \v(ftp_code)
  4286. already has it (if they agree, there's no reason to reflect it in both
  4287. variables; if they don't, why don't they?).  ckuus4.c, 9 Sep 2000.
  4288.  
  4289. Added SET FTP PROGRESS-MESSAGES { ON, OFF } to control the "if (testing)"
  4290. messages.  ckcftp.c, 9 Sep 2000.
  4291.  
  4292. Fixed some unguarded references to Unicode-specific variables in scanfile():
  4293. ckuusx.c, 11 Sep 2000.
  4294.  
  4295. A few characters (:, $, ?, etc) were still missing from the cksplit() nosep
  4296. arg in dosexp(), preventing use of variables containing those characters in
  4297. SEXPs.  Fixed in ckuus3.c, 11 Sep 2000.
  4298.  
  4299. Dat complained that you can't have an SEXP operand that is an SEXP whose
  4300. operator is an SEXP.  I started on this one by trying:
  4301.  
  4302.   def cat return \%1\%2\%3
  4303.   (setq abc 23)
  4304.   ((cat '+ '+) abc)    ; works (increments abc)
  4305.   (++ (cat 'a 'b 'c))  ; fails
  4306.  
  4307. The "works" part was done on Friday.  I fixed the failing case, and its
  4308. generalizations, in the code section that applies only to SETQ, LET, ++ and
  4309. --.  But unexpectedly, this seems to have also fixed the case that Dat was
  4310. reporting even though it did not involve those operators, no doubt through
  4311. the magic of self-reference.  ckuus3.c, 11 Sep 2000.
  4312.  
  4313. Fixed FTP IDLE when given without a time.  ckcftp.c, 11 Sep 2000.
  4314.  
  4315. Made FTP MDIRECTORY invisible because I don't see any difference from
  4316. DIRECTORY, nor any reference to it (MLIST?) in the RFCs. ckcftp.c, 11 Sep 2000.
  4317.  
  4318. Added the missing pieces to FTP PUT for automatic text/binary mode switching.
  4319. ckcftp.c, 11 Sep 2000.
  4320.  
  4321. Started looking at recursive PUTs in FTP.  Began by fixing SET FTP PATHNAMES
  4322. and FTP PUT /PATHNAMES to use the right keyword table.  Then added a very
  4323. crude sort for the file list, using a fixed-size array, just as a prototype
  4324. (in #ifdef SORTNAMES); we need the list sorted to manage directory-changing.
  4325. Seems to work fine, adds no noticeable delay for reasonable numbers of files,
  4326. but of course it soaks up storage, and will also introduce a delay for large
  4327. numbers of files.  However, we only need to do this when PATHNAMES are not
  4328. OFF, which they normally are, in which case the presort is skipped.  Second
  4329. step: made the array dynamic, but still fixed size (the limit is arbitrarily
  4330. set at 10,000 files).  ckcftp.c, 11 Sep 2000.
  4331.  
  4332. Dat reported another problem with a complex script involving S-Expressions
  4333. that use macros as operators.  I totally rewrote the SEXP debugging code so I
  4334. could follow better what was going on in the log.  The problem boils down to
  4335. this: dosexp() gets an operator it doesn't recognize, so it looks it up in the
  4336. macro table and gets its index.  Then it loops through the operands, calling
  4337. itself recursively to evaluate them.  But should any of these operands happen
  4338. to be SEXPs whose operators are macros, there is always the possibility that
  4339. they might alter the macro table.  So at the end of the argument-evaluation
  4340. loop, the index of the macro to be executed might no longer be valid.  So I
  4341. added code at the point where we invoke the macro to first compare the given
  4342. macro name with the name of the macro at the index we found when we looked it
  4343. up; if they differ, look it up again.  ckuus3.c, 12 Sep 2000.
  4344.  
  4345. Back to FTP...  Noticed that the transaction log says "status ok" even for
  4346. files that failed (e.g. because they include a pathname).  Reason:
  4347. ftp_put("STOR","foo/bar.txt","foo/bar.txt") returns 1, even though the
  4348. reply is "553 foo/bar.txt: No such file or directory".  Turns out to be
  4349. because ftp_put() never checked sendrequest()'s return code and always
  4350. returned 1.  ckcftp.c, 12 Sep 2000.
  4351.  
  4352. Fixed FTP getreply() to trim trailing junk (usually just a ^M) from the end
  4353. of ftp_reply_str[] so we can use it in messages, and changed FTP code to
  4354. include failure reason (ftp_reply_str[]) in transaction log entries.
  4355. ckcftp.c, 12 Sep 2000.
  4356.  
  4357. Now back to recursive PUTs...  Having the FTP code build a list before the
  4358. fact and sort it is not practical, because MPUT can produce a list of lists,
  4359. in which each element is a wildcard that can expand to up to MAXWLD names
  4360. (typically 102400), and there is no practical limit on the number of elements.
  4361. Therefore we might easily run out of memory when trying to combine them.  So
  4362. instead, let's try sorting each list.  This is done quite simply, by inserting
  4363. a call to sh_sort() in nzxpand().  ckufio.c, 12 Sep 2000.
  4364.  
  4365. From Jeff:
  4366.  
  4367.    Remove #if[n]def NEWFTP from all files.  It was only added to allow
  4368.    the compilation of the FTP code since we had temporarily defined
  4369.    SYSFTP by default in ckcdeb.h.  NEWFTP is not supposed to be necessary
  4370.    to use built-in FTP support.
  4371.  
  4372.    Fixed IKS Timeout parameter check.
  4373.  
  4374.    Changed parameter for NTLM validity check.  NTLM now prompts the user
  4375.    for the username, domain, and password.  For use when logging into
  4376.    IKSD on NT or Microsoft Telnet Server.  You can now login as someone
  4377.    other than the local account.
  4378.  
  4379.    The work of the past few days:
  4380.  
  4381.     . C-Kermit / Kermit 95 now compatible with the forthcoming OpenSSL
  4382.       0.9.6 release.  Compatibility is maintained with 0.9.5.
  4383.  
  4384.     . Implemented SSL/TLS session reuse: Telnet and HTTP connections
  4385.       Peter Runestig is working on code to allow session reuse between
  4386.       Kermit as client and multiple simultaneous telnetd/ftpd/iksd
  4387.       sessions to the same host.
  4388.  
  4389.     . More work on providing support for Heimdal Kerberos 5 (NetBSD,
  4390.       OpenBSD, FreeBSD, and SuSE Linux.)  Code compiles but getting
  4391.       weird errors.
  4392.  
  4393. ckcdeb.h ckuath.c ckuus7.c ckuusy.c ckuusx.c ckuusr.c ckuus5.c, 13 Sep 2000.
  4394.  
  4395. doftpput(), which parses all the FTP PUT switches and then sends the files,
  4396. was getting too big.  In the file-sending loop, I moved the code that sends
  4397. each file out of the switch case and into a separate routine, putfile(), since
  4398. we have to add lots more code here for directory switching, and many C
  4399. compilers choke on switch cases with lots of code.  ckcftp.c, 13 Sep 2000.
  4400.  
  4401. Gathered repetitive code into little routines: doftpcwd(), doftpmkd().
  4402. ckcftp.c, 13 Sep 2000.
  4403.  
  4404. Got rid of SET FTP PATHNAMES, the PUT and GET /PATHNAME switches, and the
  4405. corresponding variables (ftp_pth, x_pth).  ckcftp.c, 13 Sep 2000.
  4406.  
  4407. Got rid of SORTNAMES code.  ckcftp.c, 13 Sep 2000.
  4408.  
  4409. Added syncdir() routine for use by PUT.  Outbound filenames are all passed
  4410. through this routine, which does any needed CWDs, MKDs, and CDUPs, and then
  4411. the filename is sent to the server without the path part.  All directory
  4412. changing and creating is done one segment at a time, using only the segment
  4413. name and no separators or delimiters, so we can do recursive PUTs to servers
  4414. on UNIX, VMS, VOS, Windows, etc.  Directory changing and creation commands are
  4415. kept to a minimum by the presort that was done on the file lists, but we don't
  4416. actually depend on the presort -- it still works without it, but with more
  4417. client/server CD/MKD overhead.  The entire directory tree is sent and
  4418. replicated, except that (a) directories that contain no files are not
  4419. replicated, and (b) symlinks are not re-created (just like with recursive SEND
  4420. in Kermit).  ckcftp.c, 13 Sep 2000.
  4421.  
  4422. Added FTP PUT /NOERROR which means to stop and fail if any upload fails;
  4423. normally we just proceed to the next file.  ckcftp.c, 13 Sep 2000.
  4424.  
  4425. Change from Jeff for FTP setbpsz() (protection buffer size?) default value to
  4426. improve performance of secure connections by cutting down on page faults.
  4427. ckcftp.c, 13 Sep 2000.
  4428.  
  4429. Went back and looked at Kermit <sseof>Y code for ignoring gnfile() failures
  4430. and don't see how it could have worked, so changed it to explicitly handle >0,
  4431. 0, and <0 cases, and improved the transaction log record in this case.  Tested
  4432. with FTP and it works fine there too.  ckcpro.w, ckcfns.c, ckuusx.c,
  4433. 14 Sep 2000.
  4434.  
  4435. Totally decoupled FTP TYPE from Kermit FILE TYPE, removed all references to
  4436. the 'binary' variable from the FTP module, removed redundant calls to
  4437. changetype(), and made PUT /BINARY and /TEXT work by saving ftp_typ and
  4438. setting it as desired, and then restoring it upon the next entry to the FTP
  4439. module (whose only entry points from outside are the FTP command and SHOW
  4440. FTP).  ckcftp.c, 14 Sep 2000.
  4441.  
  4442. Fixed fpformat() to do something useful when both places and fp_digits are 0.
  4443. ckuus4.c, 14 Sep 2000.
  4444.  
  4445. But fp_digits should never be 0.  However, it turns out that initfloat() was
  4446. never called if FNFLOAT was not defined.  Changed this to CKFLOAT.  ckcmai.c,
  4447. 14 Sep 2000.
  4448.  
  4449. Added FTP PUT /PERMISSIONS, only for UNIX-to-UNIX; copies low-order 9 bits of
  4450. each file's permissions to server copy after upload.  ckcftp.c, 14 Sep 2000.
  4451.  
  4452. Changed SEXP reader to ignore spaces between otherwise adjacent left parens
  4453. (again).  ckuus3.c, 14 Sep 2000.
  4454.  
  4455. Moved GSOCKNAME_T SOCKOPT_T definitions from ckcnet.c to the end of ckcnet.h,
  4456. and changed the FTP module to use them.  ckcnet.[ch], ckcftp.c, 15 Sep 2000.
  4457.  
  4458. Fixed a typo I made in dotlog() yesterday (":" -> ':').  ckuusx.c, 15 Sep 2000.
  4459.  
  4460. Some AIX compiler warning fixes from Jeff: ckctel.[ch], ckcftp.c, 15 Sep 2000.
  4461.  
  4462. Added dozens of (CHAR *) vs (char *) casts to ckcftp.c to eliminate prolonged
  4463. howls of anguish and eventual death of the HP-UX ANSI compiler.  It doesn't
  4464. seem worthwhile to use CHAR in this module since we have to cast all the CHAR
  4465. items to char anyway in order to use most APIs (but I didn't change the
  4466. declarations, just put in casts as needed).  Also initialized a bunch of
  4467. variables that the compiler spuriously claimed could be used before a value
  4468. was assigned.  Now ckcftp.c builds without warnings (except "optimizations
  4469. skipped") on HP-UX 10.20 too.  15 Sep 2000.
  4470.  
  4471. Similarly for ckctel.c, 15 Sep 2000.
  4472.  
  4473. Now also builds cleanly on Solaris 2.5, Tru64 4.0E, Unixware 7.1.1, RH Linux
  4474. 6.1, and SCO 5.0.5, and not so cleanly on IRIX 6.5.8f -- thousands of warnings
  4475. about variables defined but not referenced, set but not used.  Usually I
  4476. ignore these but I went through them this time and tried to handle all of them
  4477. that were for variables with names longer than one char, and found some of the
  4478. warnings were actually quite useful; e.g. rc (return code) being carefully set
  4479. all over the place in some routine, but then not used in the return()
  4480. statement.  The SGI linker also picked up some cases of type mismatches
  4481. between extern declarations and the original ones Also removed quite a few big
  4482. buffers that were no longer used.  Many files, 15 Sep 2000.
  4483.  
  4484. Added several more CHAR/char casts to ckcftp.c.  18 Sep 2000.
  4485.  
  4486. Removed #include <stdlib.h> and <string.h> from ckcftp.c, since they prevent
  4487. successful compilation on some platforms (e.g. Motorola 68K) and all this
  4488. stuff should already be handled adequately in ckcdeb.h.  18 Sep 2000.
  4489.  
  4490. Dat found a problem with SEXPs, in which the end of an operand that was a
  4491. quoted SEXP was not marked, e.g. (foo '(a b) '(c d)), resulting in all but
  4492. the last operand returning too much of the original string.  Fixed in
  4493. cksplit(): ckclib.c, 18 Sep 2000.
  4494.  
  4495. Dat noticed that case-insensitive recognition of SEXP keywords was broken
  4496. again -- another casualty of optimization rampage.  Fixed in xlookup() and
  4497. mxlook().  ckuus5.c, 18 Sep 2000.
  4498.  
  4499. If "}" (without the quotes) by itself was given as a C-Kermit command, it
  4500. would go off into some weird parsing never-never land.  It's a strange special
  4501. case, fixed with a strange special-case check.  ckuus5.c, 18 Sep 2000.
  4502.  
  4503. Jeff made some changes that increase FTP PUT performance by a factor of 12
  4504. (28Kbps to 337Kbps on a given connection).  I tuned this a bit (replacing
  4505. per-character function calls with a macro), raising it to 515Kbps.  But it's
  4506. still about 5 times slower than binary.  ckcftp.c, 19 Sep 2000.
  4507.  
  4508. Removed trailing junk from an #undef directive in ckcdeb.h, 19 Sep 2000.
  4509.  
  4510. Changed SET FTP FILENAMES to include an AUTO setting and made it the default,
  4511. ditto for FTP PUT /FILENAMES.  AUTO means LITERAL if client and server are
  4512. like systems, CONVERTED otherwise.  Tested on UNIX client with UNIX and VMS
  4513. servers; works OK.  Added some crude code to compare client and server system
  4514. types so this will work on Windows as well as Unix, but who knows what system
  4515. types are reported by Windows FTP servers.  To fix, search for "myostype".
  4516. The variable "alike" should be 0 if client and server are not alike, and 1 if
  4517. they are.  If we can set this reliably, we can probably take a lot of
  4518. shortcuts & liberties.  ckcftp.c, 19 Sep 2000.
  4519.  
  4520. Added \v(ftp_server) that shows the server type and also added this info to
  4521. SHOW FTP.  ckuusr.h, ckuus4.c, 19 Sep 2000.
  4522.  
  4523. The SEXP reader didn't like numbers that started with '.' or '+' because the
  4524. xxfloat() macro front end for isfloat() didn't account for them.  Fixed in
  4525. ckuus3.c, 19 Sep 2000.
  4526.  
  4527. Dat found another fascinating bug; another case of a macro with a certain
  4528. name, when used as an SEXP operator, not working; when I tried changing its
  4529. name, it worked fine.  There was one more place where the operator index (x)
  4530. was being compared with a built-in operator code, when in fact it was a macro
  4531. table index.  Fixed in dosexp(), ckuus3.c, 19 Sep 2000.
  4532.  
  4533. Made FTP set \v(cps).  ckcftp.c, 20 Sep 2000.
  4534.  
  4535. Converted FTP sendrequest() to use Kermit file i/o APIs.  Speed is about the
  4536. same (and text is still 5 times slower than binary).  Enabled FTP PUT /COMMAND,
  4537. works fine; ditto for /FILTER: and /ARRAY:.  This also makes the FTP-format
  4538. transaction log work.  ckcftp.c, 20 Sep 2000.
  4539.  
  4540. Hooked the STATISTICS command into FTP.  ckcftp.c, ckuus4.c, 20 Sep 2000.
  4541.  
  4542. The text/binary discrepancy is no big deal, since it is observed only on
  4543. localhost connections; regular FTP clients behave the same way.  When network
  4544. i/o is not the bottleneck, it's the difference between big block read/writes
  4545. and per-character loops.  On a real network connection, the difference
  4546. vanishes.
  4547.  
  4548. Added some #ifdefs to STAT to allow linking on platforms where the new FTP
  4549. code is not included.  ckuus4.c, 21 Sep 2000.
  4550.  
  4551. Dat noticed that (QUOTE (a b c)) and ('(a b c)) gave different results when
  4552. used as a macro argument in an SEXP.  Fixed in ckuus3.c, 21 Sep 2000.
  4553.  
  4554. Started work on integrating FTP module with Kermit file transfer display.
  4555. Changed handling of 'what' variable to use bit testing/setting, rather than
  4556. testing for equality, since now the W_FTP bit can be set at the same time as
  4557. W_SEND or W_RECV.  Exported ftp_host; added a \v(ftp_host) variable for it.
  4558. ckcdeb.h, ckcker.h, ckcfn[s23].c, ckuusx.c, ckcftp.c, 21 Sep 2000.
  4559.  
  4560. Filled in details for fullscreen file-transfer-display for PUT/MPUT only.
  4561. BRIEF works too, didn't test the others yet.  ckcftp.c, ckuusx.c, 21 Sep 2000.
  4562.  
  4563. Minor repairs to file-transfer display (missing #ifdefs, etc).  Also added
  4564. display of remote system type to FTP fullscreen file-transfer display.
  4565. ckuusx.c, 22 Sep 2000.
  4566.  
  4567. Replaced all the ftp_vbm/oldverbose/quiet/q/oq/oquiet manipulations with a
  4568. much simpler scheme: ftp_vbx is the global, sticky version.  ftp_vbm is is
  4569. restored automatically from ftp_vbx (or set to 0 if quiet != 0) at the
  4570. beginning of each FTP command.  ftp_vbx is changed only by SET FTP
  4571. VERBOSE-MODE; ftp_vbm (the one which is actually used) can be changed as
  4572. desired without explicit saving & restoring (except when it needs to be
  4573. turned off and back on or v.v. within a single command).  ckcftp.c,
  4574. 22 Sep 2000.
  4575.  
  4576. Debugged SERIAL and CRT transfer display formats for FTP.  ckuusx.c,
  4577. 22 Sep 2000.
  4578.  
  4579. Added SET FTP PERMISSIONS { ON, OFF, AUTO }, and added OFF and ON args
  4580. for FTP PUT /PERMISSIONS.  ckcftp.c, 22 Sep 2000.
  4581.  
  4582. Added quoting of grouping characters in SEXPs.  ckclib.c, 22 Sep 2000.
  4583.  
  4584. Added \v(sexpdepth).  ckuusr.h, ckuus4.c, 23 Sep 2000.
  4585.  
  4586. Added \fcmdstack(level,flags) to provide programmatic access to the call
  4587. stack.  ckuusr.h, ckuus4.c, 23 Sep 2000.
  4588.  
  4589. Fixed a bug I introduced in cksplit() several days ago, in which group
  4590. quoting as in ('(a b c)) could cause us to run past the end of the string.
  4591. ckclib.c, 23 Sep 2000.
  4592.  
  4593. Extensive testing of cksplit() with quoting revealed an inconsistency in
  4594. results when quoting was used in a word or group versus between them.  When
  4595. between words, we simply move the word-begin pointer past the quote, so it
  4596. doesn't show up in the result.  But within a word the quote character was kept
  4597. because we don't copy the result to yet another new buffer; we simply insert
  4598. NULs and point to pieces of the string.  So in this case we have to scoot the
  4599. part of the string before the quote to the right by one position to cover the
  4600. quote.  ckclib.c, 23 Sep 2000.
  4601.  
  4602. Changed \fstripb() to accept a grouping mask just like \fsplit() and
  4603. \fword().  ckuus4.c, 23 Sep 2000.
  4604.  
  4605. Fixed evala() to return its result through ckltoa().  This (a) eliminates
  4606. another sprintf(), and (b) removes the need to copy every evala() or evalx()
  4607. result immediately to prevent it from being overwritten by subsequent calls;
  4608. eval[ax]() returned its result from a single static buffer, whereas ckltoa()
  4609. returns its result from a big circular buffer.  Cost: 0.  Benefit: Big (if
  4610. there were any places in the code that called evala() or evalx() more than
  4611. once in succession without copying the result each time, results would be
  4612. wrong).  ckuus4.c, 23 Sep 2000.
  4613.  
  4614. The evala() change affects all \function()s that have more than one numeric
  4615. argument.  Went through all of these and removed all the free/malloc/copy
  4616. code after evalx() calls.  ckuus4.c, 23 Sep 2000.
  4617.  
  4618. Added IF DECLARED to test if an array is declared.  ckuus[26].c, 23 Sep 2000.
  4619.  
  4620. Added HELP FUNCTION text for \fsexp() and \fcmdstack(); updated text for
  4621. \fstripb().  ckuus2.c, 23 Sep 2000.
  4622.  
  4623. Corrections from Jeff to BROWSER vs FTP #ifdefs, plus a couple FTP verbose-mode
  4624. oversights.  ckuus[r3].c, ckcftp.c, 24 Sep 2000.
  4625.  
  4626. The following construction:
  4627.  
  4628.   define xxx {
  4629.       if > \findex({\(},{ab\(cd}) 0 {
  4630.       echo one
  4631.       echo two
  4632.       }
  4633.       echo three
  4634.   }
  4635.  
  4636. confused the macro reader, causing the "echo three" command to be skipped.
  4637. Adjusted the macro reader to pay attention to quoting of parentheses and
  4638. braces.  getncm(): ckuus5.c, 24 Sep 2000.
  4639.  
  4640. Began work on FTP charset translation.  Read through RFC2640 and was not
  4641. impressed.  The FEAT mechanism is silly.  You can send pathnames and files in
  4642. UTF8 or any other charset with or without it.  The FTP partners are supposed
  4643. to "autodetect" UTF8, which is nuts.  Most of RFC2640 is devoted to the
  4644. useless LANG feature (for messages).  It barely even mentions data transfer.
  4645. There is no notion of character-set tagging of a particular file or message.
  4646. All that can be done is the server can indicate to the client that it (the
  4647. server) supports UTF8.  The client can't tell the server, OK, here comes a
  4648. file in UTF8.  It can't even say "Terrific, I support UTF8 too".  Anyway, no
  4649. known servers support the FEAT mechanism anyway.  So in practice there is
  4650. virtually no difference between a client that supports RFC2640 and one that
  4651. doesn't.  To Kermit I added:
  4652.  
  4653.   SET FTP CHARSET-TRANSLATION { ON, OFF }        <-- Default OFF
  4654.   SET FTP SERVER-CHARSET <fcs>                   <-- Default is UTF8
  4655.   FTP PUT /SERVER-CHARSET:xxx /LOCAL-CHARSET:xxx <-- FCS values
  4656.   (GET will come later.)
  4657.  
  4658. The local text-file character set is determined as in Kermit transfers.  As
  4659. always, the switches override the global settings & defaults.  So far, parsing
  4660. and SHOW FTP only; will fill in the actual translation shortly.  The main task
  4661. will be to get the "default defaults" right.  In the absence of FEAT UTF8,
  4662. there is no way of guessing what charsets the server likes.  ckuusr.h,
  4663. ckcftp.c, 24 Sep 2000.
  4664.  
  4665. The PTY command only recognized "" for argument quoting, and didn't even do
  4666. that right -- once an open quote was detected, the rest of the command line
  4667. was grouped, regardless of any closing quotes.  Replaced exec_cmd() with a new
  4668. version that simply calls cksplit(), which not only fixes the problem, but
  4669. also allows quoting with single quotes and braces.  Also changed cksplit() to
  4670. add a NULL element at the end of the split array (without affecting the count)
  4671. so it can be passed to execvp().  ckupty.c, 25 Sep 2000.
  4672.  
  4673. Yesterday's macro-reader change broke macros that contained full-line
  4674. comments.  Went back to 7.0 sources and saw that I had done all this before
  4675. and then yanked it because of all the things it broke.  But rather than roll
  4676. back again, I tried another approach.  getncm(): ckuus5.c, 25 Sep 2000.
  4677.  
  4678. Back to FTP charset translation.  Filled in setting of charsets from
  4679. scanfile() plus ASSOCIATE tables.  Filled in Unicode-based translation code
  4680. for PUT.  Updated file-transfer display to show FTP character sets rather
  4681. than Kermit ones.  ckcftp.c, ckcfns.c, ckuusx.c, ckc71.txt, 25 Sep 2000.
  4682.  
  4683. Changed CHARSET to CHARACTER-SET in FTP commands for uniformity with other
  4684. commands, even though it's really verbose...  ckcftp.c, 26 Sep 2000.
  4685.  
  4686. Converted some more old #ifdefs to NEWFTP to fix broken non-TCPSOCKET builds.
  4687. Ensured successful building with -DNONET, -UTCPSOCKET, -DNOFTP, -DSYSFTP,
  4688. and default NEWFTP.  ckuus[r45].c, ckcdeb.h, 26 Sep 2000.
  4689.  
  4690. Fixed SYSFTP build to substitute "ftp" if no FTP client has been set.
  4691. ckuusr.c, 26 Sep 2000.
  4692.  
  4693. Added CHECK FTP (succeeds only for built-in FTP).  ckuus3.c, 26 Sep 2000.
  4694.  
  4695. Broke FTP throughput stats in yesterday's charset changes.  Fixed in
  4696. sendrequest(): ckcftp.c, 26 Sep 2000.
  4697.  
  4698. Added charset and file size info to FTP transaction log entries.  Fixed
  4699. per-file elapsed time and cps stats and brief-format transaction log entries
  4700. ckcftp.c, ckuusx.c, 26 Sep 2000.
  4701.  
  4702. Filled in ftp_reset() so FTP RESET command would work (it's supposed to log
  4703. out the user without dropping the connection by sending REIN).  The watsun
  4704. server doesn't support this.  ckcftp.c, 26 Sep 2000.
  4705.  
  4706. Added \v(ftp_connected) and \v(ftp_loggedin).  These are needed because "ftp
  4707. open host /user:blah /password:xxx" might succeed in making the connection,
  4708. but still fail to log in.  In this case, it returns success, so scripts need a
  4709. way to test whether login also succeeded.  ckuusr.h, ckuus4.c, ckcftp.c,
  4710. 26 Sep 2000.
  4711.  
  4712. Changed all FTP commands (except OPEN) to give an error message and fail
  4713. gracefully after parsing if there is no FTP connection.  ckcftp.c, 26 Sep 2000.
  4714.  
  4715. Changed /NOERRORS to /ERROR-ACTION:{PROCEED,QUIT} (less confusing), and added
  4716. SET FTP ERROR-ACTION to let users set this globally.  ckcftp.c, 26 Sep 2000.
  4717.  
  4718. Added Kermit-style file (X) and group (Z) cancellation, including file-xfer
  4719. display messages, transaction log entries, etc.  ckcftp.c, 26 Sep 2000.
  4720.  
  4721. From Jeff: SET TCP IGNORE-SHUTDOWN to work around Shiva bug.  ckuusr.[ch],
  4722. ckuus3.c, ckcnet.c, 27 Sep 2000.
  4723.  
  4724. Dat discovered that local arrays didn't work any more (i.e. they had lost
  4725. their localness).  This happened when I moved common code out of dolocal()
  4726. to vardef() several weeks ago; I lost the the pusharray() call.  Changed
  4727. vardef() to return array info, and dolocal() to check the array info and
  4728. if the variable was an array, to call pusharray().  ckuus5.c, 27 Sep 2000.
  4729.  
  4730. There's a problem with array links that nobody noticed yet:
  4731.  
  4732.   define tryme {
  4733.       local \&e[]
  4734.       array link \&e[] \%1
  4735.       void \fsplit(\%2,&e)
  4736.       show array &e
  4737.   }
  4738.   declare \&a[1]                  ; This must be declared.
  4739.   tryme &a {here are some words}  ; Call macro to fill \&a[].
  4740.   show array a                    ; No change in \&a[].
  4741.  
  4742. \fsplit() calls dclarray() on \&e[], which is a link to \&a[].  What should
  4743. dclarray() do in this case?  Presently it does nothing useful.  Fixed it
  4744. affect the linked-to array.  Seems to do the trick.  ckuus5.c, 27 Sep 2000.
  4745.  
  4746. While I was at it, I improved DECLARE array-name parsing to (a) detect
  4747. syntax errors right away and report the error, and (b) if the item to be
  4748. declared is not an array name, then if it's a variable, expand it and check
  4749. again.  So now it's possible to declare an array whose name is in a variable,
  4750. and to have a macro declare an array whose name is passed as an argument.
  4751. ckuusr.c, 27 Sep 2000.
  4752.  
  4753. Consolidated FTP PUT /ARRAY code.  ckcftp.c, 27 Sep 2000.
  4754.  
  4755. Peter E complained about HP-UX hardware flow control.  Checked it with USR
  4756. modem at 57600 bps.  Dialed and uploaded a 2MB binary file with no errors or
  4757. problems (RTS and CTS lights both stayed on constantly).  Downloaded the same
  4758. file, and this time the RTS and RxD flashed in perfect synchronization.
  4759. Stress-tested this by typing Ctrl-S at the file-transfer screen, which halted
  4760. the receiver.  After 2-3 seconds the RTS went off solid, and so did the RxD
  4761. light.  After 5 or 10 secs I typed Ctrl-Q and the transfer resumed without a
  4762. hitch -- no errors, no retries.  I repeated this several times; everything
  4763. worked perfectly.  The only problem is that SHOW MODEM always says RTS is off
  4764. when it is on.  There are no obvious typos in ttgmdm(); added debugging
  4765. statements to the HPUX section of ttgmdm() in ckutio.c and rebuilt.  The debug
  4766. log clearly shows that (a) ioctl(ttyfd,MCGETA,&x) succeeds, and that (b) it is
  4767. not reporting RTS as on.  Specifics: the ioctl() call does not return a
  4768. failure code, and the returned data is: 0x1a0020 == 6400040 octal
  4769. (110100000000000100000 binary).  The definitions from <sys/modem.h> are:
  4770.  
  4771.   /* Define the bits within the mflag field */
  4772.   #define MDRS        00000000004   /* Data Rate Select */
  4773.   #define MDTR        00000000040   /* Data Terminal Ready */
  4774.   #define MRTS        00010000000   /* Request To Send */
  4775.   #define MDSR        00002000000   /* Data Set Ready */
  4776.   #define MDCD        00000400000   /* Data Carrier Detect */
  4777.   #define MRI         00000000010   /* Ring Indicator */
  4778.   #define MCTS        00004000000   /* Clear To Send */
  4779.  
  4780. So HPUX is reporting DTR, DCD, CTS, and DSR, period.  I don't see anything
  4781. wrong with Kermit.  QED, te absolvo.
  4782.  
  4783. Updated hpux80 target from Peter E (more optimization suppression).
  4784. makefile, 28 Sep 2000.
  4785.  
  4786. Added FTP PUT /UPDATE.  Seems to work but didn't have time to test much.
  4787. ckuusr.h, ckcftp.c, 28 Sep 2000.
  4788.  
  4789. Finished PUT /UPDATE, mainly sorting out the messages, etc (e.g. getreply()
  4790. was messing up the file-transfer display when MDTM returned a "File not found"
  4791. response).  ckcftp.c, 29 Sep 2000.
  4792.  
  4793. From Jeff: Remove SET TCP IGNORE-SHUTDOWN.  ckuusr.[ch],ckuus3.c, ckcnet.c,
  4794. 1 Oct 2000.
  4795.  
  4796. Changed FTP to always send STRU F, MODE S upon initial connection to server.
  4797. ckcftp.c, 1 Oct 2000.
  4798.  
  4799. Fixed FTP to skip debugging messages during file transfer if FTP DEBUG is ON.
  4800. ckcftp.c, 1 Oct 2000.
  4801.  
  4802. Added PUT /RESTART, but only for MODE STREAM, STRU FILE (which we now send
  4803. upon initial connection), and then only for binary files or when client and
  4804. server platforms are alike.  If /RECOVER (a.k.a. /RESTART) is given, 
  4805.  
  4806.  . Check for conflict with other switches; if OK:
  4807.  . If (scanfile() says binary) or (alike == 1) we can restart.  If OK:
  4808.  . Get size of remote file: First send TYPE I, so SIZE result will be
  4809.    file size in bytes.  Then send SIZE to get size.  If error or remote file
  4810.    is not found, cancel recovery.  If remote is larger than the local one,
  4811.    cancel recovery.
  4812.  . Set TYPE back to file's type.
  4813.  . If file is still a recovery candidate, compare timestamps; if local file
  4814.    is newer than remote file, cancel recovery.
  4815.  . If recovery is not canceled, and file sizes are equal, skip this file.
  4816.  . Otherwise, seek to <size>, and if successful, send  REST <size>, and
  4817.    check result. If result OK, STOR the file.  Alternatively just APPEnd it.
  4818.    (Used APPE because it's more portable.)
  4819.  
  4820. All of this works OK, except the result is corrupt -- some kind of off-by-4
  4821. error; I didn't have time to debug it.  Also, still need to handle details of
  4822. file-transfer display (start bar at right point, handle "skipped" message,etc),
  4823. logging, settings, warnings, etc etc.  To be cont'd.  ckcftp.c, 1 Oct 2000.
  4824.  
  4825. The problem yesterday was secure_flush() again -- the actions for secure
  4826. versus clear were backward.  OK, so now /RESTART works.  ckcftp.c, 2 Oct 2000.
  4827.  
  4828. Fixed file-transfer display for restart so thermometer and percent-done begin
  4829. at the restart point.  ckcftp.c, 2 Oct 2000.
  4830.  
  4831. In K95 only, file-transfer display said "Kermit Protocol" even during FTP
  4832. transfers.  ckuusx.c, 3 Oct 2000.
  4833.  
  4834. FTP PUT filename conversion wasn't working; the conversion was done, but the
  4835. original name, rather than the converted one, was sent to the server.  Fixed
  4836. in putfile(): ckcftp.c, 3 Oct 2000.
  4837.  
  4838. FTP PUT /RECOVER file-group could sometimes leave an input file open, causing
  4839. subsequent PUTs to fail.  Fixed in sendrequest(): ckcftp.c, 3 Oct 2000.
  4840.  
  4841. Straightened out inconsistent sendrequest() return codes. ckcftp.c, 3 Oct 2000.
  4842.  
  4843. From Jeff: fix a couple "not all control paths return a value" warnings; none
  4844. of the Socket Option code was ever executed because of the value of ttmdm;
  4845. fixed a potential denial of service attack; SET TCP commands should not be
  4846. executed by users of IKSD.  ckcmai.c ckuus3.c ckuus5.c ckcnet.c ckcftp.c,
  4847. 4 Oct 2000.
  4848.  
  4849. Added askmore() to SHOW FTP.  ckcftp.c, 4 Oct 2000.
  4850.  
  4851. Added protocol info to STATISTICS.  ckuus4.c, 4 Oct 2000.
  4852.  
  4853. Straightened out and documented success and failure of FTP PUT.  ckcftp.c, 
  4854. ckc71.txt, 4 Oct 2000.
  4855.  
  4856. As an experiment, added SET GET-PUT-REMOTE { AUTO, FTP, KERMIT }.  If AUTO and
  4857. an FTP connection is active, PUT (and MPUT, SEND, MSEND, MOVE, etc) use FTP.
  4858. Ditto for BYE.  Didn't do anything to the REMOTE commands yet; let's see how
  4859. this feels first.  ckuusr.[ch], ckcftp.c, 4 Oct 2000.
  4860.  
  4861. Continued with GET-PUT-REMOTE, enabling it for REMOTE and the appropriate
  4862. R-command shortcuts (RCD, RPWD, RDIR, RDEL, etc).  Also BINARY, TEXT, LOGIN,
  4863. LOGOUT, CLOSE, and HANGUP.  ckuus[r7].c, ckcftp.c, ckc71.txt, 5 Oct 2000.
  4864.  
  4865. Moved the code that sends SYST, STRU F, MODE S from ftp_open() to
  4866. ftp_login(), since most servers won't execute these commands if user is not
  4867. logged in.  Turns out I had to do this in two places, so extracted the code
  4868. to new ftp_init(), which is now called from both ftp_login() and ftp_user().
  4869. ckcftp.c, 5 Oct 2000.
  4870.  
  4871. Finishing touches on GET-PUT-REMOTE work -- added a few more commands to the
  4872. list (like FINISH), plus error messages for R-commands that don't apply to
  4873. FTP.  It seems pretty reasonable and intuitive; let's see what users think.
  4874. ckcftp.c, 6 Oct 2000.
  4875.  
  4876. Added network directory lookup for FTP.  It doesn't do anything special --
  4877. just hostname lookup with verification that network type is TCP/IP.  ckcftp.c,
  4878. 6 Oct 2000.
  4879.  
  4880. Added switch-parsing for GET, but so far it's parse-only -- nothing actually
  4881. happens -- and still mostly code stolen from PUT, which needs to be adapted to
  4882. GETting.  ckcftp.c, 6 Oct 2000.
  4883.  
  4884. Fixed secure_read() to call secure_getc() rather than secure_getbyte(), which
  4885. fails on non-secure connections.  ckcftp.c, 9 Oct 2000.
  4886.  
  4887. Changed ftp_init() to set TYPE I if client and server are alike -- although
  4888. we don't need this for PUT, we do need it for GET.  ckcftp.c, 9 Oct 2000.
  4889.  
  4890. Got FTP GET to work for a single file in both text and binary mode.  Added
  4891. code for client to ask server for the file's size so we can display % done,
  4892. plus other hooks into file-transfer display.  ckcftp.c, ckuusx.c, 9 Oct 2000.
  4893.  
  4894. Added X/Z cancellation to FTP GET and made ^C work.  ckcftp.c, 9 Oct 2000.
  4895.  
  4896. Added transaction log entries for FTP GET.  ckcftp.c, 9 Oct 2000.
  4897.  
  4898. Added MGET, including tricky parsing for a list of filespecs, since we have
  4899. to send an NLST command for each one separately.  ckcftp.c, 9 Oct 2000.
  4900.  
  4901. Filled in some of the easy switch actions:
  4902.  
  4903.  [ok] /TEXT (/ASCII) and /BINARY
  4904.  [ok] /AS-NAME (single file)
  4905.  [ok] /QUIET
  4906.  [ok] /DELETE (send DELE after successful reception)
  4907.  [ok] /ERROR-ACTION
  4908.  [ok] /EXCEPT (case sensitive if server is UNIX)
  4909.  [ok] /LARGER, /SMALLER (send SIZE for each file and compare)
  4910.  
  4911. Both Jeff and Dat reported strange problems with scripts.  In Jeff's case,
  4912. the problem occurred in the host.ksc script because the GETMENUITEM macro
  4913. definition was truncated.  I traced this to one of my micro-optimizations
  4914. in cmtxt() (avoid calling strlen() by referring to a variable that was
  4915. supposed to already contain the length but apparently in some cases does not).
  4916. Backing off on the optimization fixes Jeff's case and I hope Dat's too (no,
  4917. of course not).  ckucmd.c, 10 Oct 2000.
  4918.  
  4919. Back to FTP GET.  To do /AFTER, /BEFORE, etc, we need to be able to compare a
  4920. remote file's date with a given date-time.  But is the given date-time local,
  4921. or expressed in the timezone of the server?  We don't know the timezone of the
  4922. server, and it doesn't make sense to use local time either, since that would
  4923. be meaningless to the server.  We could use GMT, but that doesn't match the
  4924. client's OR the server's time (unless they are on the Greenwich Meridian).
  4925. OK, one less thing to do.  But for /UPDATE, we can do the same as for PUT, but
  4926. backwards: if the local file exists, compare its GMT date with the remote's
  4927. GMT date, and download only if remote is newer.  ckcftp.c, 10 Oct 2000.
  4928.  
  4929. Added as-name templates for FTP PUT and MGET.  ckcftp.c, 10 Oct 2000.
  4930.  
  4931. Fixed FTP {GET,PUT} /FILENAMES: and {SET,SHOW} FTP FILENAMES keywords and
  4932. docs to agree.  ckcftp.c, 11 Oct 2000.
  4933.  
  4934. Added filename conversion for FTP GET.  If as-name not given, and filenames
  4935. are converted, apply zrtol().  ckcftp.c, 11 Oct 2000.
  4936.  
  4937. Added filename collision options for FTP GET.  Same as for Kermit; they follow
  4938. the FILE COLLISION setting.  ckcftp.c, 11 Oct 2000.
  4939.  
  4940. Added /COLLISION: switch to FTP GET to override global FILE COLLISION setting.
  4941. ckuusr.h, ckcftp.c, 11 Oct 2000.
  4942.  
  4943. Added SET FTP COLLISION to allow a separate default collision action to be
  4944. set for FTP.  ckcftp.c, 11 Oct 2000.
  4945.  
  4946. A couple typo corrections from Jeff.  ckcftp.c, 12 Oct 2000.
  4947.  
  4948. Debugged the FTP file collision code and got all the options working.
  4949. ckcftp.c, 12 Oct 2000.
  4950.  
  4951. Added FTP GET /NODOTFILE, /NOBACKUP, /RENAME-TO:xxx.  ckcftp.c, 12 Oct 2000.
  4952.  
  4953. Removed runique variable and related code from FTP module since we now handle
  4954. filename collisions the Kermit way.  ckcftp.c, 13 Oct 2000.
  4955.  
  4956. Added MDELETE.  It shares all the same code with MGET, but a smaller switch
  4957. table.  This is nice because we get all the same file-selection options, etc,
  4958. and even a fullscreen display.  ckcftp.c, 13 Oct 2000.
  4959.  
  4960. Finished FTP MDELETE: file-transfer display details, transaction log entries,
  4961. failure handling; merged FTP DELETE and MDELETE, since there is no reason to
  4962. separate them, and linked RDEL to FTP DELETE.  ckcftp.c, 14 Oct 2000.
  4963.  
  4964. Added MGET /LISTFILE.  ckcftp.c, 14 Oct 2000.
  4965.  
  4966. Simplified file-transfer display management by hiding display initialization
  4967. in the display routine itself, so initialization happens automatically the
  4968. first time display is called for, but doesn't happen at all if no display is
  4969. ever required, e.g. for "rdelete nonexistent file", in which case we print a
  4970. simple error message.  ckcftp.c, 15 Oct 2000.
  4971.  
  4972. Fixed FTP display to put the server's error message in the Message line of
  4973. the file transfer display, so commands like "get *.*" will give a meaningful
  4974. indication of why they didn't work.  ckcftp.c 15 Oct 2000.
  4975.  
  4976. Discovered that { [M]GET, [M]PUT, [M]DEL } switches were sticky.  That's
  4977. because ftreset() was not being called after FTP transfers (as it is after
  4978. Kermit transfers).  Fixed by installing a call to ftreset() in the exit
  4979. sequences of doftpget() and doftpput().  ckcftp.c, 15 Oct 2000.
  4980.  
  4981. Added GET /RECOVER.  Must send REST to server, so download recovery depends on
  4982. this nonstandard feature.  Otherwise it's like PUT /RECOVER: we require type
  4983. binary or else alike > 0 and no Unicode charsets, then we compare sizes,
  4984. dates, and so on, before attempting recovery.  It works fine except a single
  4985. NUL is always inserted at the recovery point.  Why?  It's not because of
  4986. recovery; it's because interrupting a download with 'X' causes a NUL to be
  4987. inserted before the final record.  For example, when a download is interrupted
  4988. with 'X':
  4989.  
  4990.   partial file size:  679936 (a multiple of 8192, the write-buffer size)
  4991.   NUL inserted at:    671745 (1st byte of final block)
  4992.  
  4993. How could this happen?  In binary mode, recvrequest() calls secure_read()
  4994. in a loop, which in turn calls secure_getc(), which in turn calls iscanceled(),
  4995. which checks for keyboard interruption.  And sure enough, the trouble is that
  4996. secure_read() deposits the secure_getc() result in the output buffer without
  4997. checking first for cancellation.  ckcftp.c, 15 Oct 2000.
  4998.  
  4999. Got GET /RECOVER working in text mode, except it doesn't really work -- a
  5000. piece is missing from the result at the restart point.  The problem appears to
  5001. be that REST, when given in "ascii" mode, is "interpreted" by the server (like
  5002. it does for SIZE).  However, you can't get around this by sending TYPE I, then
  5003. REST, then TYPE A, then RETR, because nothing must come between the REST and
  5004. the RETR.  Therefore it is not possible to REGET in text mode.  Poor old dumb
  5005. FTP...
  5006.  
  5007. To avoid the unnecessary delays, fixed iscanceled() to return 1 immediately if
  5008. cancelfile is already set.  ckcftp.c, 15 Oct 2000.
  5009.  
  5010. Fixed FTP recvrequest() to return and/or set meaningful error indications
  5011. rather than just fprintf(stderr)'ing them.  ckcftp.c, 16 Oct 2000.
  5012.  
  5013. Changed FTP recvrequest() to use Kermit API (zchko()) for output file-access
  5014. checking.  This gets us SET ROOT enforcement for FTP GET and also lets us
  5015. remove bunches of ugly code from recvrequest().  ckcftp.c, 16 Oct 2000.
  5016.  
  5017. Changed UNIX zchko() to set errno to EACCES on SET ROOT violation so perror(),
  5018. ck_errstr(), etc, will give reasonable results.  ckufio.c, 16 Oct 2000.
  5019.  
  5020. FTP DIR didn't work if current directory was not writeable.  Due to messed-up
  5021. #ifdefs, recvrequest() always tried to create a file called "-".  Fixed in
  5022. ckcftp.c, 16 Oct 2000.
  5023.  
  5024. Converted recvrequest() to use all Kermit APIs for file output, crudely, but
  5025. apparently without breaking anything (e.g. recovery).  I imagine it could
  5026. stand some optimizing, but it's pretty fast already.  Also cleaned up all
  5027. kinds of scary code in the same routine that used uninitialized variables.
  5028. ckcftp.c, 16 Oct 2000.
  5029.  
  5030. Implemented FTP GET /COMMAND.  Probably needs some refinement, e.g. regarding
  5031. GET vs MGET.  Didn't do /FILTER yet.  ckcftp.c, 16 Oct 2000.
  5032.  
  5033. Fixed saving and restoring of SEND and RECEIVE filters for FTP as well as
  5034. Kermit PUTs and GETs.  ckuus[r67x].c, 17 Oct 2000.
  5035.  
  5036. Implemented FTP GET /FILTER.  Still needs a lot of checking.
  5037. ckcftp.c, 17 Oct 2000.
  5038.  
  5039. Chased down a problem seemingly confined to highly complex and convoluted
  5040. scripts.  To do this I had to add a previously unused debugging format,
  5041. F010, which is like F011, but treats s2 as a NUL-terminated string, and then
  5042. replaced debug(F11x) calls that show command buffers, macros definitions,
  5043. etc, with the new format to make the logs more manageable.  By not showing
  5044. (e.g.) an entire macro definition over and over and over in the log, I was
  5045. able to reduce the size of script-oriented debug logs by a factor of ten.
  5046. ckuus[56x].c, ckucmd.c, 18 Oct 2000.
  5047.  
  5048. Analysis of the new trim logs points the finger at the following:
  5049.  
  5050.   While looking at RETURN, discovered that it set success=1 when given a
  5051.   value, and success=0 when not given a value, which makes no sense.  
  5052.   Changed it not to mess with success.  ckuus6.c, 28 Jun 99.
  5053.  
  5054. This was a mistake.  If a RETURN command is executed, it should cause the
  5055. macro to succeed, period.  Fixed in doreturn(), ckuus6.c, 18 Oct 2000.
  5056.  
  5057. This still didn't fix the script in question.  The reason is indeed subtle.
  5058. Exiting from a macro by reaching the end (as opposed to an explicit END, STOP,
  5059. or RETURN statement) does not set SUCCESS/FAILURE, by design.  In this case,
  5060. it returns the the status of the command most recently executed.  Now recall
  5061. that certain commands do not set SUCCESS/FAILURE, for example a failing IF
  5062. command, an ECHO command, etc.  The script in question was executing a macro
  5063. which (a) executed a command that failed; (b) did not execute any subsequent
  5064. commands that set SUCCESS/FAILURE; and (c) returned by running out of
  5065. commands, rather than through an explicit END or RETURN.  Therefore the
  5066. failure status was returned by macro.  However, if a "void" command was added
  5067. to the macro, it returned success rather than failure.  Of course, because
  5068. VOID sets SUCCESS; the same would have occurred with any other command that
  5069. succeeds, including SUCCEED.  Moral: If you want to test a macro for success
  5070. or failure, always leave the macro with an END statement, or some other
  5071. statement that sets SUCCESS/FAILURE appropriately.  Corollary: if a macro has
  5072. an empty definition, or contains no statements that set SUCCESS/FAILURE, then
  5073. invoking the macro does not change the SUCCESS/FAILURE status.  Incidentally,
  5074. it would be possible to simply initialize every macro's return status to
  5075. SUCCESS, but that would rob us of the ability to write macros that test the
  5076. status of the command that preceded the macro call.
  5077.  
  5078. Jeff noticed that \fsplit() doesn't treat backslash as a separator any more.
  5079. This happened during SEXP work, when it became necessary to allow for quoting
  5080. of parens, etc, to override their separation or grouping functions.  But this
  5081. made it impossible to use backslash as a separator, no matter how many of them
  5082. you used, and we want this to work, e.g. for DOS pathnames.  So I added a
  5083. special case to cksplit() for "\\" -- if the quoted character is itself a
  5084. backslash, don't bypass the later test for whether it's a separator.
  5085. ckclib.c, 20 Oct 2000.
  5086.  
  5087. A user noticed that the statement:
  5088.  
  5089.   minput 20 {\13\10$ } {\13\10%\32} {\10\13$\32}  {\13\10)\32}
  5090.  
  5091. in our standard LOGIN.KSC script had stopped working because of the right
  5092. parenthesis in the last pattern (used for AOS/VS).  It's not really a bug;
  5093. since the SEXP work, we can't be quite so free-and-easy with syntax --
  5094. any brace or parenthesis that is to be taken literally should now be quoted.
  5095.  
  5096. Still, it's not good that this breaks an existing script for no good reason;
  5097. an unmatched right paren should be ignored.  Why isn't it?
  5098.  
  5099. Added SET DEBUG LINELENGTH (invisible) so we can have short debug strings by
  5100. default, but get long ones if we need them.  This affects all debug(F010,...)
  5101. statements, which I have attempted to use wherever a very long string might be
  5102. entered into the log.  While I was at it, I fixed the nutty flushleft switch()
  5103. formatting of doprm().  ckuus3.c, 21 Oct 2000.
  5104.  
  5105. Back to the LOGIN.KSC problem...  Why does the unmatched right paren cause
  5106. early termination of the macro?  Because litcmd() replaces unmatched right
  5107. parens with "\{41}" (to prevent early termination of the \fliteral()
  5108. construction that is generated for, e.g. THEN and ELSE parts of IF statements
  5109. to prevent premature evaluation of variables).  This was fine before, but now
  5110. that we recognize "\{" as a quoted left brace, the terminating brace matches
  5111. some earlier opening brace rather than the immediately preceding one.  This
  5112. was fixed in litcmd() by making it generate "\041" rather than "\{41}", which
  5113. is safe, because the \nnn interpreter never reads more than 3 digits.
  5114. ckuus5.c, 21 Oct 2000.
  5115.  
  5116. But now I wonder if this same problem might not occur in any script that uses
  5117. \{nnn} notation.  Talk about quoting hell...  Let's try it:
  5118.  
  5119.     def foo {
  5120.     echo [\{65}\{66}\{67}\{68}\{69}]
  5121.     if success { echo [\{73}\{83}\{32}\{79}\{75}] } else { echo no good }
  5122.     }
  5123.     do foo
  5124.  
  5125. Seems to be fine but let's keep our eyes open.
  5126.  
  5127. Back to FTP...  Realized that I did FTP GET /MOVE-TO and /RENAME-TO wrong.
  5128. I have them affecting the source file on the server, but for consistency with
  5129. the corresponding Kermit commands, they should affect the received file after
  5130. it is successfully downloaded.  ckcftp.c, 21 Oct 2000.
  5131.  
  5132. Fixed parsing of "!command" when NOPUSH is set.  ckuus5.c, 22 Oct 2000.
  5133.  
  5134. Added redirection to FTP DIRECTORY, so we can send the server's directory
  5135. listing to a file, a pipe, etc.  ckcftp.c, 22 Oct 2000.
  5136.  
  5137. Adding charset translation to FTP GET...  We need to use xgnbyte(), which
  5138. translates from any charset to UCS-2.  However, it always uses zminchar() to
  5139. get its next character.  Added a function-pointer argument to tell it what
  5140. routine to call to get its next input character, and changed all prototypes
  5141. and invocations accordingly.  If the pointer is NULL, we call zminchar()
  5142. (which is a macro), as before.  ckcker.h, ckcfns.c, ckuus[46].c, ckcftp.c,
  5143. 22 Oct 2000.
  5144.  
  5145. Added code to recvrequest() to translate charsets if in text mode.  Added
  5146. translation on/off plus file and server charset numbers as parameters to
  5147. recvrequest() and getfile(), and to prototypes and all invocations of them.
  5148. ckcftp.c, 22 Oct 2000.
  5149.  
  5150. Started looking into GET /RECURSIVE.  "NLST *" sent to WU-FTPD results in a
  5151. recursive listing.  We do a GET for each item but it doesn't work if the
  5152. directories don't already exist on the client.  As long as we're going between
  5153. UNIX and UNIX, all I have to do is call zmkdir() on each name and recursion
  5154. works.  Then the question becomes: how to disable it?  What does the regular
  5155. FTP client do?  The same thing: it receives the recursive list and tries to
  5156. GET each file, and then fails for each one that contains a pathname if the
  5157. directories in it don't exist.  If they do exist, the recursive transfer
  5158. works.  What if the server isn't UNIX?  If it sends pathnames in DOS or VMS
  5159. format, we won't even know they are pathnames, and so won't call zmkdir()
  5160. them, and will simply use the foreign pathname as the filename.  This behavior
  5161. is familiar to FTP users.
  5162.  
  5163. OK, so GET /RECURSIVE means to check each name in the NLST file list for
  5164. slashes or whatever.  If a name has a directory separator, we try to create
  5165. the directory, whereas if /RECURSIVE is not given and a name contains a
  5166. directory separator, we simply don't ask for it.  This is gross but it works
  5167. just fine with WU-FTPD.  ckcftp.c, 22 Oct 2000.
  5168.  
  5169. Also PUT /RECURSIVE was broken, fixed now.  ckcftp.c, 22 Oct 2000.
  5170.  
  5171. At this point, all the major FTP features that I was going to do are done; all
  5172. that remains is testing, debugging, porting, tuning, and cosmetics.  Jeff
  5173. needs to make sure the security features still work, and either fill in and
  5174. debug the proxy stuff or else remove it, and maybe make HTTP more symmetrical.
  5175. ckcftp.c has grown from 825 lines on July 15th to 10,675(!) -- hmmm, why's it
  5176. so big?  The object module is pretty hefty too:
  5177.  
  5178.   $ size ckcf*.o
  5179.   text    data    bss     dec     hex
  5180.   33808   528     0       34336   8620    ckcfn2.o
  5181.   27440   720     1560    29720   7418    ckcfn3.o
  5182.   70712   1248    3184    75144   12588   ckcfns.o
  5183.   75096   14840   26624   116560  1c750   ckcftp.o
  5184.  
  5185. Probably because it combines user interface and i/o in the same module.
  5186. Actually I suppose it's not that bad since /usr/ucb/ftp is about the same.
  5187.  
  5188. Fixed f-t display "(SECURE)" indication for FTP.  ckcftp.c, ckuusx.c,
  5189. 23 Oct 2000.
  5190.  
  5191. Added GET /TO-SCREEN, equivalent to Kermit REMOTE TYPE.  We can't use /TYPE
  5192. or FTP TYPE since they both mean something else (text vs binary).  ckcftp.c,
  5193. 23 Oct 2000.
  5194.  
  5195. Changed UNIX nzltor() to accept a 3-state conversion argument, rather than
  5196. the previous 2-state one.  Previously, if the 3rd parameter was nonzero, full
  5197. conversion was done.  Now full conversion is done if it's > 0 and minimal
  5198. conversion if it's < 0 (and none if it == 0, as before).  Minimal conversion
  5199. means everything except uppercasing of letters and enforcing only one period.
  5200. Thus files like "Foo.tar.gz" can be sent without changing their names if we
  5201. use a negative conversion argument, but we still do the other stuff like
  5202. replacing space with '_'.  The Windows and other versions of nzltor() should
  5203. be changed this way too (but no harm is done if they aren't; they'll operate
  5204. as before).  ckufio.c, 23 Oct 2000.
  5205.  
  5206. Changed FTP PUT to call nzltor() with a negative conversion argument if client
  5207. and server are not alike but the FTP server is UNIX (I could do the same for
  5208. Win32 FTP servers if I knew how they responded to SYST). ckcftp.c, 23 Oct 2000.
  5209.  
  5210. Did the same for Kermit SEND (this time for both Win32 and UNIX servers).
  5211. ckcfns.c, 23 Oct 2000.
  5212.  
  5213. Added support for download directory.  If someone goes to the trouble of
  5214. setting one, FTP GET should use it just like regular GET does. ckcftp.c,
  5215. 23 Oct 2000.
  5216.  
  5217. Made the WHERE command work for FTP.  ckcftp.c, 23 Oct 2000.
  5218.  
  5219. Tested against IBM VM/CMS FTPD.  Seems to work fine.  Tested against VMS
  5220. MultiNet FTPD.  This one doesn't respond to SIZE or MDTM (OK...) but then it
  5221. seems to somehow trick us into using the same name for the incoming file over
  5222. and over.  Which-buffer-is-which confusion in doftpget(), fixed now.
  5223. ckcftp.c, 23 Oct 2000.
  5224.  
  5225. When receiving a file and we don't know the size, then at the end we
  5226. do "Percent done: 100 ////...." out to the end.  However, it seems we don't
  5227. clear the line first:
  5228.  
  5229.         Percent Done: 1009//////////////////////////////////////////////////
  5230.                          ^
  5231. Fixed in ckscreen(): ckuusx.c, 23 Oct 2000.
  5232.  
  5233. Fixed unprotected reference to ftpissecure() in ckuusx.c, 24 Oct 2000.
  5234.  
  5235. Somehow on Oct 22, I removed the cmtxt() call from dolocal().  This causes
  5236. compiler warnings and core dumps.  Now it's back.  ckuus5.c, 24 Oct 2000.
  5237.  
  5238. Previously, the UNDEFINE command let you type lots of variables but only
  5239. undefined the first one.  Also there was no provision for undefining a group
  5240. of variables based on a pattern.  So I changed it to (a) allow a list of items
  5241. to be undefined; (b) allow a pattern-matching option; and (c) add a verbose
  5242. option, to list the variables that were undefined.  Works nicely except
  5243. (a) sometimes /VERBOSE gets the wrong numbers for the summary, and (b) it
  5244. doesn't seem to work for array elements.  Will fix (and document) tomorrow.
  5245. ckuus6.c, 24 Oct 2000.
  5246.  
  5247. Fixed yesterday's Percent Done fix to not break the thermometer for normal
  5248. transfers.  ckuusx.c, 25 Oct 2000.
  5249.  
  5250. Fixed a couple of compilation glitches noticed on Ultrix:
  5251.  
  5252.   cfe: Error: ckuusr.c, line 6931: 'cmdstats' undefined
  5253.   cfe: Warning: ckuusr.c, line 10102: Number of arguments doesn't agree
  5254.        with number in declaration: return(dodcl());
  5255.  
  5256. ckuusr.c, 25 Oct 2000.
  5257.  
  5258. While I was at it, I cleaned up NOSPL builds.  ckucmd.c, ckuus[25rxy].c,
  5259. 25 Oct 2000.
  5260.  
  5261. Noticed that "make linux" did not include built-in FTP client.  The #ifdefs
  5262. in ckcdeb.h were all wrong.  Fixed them.  ckcdeb.h, 25 Oct 2000.
  5263.  
  5264. Linux/PC builds:
  5265.   Full:      1874K
  5266.   NOFLOAT:   1840K
  5267.   NOFTP:     1785K
  5268.   NONET:     1674K
  5269.   NODIAL:    1742K
  5270.   NOLOCAL:   1428K
  5271.   NOUNICODE: 1572K
  5272.   NOCSETS:   1489K
  5273.   NOSPL:     1575K
  5274.   NOHELP:    1619K
  5275.   NOIKSD:    1825K
  5276.   NOSHOW:    1806K
  5277.   NOXFER:    1404K
  5278.  
  5279. Various adjustments were needed in the same modules.  25 Oct 2000.
  5280.  
  5281. Spent most of the day checking a user's misbehaving script.  It seems that
  5282. using an \fexec() invocation as a macro argument does something terrible.
  5283. Reworked a number of debug() statements to make it easier to track, but didn't
  5284. have time to actually fix anything yet.  ckuus[56rx].c, 26 Oct 2000.
  5285.  
  5286. Yesterday's script exposed two problems.  First, when a macro argument contains
  5287. an \fexec() reference, the parser calls itself recursively and changes the
  5288. macro index variable, which was not on the stack.  Putting it on the stack
  5289. fixed the problem.  Second, we never accounted for the possibility that the
  5290. macro called by fexec would change the macro table, thus rendering the index
  5291. invalid by the time we use it (as an argument to dodo()), e.g.:
  5292.  
  5293.   def bad undef good, return "haha"
  5294.   define good echo \%1
  5295.   do good \fexec(bad)
  5296.  
  5297. Obviously this could be fixed by looking up the macro name again after parsing
  5298. the args, but not without killing script performance, so I added Yet Another
  5299. Global Flag, mtchanged (macro table changed), which is set by addmac() and
  5300. delmac().  We set this to 0 before parsing macro args, and if it is nonzero
  5301. afterwards, then we relookup the name.  Also now we recover gracefully from
  5302. the case above (the macro itself disappeared after we looked it up but before
  5303. we tried to start it).  ckuus[r5].c, 27 Oct 2000.
  5304.  
  5305. Fixed the debug log to include each command (using the new length-limited
  5306. F010 format) in a line that starts with CMD, followed by (P), (F), or (M),
  5307. to indicate the command source (prompt, file, or macro), followed by the
  5308. command itself, plus indicators of command-level changes, similar to what is
  5309. shown by TRACE.  So now "grep ^CMD" gets a command history showing command
  5310. file and macro entry and exit and the commands themselves.  The F010 format
  5311. for the actual commands pretty much restricts each entry to fit within an
  5312. 80-column line, but for heavy debugging we can use SET DEBUG LINELENGTH.
  5313. ckuus5.c, ckucmd.c, 27 Oct 2000.
  5314.  
  5315. OPEN !READ and OPEN !WRITE did not strip braces/quotes.  Fixed in doopen():
  5316. ckuus6.c, 27 Oct 2000.
  5317.  
  5318. Jeff says "All entries in the makefile that include KRB5 must now link to
  5319. -lgssapi_krb5 and those referencing SRP must now link to -lkrypto if NEWFTP is
  5320. on by default."  Added this (without testing), 27 Oct 2000.
  5321.  
  5322. Changed zrename() to not choose between (atomic) rename() and (vulnerable)
  5323. link()/unlink() at compile time, but rather to call rename() (if available)
  5324. and then if it fails (or is not available), to call link()/unlink(), and if
  5325. that fails, to copy the file, then delete the original.  ckufio.c, 27 Oct 2000.
  5326.  
  5327. Fixed some compilation glitches (#ifdefs, casts, unguarded references to
  5328. h_addr_list[]) in ckcftp.c, 27 Oct 2000.
  5329.  
  5330. Built with FTP and tested OK on HP-UX 8.00, HP-UX 10.20, Unixware 7.0, BSDI
  5331. 4.1, IRIX 6.5, Tru64 4.0E, Solaris 2.5.1, AIX 4.3, and (without FTP) on VMS
  5332. 7.2-1.  Minor adjustments required to ckuus[r35].c, ckuusr.h, ckcftp.c,
  5333. ckcpro.w. 27 Oct 2000. Later Christian Mondrup built it OK on Ultrix 4.4 too.
  5334. And Gerry Belanger on Motorola Sys V/68 and /88 (although it doesn't actually
  5335. work on those -- the TCP stuff isn't right, it times out trying to connect).
  5336.  
  5337. Discovered that FTP PUT didn't show an error in its file transfer display
  5338. if the destination file could not be opened.  Fixed in putfile(): ckcftp.c,
  5339. 28 Oct 2000.
  5340.  
  5341. Reformatted ckuusy.c to be normal by indenting flushleft case statements.
  5342. 28 Oct 2000.
  5343.  
  5344. Added '-9' command-line option for FTP host.  Works with -M ("My user ID").
  5345. If FTP connection made from command line without -S (Stay), BYE exits Kermit
  5346. with status code based on FTP transfers.  ckuusy.c, 28 Oct 2000.
  5347.  
  5348. Added FTP command-line personality, very simple, no options to speak of.
  5349. ckcmai.c, ckuusy.c, ckcftp.c, 28 Oct 2000.
  5350.  
  5351. Added command-line options to actually transfer files; thus an entire FTP
  5352. session can be initiated from the command line with no interaction or
  5353. scripting required (if you can make a secure connection or you don't mind
  5354. putting your password on the command line).  Upload only.  ckuusy.c, ckcftp.c,
  5355. 28 Oct 2000.
  5356.  
  5357. Added downloading from command line, but it took a lot of fiddling to get
  5358. the file transfer display working, extraneous messages suppressed, etc. 
  5359. ckuusy.c, ckcftp.c, 28 Oct 2000.
  5360.  
  5361. Fixed GET statistics; the first file was always 0 sec, the second file had the
  5362. time of the first, etc.  Fixed ftp -q to really be quiet.  Cleaned up the
  5363. cmdlineget/put() routines.  Fixed ftp -D to CD even if -p or -g not given.
  5364. Installed FTP LOGIN as an invisible synonym for FTP USER, and uncovered
  5365. FTP REGET.  ckcftp.c, 29 Oct 2000.
  5366.  
  5367. Any user can make C-Kermit dump core by starting with -A (IKSD) and then
  5368. Ctrl-C'ing it.  It appears the jmp buffer isn't set up yet.  Jeff added some
  5369. preventive measures.  ckcmai.c, 30 Oct 2000.
  5370.  
  5371. The SWITCH statement failed to strip braces from around its control variable,
  5372. and also didn't handle control variables with empty or multiword values very
  5373. well.  I retooled the SWITCH command (and the _FORWARD command that it uses
  5374. internally) to allow all combinations of control variable contents (empty,
  5375. one word, multiple words) and encapsulation:
  5376.  
  5377.   switch \%a { ... }
  5378.   switch {\%a} { ... }
  5379.   switch (\%a) { ... }
  5380.   switch ( \%a ) { ... }
  5381.   switch { \%a } { ... }
  5382.   switch { (\%a) } { ... }
  5383.  
  5384. ckuus[r6].c, 30 Oct 2000.
  5385.  
  5386. Added lots of debug() statements to ftp_hookup() in hopes of tracking down
  5387. the problems on FreeBSD 3.1, SV68, and SV88.  ckcftp.c, 30 Oct 2000.
  5388.  
  5389. Back to FTP command line.  The -Y option (skip init file) didn't work because
  5390. it has to be done in prescan() but prescan() doesn't do anything if the
  5391. command-line personality is not Kermit.  Added code to prescan() to take care
  5392. of this.  ckuus4.c, 30 Oct 2000.
  5393.  
  5394. Moved doftparg() from ckuusy.c to ckcftp.c, since it will need access to the
  5395. symbols, variables, etc.  30 Oct 2000.
  5396.  
  5397. Added security-related command-line options from kftp, parsing only; actions
  5398. need to be filled in.  doftparg(): ckcftp.c, 30 Oct 2000.
  5399.  
  5400. From Jeff: "In ckxlogin() I added a doexit() to prevent an infinite loop in
  5401. IKSD caused by the ttfdflg flag.  This flag appears to be set when IKSD starts
  5402. which results in ttclos() not closing the socket when it is called.  I don't
  5403. think the ttfdflg flag should be set when we are using fd 0 in IKSD.  There is
  5404. no parent process for us to preserve the socket for.  I'm not sure what the
  5405. best way to modify this is, so I leave it to you."  We'll leave it like this
  5406. for now.  ckuus7.c, 31 Oct 2000.
  5407.  
  5408. Filled in some of the FTP help text.  ckcftp.c, 31 Oct 2000.
  5409.  
  5410. Looked into the FTP connection failure on FreeBSD 3.x.  The connect() in
  5411. ftp_hookup() fails with EACCESS.  "man 2 connect" says EACCESS is returned
  5412. when "write access to the named socket is denied" or "search permission is
  5413. denied for a component of the path prefix".  These are listed under the
  5414. heading: "The following errors are specific to connecting names in the UNIX
  5415. domain.  These errors may not apply in future versions of the UNIX IPC domain"
  5416. (whatever that means).  Yet Kermit's TELNET command works fine on the same
  5417. computer.  Comparing ftp_hookup() with netopen() in ckcnet.c, the first
  5418. difference that jumps out is that ftp_hookup() simply calls inet_addr() on the
  5419. name, whereas netopen() has dozens of lines of #ifdefs based on symbols
  5420. NOMHHOST, INADDRX, and INADDR_NONE, and then the whole HADDRLIST business.  In
  5421. ckcnet.c, there are 241 lines devoted to address resolution, whereas in
  5422. ftp_hookup() has only 37.  Maybe we should just adapt netopen() for FTP and
  5423. use it instead ftp_hookup().  This will probably also fix the other
  5424. nonstarters too: In SVR4/88 connect() gets errno 157, "no route to host"; in
  5425. SVR3/68, the errno is 115, "connection timed out".
  5426.  
  5427. Another clue, by the way, is that the connect() fails only if you give a
  5428. hostname; connect() works fine when you give an IP address.  This is true on
  5429. all of the failing platforms (FreeBSD 3.1, 3.3, and 4.1 as well as SV/68
  5430. and SV/88).
  5431.  
  5432. Fix from Jeff for the FreeBSD FTP problem (HADDRLIST stuff).  This also did
  5433. the trick for SV/[68]8.  ckcftp.c, 1 Nov 2000.
  5434.  
  5435. Jeff filled in the network side of the TELNET COMPORT option.  ckctel.[ch],
  5436. ckuus[r3].c, 1 Nov 2000.
  5437.  
  5438. There was some kind of malloc/free problem in the ftp code that caused core
  5439. dumps in SV/68, which I don't have access to, and couldn't reproduce anyplace
  5440. else.  However, I discovered that in the very latest FreeBSD release, the
  5441. free() routine prints an error message when passed a bogus pointer, and used
  5442. this to find the (or at least a) hole, and plugged it.  ckcftp.c, 1 Nov 2000.
  5443.  
  5444. Actually the problem in SV/68 was not malloc/free at all, but an #ifdef
  5445. foulup.  This was the first platform that we tried this code on in which
  5446. "printf" was not defined as a macro, and the "#ifdef printf" in recvrequest()'s
  5447. ASCII case didn't have the appropriate #else part.  ckcftp.c, 2 Nov 2000.
  5448.  
  5449. More Telnet COMPORT code from Jeff: ckctel.[ch] + various ckuus*.c modules.
  5450. 2 Nov 2000.
  5451.  
  5452. The various clients of secure_getc() were checking its return code in
  5453. different ways, which apparently could result in long delays at the end of
  5454. a connection, when it returned EOF but the client checked for < 0, on
  5455. platforms where EOF is not defined to be -1.  Fixed in ckcftp.c, 2 Nov 2000.
  5456.  
  5457. Added connection-log entry code for FTP, and made SHOW CONNECTION also show
  5458. any active FTP connection.  ckcftp.c, ckuus[35].c, 2 Nov 2000.
  5459.  
  5460. More #ifdef fiddling for COMPORT, more debugging for FTP, ckctel.[ch],
  5461. ckcdeb.h, ckcftp.c, 3 Nov 2000.
  5462.  
  5463. #ifdef'd out all shutdown() calls in ckcftp.c since they seem unnecessary
  5464. (each shutdown() call is before a close()) and they cause long pauses on
  5465. SV/68 R3.  4 Nov 2000.
  5466.  
  5467. More Telnet COMPORT code from Jeff.  ckctel.[ch], 5 Nov 2000.
  5468.  
  5469. Adapted Jeff's Telnet COMPORT code to ckutio.c.  5 Nov 2000.
  5470.  
  5471. Changed tnsettings() to differentiate between 7 and 8 data bits using our
  5472. hokey convention for hardware parity, and added a convention for calling
  5473. it with a "don't change parity" argument.  ckctel.c, 5 Nov 2000.
  5474.  
  5475. Added calls to tnsettings() from SET PARITY, SET STOP-BITS, and SET SERIAL,
  5476. to allow for changes after SET HOST.  ckuus3.c, 5 Nov 2000.
  5477.  
  5478. More Telnet COMPORT code from Jeff.  ckcdeb.h, ckuus[r34].c, ckctel.[ch],
  5479. ckutio.c, 6 Nov 2000.
  5480.  
  5481. Removed tailing blanks and fixed long lines in ckctel.[ch], and fixed the
  5482. formatting of the TN_COMPORT code.  6 Nov 2000.
  5483.  
  5484. I noticed that TN_COMPORT was not being included in the SunOS and Solaris
  5485. builds, along with certain other features.  I traced this to the "built-in
  5486. makefile entries" in ckcdeb.h -- they were too far down.  I moved them up to
  5487. where they would have the intended effect.  This might also explain the foulup
  5488. with Solaris hardware flow control in 7.0.  Fixing it actually took a fair
  5489. amount of juggling.  Rainy-day project: make sure that for every #ifdef BLAH
  5490. in this file, there are no #define BLAH's further down.  ckcdeb.h, 6 Nov 2000.
  5491.  
  5492. Added a separate SET SPEED table for TN_COMPORT connections, and code to use
  5493. it whenever the Telnet COMPORT option has been negotiated on the current
  5494. connection.  ckuus3.c, 6 Nov 2000.
  5495.  
  5496. Corrections to TN_COMPORT from Jeff, ckuus3.c, 7 Nov 2000.
  5497.  
  5498. Corrections to FTP temp file handling from Jeff, ckcftp.c, 7 Nov 2000.
  5499.  
  5500. Added istncomport() to centralize criteria for testing if connection is a
  5501. Telnet COMPORT one, and so modules that do not already include ckctel.h don't
  5502. have to do so just to make this test.  ckctel.c, ckutio.c, ckuus[34].c,
  5503. 7 Nov 2000.
  5504.  
  5505. Added TN_COMPORT code for SET FLOW.  This allows the full range of flow
  5506. control types to be selected when a Telnet COMPORT connection is active, even
  5507. when they are not otherwise available.  Also I changed setflow() to choose the
  5508. SET FLOW /MODEM flow-control type for Telnet COMPORT connections.  ckuus[3x].c,
  5509. 7 Nov 2000.
  5510.  
  5511. Changed FTP DELETE to not use the regular file-transfer display, but just
  5512. list each filename with "OK" or "Failed".  ckcftp.c, 7 Nov 2000.
  5513.  
  5514. Added support for FTP URLs.  It's only for when Kermit is invoked as "ftp",
  5515. and only works for "ftp:" URLs.  If the URL includes a path (i.e. filename):
  5516.  
  5517.  . If no username is given, we log in automatically as user anonymous.
  5518.  . GET is implied -- we get the file.
  5519.  
  5520. So for example:
  5521.  
  5522.   ftp ftp://kermit.columbia.edu/kermit/READ.ME
  5523.  
  5524. gets the Kermit FTP site read-me file anonymously.  If a user ID is given but
  5525. no password, the password is prompted for.  If no path is given, we just
  5526. connect to the host and wait for a command.  To handle URLs, I added a
  5527. urlparse() routine to ckuusy.c, and then use it to check any command-line
  5528. hostname to see if it's a URL.  If so, it sets pointers to the pieces and we
  5529. treat them as if they had been given as separate command-line arguments.  The
  5530. result is about the same as what we already had for Telnet: "telnet:" URLs are
  5531. recognized when the command-line personality is Telnet.  However, the FTP URL
  5532. recognizer doesn't incorporate any notion of chaining to other services, and
  5533. I'm not sure if this would be useful; after all, we don't expect FTP clients
  5534. to make Telnet connections.  ckuusy.c, ckcftp.c, 7 Nov 2000.
  5535.  
  5536. The format of a comment in ckcdeb.h (in the #else part of #ifdef TTSPDLIST)
  5537. was blowing up the SunOS non-ANSI compiler.  Moved the comment delimiter and
  5538. all is well.  ckcdeb.h, 7 Nov 2000.
  5539.  
  5540. Also a few last-minute adjustments to make sure we build OK with -DNONET,
  5541. -DNOFTP, and -DNOCMDL.  ckcftp.c, ckuus3.c, 7 Nov 2000.
  5542.  
  5543. The temp[] buffer in remote_files() needed to be static so the file could be
  5544. deleted when done.  ckcftp.c, 8 Nov 2000.
  5545.  
  5546. doftpget() was activating update mode unconditionally if FILE COLLISION UPDATE
  5547. was set, but it should only have done this for GET, not for DELETE.  ckcftp.c,
  5548. 8 Nov 2000.
  5549.  
  5550. Opening a Telnet connection would close any open FTP connection.  Fixed in
  5551. setlin(): ckuus7.c, 8 Nov 2000.
  5552.  
  5553. Added \v(ftp_getputremote) to allow the FTP GET-PUT-REMOTE setting to be
  5554. saved and restored in scripts.  ckuusr.h, ckuus4.c, 8 Nov 2000.
  5555.  
  5556. Generalized FTP server OS-type detection.  ckcftp.c, 8 Nov 2000.
  5557.  
  5558. Filled in more HELP FTP text.  ckcftp.c, 8 Nov 2000.
  5559.  
  5560. From Jeff:
  5561.  . Fixed I_AM_XXX detection for K95, ckcmai.c.
  5562.  . Fixed ftp ftp://kermit.columbia.edu/kermit/ to perform a directory
  5563.    listing instead of a performing a recursive get.
  5564.  . Fixed a prototype error in ckcfns.c.
  5565. 10 Nov 2000.
  5566.  
  5567. Changed "ftp ftp://xxx" to suppress messages.  ckcftp.c, 10 Nov 2000.
  5568.  
  5569. SHOW CONNECTION didn't notice when a Telnet connection had been terminated by
  5570. the remote; it only noticed if you give a CLOSE command.  This is a new
  5571. problem since 7.0.  Added dologend() calls in the places where "closed by
  5572. peer" is detected.  cku{con,cns}.c, 10 Nov 2000.
  5573.  
  5574. Changed dologshow() to test the ttchk() return code for > -1 rather than != -1,
  5575. since it was missing the -2 case.  ckuus3.c, 10 Nov 2000.
  5576.  
  5577. SHOW CONNECTION was truncating the last digit of the time.  Another case of
  5578. using ckstrncpy() (which is intended only for copying WHOLE strings) rather
  5579. than strncpy() (which must be used when we want to copy a PIECE of a string).
  5580. ckuus3.c, plus added comments to ckclib.c, 10 Nov 2000.
  5581.  
  5582. Commands for SRP security options added to FTP by Jeff.  ckcftp.c, 12 Nov 2000.
  5583.  
  5584. Filled in remaining help text.  ckcftp.c, 12 Nov 2000.
  5585.  
  5586. Fixed FTP to use the networks directory the same way Telnet and other services
  5587. do: cycle thru matching entries until one is found that works; there's no
  5588. reason why FTP should be different.  ckcftp.c, ckuusy.c, 12 Nov 2000.
  5589.  
  5590. Improved the heading for FTP DIRECTORY.  ckcftp.c, 12 Nov 2000.
  5591.  
  5592. Improved some file-transfer display status messages for when GETs fail or the
  5593. file is refused.  ckcftp.c, 12 Nov 2000.
  5594.  
  5595. Discovered that \fexec(BLAH ...) (uppercase macro name) didn't work because of
  5596. a 1-character typo.  Fixed in mlook().  ckuus4.c, 13 Nov 2000.
  5597.  
  5598. If the LINES or COLUMNS environment variable has a non-numeric definition,
  5599. curses library calls dump core in HP-UX.  Added code to screenc() to check for
  5600. this case and to disable the fullscreen display when it is encountered.
  5601. ckuusx.c, 15 Nov 2000.
  5602.  
  5603. I wrote a Kermit script that reads a C header file to find all occurrences
  5604. of #ifdef BLAH followed by #define BLAH later in the file.  Sample result:
  5605.  
  5606.   (/usr/fdc/kermit/) C-Kermit>take define.ksc ckcker.h
  5607.   --------
  5608.      56. #ifdef WHATAMI
  5609.     306. #define WHATAMI
  5610.   --------
  5611.     210. #ifdef CK_APC
  5612.     224. #define CK_APC
  5613.     227. #define CK_APC
  5614.     230. #define CK_APC
  5615.   --------
  5616.     260. #ifdef CK_AUTODL
  5617.     274. #define CK_AUTODL
  5618.   --------
  5619.   ckcker.h Lines: 1257
  5620.   Possible errors: 5
  5621.   Time: 64 sec
  5622.  
  5623. All of these turned out to be OK.  The real rat's nest is ckcdeb.h with 5800+
  5624. lines and deeply convoluted #ifdefs.  This one took 2700 seconds (45 min) and
  5625. turned up some duplicated #ifedf blocks mainly involving BLAHx implies BLAHy
  5626. for SunOS and Solaris, of each which I removed the later instance.  ckcdeb.h,
  5627. 15 Nov 2000.
  5628.  
  5629. Added the bit of code that checks if we had CD'd to a temporary directory
  5630. (e.g. download directory) and if so, CD's back to where we were before to
  5631. ftreset() as a catch-all, in case of Ctrl-C, etc.  ckuusx.c, 16 Nov 2000.
  5632.  
  5633. In UNIX ttinl() where we do sanity checks on the packet fields, in most
  5634. cases we only look at the low-order 7 bits of the control fields, but in
  5635. one case (length field) I neglected to ignore the high-order bit, resulting
  5636. in spurious rejection of the first packet if it has parity, since we have
  5637. not yet called parchk() on it.  ckutio.c, 16 Nov 2000.
  5638.  
  5639. Added SET TRANSFER MESSAGE <text> to set a text message to be displayed
  5640. initially in the "Last Message:" field of the fullscreen display.  ckuusr.h,
  5641. ckcmai.c, ckuus[3x].c, 16 Nov 2000.
  5642.  
  5643. The stats script that uses SEXPs has a problem when the dataset includes big
  5644. and/or many numbers: the sum of the squares goes negative:
  5645.  
  5646.   (++ xsum2 (^ x 2) ysum2 (^ y 2))
  5647.  
  5648. Why?  Because an integer is being added to an integer, so it's not being
  5649. converted to FP.  The problem was in the "++" routine; it needed to check
  5650. the result, just like the "+" routine does, and switch to FP upon overflow.
  5651. Ditto for "--".  ckuus3.c, 17 Nov 2000.
  5652.  
  5653. Allowed SEXPs to be entered on multiple lines without having to hyphenate,
  5654. until the right paren is entered that matches the opening left paren.
  5655. ckuusr.c, 18 Nov 2000.
  5656.  
  5657. Fixed fullscreen f.t. display to clear to eol before printing anything in
  5658. the Last Message: field, in case SET XFER MSG had put something longer
  5659. there previously.  Also made ckscreen() print the XFER MSG in non-fullscreen
  5660. displays too.  ckuusx.c, 18 Nov 2000.
  5661.  
  5662. TYPE /TAIL didn't work in K95 because the code in the "if (tailing)" sections
  5663. did not account for the buffers containing UCS2 and therefore NULs.  This
  5664. required reworking all the code in those sections, and adding a parallel
  5665. length array to save the length of each string.  ckuus6.c, 18 Nov 2000.
  5666.  
  5667. Suppose you want to use MINPUT to look for a bunch of targets simultaneously
  5668. but you don't know in advance how many targets there will be.  Previously
  5669. there was no way.  But now thanks to cksplit() and \fjoin() we can use arrays
  5670. or array segments for this.  If you put \fjoin(&a) or \fjoin(&a[3:5]) or
  5671. whatever in the MPUT target list, it expands the array reference into the
  5672. appropriate number of separate targets.  This required a total rewrite of
  5673. MINPUT parsing: from cmfld() in a loop to cmtxt() with subsequent cksplit().
  5674. ckuusr.c, 18 Nov 2000.
  5675.  
  5676. When sending a file in local mode, we displayed the "Transfer OK" message up
  5677. when we sent the Z packet, which was premature.  For example, there might
  5678. be dozens of unack'd data packets still in window.  I moved the xxscreen()
  5679. call for this from clsif() to the <sseof>Y state of ckcpro.w.  18 Nov 2000.
  5680.  
  5681. Added code for the '-9' (ftp host) command-line option to allow for a port
  5682. and added help text for this option.  In this case the port number must be
  5683. appended to the hostname, connected by a colon (:) as in -j, -J, etc.
  5684. ckuusy.c, 19 Nov 2000.
  5685.  
  5686. The FTP command-line personality had no allowance for specifying a TCP port
  5687. name or number.  Handling this was a bit complicated.  First of all, command
  5688. lines like "ftp host:21" are confusing because they look like URLs.  In fact
  5689. there is no way of distinguishing this from a URL without "special knowledge".
  5690. So we let our URL routine declare it to be a URL and then compensate for this
  5691. afterward (if the URL has only service and host fields and the service is not
  5692. "ftp" then we rearrange the fields and say the service if FTP).  But we also
  5693. need to allow "ftp host port" (no colon) for compatibility with other FTP
  5694. clients, so I added this too.  ckuusy.c, ckcftp.c, 19 Nov 2000.
  5695.  
  5696. The change that was made to nzltor() to allow minimal conversions when the
  5697. name-conversion argument is negative also needed to be done for nzrtol(), with
  5698. the corresponding change to the calls in the FTP module in cmdlinget() and in
  5699. the GET command.  ckufio.c, ckcftp.c, 19 Nov 2000.
  5700.  
  5701. Added TYPE /TRANSPARENT to explicitly disable character-set translation in
  5702. the TYPE command.  ckuus[r2].c, 19 Nov 2000.
  5703.  
  5704. Added CLEAR KEYBOARD-BUFFER to allow scripts to flush typeahead.  ckuus[r2].c,
  5705. 19 Nov 2000.
  5706.  
  5707. Added HEAD and TAIL commands, which are simply aliases for TYPE with /HEAD
  5708. and /TAIL switches, respectively.  ckuusr.[ch], ckuus2.c, 19 Nov 2000.
  5709.  
  5710. Fixed top-level ?-help to fit on a 24-80 screen again, at least in C-Kermit.
  5711. ckucmd.c, 19 Nov 2000.
  5712.  
  5713. Discovered that "if defined \v(blah) ..." gave an obnoxious error message if
  5714. there was no such built-in variable, with no way to shut it up.  Fixed by
  5715. adding another special case to boolexp(): ckuus6.c, 19 Nov 2000.
  5716.  
  5717. Added (invisible) DEBUG OFF/ON to give slightly more fine-grained control over
  5718. debugging.  If LOG DEBUG is active, this turns logging off and on.  If LOG
  5719. DEBUG is not active, or Kermit was built without debugging, it does nothing.
  5720. Also converted a debug() straggler in dofor() to use F010 instead of F110.
  5721. ckuusr.[ch], ckuus[6x].c, 22 Nov 2000.
  5722.  
  5723. Suggested by Aaron Rendahl <arendahl@tricord.com>: unset IGNPAR bit when using
  5724. hardware parity, so incoming bytes that have parity errors are not discarded.
  5725. ckutio.c, 22 Nov 2000.
  5726.  
  5727. I hadn't done anything fun for a while, so started adding learned scripts.
  5728. These are included if CKLEARN is defined (and NOLEARN is not defined).
  5729. Initially it's just for UNIX (ckucns builds only); it can be added for K95
  5730. and VMS (when it is, update the CKLEARN #ifdefs in ckcdeb.h).  Definitions:
  5731. ckcdeb.h, ckuusr.h.  Parsing: ckuusr.c.  When learning, Kermit records all
  5732. commands except LEARN and CONNECT, and it converts TELNET to SET HOST:
  5733. ckucmd.c, ckuusr.c.  Ctrl-C cancels script recording.  ckuusx.c.  SHOW
  5734. FEATURES, SHOW SCRIPTS: ckuus5.c.  HELP: ckuus2.c.  23 Nov 2000.
  5735.  
  5736. Added code to the UNIX CONNECT module to record keystrokes and communications
  5737. input as OUTPUT and INPUT commands, respectively, and it sort of worked,
  5738. except it got really ugly with remote echoing.  This was easily fixed by
  5739. making it line-oriented rather than byte-oriented, at the expense of being
  5740. able to script things like pressing the space bar at a "More?" prompt or
  5741. editing a file with EMACS.  The alternative would be some kind of horrendous
  5742. super-hairy and error-prone echo-cancellation technique that would probably
  5743. never work in real life.  Better to keep it simple.  ckucns.c (NOT ckucon.c;
  5744. it can't be done there because forks don't share variables), 23 Nov 2000.
  5745.  
  5746. The new "minput n \fjoin(&a)" feature would sometimes include a spurious empty
  5747. element in the list, which, of course, would always succeed, thus wrecking any
  5748. script.  Rewrote the argument-gathering code to ensure there could be no
  5749. empties.  ckuusr.c, 24 Nov 2000.
  5750.  
  5751. A minor refinement to learned scripts: fixed the INPUT timeout interval after
  5752. long-running commands (like SEND).  Also there were a couple bits of new code
  5753. that were not within #ifdef CKLEARN..#endif; I added the #ifdefs to make it
  5754. easier to copy to the code to other platforms.  ckucns.c, 24 Nov 2000.
  5755.  
  5756. Added -DNOLEARN to most wermit-based makefile targets.  Made sure it built
  5757. OK with -DNOLEARN.  makefile, 24 Nov 2000.
  5758.  
  5759. Adapted learned-script code to VMS and cleared up a few other VMS compilation
  5760. glitches, like missing prototypes for Telnet Com Port functions.  ckcdeb.h,
  5761. ckuusr.c, ckvcon.c, ckctel.h, ckuus3.c, 24 Nov 2000.
  5762.  
  5763. Fixed learned scripts to always record recalled commands, rather than only
  5764. when they were different from the previous command in the recall buffer.
  5765. ckucmd.c, 25 Nov 2000.
  5766.  
  5767. Removed a vestigial cmcfm() call from EXIT parsing (cmtxt() had already been
  5768. called).  ckuusr.c, 25 Nov 2000.
  5769.  
  5770. Discovered that addcmd() was called for every command, even though it only had
  5771. an effect for commands entered at the prompt -- a lot of useless overheard for
  5772. script execution.  Changed the calls to depend on the appropriate conditions.
  5773. ckucmd.c, 25 Nov 2000.
  5774.  
  5775. Noticed that floating-point ops occasionally printed "log10: SING error".
  5776. Fixed in fpformat() by not trying to take the log of 0.  ckuus4.c, 25 Nov 2000.
  5777.  
  5778. Verified that MINPUT n \fjoin(&a) now works properly in latest K95 build.
  5779. 27 Nov 2000.
  5780.  
  5781. Fixed cmcfm() to call addcmd() only if cmflgs not 1 (in case confirmation
  5782. was already obtained, e.g., in cmfdb()).  ckucmd.c, 27 Nov 2000.
  5783.  
  5784. Minor corrections from Jeff to learned-script, FTP, Telnet Com Port, and
  5785. SSL code.  ckcftp.c, ckuusr.c, ckctel.c, ck_ssl.c, 28 Nov 2000.
  5786.  
  5787. Made ADD SEND-LIST work with FTP.  ckcftp.c, 28 Nov 2000.
  5788.  
  5789. Ctrl-C during ftp login at Password: prompt was caught but just returned to
  5790. where it was, i.e. didn't interrupt.  That's because ftpcmd() had already been
  5791. called, which sets SIGINT to cmdcancel(), but cmdcancel() only sets a flag and
  5792. returns.  Meanwhile we're inside readpass() which doesn't know anything about
  5793. the flag, so readpass() keeps trying to read the password.  Fixed by calling
  5794. sigint() before calling readpass() (4 or 5 places).  This should be harmless
  5795. since the next ftpcmd() call will send SIGINT back to cmdcancel().  ckcftp.c,
  5796. 28 Nov 2000.
  5797.  
  5798. FTP to VMS / MultiNet...  Interruption of GET with X or Z or ^C didn't work --
  5799. just stopped it cold.  But interrupting the same kind of download from a Unix
  5800. server worked fine.  Furthermore, when using K95 as a client to the same VMS
  5801. server, cancellation also worked.  Eventually I figured it out.  In UNIX,
  5802. BSDSELECT is not defined, so select() was never being called and were hanging
  5803. in getreply().  So I defined BSDSELECT and poof, everything worked.  ckcftp.c,
  5804. 28 Nov 2000.
  5805.  
  5806. When GET'ing files from an FTP server that does not understand the SIZE
  5807. command, the file-transfer display inappropriately put up the "Percent done"
  5808. label, instead of the "Bytes so far" label.  Fixed in ckcftp.c, 28 Nov 2000.
  5809.  
  5810. In enabling the BSDSELECT code in ckcftp.c yesterday, I opened the "time.h"
  5811. hornet's nest.  I had foolishly hoped to sidestep it by defining an ersatz
  5812. timeval-like struct with a different name, but this stopped compilation cold
  5813. on HP-UX, SV/68, etc.  Jeff thought a (void *) cast would fix it, and maybe it
  5814. would if enclosed in #ifdef CK_ANSIC..#endif (void is not portable), but this
  5815. seemed too easy (experience teaches that the easy way never works in C) so
  5816. instead I went back and did it "right" with all the #ifdefs for <time.h>,
  5817. <sys/time.h>, <timeb.h>, etc etc, as in ckutio.c.  But it was easier than
  5818. expected -- I forgot I had cleaned up this mess considerably in ckutio.c a
  5819. while back.  Built OK on SunOS/gcc, Solaris with Sun CC, HP-UX 9.05 and 10.20
  5820. with bundled non-ANSI compiler, HP-UX 10.20 with ANSI optimizing compiler.  It
  5821. blew up on HP-UX 9.05 with the ANSI compiler: not the timeval argument, but on
  5822. the fd_set ones, which the HP prototype says must be (int *) rather than
  5823. (fd_set *).  Added #ifdefs for this -- no doubt this process is to be repeated
  5824. a hundred more times -- then it built and worked OK.  ckcftp.c, 29 Nov 2000.
  5825.  
  5826. From Jeff: Enable learned scripts in ckcdeb.h.  Updated Kerberos builds in
  5827. makefile.  Forward-X updates to ckcnet.c.  29 Nov 2000.
  5828.  
  5829. From Jeff, 30 Nov 2000:
  5830.   ckctel.c ck_ssl.c ckcnet.c ckcfn2.c ckutio.c makefile
  5831.  
  5832.   More fixes to Forward X
  5833.  
  5834.   Added support for embedded TLS compression (Zlib).  I see a 200% file
  5835.   transfer improvement on my DSL line.
  5836.  
  5837.   Corrected a problem with ttinl() and streaming when telnet
  5838.   negotiations are sent during a streaming receive.  If there is
  5839.   incoming data while we are reading Data packets we were treating it as
  5840.   an error on the link even if the data was not in fact a Kermit
  5841.   packet.  Instead, what we want to do is read the data, if it is a
  5842.   packet return an error OR if all the data was read and there was no
  5843.   packet, then return 0 bytes read.  If 0 bytes are returned from
  5844.   ttinl() while in streaming mode, treat it as if we never called
  5845.   ttinl() in the first place.  I tested it on Unix and Windows with
  5846.   several different combinations of data flows.
  5847.  
  5848. Fixed a compiler warning in Solaris about the 2nd arg to recv().  For some
  5849. reason I believed that it had be be "const char *" on Solaris, but it didn't.
  5850. I wonder why I thought that...  ckcftp.c, 30 Nov 2000.
  5851.  
  5852. Back to ckcftp.c and select() vs time.h...  It still didn't build on SV/68;
  5853. now we have multiple definitions of struct tm.  Rearranged #ifdefs til it
  5854. worked.  ckcftp.c, 30 Nov 2000.
  5855.  
  5856. Ever since IRIX 6.5 came out, building C-Kermit there has been a big pain
  5857. since the compiler spits out thousands of "variable declared but not used"
  5858. or "variable set but not referenced" messages.  I finally discovered the
  5859. magic incantation to suppress these messages (-woff 1174,1552).  makefile,
  5860. 30 Nov 2000.
  5861.  
  5862. Built on AIX 4.3, which went OK except a few modules exceeded the optimizer.
  5863. But "ftp 128.59.39.2" didn't work -- it didn't do anything at all, just gave
  5864. another prompt.  But "ftp =128.59.39.2" worked fine.  Network directory
  5865. lookups were not working.  First: don't bother with directory lookup if
  5866. hostname starts with a digit.  Second, "tcp/ip" was required in the
  5867. network-type field and "tcp" wasn't accepted.  Plus certain cases were simply
  5868. not handled.  Fixed in ckcftp.c, 30 Nov 2000.
  5869.  
  5870. Portability checks/builds.  OK if it builds without complaint, makes an
  5871. FTP connection, transfers files, and file transfer can be interrupted (which
  5872. is where select() comes in):
  5873.  
  5874.  . Unixware 7.1 OK
  5875.  . IRIX 6.5 OK (and now with no warnings).
  5876.  . Compaq Tru64 4.0E OK.
  5877.  . HP-UX 8.00 non-ANSI OK.
  5878.  . HP-UX 8.00 ANSI (ran out of memory after 4+ hours)
  5879.  . HP-UX 9.05 still OK.
  5880.  . HP-UX 10.20 ANSI OK.
  5881.  . HP-UX 10.20 non-ANSI OK.
  5882.  . DG-UX 5.4R4.11 OK.
  5883.  . SCO OSR5.0.5 OK.
  5884.  . FreeBSD 2.2.8 OK.
  5885.  . FreeBSD 3.3 OK.
  5886.  . Linux Red Hat 6.1 OK.
  5887.  . Solaris 2.5.1 gcc OK.
  5888.  . Solaris 2.5.1 Sun cc OK.
  5889.  . Solaris 7 gcc OK (with some .h redefinition warnings: int8_t, int16_t, ...)
  5890.  . Solaris 7 Sun cc OK.
  5891.  
  5892. The QNX 4.24 build blew up big-time.  More BSDSELECT fallout.  In QNX, fd_set
  5893. is defined in select.h rather than types.h.  Adding the appropriate #include
  5894. made it compile and link OK, but at runtime it dumped core in the first
  5895. ftpcmd() call; I couldn't find any good reason for this.  Tried building it on
  5896. QNX 4.24.  Here it compiled OK, but the link step crashed with SIGSEGV, "make
  5897. error 139" (no clue what 139 is, but it's not an errno, and the online 'make'
  5898. and 'ld' manuals do not list error codes).  Nevertheless, the executable was
  5899. there and could be started.  The debug log shows that the very act of calling
  5900. secure_command() is what makes it crash.  secure_command itself never even
  5901. starts.  I can't imagine any reason for this.  I tried changing the name of
  5902. the routine and its args in case any of them were reserved words, but no
  5903. change.  Then, noticing that secure_command() (now renamed to scommand()) has
  5904. a lot of automatic arrays that are quite big.  So I #ifdef'd out the contents
  5905. of this routine and made a short simple one with no automatic arrays (and no
  5906. security) for QNX.  Now we can call the routine, and it builds and sends the
  5907. FTP command and even returns, but (a) getreply() says it gets 421 (EOF), and
  5908. (b) we never get another prompt back.  Then I tried making a Telnet connection
  5909. -- hmmm, that hung too.  OK, let's back up and see where we went wrong.
  5910. Rebuilt with -DNOFTP, still can't Telnet.  Well, there's no reason Telnet
  5911. should have stopped working; of course it worked in C-Kermit 7.0.  But QNX is
  5912. very different from other UNIXes -- the makefile entry (written by Dan
  5913. Hildebrand before he died) has some cryptic compilation and link options that
  5914. I don't understand that probably have to do with memory model, segments,
  5915. pages, etc, so maybe it's a size thing.  Tried building with -DNOFTP and
  5916. -DNOCSETS to remove two of the largest modules.  No difference.
  5917.  
  5918. OK, the SIGSEGV and "Error 139" were red herrings.  It turns out the makefile
  5919. entry not only compiles and links Kermit, but also tries to install some kind
  5920. of "use message" using a utility called "usemsg" and that's what was crashing.
  5921. Removed that from the makefile and no more scary messages.  But it doesn't
  5922. help at runtime.  "set telnet debug on" shows all the negotiations are fine;
  5923. the hangup occurs only after entering CONNECT mode, indicating that select()
  5924. never returns.  But select() worked in 7.0?  What's the difference?  Who
  5925. knows, it could be anything -- the many changes in ckc{tel,net}.[ch], some
  5926. module or routine whose size grew beyond some limit...
  5927.  
  5928. After finding Watcom C docs, discovered that the -ms option in the qnx32
  5929. target means "small model" (64K).  Changed this to -mf ("flat" 4GB) and
  5930. removed QNX hacks from ckcftp.  Now:
  5931.  
  5932.  . FTP still dumps core with SIGSEGV when ftpcmd() calls scommand().
  5933.    There is nothing illegal or strange about this simple call; it works
  5934.    on all the other platforms.  So -ms/-mf had nothing to do with this.
  5935.  
  5936.  . When Telnet first calls select(), the result is -1 with errno = EBADF.
  5937.    This seems to indicate that the FD_SET() setup is wrong.  But this code
  5938.    hasn't changed since 7.0 (** not true, keep reading **), which works fine.
  5939.    Again, -ms/-mf irrelevant. 
  5940.  
  5941.  . Autotelnet?  Maybe scripts work if we don't enter CONNECT mode.  But
  5942.    in trying this I discovered that the TYPE command also seg-faults.  So
  5943.    do DATE, SEND, IKSD, ...
  5944.  
  5945. OK so what else do we find in the CFLAGS?  "-3r" means use register-based
  5946. argument passing.  Changed this to "-3s" (stack-based) and FTP and TYPE
  5947. commands still crash in the same way, but now so does TELNET.  Various other
  5948. options (-r, -sg, -zt) made no difference either.  Finally I went to QSSL
  5949. for help and was told about the undocumented -N linker flag, which fixed
  5950. everything except the hanging Telnet.  Put the other options back the way
  5951. they were (turns out -ms only means 64K in the 16-bit world; in the 32-bit
  5952. world it means: separate code and data segments each with a max size of
  5953. 4GB).  makefile, 1 Dec 2000.
  5954.  
  5955. So why doesn't TELNET work?  Comparison of ckucns.c from 7.0 and the current
  5956. one shows that the 1st (width) arg to select() was increased from 16 to 256
  5957. (why?); putting it back to 16 fixes the problem (I did this in #ifdef QNX but
  5958. I wouldn't be surprised if something like this crops up elsewhere).  ckucns.c,
  5959. 1 Dec 2000.
  5960.  
  5961. When adding learned scripts, I used addcmd() (which adds interactive commands
  5962. to the recall buffer) to record commands.  But this had certain problems; for
  5963. example, some commands would be skipped in the learned script.  That was
  5964. because addcmd() didn't record a command if it was the same as the previous
  5965. one.  Anyway, I juggled things a bit to make this work, but evidently broke
  5966. command recall.  Fixing it required some pretty deep thought (like I should
  5967. have done to begin with).  The calls to addcmd() have always been at the wrong
  5968. level.  There really should be just one call: in gtword(), when the user types
  5969. CR.  So I removed all the old calls and put the one call there.  This works
  5970. fine except for one thing: cmfdb() can cycle through the same command several
  5971. times, each time using gtword(), and therefore addcmd() can be called multiple
  5972. times per command.  A good example is DIRECTORY.  This was circumvented easily
  5973. by Yet Another Global Flag (but static to the command module): newcmd is set
  5974. to 1 by cmini() and tested by addcmd().  If it is 0, addcmd() just returns; if
  5975. newcmd is nonzero, the command is added and newcmd is set to 0 so it won't be
  5976. added next time.  ckucmd.c, 1 Dec 2000.
  5977.  
  5978. The large width arg to select() was for Forward-X.  Redid the select() call
  5979. using FD_SETSIZE, whose definition is taken from the header files, and if not
  5980. found there is defined to 256 if CK_FORWARD_X is defined, otherwise to 32.
  5981. ckucns.c, 2 Dec 2000.
  5982.  
  5983. Gave SET TERM IDLE-SEND its own #ifdef feature symbol, CKTIDLE, and defined
  5984. it by default for OS2 and for UNIX unless NOLEARN was defined (NOLEARN pretty
  5985. much corresponds to the UNIX targets that use ckucon.c instead of ckucns.c,
  5986. and is set in all the appropriate makefile targets).  ckcdeb.h, ckuus7.c,
  5987. 2 Dec 2000.
  5988.  
  5989. Changed SET TERM IDLE-SEND parsing to not be OS2-specific.  ckuusr.h,
  5990. ckuus7.c, 2 Dec 2000.
  5991.  
  5992. Enabled select()-based SET TERM IDLE-SEND in UNIX select() builds, including
  5993. (because why not) allowance for a negative timeout value to indicate
  5994. milliseconds.  ckucns.c, 2 Dec 2000.
  5995.  
  5996. Added SET TERM IDLE-SEND to SHOW TERM and HELP SET TERM.  Also added SET
  5997. TERM TRIGGER to these, which had been omitted outside K95 in 7.0.
  5998. ckuus[27].c, 2 Dec 2000.
  5999.  
  6000. Updated NEWS text.  ckuus2.c, 3 Dec 2000.
  6001.  
  6002. The select() call in ckucns.c needed special treatment for HP-UX 9.xx and
  6003. earlier, where the interior args must be (int *) rather than (fd_set *).
  6004. ckucns.c, 4 Dec 2000.
  6005.  
  6006. The tn_comport code is a major pain with its long identifiers, some of them
  6007. about 40 characters long, and some of them not unique within the first 30.  31
  6008. is the max in VAX C and I'm sure others have smaller maximums.  It's silly to
  6009. disable a feature that would work otherwise just because the identifiers are
  6010. too long.  To fix, I wrote a very dumb shell script that uses sed to shorten
  6011. the names of 58 overlong identifiers and ran it on ckctel.[ch], ckutio.c, and
  6012. ckuus4.c, which are the only UNIX modules where these identifiers appear and
  6013. rebuilt the result.  (You have to run it 2 or 3 times on some modules because
  6014. it only makes one replacement per line.)  4 Dec 2000.
  6015.  
  6016. Added Telnet Com Port Option to VMS.  ckvtio.c, 4 Dec 2000.
  6017.  
  6018. Correction from Jeff for Kermit protocol timer initialization.
  6019. ckcfns.c, 5 Dec 2000.
  6020.  
  6021. Removed a spurious second inclusion of <time.h> from ckcftp.c.  5 Dec 2000.
  6022.  
  6023. More #ifdef twiddling for building on many platforms, mostly to do with
  6024. <time.h> and structs timeval and tm.  ckucns.c, ckcftp.c, makefile, 6 Dec 2000.
  6025.  
  6026. Build problems:
  6027.  . VMS 7.2 + TGV 4.2A on Dopey: conflicts in VMS and TGV header files
  6028.    for functions we aren't even using prevent successful build.  Ditto MVB.
  6029.  . SCO OSR5 - DNS_SRV, SOCKOPT_T: ckcnet, ckcftp (just warnings, net only).
  6030.    The warnings make no sense, since SOCKOPT_T is int for SCO, and arg 5
  6031.    is int in sys/socket.h.  Same deal for getsockname(), accept()
  6032.  
  6033. Various touch-ups from Jeff, plus addition of \v(secure).  ckuusr.[ch],
  6034. ckuus[347].c, ckcfn2.c, ckctel.[ch], ck_ssl.c, 7 Dec 2000.
  6035.  
  6036. From Mark Berryman, a fix for a problem introduced in combinations of recent
  6037. DECC / MultiNet combinations, in which both declare select() in their header
  6038. files, but with conflicting data types.  ckuusr.c, ckvcon.c, 7 Dec 2000.
  6039.  
  6040. sco32v4net won't build no-how no-way; all the CONST/const garbage in ckclib
  6041. (e.g. ckmakmsg) blows it up: "lvalue specifies const object",
  6042. "lvalue specifies const object", etc.  Adding -DNOANSI and/or -U__STDC__
  6043. doesn't change anything.
  6044.  
  6045. ---7.1.199 Alpha.01---
  6046.  
  6047. brstrip() (strip braces or doublequotes from around string) didn't work
  6048. for empty {} or "".  ckclib.c, 11 Dec 2000.
  6049.  
  6050. Added -DHWPARITY for SunOS 4.1; verified to work by Piet Vloet at Siemens.
  6051. makefile, 11 Dec 2000.
  6052.  
  6053. There has never been a way to make C-Kermit not send I packets when given a
  6054. GET, FIN, REMOTE, or BYE command.  Now there is: SET SEND I-PACKETS OFF.
  6055. Needed because some Kermit server implementations can't handle I-packets.
  6056. (Theoretically this was handled already: C-Kermit ignored an E packet if it
  6057. came in response to an I packet; but it seems some Kermit servers are so buggy
  6058. they send a NAK rather than than E if they get an I packet, so the only
  6059. recourse is not to send the I packet.)  ckuus7.c, ckcfns.c, ckcmai.c,
  6060. 12 Dec 2000.
  6061.  
  6062. Peter E has a program that generates Kermit scripts that contain constructs
  6063. like this:
  6064.  
  6065.   xif condition {,-
  6066.     ,-
  6067.     command,-
  6068.   }
  6069.  
  6070. In such constructions, the command is never executed (this only happens when
  6071. ",-" is used).  Diagnosis: the isolated ",-" confused the brace counter; it
  6072. backed up too far and recounted the opening brace, and therefore never found
  6073. an end to the braced sequence.  Fixed in getnct(): ckuus5.c, 13 Dec 2000.
  6074.  
  6075. Noticed that FTP remote_files() ignored its first argument, the one that says
  6076. whether to build a new list or just return the next item from the current one.
  6077. Instead it always built the list if there was no list, and then returned the
  6078. next item from it.  Wouldn't this mess up if we interrupted a GET and started
  6079. a new one?  Yes.  Not only that, but the second GET resulted in a steady
  6080. stream of "socket: Too many open files".  Fixed in remote_files(): ckcftp.c,
  6081. 15 Dec 2000.
  6082.  
  6083. Added FTP CHECK remote-filespec.  Client does NLST for given filespec, and
  6084. succeeds if any files match, fails if none do.  This lets the client check
  6085. if a server file (or file group) exists.  ckcftp.c, 15 Dec 2000.
  6086.  
  6087. Added FTP [M]GET /NAMELIST:[filename].  This is just like [M]GET, except
  6088. instead of getting the files themselves, it gets a list of their names into
  6089. the given file.  All the other GET switches are honored, so this is the list
  6090. of files that matches the GET filespec and all the other selection criteria.
  6091. The file is suitable for processing by the filter or software of your choice,
  6092. as well as by Kermit itself (fopen/fread/fwrite/fclose), and as /FILELIST:
  6093. file.  If the filename is omitted (or given as "-"), the list goes to the
  6094. screen.   ckcftp.c, 17 Dec 2000.
  6095.  
  6096. FTP PUT /AS-NAME:\v(filename).tmp * didn't work, due to some typos, fixed
  6097. now.  ckcftp.c, 18 Dec 2000.
  6098.  
  6099. Discovered that PUT's asname buffer (asnambuf[]) was not cleared between PUTs,
  6100. so the as-name was persistent.  Fixed in ckcftp.c, 18 Dec 2000.
  6101.  
  6102. Added [M]PUT /SERVER-RENAME:.  This was the final missing piece of "atomic"
  6103. file movement when uploading to the FTP server.  Normally to be used with
  6104. \v(filename).  Requires write and rename access on the server, so doesn't
  6105. usually work (e.g.) with anonymous uploads to public incoming areas, where
  6106. the permissions don't allow renaming.  Example:
  6107.  
  6108.   ftp mput /server-rename:\v(filename).ok *
  6109.  
  6110. to append ".ok" to the filename when it's finished uploading.
  6111.  
  6112. Or it can be used in conjunction with /AS-NAME to give a temporary name
  6113. while uploading is in progress and revert to its real name when uploading
  6114. is complete:
  6115.  
  6116.   ftp mput /as-name:\v(filename).tmp /server-rename:\v(filename) *
  6117.  
  6118. It can also be used to move the file from the working directory to a final
  6119. directory when upload is done:
  6120.  
  6121.   ftp mput /as-name:\v(filename) /server-rename:../final/\v(filename) *
  6122.  
  6123. but in this case you have to know the pathname syntax of the server.  If the
  6124. rename fails, the [M]PUT command fails according to the ERROR-ACTION
  6125. selection.  There is no explicit /SERVER-MOVE-TO: switch because it would only
  6126. do the same thing as /SERVER-RENAME (i.e. send RNFR and RNTO), but require
  6127. risky code to construct the full pathname, which would require Kermit (rather
  6128. than the user) to know the pathname syntax on the server, which is a protocol
  6129. no-no.  ckuusr.h, ckcftp.c, 18 Dec 2000.
  6130.  
  6131. Added [M]GET /SERVER-RENAME:, same deal as [M]PUT /SERVER-RENAME:.
  6132. ckcftp.c, 18 Dec 2000.
  6133.  
  6134. Discovered that TOPS-20 gives only a filename list if you send LIST:
  6135.  
  6136.   C-Kermit>ftp dir
  6137.   Directory of files at cu20b.arpa:
  6138.   227 Entering Passive mode, use PORT 192,94,202,40,13,20
  6139.   150 List started.
  6140.   PS:<FDC>
  6141.   CKERMIT.DIRECTORY.1
  6142.   CKERMIT2.TXT.1
  6143.   GNUEMACS.INIT.1
  6144.   KERMIT.DIRECTORY.1
  6145.   LOGIN.CMD.1
  6146.   226 Transfer completed.
  6147.  
  6148. If you want a full listing with dates, permissions, etc, you have to send NLST
  6149. and then send STAT for each filename that is returned, and then read and print
  6150. each response on the control socket (not the data socket).  Added
  6151. FTP VDIRECTORY (which is a familiar TOPS-20 command) for this:
  6152.  
  6153.   C-Kermit>ftp vdirectory *.*
  6154.   Directory of files *.* at cu20b.arpa:
  6155.   PS:<FDC>CKERMIT.DIRECTORY.1;P20200;A,0,15-Jan-1999 13:41:26-EST,
  6156.   15-Jan-1999 13:41:27-EST,14-Sep-1999 17:49:06-PDT,FDC,FDC
  6157.   PS:<FDC>CKERMIT2.TXT.1;P775200;A,166,15-Jan-1999 13:43:17-EST,15-Jan-1999
  6158.   13:43:17-EST,15-Jan-1999 14:35:06-EST,FDC,FDC
  6159.   PS:<FDC>GNUEMACS.INIT.1;P775200;A,8,25-Jan-1997 10:46:54-EST,25-Jan-1997
  6160.   10:46:54-EST,25-Jan-1997 10:49:34-EST,FDC,FDC
  6161.   PS:<FDC>KERMIT.DIRECTORY.1;P20200;A,0,25-Jan-1997 10:45:59-EST,25-Jan-1997
  6162.   10:45:59-EST,14-Sep-1999 17:49:07-PDT,FDC,FDC
  6163.   PS:<FDC>LOGIN.CMD.1;P775200;A,1,25-Jan-1997 10:43:05-EST,25-Jan-1997
  6164.   10:43:05-EST, 8-Sep-2000 16:15:37-PDT,FDC,FDC
  6165.  
  6166. ckcftp.c, 19 Dec 2000.
  6167.  
  6168. We need a way to specify whether the rename in GET /RENAME should overwrite
  6169. existing files and/or if it should check first and fail immediately if the
  6170. rename target already exists.  GET /RENAME: /NOSUPERSEDE?  But /NOSUPERSEDE is
  6171. confusing (which end?) and makes no sense without /RENAME:, so really we need
  6172. a single switch that means "get and then rename the source but only if the
  6173. rename target doesn't already exist", so /SERVER-XRENAME: or something, yuk.
  6174. This would work by checking the rename target before downloading (if it's
  6175. there fail), and again after downloading (just before the renaming).  But how
  6176. do we know if it failed to download at all, or downloaded but failed to
  6177. rename?  There's no good way, we fail the same way in both cases.  Usually it
  6178. will be because the file was already there before we started the GET.  OK, so
  6179. GET /SERVER-XRENAME:.  But oops, to do this we have call remote_files(), which
  6180. will clobber the current file list.  Which means we'd need to push and pop
  6181. lists, with all the associated bookkeeping and file opening/closing.  Is it
  6182. worth it?  I don't think so.  Anybody who is concerned with this level of
  6183. safety is going to want detailed per-file control at the script level and so
  6184. wouldn't use GET /SERVER-XRENAME for a wildcard group anyway.  So for
  6185. Alpha.02, we just need to document how to get the file list and loop through
  6186. it, embedding the current 'upload' script in a loop.
  6187.  
  6188. Added TYPE TENEX (and {GET/PUT} /TENEX) to the FTP client -- no big deal.
  6189. It's the same as binary except we send TYPE L 8 instead of TYPE I; all the
  6190. packing/unpacking work is done on the other end.  The hard part isn't coding
  6191. it, it's explaining it: TYPE TENEX is to be used for uploading 8-bit binaries
  6192. to 36-bit platforms and downloading them again.  It is NOT for downloading
  6193. 36-bit binaries to 8-bit platforms and uploading them again: TYPE BINARY must
  6194. be used for that.  ckcftp.c, ckuus[5x].c, 20 Dec 2000 (DEC-20 day).
  6195.  
  6196. Actually there was one tricky part.  Suppose the user gives a PUT command
  6197. without a /BINARY, /TEXT, or /TENEX switch.  In this case putfile() does a
  6198. file scan, and then sets ftp_typ accordingly.  But if the prevailing type (FTP
  6199. TYPE) is TENEX, this would undo it since TENEX is not a file type, but really
  6200. a transfer mode; scanfile() knows (and should know) nothing about it.  So now
  6201. there has to be a global tenex flag that is set to 0 or 1 whenever the user
  6202. gives an FTP [SET] TYPE TENEX command.  If it's 1, and scanfile() says a file
  6203. is binary, we set the type to TENEX rather than BINARY.  In working through
  6204. this I also found and fixed a bug with file scanning in FTP, namely that it
  6205. could alter the global TYPE setting.  ckcftp.c, 20 Dec 2000.
  6206.  
  6207. Changed how global versus local (per-command) FTP TYPE is managed.  It was
  6208. too confusing before.  Now we set it whenever an FTP TYPE or SET FTP TYPE
  6209. command is given, and never reset it.  The top-level FTP command entry point
  6210. restores the global mode every time.  Now we can fool with ftp_typ and
  6211. changetype() all we want and not have to worry about saving and restoring it
  6212. in 100 places.  ckcftp.c, 21 Dec 2000.
  6213.  
  6214. How to do automatic text/binary switching when downloading in FTP?  The server
  6215. can't do it, but we have the file list in advance so we can use filename
  6216. patterns.  Of course these were originally designed to apply to the local
  6217. filesystem but at least this way the user has some control (by adjusting the
  6218. name-pattern list).  Added SET FTP GET-FILETYPE-SWITCHING { ON, OFF }.
  6219. Implementation is simple: for each filename, call matchname() and then
  6220. changetype() accordingly.  ckcftp.c, 21 Dec 2000.
  6221.  
  6222. Don't set dpyactive if file display is BRIEF.  This way we can see FTP
  6223. protocol messages during file transfer without turning the display completely
  6224. off.  ckcftp.c, 21 Dec 2000.
  6225.  
  6226. Removed hack installed last May because Latin-1 and CP1252 shared the same
  6227. index, since now they don't any more.  ckuusr.c, 23 Dec 2000.
  6228.  
  6229. Changed CONST definition to nothing for SCO 3.2V4.x.  ckcdeb.h, 23 Dec 2000.
  6230.  
  6231. Added experimental code allowing Kermit to accept a URL as its first
  6232. command-line argument, just as it now can accept a filename there.  If a URL
  6233. was detected after cmdlin() has executed, dourl() (in ckcmai.c) is called,
  6234. which presently handles telnet, ftp, and iksd URLs.  FTP and Telnet are
  6235. handled by switching immediately into the appropriate alter-ego command-line
  6236. personality; only a few lines of code needed.  The IKSD URL does what the
  6237. "iksget" script does: it logs you in and gets the given file (if a path
  6238. component was included in the URL; if no path component was included it puts
  6239. you in CONNECT mode).  It writes the iksget script into a malloc'd buffer
  6240. which it tricks the subsequent code into believing is the "-C" command-line
  6241. argument.  It works fine for anonymous or real-user logins, in the latter case
  6242. prompting for password if one was not included in the URL, etc.  It probably
  6243. needs a bit more work to account for other authentication methods; I'm not
  6244. sure what variables to check to tell whether the user is already logged in.
  6245. It won't log in or get files in NOSPL builds, not that anyone will notice.
  6246. ckcmai.c, ckuus[4y].c, 23 Dec 2000.
  6247.  
  6248. Why does \fword({Now , Is, ,the,,time},\%1,{,}) not recognize the two adjacent
  6249. commas after "the" as an empty word?  Because adjacent separators are
  6250. collapsed (which is what is normally desired, e.g. when spaces are
  6251. separators).  Changing this would be dangerous.  But not if we add Yet Another
  6252. Argument to cksplit() that says whether to collapse adjacent separators, and
  6253. add the same argument to \fword() and \fsplit(), and leave the default action
  6254. (when the new argument is omitted) to collapse separators, as now.  This is a
  6255. rather important capability; otherwise we wouldn't be able to parse (e.g.)
  6256. comma-separated lists that were output by database export procedures.
  6257. ckclib.[ch], ckuus[r234].c, ckcpty.c, 24 Dec 2000.
  6258.  
  6259. Added Kermit stuff (cmdmsk, parity, etc) to "telnet -8" semantics.
  6260. ckuusy.c, 24 Dec 2000.
  6261.  
  6262. Fix from Jeff to distinguish command-line URLs from DOS filenames.
  6263. ckuus4.c, 27 Dec 2000.
  6264.  
  6265. The routine to convert an old-style (pre-CK-6.0) dialing directory to the new
  6266. format apparently had never been tested in VMS, at least not on an Alpha,
  6267. where it crashed the program.  It worked by accident on the VAX, hard to
  6268. explain.  Fixed in ddcvt(): ckuus6.c, 27 Dec 2000.
  6269.  
  6270. Fixed HELP SET FILE to also mention SET/SHOW TRANSFER/PROTOCOL.  ckuus2.c,
  6271. 27 Dec 2000.
  6272.  
  6273. Discovered that mlook() would dump core if called with a constant string,
  6274. since it lowercased its keyword arg in place.  Fixed it to make a copy, in
  6275. such a way as not to hurt performance -- in fact, it should help a bit.  Ditto
  6276. for mxlook().  ckuus5.c, 27 Dec 2000.
  6277.  
  6278. Fixed SHO MAC X to say "ambiguous" rather than "not defined" if X is
  6279. ambiguous.  ckuus5.c, 27 Dec 2000.
  6280.  
  6281. Fixed SHOW COMMAND to include the ON_UNKNOWN_COMMAND definition.  ckuus5.c,
  6282. 27 Dec 2000.
  6283.  
  6284. The FTP client did not do anything about character sets in filenames.  This
  6285. turns out to be an issue (surprise).  People are complaining in the newsgroups
  6286. that no FTP client lets them get their (e.g.) German-named files from (e.g.)
  6287. Windows to Unix, using a Unix FTP client and a Windows server.  The obvious
  6288. gotcha is that we can't use UCS-2, period.  While this might be OK in file
  6289. data, it's absolutely not OK in filenames because of the C library and system
  6290. call APIs.  Therefore if the user says the file or server charset is UCS2, we
  6291. can translate the data but not the filename.  (Otherwise, we assume that the
  6292. file contents and file name use the same character set.)
  6293.  
  6294. But first... FTP directory listings don't seem get translated, even with:
  6295.  
  6296.  ftp character-set-translation: on
  6297.  ftp server-character-set:      latin1-iso
  6298.  file character-set:            cp437
  6299.  
  6300. Why not?  Because the charset args to recvrequest() in doftpdir() were all 0.
  6301. Fixed in ckcftp.c, 28 Dec 2000.
  6302.  
  6303. Next, SET FTP CHARACTER-SET-TRANSLATION is OFF even after you SET FTP
  6304. SERVER-CHARACTER-SET to something, which is kind of disconcerting.  So I
  6305. changed SET FTP SERVER-CHARACTER-SET to also enable translation; why else
  6306. why else would anybody bother with it?  ckcftp.c, 28 Dec 2000.
  6307.  
  6308. Changed all calls to recvrequest() to provide the appropriate charset
  6309. arguments.  This means that whenever we ask the server to send anything back
  6310. to us on the data channel, it gets translated.  ckcftp.c, 28 Dec 2000.
  6311.  
  6312. Is this right?  For example, NLST tells the server to send us a list of
  6313. filenames so we can send them back one by one in GET requests.  This list is
  6314. already in its own character set, so why translate it?  Answer: because we
  6315. also need to display each filename on our local screen, and to use it when
  6316. creating the local file.  So when we send each filename back to the server in
  6317. our GET requests, we must translate it back.  And that means our translations
  6318. better be invertible.  But they are, since FTP uses only Unicode as an
  6319. intermediate character set.
  6320.  
  6321. Next: Translate filenames in RETR commands.  This is done in recvrequest().
  6322. The filename is the 'remote' parameter.  To do this requires setting up an
  6323. input helper-function for xgnbyte() and an output function for xpnbyte():
  6324. strgetc() and strputc().  strgetc() has to be extra careful about sign
  6325. extension.  ckcftp.c, 28 Dec 2000.
  6326.  
  6327. First test:
  6328.  
  6329.   get /text /server-char:latin1 /local-char:cp850 Grⁿ▀e.txt
  6330.  
  6331. This turns out to be a bit more tricky than expected.  First we have to
  6332. translate the filename in the [M]GET command from local to remote for the NLST
  6333. command.  The NLST results come back in the remote charset, and we translate
  6334. them to the local one.  The MGET loop gets the next filename from this list
  6335. and calls getfile() with it, which in turn calls recvrequest().  recvrequest()
  6336. must convert the remote filename back to the remote charset for the RETR
  6337. command, and then immediately switch its translation around, so the incoming
  6338. data is translated from the remote to the local charset.  This works, but lots
  6339. of details need ironing out: the name shown in the file-transfer display (plus
  6340. the fact that curses goes bonkers when asked to display an 8-bit character),
  6341. plus the name also needs to be translated in the SIZE, MDTM, and other
  6342. commands.  The latter seems to imply that ftpcmd() itself is a better place to
  6343. put the translation since we also have to do it for CWD, MKD, RMD, etc etc,
  6344. but ftpcmd() is not designed for this.  ckcftp.c, 28 Dec 2000.
  6345.  
  6346. The change I made to mlook() two days ago inexplicably broke lots of things:
  6347. IF, FOR, etc.  It seems that the upper level code actually DEPENDS on mlook()
  6348. lowercasing its argument.  For now I just put the code back as it was and
  6349. adjusted SHOW COMMAND not to call mlook() with an uppercase constant string.
  6350. Figuring out what's really going on will take a quiet day, if I ever have one.
  6351. ckuus5.c, 29 Dec 2000.
  6352.  
  6353. Changed ftpcmd() to take 4 args instead of one: the command, the argument
  6354. string, and the two charset indices.  The first argument (the FTP protocol
  6355. command, such as STOR or LIST) is not translated.  The second arg, if not NULL
  6356. or empty and if both charset indices are greater than -1, is translated from
  6357. the local charset to the remote one.  Changed all ftpcmd() calls (over 80 of
  6358. them) to the new format, and got rid of almost an equal number of preparatory
  6359. ckmakmsg() calls, and removed some special-case code I had installed a couple
  6360. days ago.  The new scheme makes the code much simpler, cleaner, and more
  6361. comprehensible and maintainable.  In brief testing, it seemed to work, but
  6362. needs a LOT more testing, since every single client/server interaction is
  6363. affected.  ckcftp.c, 30 Dec 2000.
  6364.  
  6365. Having char * s and * p as "global variables for disciplined use" turned out
  6366. to be too dangerous, got rid of them.  ckcftp.c, 30 Dec 2000.
  6367.  
  6368. Note to myself: bash on the Columbia systems interferes with 8-bit characters
  6369. no matter what your stty settings are.  For any testing involving typing of
  6370. 8-bit text at the shell prompt or Kermit prompt, use ksh (and then "stty
  6371. pass8").  I don't know what bash does, but whatever it is, it's so powerful
  6372. that it prevents Kermit itself from undoing it with it all its ioctls.  Also
  6373. note that "ls" on SunOS doesn't show 8-bit names in files unless you pipe it
  6374. through another program like cat or more.
  6375.  
  6376. Now...  to set up a testing environment for FTP, I open two windows into the
  6377. Sun from K95.  In both windows, I run ksh and stty pass8.  In one window I use
  6378. Latin-1 as the terminal character set and in the other, DG International.
  6379.  
  6380. In the Latin-1 window, I have a text file with a Latin-1 name containing
  6381. Latin-1 characters.  I "set file char latin1, set ftp server-char dg" and PUT
  6382. the file.  The file arrives with its name and contents translated to DGI.
  6383. Then I GET the same file, by name (typing the umlauts, etc, at the Kermit
  6384. prompt).  It returns successfully with the proper name, its contents
  6385. translated back to Latin-1, except for a few points, indicating the
  6386. DG->Unicode->Latin1 and Latin1->Unicode->DG translations are not 100%
  6387. invertible:
  6388.  
  6389.  . Broken bar
  6390.  . Soft hyphen
  6391.  . Macron
  6392.  . Superscript 1
  6393.  . fractions 1/4 and 3/4
  6394.  . Thorns and Eths
  6395.  . Division sign
  6396.  . y-acute
  6397.  
  6398. But this is as it should be, since DGI does not have these characters.  The
  6399. BRIEF-format file-transfer display shows the filename in the local character
  6400. set, and it also appears that way in the transaction log.  (In the curses
  6401. display, however, 8-bit characters appear with the 8th bit truncated, but
  6402. highlighted, so "Gr<u-umlaut><ss>e" appears as bold "Gr|_e"; there's not much
  6403. Kermit can do about that.  It will no doubt be different with more modern
  6404. termcap/terminfo/curses/ncurses implementations.)
  6405.  
  6406. The first test "pushed" a Latin-1 file to the DG side and "pulled" it back
  6407. again.  A second test pulled a DGI file from the DG side and pushed it back.
  6408. This worked fine too, but this time of course the characters that were lost in
  6409. the text were those which DGI has but Latin-1 lacks: various daggers,
  6410. less/greater-equal signs, Florin, arrows, OE digraph, etc.
  6411.  
  6412. The third test added binary files that had 8-bit names.  For this, some small
  6413. fixes were necessary, most of them due to the fact that we turned translation
  6414. off when TYPE was not ASCII.  After this, we can "mput *" where * matches a
  6415. mixture of text and binary files, and each file is sent in the appropriate
  6416. mode automatically, and each file's name is translated, regardless of mode.
  6417. ckcftp.c, 31 Dec 2000.
  6418.  
  6419. However, a command such as "mget Gr<u-umlaut><ss>e.*" doesn't work.  Kermit
  6420. translates the name correctly (as shown in the debug log), but the server
  6421. (wu-ftpd) says no files match.  However, "mget G*.*" works fine -- the files
  6422. come, their names are translated, and name-based text/binary mode switching
  6423. works fine.  This must be a bug in wu-ftpd, since "get Gr<u-umlaut><ss>e.txt"
  6424. works; evidently the combination of 8-bit characters and wildcards is fatal.
  6425. Tried the same thing to the VMS UCX 2.0 FTP server: "File specification syntax
  6426. error".  Enclosing in quotes only changes the message to "Error in filename".
  6427. Evidently this one simply can't deal with 8-bit names.  But the same test
  6428. works fine with NcFTPd, which I found on an IRIX system.  So Kermit is OK.
  6429.  
  6430. Changed cmdmsk (SET COMMAND BYTESIZE) to be 255 rather than 127 by default.
  6431. After all, tomorrow is 2001...  ckucmd.c, 31 Dec 2000.
  6432.  
  6433. Problem: getreply() does not translate FTP server reply messages.  This means
  6434. that "Gr<8-bit-chars>*.txt not found" won't be translated back into the local
  6435. charset for display, and also that FTP VDIR doesn't translate.  But getreply()
  6436. is pretty horrendous...  But oops, this also affects PWD, plus replies to
  6437. MKDIR, RMDIR, etc.  Guess I'd better fix it... (tomorrow).
  6438.  
  6439. Meanwhile, I tested charset translation with directory names: MKDIR, CD, PWD,
  6440. DIRECTORY, DELETE, and RMDIR.  All OK except for non-translation of replies.
  6441.  
  6442. Updated copyrights to 2001: ck[cuw]*.[cwh], makefile, COPYING.TXT, 1 Jan 2001.
  6443.  
  6444. Back to getreply()...  First we add charset index args to the function itself,
  6445. its prototype, and all invocations.  Next we find the spots in getreply()
  6446. where the server response is output.  As far as I can tell, these are the
  6447. two instances of printf("%c",c).  When translation is active, a new routine,
  6448. xlatec(), is called instead of printf().  The new routine must be mindful of
  6449. the possibility the input and output sizes can be different; thus an input
  6450. byte might be just part of a character (e.g. one octet of a UTF-8 sequence),
  6451. and ditto for the output, in any combination.  So xlatec() has to maintain an
  6452. internal catch-up buffer and act somewhat asynchronously. ckcftp.c, 1 Jan 2001.
  6453.  
  6454. Fixed several FTP glitches:
  6455.  
  6456.  . RPWD translation didn't work.
  6457.  . FTP VDIR did't translate
  6458.  . RDEL overprinted <filename> with "...OK".
  6459.  
  6460. The new code seems quite solid.  I ran through all the previous tests with
  6461. no problems, and then I did them again with UTF8 on the far end.  ckcftp.c,
  6462. 1 Jan 2001.
  6463.  
  6464. cmdate() parsing of TODAY, YESTERDAY, and TOMORROW has been broken since the
  6465. strncpy() -> ckstrncpy() rampage of last June.  Fixed by reverting the
  6466. ckstrncpy()'s in these sections back to strncpy()'s.  Remember: in ckstrncpy(),
  6467. the number refers to the size of the buffer -- the whole source string is
  6468. copied up to the given size.  In strncpy(), the number refers to the size of
  6469. the source string, not the buffer.  ckucmd.c, 2 Jan 2001.
  6470.  
  6471. Added SET FTP DATES { ON, OFF }, and accounted for it in SHOW FTP and
  6472. HELP SET FTP.  ckcftp.c, 2 Jan 2001.
  6473.  
  6474. Changed chkmodtime() to have a third argument, fc (function code), and changed
  6475. all four invocations of it to include it (0).  0 means compare file times, as
  6476. before; 1 will mean set local file's modtime from the remote.  I still have to
  6477. fill in code to actually perform the new function.  ckcftp.c, 2 Jan 2001.
  6478.  
  6479. Fix from Jeff for TAKE path, plus additional SET MODEM debugging.
  6480. ckuus[r34].c, 3 Jan 2001.
  6481.  
  6482. Added appropriate #ifdefs around dologend() calls in ckucns.c and ckucon.c.
  6483. 3 Jan 2001.
  6484.  
  6485. Finished FTP file-date setting.  FTP DATES is OFF by default, for
  6486. compatibility with existing FTP clients and so as not to mislead, since even
  6487. if we can set dates of incoming files, there is no way to tell the server to
  6488. set the date of a file we send to it, and also because the server might not
  6489. support MDTM.  Two new functions were added.  First mkutime(), which does what
  6490. timegm() does, either by simply calling timegm() itself if HAVE_TIMEGM is
  6491. defined, or by executing the equivalent code supplied by Russ Allbery of
  6492. Stanford (author of INN) if HAVE_TIMEGM is not defined, which it is not by
  6493. default.  As far as I can tell by testing with both a recent file and a
  6494. 15-year-old file, locally and across timezones, Russ's code is equivalent to
  6495. timegm(), at least on SunOS.  The second new function, setmodtime(), simply
  6496. hides all the hideous #ifdefs and differences from the rest of the code; it
  6497. was copied direct out of zstime() in ckufio.c; it could be consolidated if
  6498. necessary, but for the present I'd rather keep the FTP module as
  6499. self-contained as possible.  ckcftp.c, 3 Jan 2001.
  6500.  
  6501. Fixed recent FTP code to be K&R-safe.  ckcftp.c, 4 Jan 2000.
  6502.  
  6503. Added support for SCO OSR5.0.6.  makefile, ckuver.h, ckcnet.c, ckutio.c,
  6504. 4 Jan 2001.
  6505.  
  6506. After nearly completing the build-all I noticed a couple bad problems with
  6507. FTP.  First, commands like RPWD showed their results only if the debug log
  6508. was open.  This was due to excessive cleverness in getreply() for the benefit
  6509. of VDIRECTORY.  Fixed by removing the special case.  ckcftp.c, 5 Jan 2001.
  6510.  
  6511. Second, GET path/file didn't work.  It never did.  Here's why: if you send
  6512. NLST to wu-ftpd, it returns a recursive list.  Therefore, Kermit, when going
  6513. through the NLST file, silently skipped past any file that included a path
  6514. segment if /RECURSIVE was not given.  But this ignored the possibility that
  6515. the user included a path segment in the [M]GET filespec.  Taking this into
  6516. account required a rather major rewrite of the [M]GET code.  The trick is: if
  6517. the user included a path segment in the [M]GET command, we have to check each
  6518. remote filename to see if it starts with the same path segment, and if so,
  6519. strip it before creating the local filename; this must be done whether
  6520. /RECURSIVE was given or not.  In addition, if /RECURSIVE was NOT given, we
  6521. skip any file that still has a path segment after stripping the one the user
  6522. gave, because in that case the server is sending a recursive list when we did
  6523. not ask for one.  NOTE: whether the server returns a recursive list, and
  6524. exactly what it includes, is highly dependent on the format of the user's
  6525. filespec.  Suppose "foo" is the name of a subdirectory of the (UNIX) FTP
  6526. server's current directory.  Then "mget foo", "mget foo/", "mget foo/*",
  6527. "rcd foo, mget *", and "rcd foo, mget ." might each have entirely different
  6528. results.  ckcftp.c, 5 Jan 2001.
  6529.  
  6530. Changed SET FTP DEBUG ON to report the name of the NLST temp file and to not
  6531. delete it.  ckcftp.c, 5 Jan 2001.
  6532.  
  6533. FTP CHMOD was broken in ftpcmd() rewrite; the filename arg was lost (two
  6534. places).  ckcftp.c, 5 Jan 2001.
  6535.  
  6536. After giving an RDELETE command, we stopped printing responses.  Mishandling
  6537. of the 'silent' variable.  ckcftp.c, 5 Jan 2001.
  6538.  
  6539. FTP setmodtime() didn't initialize its stat() struct prior to reference.
  6540. Also, it didn't include the necessary utime() related header files.  ckcftp.c,
  6541. 5 Jan 2001.
  6542.  
  6543. So I repeated the mini-build-all (takes about 3 hours), and then "ftp put
  6544. filename as-name" suddenly started dumping core (and I had been using this
  6545. command all day).  And not because any code changed either.  Turns out the
  6546. problem was in a debug statement, one of whose parameters made a bogus array
  6547. reference: even though debugging was not on, the array reference was still
  6548. resolved, and that's what caused the crash.  It's been like that since Day 1.
  6549. Fixed in doftpput(), ckcftp.c, 5 Jan 2001.
  6550.  
  6551. Another new problem resulting from today's fixes: "get foo bar" gave an error,
  6552. "?As-name for MGET must contain variables such as \v(filename)".  But it's
  6553. GET, not MGET.  Fixed in doftpget(), ckcftp.c, 5 Jan 2001.
  6554.  
  6555. AOS/VS doesn't have [nh]to[hn]l().  Built OK on AOS/VS but it seems to be too
  6556. big to run on the little MV 2500 -- mallocs fail, etc. ckctel.c, 6 Jan 2001.
  6557.  
  6558. If you start Kermit on AOS/VS without its init file, it runs OK and can make
  6559. a Telnet connection, but crashes in scanfile().  Hmmm, there's no #ifdef to
  6560. get rid of scanfile().  So I used #ifdefs to set file scanning off for DG,
  6561. and to remove the SET FILE command that turns it back on.  ckcmai.c,
  6562. ckuus7.c, 6 Jan 2001.
  6563.  
  6564. #ifdefs for SCO XENIX 2.3.4.  The Xenix ftp client works, but only if
  6565. you "set ftp passive off"; otherwise it hangs in the connect() call.
  6566. ckcftp.c, 6 Jan 2001.
  6567.  
  6568. ---7.1.199 Alpha.02---
  6569.  
  6570. Changes from Jeff 4-20 Jan 2001::
  6571.  . ckcmai.c: fix to isabsolute() for recognizing PC disk letters.
  6572.  . ckuusx.c: add tthang() to doclean().
  6573.  . ckudia.c: increase size of modem-message buffer and make length a symbol.
  6574.  . ckcfn3.c: temporarily restore verbose debugging to getrbuf().
  6575.  . ckuus4.c: fix spelling of \Fminimum().
  6576.  . ckcfns.c: fix a repeat-count boundary condition (see CHECK THIS).
  6577.  . ckcnet.c: move some http code.
  6578.  . ckuus3.c: fix dial directory lookup and dial-command-string nullification.
  6579.  . ckcfn2.c: temporary debugging for "receive window full" errors.
  6580.  . ckcftp.c: "testing=0"; URL use GET not MGET; make FTP DEBUG take precedence
  6581.              over FTP QUIET; 
  6582.  
  6583. Changes from me that Jeff never picked up:
  6584.  . ckucns.c: conditionalize dologend() calls.
  6585.  . makefile: all the updates for Alpha.02.
  6586.  
  6587. Jeff switched the cmdlinget() code to do GET rather than MGET because some
  6588. server was not returning proper information when an FTP URL was used.  But
  6589. this code is used not only for FTP URLs, but also for regular command-line
  6590. driven GETs -- it's a new, documented, and very handy feature of the Kermit
  6591. FTP client, and it works fine.  So if there is some problem when doing this
  6592. with URLs, then cmdlinget() should make the distinction at runtime -- if it's
  6593. a URL, do a GET, otherwise do an MGET.  Changed Jeff's change accordingly.
  6594. cmdlinget(): ckcftp.c, 21 Jan 2001.
  6595.  
  6596. I still don't like it though, since FTP URLs with wildcards work fine with
  6597. most servers, and this is a big advantage for Kermit over other FTP URL
  6598. interpreters, especially since Kermit does the automatic text/binary
  6599. switching.  It seems a shame to disable this feature for everybody just
  6600. because one server somewhere misbehaves when we use it.  Actually, now that I
  6601. think about it, the server has no idea whether the client used an FTP URL or
  6602. gave an MGET command interactively -- the result would be the same.  I checked
  6603. this by making an interactive connection to ftp.ssc.com and doing "mget
  6604. pub/lj/listings/issu72/*" and sure enough, it did not work (in response to
  6605. NLST, the server returned basenames, not full or relative pathnames, so each
  6606. RETR command based on the NLST list resulted in "file not found").
  6607.  
  6608. How can we possibly work around this problem?  FTP URLs don't leave any room
  6609. for options.  OK, here's what we do: if the server OS is UNIX, we can check
  6610. the filespec for wildness.  If wild, we do MGET; if not we do GET.  This seems
  6611. to do the trick.  Of course it still doesn't let us MGET files with a pathname
  6612. from the broken server.  cmdlinget(): ckcftp.c, 21 Jan 2001.
  6613.  
  6614. A Receive Window Full error occurred when the client's GET packet was
  6615. answered by a retransmission of the server's ACK to the client's I packet
  6616. (the exact circumstances were pinned down by Jeff).  Fixed in ckcpro.w,
  6617. <get>Y, 22 Jan 2001.
  6618.  
  6619. From Jeff: Enable HTTP and shadow passwords for SCO ORS5.0.6; remove
  6620. temporary debugging for receive window full; ckcdeb.h, ckcfn[23].c, ckcnet.c,
  6621. 4 Feb 2001.
  6622.  
  6623. The USPS reported that the session log came out differently in interactive
  6624. (CONNECT) and scripted (INPUT/OUTPUT) sessions in VMS.  Fixed in ckuusx.c,
  6625. 4 Feb 2001.
  6626.  
  6627. Fixed HELP SET BUFFER text to say "Kermit" instead of "C-Kermit".  Fixed typo
  6628. (s2 instead of s3) in HELP FUNC SUBSTITUTE.  Removed spurious second arg from
  6629. HELP FUNC FPINT text.  ckuus2.c, 4 Feb 2001.
  6630.  
  6631. Made \fmodulus() visible again, since I can't recall why I made it invisible.
  6632. ckuus4.c, 4 Feb 2001.
  6633.  
  6634. If the user says SET PREFIXING <anything> or SET CONTROL PREFIX <anything>,
  6635. then also implicitly set CLEARCHANNEL (clearrq) to OFF; otherwise the user's
  6636. command has no effect at all.  Evidently we had done this before, but then
  6637. backed off.  The trick is to not do it in setprefix(), but rather in the
  6638. command-parsing code, so that way it only occurs if a SET [CONTROL] PREFIX
  6639. command is given explicitly.  ckuus3.c, 4 Feb 2001.
  6640.  
  6641. Discovered there was no way to make UNIX C-Kermit convert spaces in incoming
  6642. filenames to underscore (or anything else).  Fixed in nzrtol(), ckufio.c,
  6643. 4 Feb 2001.
  6644.  
  6645. At Jeff's suggestion, reordered the statements at <ipkt>E, which looked like
  6646. they might free the wrong sequence slot.  ckcpro.w, 4 Feb 2001.
  6647.  
  6648. Add missing #ifdef DEBUG..#endif around an unguarded reference to debtim in
  6649. ckcftp.c, to fix Ultrix build which happens to include -DNODEBUG.  4 Feb 2001.
  6650.  
  6651. Mark Sapiro noticed that the fullscreen file transfer display, in its summary
  6652. message at the end of a transfer, reported the total number of files, rather
  6653. than the actual number that were sent (the new code forgot to subtract the
  6654. number that were rejected).  Fixed in screenc(): ckuusx.c, 4 Feb 2001.
  6655.  
  6656. Changed command-line ftp handler to exit and fail if it can't make the
  6657. connection or log in, rather than going ahead as if it had.  ckuusy.c,
  6658. 4 Feb 2001.
  6659.  
  6660. Fixed a mistake introduced in my 21 Jan 2001 edit of cmdlinget(), which caused
  6661. it fall thru to MGET after doing a successful GET.  ckcfns.c, 4 Feb 2001.
  6662.  
  6663. Got rid of warning messages about STRU, MODE, and REST.  ckcftp.c, 4 Feb 2001.
  6664.  
  6665. PeterE discovered that MKDIR didn't give an error message when it should have
  6666. under certain extremely bizarre circumstances (namely, C-Kermit had been
  6667. started with an init file that defined a macro that returned a string and then
  6668. SET PROMPT to \fexec() of that macro).  Fixed in ckuusr.c, 5 Feb 2001.
  6669.  
  6670. The following:
  6671.  
  6672.   ftp ftp://ftp.ssc.com/pub/lj/listings/issue73/\*.tgz
  6673.  
  6674. accesses an FTP server whose NLST command does not return the path, thus MGETs
  6675. containing pathnames fail.  On Jan 21, I added a workaround for (single-file)
  6676. GETs.  Today I added similar (worse) code to handle MGETs: if (a) the server
  6677. is UNIX, and (b) an NLST name does not contain a '/', and (c) the MGET name
  6678. *does* contain a '/', then I append the NLST name to the MGET name after the
  6679. rightmost slash before sending the RETR request.  I do this for both MGET
  6680. commands and command-line GETs and URLs.  It works with ftp.ssc.com server and
  6681. also still works with the more common servers that do include paths in NLIST
  6682. names.  ckcftp.c, 5 Feb 2001.
  6683.  
  6684. Some minor adjustments of text-patterns.  ckuusx.c, 5 Feb 2001.
  6685.  
  6686. For docs: describe effect of -d for FTP command-line GETs/PUTs.
  6687.  
  6688. Temporary extra debugging for doinput(): ckuus4.c, 6 Feb 2001.
  6689.  
  6690. Vitek Pepas complained that the "Closing /dev/blah..OK" message came out when
  6691. Kermit exits, even if QUIET is ON, if the EXIT command is executed from a
  6692. script.  Why?  Because the QUIET setting is on the command stack.  EXIT pops
  6693. the command stack.  If SET QUIET ON was given in the command file, it's lost
  6694. when the stack is popped.  I worked around this by having doclean() check
  6695. msgflg rather than quiet.  (The right way to fix this would be to make sure
  6696. popclvl() wasn't called before checking QUIET, but the workaround is safer.)
  6697. ckuusx.c, 6 Feb 2001.
  6698.  
  6699. Wasted some time trying to make an Irix 6.5 compiler warning about utime()
  6700. go away.  At least I reduced the warning to its most absurd form:
  6701.  
  6702.   Argument of type "const struct utimbuf *" is incompatible with parameter
  6703.            of type "const struct utimbuf *".
  6704.  
  6705. The odd thing is the exact same code is used in ckufio.c, but in that case
  6706. there's no warning.  ckcftp.c, 6 Feb 2001.
  6707.  
  6708. Added #ifdefs to choose whether to use mktemp() or mkstemp() to create
  6709. temporary files.  For now we use mkstemp() in Linux and 4.4BSD, since those
  6710. are the platforms that warn us at link time that mktemp() is unsafe.  Now it
  6711. builds with no warnings on RH7.0.  ckcdeb.h, ckcftp.c, 8 Feb 2001.
  6712.  
  6713. From Jeff: replace some duplicated chunks of K95 terminal-dimension setting
  6714. code with calls to os2_setterm{width,height}(): ckuus[37].c; fix INPUT for
  6715. K95 to ignore spurious keyboard events: ckuus4.c, 20 Feb 2001.
  6716.  
  6717. DELETE switches accidentally omitted /[NO]PAGE.  Fixed in ckuus6.c,
  6718. 20 Feb 2001.
  6719.  
  6720. Made SET FILE T be an acceptable abbrev for SET FILE TYPE, as it used to be
  6721. before TEXT-PATTERNS was added, so the book doesn't lie. ckuus7.c, 20 Feb 2001.
  6722.  
  6723. Made VERSION show version, LICENSE (= COPYRIGHT) show copyright notice and
  6724. license.  ckuus[r2].c, 20 Feb 2001.
  6725.  
  6726. Fixed many HELP messages not to say C-Kermit if it's K95.  Also changed
  6727. HELP SET COMMAND not to say the default COMMAND BYTESIZE is 7.  Also fixed
  6728. HELP SET PROMPT text for K95.  ckuus2.c, 20 Feb 2001.
  6729.  
  6730. Changed default TERMINAL BYTESIZE from 7 to 8 (cmask from 0177 to 0377).  This
  6731. is appropriate for most situations, but hmmm, SunOS 4.1 sends even parity when
  6732. you log in on a serial port.  But hardly anybody logs in on a serial port any
  6733. more so no big deal.  ckcmai.c, 6 Mar 2001.
  6734.  
  6735. Changed default modem type from NONE to GENERIC.  ckcmai.c, 6 Mar 2001.
  6736.  
  6737. Changed GENERIC modem definition to not send any init string, and changed the
  6738. name from "generic-high-speed" to simply "generic" (but still accept
  6739. "generic-high-speed").  ckudia.c, 6 Mar 2001.
  6740.  
  6741. But if the default modem type is not NONE, it no longer makes sense to have
  6742. the default MODEM HANGUP-METHOD be MODEM-COMMAND, because if you make a direct
  6743. connection, hanging up sends ATH0 or whatever.  So I changed it to
  6744. RS232-SIGNAL.  ckudia.c, 6 Mar 2001.
  6745.  
  6746. Updates from Jeff, mainly for GUI: ck_ssl.c, ckcnet.c, ckuus7.c, ckuus5.c,
  6747. ckuusx.c, ckcmai.c, ckuus3.c, ckcdeb.h, 7 Mar 2001.
  6748.  
  6749. The DIRECTORY /RECURSIVE command and the \frdir() function always follow
  6750. symlinks.  This is bad for many reasons, such as multiple traversals of the
  6751. same tree, and even endless loops.  Sometimes you want to follow links,
  6752. sometimes you don't.  Ditto for SEND.  So there needs to be a switch.  Added
  6753. DIR_LNK/DIR_NLK and SND_LNK/SND_NLK to ckuusr.h.  Added /NOFOLLOWLINKS (and
  6754. /FOLLOWLINKS) to DIRECTORY command; this uses the same underlying mechanism
  6755. that I added to make DELETE /RECURSIVE never follow links.  Changed DIR to not
  6756. follow links by default, since following links is dangerous and not following
  6757. them isn't.  domydir(): ckuus6.c, 7 Mar 2001.
  6758.  
  6759. Same deal for SEND.  ckuusr.c, 7 Mar 2001.
  6760.  
  6761. Fixed \frdirectory() to never follow links.  ckuus4.c, 7 Mar 2001.
  6762.  
  6763. New SunOS 4.1 secure builds from Jeff.  ck_ssl.c, makefile, 9 Mar 2001.
  6764.  
  6765. Updated HELP SET { COMMAND, TERMINAL } BYTESIZE text.
  6766.  
  6767. Discovered that \fday() dumps core when given a date prior to 17 Mar 1858.
  6768. Fixed in ckuus4.c, 13 Mar 2001.
  6769.  
  6770. Fixed cmifi2() (and its clients, e.g. cmifi(), cmdir(), etc) to return -3
  6771. if given {} or "".  ckucmd.c, 13 Mar 2001.
  6772.  
  6773. Updated help text for SET TERM BYTE, SEND, DIR, ckuus2.c, 13 Mar 2001.
  6774.  
  6775. There is something in ckcftp.c that I never understood, but didn't cause any
  6776. trouble until now:
  6777.  
  6778.   #define sig_t my_sig_t
  6779.   #define sigtype SIGTYP
  6780.   typedef sigtype (*sig_t)();
  6781.  
  6782. In Ultrix 3.0 all hell breaks loose.  In all our other signal-using modules
  6783. we use only SIGTYP, so I changed ckcftp.c to follow the same conventions, and
  6784. removed all references to sigtype and sig_t.  At least this makes ckcftp.c
  6785. consistent with the other modules.  But it made no difference at all.  For
  6786. some reason the Ultrix compiler violently objects to "oldintr != cmdcancel"
  6787. in getreply() because the operands are not the same type (but they are).  So
  6788. I backed off the changes and then #ifdef'd this comparison away for Ultrix
  6789. 3.x only.  makefile, ckcftp.c, ckuver.h, 15 Mar 2001.
  6790.  
  6791. The change I made to \frdir() a week ago had a typo that broke recursion.
  6792. Fixed in ckuus4.c, 17 Mar 2001.
  6793.  
  6794. A couple minor cosmetic changes to DIAL module, ckudia.c, 17 Mar 2001.
  6795.  
  6796. Updated sourced from Jeff: shotcs(): ckuus5.c; add brace stripping to
  6797. SET FILE DOWNLOAD-DIR: ckuus7.c, 17 Mar 2001.
  6798.  
  6799. Added new modem types:
  6800.  
  6801.  . lucent:          Lucent Venus chipset
  6802.  . pctel:           PCTel V.90 chipset
  6803.  . conexant:        Conexant (ex-Rockwell) modem family
  6804.  . zoom-v32bis:     New name for "Zoom"
  6805.  . zoom-v34         Zoom V.34
  6806.  . zoom-v90         Zoom V.90 56K
  6807.  . zoom-v92:        Zoom V.92 with V.44 data compression
  6808.  . zoltrix-v34:     New name for "zoltrix"
  6809.  . zoltrix-hsp-v90: Synonym for PCTel
  6810.  . zoltrix-hcf-v90: Synonym for ITU-T-V250
  6811.  . smartlink-v90:   Synonym for usrobotics (same chipset)
  6812.  . acer-v90:        Synonym for Rockwell-v90
  6813.  
  6814. All untested.  ckuusr.h, ckudia.c, 18 Mar 2001.
  6815.  
  6816. Merge with Jeff's updated sources: ckcnet.c ckudia.c ckuath.c ckuusr.h
  6817. makefile ckuscr.c ckctel.c ckufio.c ckcftp.c ckcnet.h ckuus4.c ckuus7.c,
  6818. 20 Mar 2001.
  6819.  
  6820. Tighten up generic dialing a bit.  Don't bother with speaker settings.
  6821. Change dialhup() to not send +++<sec>ATH0<sec>+++ if modem type is generic
  6822. AND it's a serial connection.  ckudia.c, 20 Mar 2001.
  6823.  
  6824. Changed defaults for MODEM ERROR-CORRECTION, DATA-COMPRESSION, and
  6825. HANGUP-METHOD to match new default modem type of GENERIC, so that start-up
  6826. defaults are the same as when you get when you SET MODEM TYPE GENERIC.
  6827. ckuus3.c, ckudia.c, 21 Mar 2001.
  6828.  
  6829. Fix from Jeff to parsedir() for parsing directory-path lists.
  6830. ckuus3.c, 22 Mar 2001.
  6831.  
  6832. Added IF GUI, to allow portable scripting of GUI-related commands, such as
  6833. font selections (e.g. "if ( k-95 && gui ) set font courier_new 16").  Maybe
  6834. now we should get rid of "k95g" as a \v(program) value; I don't like it
  6835. because it's likely to break existing scripts.  Now we can use IF GUI to test
  6836. for GUI-ness without disrupting anything.  Also removed a few more stray
  6837. references to Kermit/2.  ckuus[26].c, 22 Mar 2001.
  6838.  
  6839. Removed &Sn from V.250 init strings - it's not in the standard.
  6840. ckudia.c, 25 Mar 2001.
  6841.  
  6842. Sync'd files with Jeff; his changes mainly for GUI font selection. 27 Mar 2001.
  6843.  
  6844. In response to scattered but persistent requests over the years, added SET
  6845. SESSION-LOG TIMESTAMPED-TEXT.  It's done sys-independently in logchar() so
  6846. should work for all platforms.  The command is cleverly structured to allow
  6847. timestamps only for text-mode logs.  The timestamp at the beginning of each
  6848. line shows the hh:mm:ss.nnn when the first character of the line appeared.
  6849. ckuus[23x].c, 27 Mar 2001.
  6850.  
  6851. Also changed ckucns.c and ck[uv]con.c to say "Session Log: filename,
  6852. timestamped-text" (or other type), but it's just a frill, not necessary in 
  6853. all CONNECT modules.  27 Mar 2001.
  6854.  
  6855. Changed askmore() to accept G (Go) or P (Proceed) to show all the rest without
  6856. asking.  ckuusx.c, 27 Mar 2001.
  6857.  
  6858. Started working on an FTP NLST command but didn't finish.  The idea is to be
  6859. able to make the NLST temporary file available programmatically, as discussed
  6860. on the newsgroup a while back.  This will require (a) not deleting it (done);
  6861. (b) not actually GET'ing the files (done); (c) putting its name in a variable;
  6862. and (d) not creating a new file for each filespec in the command (e.g. "ftp
  6863. nlst a* b* c*" should create one temp file, not three).  Invisible for now;
  6864. will finish later.  ckcftp.c, 27 Mar 2001.
  6865.  
  6866. Small correction to timestamped logs (session and debug) for the case where
  6867. ztime() does not set ztmsec > -1.  ckuusx.c, 28 Mar 2001.
  6868.  
  6869. Backed off on yesterday's FTP changes.  I should take more Vitamin E...
  6870. The NLST command was already there, as "mget /namelist:filename ...".  I
  6871. really don't remember putting this in.  ckcftp.c, 28 Mar 2001.
  6872.  
  6873. Made SET SESSION-LOG TIMESTAMPED-TEXT un-invisible for all, since it didn't
  6874. turn out to be UNIX-specific like I thought it would be. ckuus3.c, 29 Mar 2001.
  6875.  
  6876. Added FTP OPEN /PASSIVE and /ACTIVE.  ckcftp.c, 29 Mar 2001.
  6877.  
  6878. Changed getyesno() interpretation of 2nd argument.  If it contains 1,
  6879. "quit" is a valid keyword.  If it contains 2, "go" is a valid keyword.
  6880. ckuus3.c, 29 Mar 2001.
  6881.  
  6882. Changed DELETE /ASK to call getyesno(xxx,3) to allow both "quit" (cancel
  6883. the DELETE command) and "go" (delete all the rest of the files without
  6884. asking).  ckuus[26].c, 29 Mar 2001.
  6885.  
  6886. If C-Kermit in server mode is given a REMOTE CD command, it would print
  6887. the directory name.  Fixed in docd(): ckuus5.c, 29 Mar 2001.
  6888.  
  6889. Refixed a typo in ck_copyhostent() in ckcnet.c that broke non-ANSI builds.
  6890. Put ck_copyhostent() and all references to it in #ifdef HADDRLIST..#endif in
  6891. ckcnet.c, ckuath.c, ckufio.c, and ckcftp.c.  Fixed some char/CHAR complaints
  6892. in ckuusx.c.  Added makefile entry and designer banner for FreeBSD 4.3:
  6893. makefile, ckuver.h.  Added missing "extern int sessft" in ckvcon.c.
  6894.  
  6895. On my own SCO 5.0.5 system, compilation fails unless I add -DDCLTIMEVAL, and
  6896. then getspnam() is missing at link time.  So I changed ckcdeb.h to not
  6897. automatically define CK_SHADOW for CK_SCOV5 if NOSHADOW is defined, and added
  6898. -DDCLTIMEVAL -DNOSHADOW to KFLAGS, and it builds OK, but with lots of warnings
  6899. about getsockopt() and other function args.  But if I build on Boyd G's 5.0.5
  6900. system, there are no errors and no warnings.
  6901.  
  6902. ---7.1.199 Alpha.03---
  6903.  
  6904. The ck_copyhostent() routine dumped core on many platforms, Jeff fixed it.
  6905. Unfortunately, this happened just after the 3-day build-all for Alpha.03, but
  6906. before the announcement.  I updated the sources with Jeff's changes:
  6907. ckcdeb.h, ckcmai.c, ckuusr[c57].c, ckcnet.c, 1 Apr 2001.
  6908.  
  6909. Upped the test version from Alpha.03 to Alpha.04.  ckcmai.c, 1 Apr 2001.
  6910.  
  6911. While I was at it... the FTP client has been spewing out more and more
  6912. messages when logging in to the server.  To avoid this I had set ftp_vbm = 0
  6913. around the initial connection.  Now it seems that ftpcmd() always sets ftp_vbm
  6914. back to ftp_vbx before exiting, so setting ftp_vbm to 0 and then calling
  6915. ftpcmd() several times does not suppress the messages as expected.  Too many
  6916. cooks syndrome.  Now the code is full of little tricks to force verbose mode
  6917. on or off around certain commands, to undo the forcing, and undo the undoing
  6918. of the forcing, to the extent that it's incomprehensible and the SET FTP
  6919. VERBOSE command has no predictable effect.  So I got rid of the tricks and set
  6920. FTP VERBOSE-MODE OFF by default.  Now the command does what it says it does
  6921. and the user doesn't get tons of cryptic messages.  ckcftp.c, 1 Apr 2001.
  6922.  
  6923. Built new binaries for SunOS, Solaris 2.5.1, Solaris 7, Unixware 7,
  6924. RH 7.0, Freebsd2,3,4, and a bunch of others, but not the slow ones.
  6925. There was no way to install the new binaries on watsun alongside the old ones
  6926. because /pub/ftp too full, so installed them on ftp.kermit, then pruned old
  6927. binaries, and then removed all ck* from watsun's kermit/test/bin/ and copied
  6928. ftp.kermit's there.  This dual-server business is getting rather convoluted;
  6929. now watsun is the master for some directories but ftp.kermit is the master
  6930. for others.  We'd better totally cut over soon...
  6931.  
  6932. ---7.1.199 Alpha.04---
  6933.  
  6934. Changed FTP ftpcmd() and getreply() to have a new verbosity parameter, to
  6935. simplify switching forcing server-reply displays on or off in certain
  6936. contexts.  Changed VERBOSE default back to ON and used the new parameter to
  6937. hide the initial connection dialog (REST, MODE, STRU, SYST).  ckcftp.c,
  6938. 2 Apr 2001.
  6939.  
  6940. Added aix43x25 makefile entry.  makefile, 6 Apr 2001.
  6941.  
  6942. From Jeff:
  6943.  . Add SET PORT /SHARE for K95.
  6944.  . Fix SRP FTP bug.
  6945.  . Fix bug with generic dialing pausing for several secs.
  6946.  . Fix IKSD prompt to send <CR><NUL> rather than just <CR>.
  6947.  . Fix dolognet() not to write into uidbuf[], which was preventing
  6948.    SET HOST /USER:{}, SET LOGIN USER {}, etc, from working.
  6949.  . Create separately callable getexedir(), extracted from prescan().
  6950.  . Restructure FTP module for cleaner message control.
  6951. ckcdeb.h, ckcmai.c, ckcnet.c, ckuus[347x].c, ckudia.c, ckcftp.c, 7 Apr 2001.
  6952.  
  6953. FTP messages need some tuning.  Data transfer commands like DIR, GET, etc,
  6954. are too verbose.  But this would get us into the editing/censorship business
  6955. again.  I think what I need to do is add SET FTP VERBOSE-MODE NORMAL.
  6956. This will be the "edited" mode that shows some messages but not others,
  6957. like a regular FTP client.  After that ON will show all messages, OFF will
  6958. show no messages, and NORMAL (the new default) will show selected messages.
  6959.  
  6960. Jeff and I added CONNECT /ASYNC, plus some other minor updates from Jeff:
  6961. ckcker.h, ckuusr.h, ckcmai.c, ckuus[r47].c, ckudia.c, ckcftp.c, 9 Apr 2001.
  6962.  
  6963. Lots of changes from Jeff from last several weeks, 27 Apr 2001:
  6964.   Misc small adjustments: ckcmai.c ckcdeb.h ckcker.h
  6965.   CONNECT /ASYNC, APC details: ckuus[r457].c ckcfn2.c
  6966.   Security: ck_ssl.[ch], ckuath.c
  6967.   SET PRINTER fixes for K95: ckuus3.c
  6968.   New generalized HTTP CONNECT: ckcnet.h ckuusr.c ckcftp.c
  6969.   Fix modem capabilities AT testing: ckudia.c
  6970.  
  6971. Added \v(dm_hf) (dial modifier hook flash) and \v(dm_wb) (dial modifier wait
  6972. for bong).  ckuusr.h, ckuus4.c, ckudia.c, 27 Apr 2001.
  6973.  
  6974. Added --version command-line switch.  ckuusr.h, ckuusy.c, 27 Apr 2001.
  6975.  
  6976. Trimmed trailing blanks and folded long lines, most modules.  27 Apr 2001.
  6977.  
  6978. This will be Beta.01 after build-all and more cleanups.
  6979.  
  6980. Fixed an oversight in merging Jeff's SET PRINTER code from yesterday.
  6981. ckuus3.c, 28 Apr 2001.
  6982.  
  6983. While helping a user I discovered that C-Kermit on NetBSD always fails to
  6984. hangup by dropping DTR; the tcsetattr() call always fails with EINVAL.  It
  6985. doesn't like an argument of B0.  The same code works fine in FreeBSD.  Found
  6986. out that the NetBSD tty device driver code is broken (for some reason the B0
  6987. hangup code is commented out).  The workaround is to use ioctl() with TIOCCDTR
  6988. and TIOCSDTR -- Yet Another Hanging Up API.  Added code for this to tthang(),
  6989. tested in NetBSD (which uses it) and FreeBSD (which doesn't).  On BSD44 and
  6990. POSIX systems, the use of this code can be forced by defining USE_TIOCSDTR.
  6991. ckutio.c, 28 Apr 2001.
  6992.  
  6993. Another correction to ckuus3.c (I left out a line AGAIN in yesterday's
  6994. correction).  OK, no more allergy pills for me.  29 Apr 2001.
  6995.  
  6996. Cleanups resulting from HP "flexelint" run on Alpha.04, as well as gcc -Wall.
  6997. A couple genuine (potential) problems were found, marked with "+":
  6998.  
  6999.   General (all or many modules):
  7000.     "Constant value Boolean":
  7001.        These warnings are bogus - the constructions are deliberate.
  7002.     "Variable not subsequently referenced" and "not accessed":
  7003.        These are harmless, and result from the tangle of #ifdefs.
  7004.        "Fixing" these warnings would introduce even more spaghetti
  7005.        and risk serious breakage, except in very short functions.
  7006.     "Control flows into case": these are all deliberate.
  7007.     "Expected a constant" - Bogus; they are constants, e.g.:
  7008.        extern CHAR (*xls[MAXTCSETS+1][MAXFCSETS+1])(CHAR).
  7009.     "Array subscript has type 'char'": yes, it does, by design.
  7010.     Thousands of warnings about omitted braces around initializers, harmless.
  7011.     Warnings about signal(): "Error:64:Type mismatch (arg. no. 2)
  7012.        (void (*)(int) = int (*)())": Many modules.  Lint is simply not
  7013.        resolving all the preprocessor definitions and prototypes correctly.
  7014.        All these statements compile without complaint in the optimizing
  7015.        compiler and execute correctly.
  7016.     Added extra parens around "while (*p++ = *s++)..." etc to avoid warnings
  7017.        from gcc -Wall.  Ditto for boolean expressions using && and || where
  7018.        gcc "suggests" parens for grouping, as if the rules of precedence
  7019.        can't be trusted.  Well, who knows, maybe they can't.
  7020.     Cast non-char* args to free() to (char *) to shut up stupid warnings.
  7021.  
  7022.   ckcfn2.c:
  7023. +   1328: mydata[i++] = tochar(chk1(mydata+lp,i+lp));
  7024.       (Depends on order of evaluation, fixed by using a temp variable).
  7025.     Cast non-(char *) args to free() to (char *).
  7026.     Various other minor syntax adjustments from gcc -Wall.
  7027.  
  7028.   ckcfn3.c:
  7029.     Various type mismatches -- casts added, etc.
  7030.  
  7031.   ckcfns.c:
  7032.     There were some bogus out-of-bounds array reference
  7033.     warnings in nxtdir(), which could never have happened in real life but I
  7034.     fixed them anyway.
  7035.  
  7036.   ckclib.c:
  7037. +   chartostr(): a true out-of-bounds array reference was caught: if this
  7038.       function was ever called with a char val of 128-159, it made a wild
  7039.       reference.
  7040.     makestr(): Out-of-bounds pointer in makestr() has to be bogus.
  7041.     ckregex(): adjusted some "suspicious casts".
  7042.     ckregex(): Out-of-bounds warning is bogus.
  7043.  
  7044.   ckcmai.c: added a few missing prototypes.
  7045.  
  7046.   ckucmd.c: added some casts and extra parens.
  7047.  
  7048.   ckucns.c:
  7049.     Lots of bogus "expected a constant" warnings; they *are* constants.
  7050.     Added missing prototypes.
  7051. +   if (printing & escbuf > 1) should have been "&&" (probably same effect).
  7052.     Moved dologshow() prototype from ckuusr.h to ckcker.h where ckucns.c
  7053.       can find it.
  7054.  
  7055.   ckucon.c:
  7056.     All warnings inconsequential, and HP-UX doesn't use this module anyway.
  7057.  
  7058.   ckudia.c:
  7059.     Out-of-bounds references to tonecc[] array: can't happen (read the code).
  7060.     Ditto for pulsecc[].
  7061.     Out-of-bounds reference to pp[] array: fixed off-by-1 declaration.
  7062.  
  7063.   ckufio.c:
  7064.     ctime() "Should be a pointer".  It is a function that returns char *.
  7065.     zinfill() "loss of information": bogus, anyway it's only for debugging.
  7066.     "Non-existent return value for write()" -- that's just silly.
  7067.     "Redefinition of symbol 'zchki(char *)'" -- bogus, lint is wrong; it's
  7068.       not picking up the definitions from ckcdeb.h.
  7069.     Ditto for nzrtol() and nzltor().
  7070.     zchkpid(unsigned long pid): "Expecting an identifier or other declarator":
  7071.       apparently "pid" must be a reserved word?  Changed it to xpid.
  7072.     A similar warning at line 2848.  There's nothing wrong with these lines;
  7073.       lint is confused.
  7074.     zhomdir not initialized: wrong, it is.
  7075.     fp[filnum] = popen(...) "type mismatch": wrong; it's not.
  7076.     3073/1276: 2 vs 3 args to open().  This is legal, see "man 2 open".
  7077.     fp[filnum] = fdopen(...) "type mismatch": wrong; it's not.
  7078.     "Redefinition of symbol zxpand()": Wrong.
  7079.     3437: "flags not initialized": nonsense, it's a parameter to this function.
  7080.     3621+ff: out-of-bounds ref to p[]: No, it can't be out of bounds.
  7081.     3647: type mismatch: no it isn't.  Lint is not picking up the prototypes.
  7082.     5724: read arg #3: lint doesn't understand sizeof.
  7083.     6349: wrong number of args to execl(): wrong.  See "man execl".
  7084.     Complaints about ckstrncpy() unfounded.
  7085.  
  7086.   ckuscr.c:
  7087.     Possible out-of-range array ref: bogus, but I increased the array size.
  7088.  
  7089.   ckutio.c:
  7090.     10991: One bad call to congetbuf() was found (missing arg) but it wasn't 
  7091.       in the HP-UX code.
  7092.     3995: read() is called with a long; cast it to int.  We'll always get
  7093.       warnings about read() arg #3 (int vs unsigned int vs size_t etc), but
  7094.       fixing them is impossible, and they only really matter when size_t is
  7095.       not int or unsigned int, or if read really wants a long or unsigned long.
  7096.     All rest are because Lint didn't pick up function prototypes,
  7097.     preprocessor symbols, and/or typedefs.  It's even reading big blocks of
  7098.     code that are not selected for HP-UX.
  7099.  
  7100.   ckuusr.c:
  7101.     700 "omitted braces" warnings safely ignored.    
  7102.     Some free((char *)blah) casts added.
  7103.  
  7104.   ckuus3.c:
  7105.     Missing braces around keyword table entries: ignored, harmless.
  7106. +   2102: pp not init'd in parsedir().  Sure enough, it wasn't!
  7107.     3574ff: Possible division by 0.  No, these are all prechecked.
  7108.  
  7109.   ckuus4.c:
  7110.     Missing braces around keyword table entries: ignored, harmless.
  7111.     Complaints involving sizeof: bogus.
  7112.     Complaints about signal(): ignored.
  7113.     Many xx.os_specific = '\0'; changed to xx.os_specific = "";
  7114.     6614: possible out-of-bounds array ref: no, prechecked.
  7115.     6749ff: ditto.
  7116.     6810ff: ditto.
  7117.     6898ff: ditto.
  7118.     7036ff: ditto.
  7119.     7321ff: ditto.
  7120.     9214, incompatible types: wrong, Lint missed the prototype.
  7121.     12904ff: possible out-of-bounds array ref: no, prechecked.
  7122.  
  7123.  ckuus5.c:
  7124. +   1890: while () condition lacked parens for proper grouping.
  7125.     3602: out-of-bounds: bogus.
  7126.     3674: ditto.
  7127. +   3919: This one was interesting...  Evidently \%x variables are not
  7128.       limited to just letters and digits.  Any ASCII character can be used
  7129.       in the 'x' position, e.g. \%_, \%=, \%+, etc.  I did this so long ago
  7130.       I forgot about it.  Anyway, there could have been an out-of-bounds
  7131.       reference if anybody took advantage of this undocumented feature and
  7132.       defined a \%~ variable.  Fixed in ckuusr.h and ckuus5.c.
  7133.     3939: Warnings about a_ptr[] references, bogus (prechecked) but I
  7134.       increased the dimensions anyway to suppress the warnings.
  7135.     4151ff: like 3919.
  7136. +   8003ff: possible out-of-bounds references to parameter s[]: fixed.
  7137.  
  7138.   ckuus6.c:
  7139.     4797ff: zfcdat() is guaranteed to return a string in the right format.
  7140.       But I added code to defend against improper zfcdat() implementations
  7141.       anyway.
  7142.     6475ff: out-of-bounds: bogus (prechecked).
  7143. +   8895: An out-of-bounds reference was possible here (to s[3]), fixed.
  7144.     8903: Out-of-bounds reference warning: bogus; it's OK to reference 
  7145.       the terminating NUL.
  7146.  
  7147.   ckuus7.c:
  7148.     2346ff bkupnum(): array ref out-of-bounds, bogus (prechecked)
  7149.     11827: xx.os_specific = '\0'; changed to xx.os_specific = "";
  7150.  
  7151.   ckuusx.c:
  7152.     4485: *p ref possibly out of range: no.
  7153.  
  7154.   ckuxla.c:
  7155.     274 "omitted braces" warnings (safely) ignored.
  7156.     53 "expected a constant" warnings (safely) ignored.
  7157.     "Too many initializers for aggregate", "expecting a '}'": nonsense.
  7158.     
  7159. Also:
  7160.   Added missing prototypes for do_pty() and end_pty() to ckcdeb.h.
  7161.   Removed unused variables from functions where it was safe to do.
  7162.  
  7163. (Apr 29 - May 1, 2001.)
  7164.  
  7165. Added prototypes for all the IKSD database routines to ckcker.h, 2 May 2001.
  7166.  
  7167. Removed an extraneous trailing arg to slotstate() call.  ckcpro.w, 2 May 2001.
  7168.  
  7169. Added prototypes for ftp routines called from outside to ckcdeb.h, 2 May 2001.
  7170.  
  7171. Recent modem-type additions included some aliases that made modem-type
  7172. display confusing; for example, "set modem type usrobotics" would list the
  7173. modem type as "smartlink-v90" because that was the first one in the list
  7174. (alphabetically) that had the USR type.  Added an M_ALIAS flag for the keyword
  7175. list to prevent this.  ckudia.c, 2 May 2001.
  7176.  
  7177. Fixed mlook() and mxlook(), which actually wrote into their argument strings.
  7178. This was discovered last December but tabled:
  7179.  
  7180.   Something is very wrong here.  The OLDMLOOK code, which was used prior
  7181.   to 28 Dec 2000, lowercases its argument string IN PLACE.  But fixing this
  7182.   to make a copy of the argument string and lowercase the copy breaks
  7183.   just about everything.  So evidently the higher-level code depends on
  7184.   mlook() lowercasing its argument.  For now we just put it back the way
  7185.   it was before.  Fixing this will require a detailed audit of mlook()
  7186.   calls and their aftermath.
  7187.  
  7188. The fix involved a rather extensive rewrite of mlook() and mxlook(), probably
  7189. negating a good deal of the performance improvements gained in the tuning
  7190. extravaganza of last year, but I also added an early loop exit that, hopefully,
  7191. negates the negation.  The various demos and torture test still work.
  7192. ckuus5.c, 2 May 2001.
  7193.  
  7194. Straightened out messy if-condition in doxget() to complain about missing
  7195. as-name for XMODEM receives.  ckuus6.c, 2 May 2001.
  7196.  
  7197. Cleaned up most gcc -Wall warnings in ckuus7.c, including (don't ask me why)
  7198. putting braces around all keyword tab entries.  Ditto for ckuus4-6, but I
  7199. doubt I'll have the patience to do this for all the modules.  2 May 2001.
  7200.  
  7201. Fixed the ECHO command (again) so that it works as before when given a quoted
  7202. string, so that echo "foo" will print "foo" (with the quotes).  The previous
  7203. fix was a bit flaky, e.g.
  7204.  
  7205.   echo foo "bar"
  7206.  
  7207. printed:
  7208.  
  7209.   "foo "bar""
  7210.  
  7211. But even with the bugs fixed, I'm still not sure whether this is the right
  7212. thing to do.  It keeps the ECHO command working as it did before, but it also
  7213. will confuse the heck out of somebody who expects the doublequotes to be
  7214. stripped.  But it really doesn't seem worth adding a SET command for this...
  7215. ckuusr.c, 3 May 2001.
  7216.  
  7217. Lint/Wall cleanups, cont'd.  ckuus[rxy].c, ckcftp.c, 3 May 2001.
  7218.  
  7219. The trick for looking ahead to see if we're at the end of a macro definition
  7220. (used by CONNECT /ASYNC) is not reliable because sometimes macro definitions
  7221. have trailing spaces and/or commas.  These can be added by the parser when
  7222. reading a multiline { block } from a file, the prompt, or even another macro.
  7223. We can (a) prevent the trailing ", " from being added in the first place (but
  7224. this would have to be handled in at least three places); or (b) change the
  7225. DEFINE command to remove it; or (c) change the CONNECT /ASYNC lookahead code
  7226. to test for only commas and spaces left in a macro definition.  (c) is
  7227. obviously the safest choice since it can't possibly break anything, but it's
  7228. ugly and unsatisfying.  The problem with (a) is that it can't address nested
  7229. definitions; (b) is out of the question because how do we know it's a macro
  7230. and not a variable whose definition is *supposed* to have trailing comma
  7231. and/or spaces?  Which leaves (c).  I added a new routine, prepop(), to replace
  7232. the loop which had been replicated in various places around the ckuus*.c
  7233. files, which does what the loop did but also checks whether nothing remains
  7234. in a macro definition except spaces and/or commas (this is done by a second
  7235. new routine, iseom()).  ckuusr.h, ckuus[r57].c, 4 May 2001.
  7236.  
  7237. Feature-set builds on Linux, 4 May 2001:
  7238.  
  7239. Build           Size    Savings     Corrections needed
  7240.  Full        1975235          -      None
  7241.  NOSPL       1659767     315468      ckcmai.c ckuus5.c ckcftp.c ckudia.c
  7242.  NOCSETS     1597924     377311      None
  7243.  NOUNICODE   1682029     293206      None
  7244.  NONET       1704588     270647      None
  7245.  NOFTP       1834813     140422      None
  7246.  NODEBUG     1761288     213947      None
  7247.  NOHELP      1692150     283085      None
  7248.  NOLOCAL     1442034     533201      ckudia.c
  7249.  NODIAL      1834898     140337      ckudia.c
  7250.  MINIDIAL    1945894      29341      None
  7251.  NOCHANNELIO 1943741      31494      None
  7252.  NOCMDL      1932120      43115      ckcmai.c
  7253.  NOIKSD      1925070      50165      None
  7254.  NOSEXP      1953885      21350      None
  7255.  NOFRILLS    1791245     183990      ckuus2.c
  7256.  NOCURSES    1946989      28246      None
  7257.  NOXFER      1445466     529769      None
  7258.  NOICP        476762    1498473      ckcmai.c ckuus[r3457y].c ckcftp.c ckcdeb.h
  7259.  NOSERVER    1946942      28293      None
  7260.  NOPUSH      1930325      44910      ckcftp.c
  7261.  
  7262. Notes:
  7263.  . NOICP for now implies NOFTP, although a command-line-only FTP client
  7264.    could be accomplished with a lot of #ifdef fiddling
  7265.  . NOXFER also implies NOFTP.
  7266.  
  7267. Built non-ANSI versions on SunOS and HP-UX; no changes needed.  4 May 2001.
  7268.  
  7269. Built on VMS with & without TCP/IP, required a fix to ckvcon.c.  4 May 2001.
  7270.  
  7271. Fixed REDIRECT to require an arg.  ckuusr.c, 4 May 2001.
  7272.  
  7273. Enabled SET SESSION-LOG for VMS and other platforms where it wasn't usable
  7274. before, no now they can get timestamped session logs.  ckuus[r3x].c, ckvcon.c,
  7275. Cinco de Mayo 2001.
  7276.  
  7277. Command recall didn't work well when reversing direction; for example,
  7278. after up up up, down would show the same command again, similarly in the other
  7279. direction.  Fixed in gtword(), 5 May 2001.
  7280.  
  7281. SET FLOW /xxx AUTO should not have been allowed.  AUTO is not a valid choice
  7282. for a specific connection type.  Fixed in ckuus3.c, 5 May 2001.
  7283.  
  7284. The SHOW FLOW display was confusing about AUTO versus specific types.
  7285. Fixed in ckuus4.c, 5 May 2001.
  7286.  
  7287. IKSD URLs (added 23 Dec 2000) were broken at some point.  Fixed in prescan():
  7288. ckuus4.c, 5 May 2001.
  7289.  
  7290. Checking verbosity of FTP commands...
  7291.  . PUT/GET always prints the file size.
  7292.  . If a mode change is done, that is printed too.  Example:
  7293.  
  7294.    (/w/fdc/tmp3/) C-Kermit>get foo.txt
  7295.    46669
  7296.    Type set to A.
  7297.  
  7298.  . If TRANSFER DISPLAY is BRIEF, we still get a lot of stuff:
  7299.  
  7300.     (/w/fdc/tmp3/) C-Kermit>get foo.txt
  7301.     46669
  7302.     Type set to A.
  7303.      GET foo.txt (text) (46669 bytes)Entering Passive Mode
  7304.     (128,59,39,2,15,154)
  7305.     Opening ASCII mode data connection for foo.txt (46669 bytes).
  7306.     Transfer complete.
  7307.     : OK (0.196 sec, 238107 cps)
  7308.     (/w/fdc/tmp3/) C-Kermit>
  7309.  
  7310.  . Debugging display shows none of this comes out with DISPLAY FULL.
  7311.  
  7312. Going through all the FTP commands with VERBOSE ON, which is the default,
  7313. shows they are very inconsistent about showing server responses.  Let's think
  7314. about this....  We have three kinds of messages:
  7315.  
  7316.  1. Messages from Kermit to the server, which are currently shown only
  7317.     if FTP DEBUG is ON.
  7318.  
  7319.  2. Messages from the server to Kermit, which are shown inconsistently,
  7320.     but when they are shown at all, FTP VERBOSE must be ON, which it is
  7321.     by default, producing annoying messages in the DIR, VDIR, CHECK,
  7322.     DELETE, and MODTIME commands, as well as the file-transfer commands.
  7323.  
  7324.  3. Messages from Kermit to the user, which are shown unless QUIET is ON.
  7325.  
  7326. We went through all this a month ago but didn't settle it.  OK, here's what I
  7327. did: first I made FTP VERBOSE OFF be the default (again), because it produces
  7328. the best results for all commands except BYE, STATUS, and PWD; i.e. the ones
  7329. where the server sends back data on the control connection.  For these we use
  7330. the "printlines" variable to force verbose mode unless QUIET is ON.
  7331. ckcftp.c, 8 May 2001.
  7332.  
  7333. Peter E complained about the well-known (to me) situation in which you give a
  7334. valid command, then some more commands, then ^P back to the previously valid
  7335. command, but it's not valid any more (e.g. because it deleted or renamed a
  7336. file, so the file no longer exists, so cmifi() gets a parse error).  This one
  7337. has been on my list for a long time because it's so hard to fix.  Command
  7338. recall is done in gtword().  When ^P or ^N is encountered, the previous or
  7339. next command is copied from the history list and stuffed into the command
  7340. buffer, and then gtword() returns with cmflgs = -1, which forces a reparse,
  7341. and this is what causes the error.  But what if, instead of returning,
  7342. gtword() simply continued its character-getting loop until it gets a CR, DEL,
  7343. SP, or other break character is entered?  Sounds good in theory, and I almost
  7344. got it working, but it has too many side effects -- you have to type two CR's
  7345. to enter a recalled command; recalled commands don't erase longer previous
  7346. commands so there is junk on the end; ?-help is totally confused; the program
  7347. sometimes just hangs, etc.  So rather than try to fix each of these side
  7348. effects piecemeal by adding more and more but-ifs, I backed off.  8 May 2001.
  7349.  
  7350. Peter E noticed that DELETE did not print an error message if it failed to
  7351. delete 1 or more files and /NOLIST was in effect (as it is by default).  Added
  7352. a special case for this to dodel(): ckuus6.c, 9 May 2001.
  7353.  
  7354. Updated NEWS text plus a few assorted HELP-text glitches. ckuus2.c, 9 May 2001.
  7355.  
  7356. Fixed FTP VERBOSE vs FTP [M]GET and FTP DELETE -- there was still some
  7357. interference.  ckcftp.c, 9 May 2001.
  7358.  
  7359. More FTP message fixing from Jeff (for authentication of data channel).
  7360. ckcftp.c, 10 May 2001.
  7361.  
  7362. Change SINIX 5.42 makefile entry to not optimize -- otherwise it gets stuck
  7363. on ckuusr.c, ckuus4.c, etc.  10 May 2001.
  7364.  
  7365. ---Beta.01---
  7366.  
  7367. 22 May 2001: I found a bunch of problems with FTP and Jeff worked on them:
  7368.  
  7369. > With C-Kermit or K95 (latest), CD orientation messages aren't printed.
  7370. > Another VERBOSE mode foulup.  What a nightmare.  But that's only the
  7371. > beginning.
  7372.  
  7373. ok.  this I can fix. 
  7374.  
  7375. > If I SET FTP VERBOSE ON (but not DEBUG) and then CD to a directory, the CD
  7376. > messages are printed, but the beginning of each line is lost.  There's some
  7377. > new bug in getreply().
  7378.  
  7379. I know where this would be
  7380.  
  7381. > I wanted to get a partial binary file so I could REGET it afterwards.  "get
  7382. > wermit" (from K95 to watsun) gets wermit in text mode.  That's bad but I can
  7383. > understand it: automatic text/binary switching is based on filetypes, and
  7384. > this one doesn't have a file type, and the platforms are not alike, so it
  7385. > didn't switch to binary mode -- but why is the default text mode???.
  7386. > But "get /binary wermit" still gets it in text mode!  The /BINARY switch
  7387. > should override everything else!
  7388. default is TEXT because the default for FTP is TEXT.  It was probably
  7389. never changed.  Not sure why /BINARY does not override.  But it is
  7390. probably because the FTP TYPE value is copied over the current value
  7391. at some inappropriate point.
  7392.  
  7393. > "ftp type binary" gets around this but...  "get wermit" and then interrupt
  7394. > with Ctrl-X (seems OK).  Then "reget wermit" goes into an uninterruptible
  7395. > infinite loop of "ftp: connect: No such file or directory" and "Transfer
  7396. > interrupted".  I had to Ctrl-Alt-Del it.
  7397. >
  7398. What does SET FTP DEBUG show I wonder ....
  7399.  
  7400. > When I started a new copy of K95 and make an FTP connection to ftp.kermit,
  7401. > log in anonymously, cd kermit/bin, "get msvibm.zip", interrupt it with 'X'
  7402. > (so far so good), and then "reget msvibm.zip", I get:
  7403. > *************************
  7404. > RECEIVE- or GET-class command failed.
  7405. >  Packets received: 21505
  7406. >  Damaged packets: 0
  7407. >  Timeouts: 0
  7408. >  Packet length: 4000
  7409. >  Most recent local error: "Bad file descriptor"
  7410. > *************************
  7411. > That's a Kermit message.  The FTP connection was closed.  That's apparently
  7412. > what happened the first time too?  I wonder where K95 thought it was 
  7413. > REGET'ing the file from...
  7414.  
  7415. Interesting ...
  7416.  
  7417. > Starting a new copy of K95, doing the same thing again with a debug log, the
  7418. > same thing happens, except now the File Type: and File Size: fields in the
  7419. > file transfer display are blank???
  7420.  
  7421. So the debug.log is causing the file type and size to not be set?
  7422.  
  7423. > At this point (after 'X') there is no connection (verified by SHOW COMM and
  7424. > SHOW CONN).
  7425. > So then I told the same copy of cknker to "ftp watsun" so I could upload the
  7426. > debug log.  It put up the "Name:" popup, but typing goes to the prompt and
  7427. > not to the popup.  The popup sits there uselessly and there's no way to make
  7428. > it go away.  I had to exit again and start a new copy.
  7429. > Now I make an ftp connection ftp.kermit, logged in anonymously, set ftp
  7430. > debug and verbose on, file display brief.  Then "rcd kermit/bin" and this
  7431. > time I got the CD orientation messages correctly, with no missing pieces.
  7432. > So apparently this works only when FTP DEBUG is ON.
  7433. > Now I typed "reget msvibm.zip" (because I still have a partial msvibm.zip
  7434. > in my current directory) and K95 said "Sorry, GET /RECOVER requires
  7435. > binary mode."  I thought I put code in months ago to force binary mode for
  7436. > REGET!!!
  7437. > OK, so "ftp type bin", "reget msvibm.zip".  Now we get a neverending series
  7438. > of:
  7439. > 501 Invalid number of arguments.
  7440. >  GET  (binary) (-1 bytes)---> PASV
  7441. > 227 Entering Passive Mode (128,59,31,95,8,133).
  7442. > ftp: connect: Bad file descriptor
  7443. > : INTERRUPTED
  7444. > ---> SIZE
  7445. > 501 Invalid number of arguments.
  7446. >  GET  (binary) (-1 bytes)---> PASV
  7447. > 227 Entering Passive Mode (128,59,31,95,8,134).
  7448. > ftp: connect: Bad file descriptor
  7449. > : INTERRUPTED
  7450. > ---> SIZE
  7451. > 501 Invalid number of arguments.
  7452. >  GET  (binary) (-1 bytes)---> PASV
  7453. > which can't be interrupted.  Well, Ctrl-C is caught (because it echoes
  7454. > "^C..." but it doesn't stop anything.  I have to Ctrl-Alt-Del it.
  7455. > Now I switch to UNIX.  I used C-Kermit to make an FTP connection to watsun,
  7456. > interrupted a GET with 'x' and it seemed to work:
  7457. > C-Kermit>get wermit
  7458. > ---> SIZE wermit
  7459. > 213 2244608
  7460. >  GET wermit (binary) (2244608 bytes)---> PASV
  7461. > 227 Entering Passive Mode (128,59,39,2,7,35)
  7462. > ---> RETR wermit
  7463. > 150 Opening BINARY mode data connection for wermit (2244608 bytes).
  7464. > 426 Transfer aborted. Data connection closed.
  7465. > 226 Abort successful
  7466. > : INTERRUPTED
  7467. > C-Kermit>
  7468. > SHOW CONN says the connection is still open.  A second "get wermit" works,
  7469. > and can be interrupted successfully.  And a third, and so on.  But:
  7470. > C-Kermit>reget wermit
  7471. > ---> SIZE
  7472. > 500 'SIZE': command not understood.
  7473. >  GET  (binary) (-1 bytes)---> PASV
  7474. > 227 Entering Passive Mode (128,59,39,2,7,242)
  7475. > ---> RETR
  7476. > 500 'RETR': command not understood.
  7477. > ---> SIZE
  7478. > 500 'SIZE': command not understood.
  7479. >  GET  (binary) (-1 bytes)---> PASV
  7480. > 227 Entering Passive Mode (128,59,39,2,7,244)
  7481. > ---> RETR
  7482. > 500 'RETR': command not understood.
  7483. > and so on forever.  Obviously we're sending SIZE and RETR commands without
  7484. > operands -- something has been lost.  But then why does it loop?
  7485. >
  7486. I think most of the problems have been fixed (if they can be):
  7487.  
  7488. /BINARY switch now does the correct thing.  The reason it was not
  7489. working is that the PATTERNS code in getfile() did not pay attention
  7490. to the 'forcetype' flag which is set when a switch /BINARY /TEXT ... 
  7491. is used.
  7492.  
  7493. The reason that ASCII transfers are the default is because according
  7494. to the FTP protocol specs, ASCII transfers are the default.
  7495.  
  7496. File Collision Options were a bit weird.  The first time you issued an
  7497. FTP command the current File Collision Option would be assigned to 
  7498. FTP File Collision Option IFF the SET FTP COLLISION command had never
  7499. been issued.  But if you then issued a SET FILE COLLISION command the
  7500. original one would still be active for FTP.  Very confusing since
  7501. there was no way to determine what the FTP Collision setting would be.
  7502. I changed this to behave as follows: if the SET FTP COLLISION command
  7503. is not executed, the value of the SET FILE COLLISION command is used.
  7504.  
  7505. The reason there was a problem with REGET going into an infinite loop
  7506. is that the 'getone' flag was not being set.  Therefore, if there was
  7507. an error when calling ftpgetfile() the program would go into an
  7508. infinite loop attempting to REGET the same file over and over again.
  7509. Only problem was the second time through the loop the same
  7510. IP-Addr/Port combination would be used.  Unfortunately, since the
  7511. initial REGET failed the host was no longer waiting for a data
  7512. connection.   The connect() would fail and the control channel would
  7513. be closed as well.  Fixed by setting 'getone' for REGET as well as
  7514. GET.  
  7515.  
  7516. FTP REGET of files now work if the appropriate File Collision settings
  7517. are used.  REGET with UPDATE does not work if the Timestamps do not
  7518. match.  BINARY is not forced for REGET.  If you say 
  7519.  
  7520.   FTP TYPE TEXT
  7521.   FTP GET file
  7522.  
  7523. and then
  7524.  
  7525.   FTP REGET file
  7526.  
  7527. it is absolutely correct for the REGET to be rejected because the
  7528. previous transfer type was TEXT.  However, 
  7529.  
  7530.   FTP REGET /BINARY file 
  7531.  
  7532. will force the transfer to be performed anyway.  I tested this and it
  7533. works.
  7534.  
  7535. The problem with initial banners not being displayed was caused by an
  7536. incorrect setting of the verbose parameter for some of the many "PASS"
  7537. command instances.
  7538.  
  7539. The problem with the first four characters being deleted was caused by
  7540. an incorrect test in ftp_reply().  This is the code that was added to
  7541. strip the numeric responses.  However, this code was never written to
  7542. take into account the fact that some responses are multiple lines and
  7543. the numeric response only occurs on the first line.
  7544.  
  7545. I can't seem to find an ftp server that sends the directory README
  7546. file.  But I think the same change that fixed the above code would
  7547. work there.
  7548.  
  7549. File Transfer display Size and Filename.  This is a problem with
  7550. SSL/TLS connections that I do not believe can be solved in a trivial
  7551. manner.  It has to do with the code in ssl_dataconn() that turns off
  7552. the file transfer display because of the potential user prompts which
  7553. can occur if the server certificate info does not match what the user 
  7554. specified when making the connection.
  7555.  
  7556. There was a memory corruption error if /USER: and /PASSWORD: were used
  7557. on the FTP OPEN ... command line.  Memory was being free'd but the
  7558. pointers were not set to NULL.  Subsequent commands would act in a
  7559. random manner.
  7560.  
  7561. ^C is not processed in the ftp code in K95.  None of the FTP uses the
  7562. hokey ^C processing used in the command parser.
  7563.  
  7564. (End of quoted email from 22-23 May 2001)
  7565.  
  7566. Glen Thobe noticed that in Solaris 8, if you make an FTP connection,
  7567. GET a file, and then try to GET a file that doesn't exist, C-Kermit
  7568. loses its terminal modes and no longer echoes commands.  This seems to be
  7569. a double-barreled problem.  First of all, doftpget() did not call
  7570. ftscreen(SCR_TC,...) if the operation failed, so of course the echoing
  7571. was messed up after a failed FTP GET.  (Yet oddly enough, this showed up
  7572. only in Solaris 8...)  But fixing this didn't cure the problem.  Why?
  7573. Because the SCR_TC code in screenc() contained this:
  7574.  
  7575. #ifndef VMSCURSE
  7576.           endwin();
  7577. #ifdef SOLARIS
  7578.           conres();
  7579. #endif /* SOLARIS */
  7580. #endif /* VMSCURSE */
  7581.  
  7582. Unfortunately there is no explanatory comment, nor anything in my notes about
  7583. why/how/when the SOLARIS bit was added.  But taking out the call to conres()
  7584. fixes the problem and doesn't seem to break anything in Solaris 2.5.1.
  7585. ckcftp.c, ckuusx.c, 23 May 2001.
  7586.  
  7587. From Jeff: a fix for date-time strings sometimes having two extra 0's on
  7588. the end, e.g. in DIR listings.  ckuus6.c, 24 May 2001.
  7589.  
  7590. From Jeff: fix SHOW PROTO to print auto-blah strings with shostrdef() so
  7591. control chars appear as (e.g.) \{13}.  ckuus4.c, 24 May 2001.
  7592.  
  7593. From Jeff: fix FTP PWD, CD, CDUP to always display replies (including CD
  7594. orientation messages); fix a misplaced brace in ftpopen().  ckcftp.c,
  7595. 24 May 2001.
  7596.  
  7597. Define BIGBUFOK for all SOLARIS, not just Sparc.  ckcdeb.h, 24 May 2001.
  7598.  
  7599. Set NEWDEFAULTS if BIGBUFOK is defined.  Previously NEWDEFAULTS was set
  7600. only if OS2 was defined.  ckcker.h, 24 May 2001.
  7601.  
  7602. Made SET FTP DA be an OK abbreviation for DATES.  ckcftp.c, 24 May 2001.
  7603.  
  7604. Kermit server was not discarding an incompletely received file if the retry
  7605. limit is exceeded while trying to read an ACK.  In this case it calls errpkt()
  7606. to send "Too many retries" and errpkt() calls clsof().  But (a) it was calling
  7607. clsof() with the wrong argument (discard) and (b) clsof() was being called
  7608. again later.  Fixed errpkt() to call clsof(1) and then let clsof decide about
  7609. discarding or keeping (which it already did), and the protocol module to skip
  7610. calling clsof() a second time if it knew it has already sent an error packet.
  7611. ckcfn2.c, ckcpro.w, 24 May 2001.
  7612.  
  7613. It is increasingly likely that our fixed stringspace allocation will be used
  7614. up when building big and/or recursive file lists.  For BIGBUFOK UNIX builds,
  7615. the pool is currently set at 500000.  If it runs out on any particular
  7616. operation, it simply gets an error.  There's no way to make it handle more
  7617. filenames.  Of course we could always just make the pool bigger, but that
  7618. penalizes everybody.  Or does it?  With 0.5MB filename stringspace (as in
  7619. 7.0), Kermit uses about 2700K when doing a directory listing of a directory
  7620. with 2300 files.  When I double the stringspace to 1MB, it still uses 2700K.
  7621. But when I raise it to 5MB, it still uses 2700K.  This suggests that it might
  7622. be OK to simply make it bigger (because on most platforms, the memory is not
  7623. actually allocated until used), rather than coding some complicated dynamic
  7624. extension scheme.  But how big?  No number will satisfy everybody so we'll
  7625. need a command to change and reallocate.  Same deal for the maximum number of
  7626. filenames, currently 102400 (= 400KB) for BIGBUFOK builds.  So I left string
  7627. space at 0.5MB for UNIX BIGBUFOK builds (since, after all, only one person has
  7628. ever complained about it in all these years).  This allows 100,000 files with
  7629. an average namelength of 5 characters, or 50,000 files with an average name
  7630. length of 10, etc.  Then for adjustments in the #ifdef UNIX / #ifdef DYNAMIC
  7631. case, I added SET FILE STRINGSPACE <number> and SET FILE LISTSIZE <number> to
  7632. let the user to change the stringspace and the maximum number of files.  Added
  7633. this info to SHOW FILE also.  ckcker.h, ckuus[247].c, ckufio.c, 24 May 2001.
  7634.  
  7635. Now that we can change these two allocations independently, it's easy to
  7636. stress-test the code.  Sure enough, I found that UNIX C-Kermit would dump core
  7637. if the filename pointer array filled up before the string space did.  Added a
  7638. test for this.  Also ensured that if a too-large operand results in a malloc
  7639. failure, the old space remains undisturbed and usable.  ckufio.c, 24 May 2001.
  7640.  
  7641. Solaris 8 serial ports and dialing on PC, built with gcc 2.95.3...
  7642.  
  7643.  . Lockfile is SVR4 style with device numbers (OK)
  7644.  . /dev/term/a and /dev/ttya interlock properly.
  7645.  . But /dev/term/a and /dev/cua/a do not interlock.
  7646.  . However, if /dev/term/a is open then /dev/cua/a gets "device busy".
  7647.  . And vice versa.
  7648.  . Meanwhile, there is a secondary lockfile with a bogus name "fU".
  7649.    I wonder where this comes from.  The file 'a' in /dev/term is a symlink:
  7650.    a -> ../../devices/isa/asy@1,3f8:a
  7651.  
  7652. The bogus secondary lockfile name was because of a misplaced #ifdefs.  But
  7653. when we use device numbers in the lockfile name, there is no need for a
  7654. secondary lockfile (which is used only to account for multiple names for the
  7655. same device).  Fixed in ckutio.c, 24 May 2001.
  7656.  
  7657.  . Lockfiles are correctly deleted upon closing the device.
  7658.  . Stale lockfiles are correctly removed.
  7659.  
  7660. Uploading a big file at 115200 bps (on a V.90 connection) works fine (the
  7661. Solaris header files define higher rates but the port device driver doesn't
  7662. accept them).  RTS/CTS is fully effective.  Protocol defaults are now modern
  7663. (big buffers, etc).  Echoing of commands after curses display works fine.
  7664. Suspending and continuing are OK, including terminal modes.  Shell terminal
  7665. modes are normal after quitting.  In short, I couldn't reproduce any of
  7666. problems that were reported recently.  Of course this is on a PC, but the
  7667. complaints came from Sparc users.
  7668.  
  7669. Add -DNOFLOAT to Coherent 4.2 makefile entry.  makefile, 1 Jun 2001.
  7670.  
  7671. Lars Kellogg-Stedman <lars@larsshack.org> noticed that the PTY command wasn't
  7672. working in recent Linuxes.  Rug-pulling-out syndrome again.  Fixing it broke
  7673. it for old Linuxes like Red Hat 5.2 (surprise).  The most foolproof fix seemed
  7674. to be to rewrite the makefile entry to test for the presence of /dev/ptmx,
  7675. with corresponding shuffling of #ifdefs in the pty module: separation of
  7676. HAVE_STREAMS from HAVE_PTMX (needs checking on non-Linuxes, but I think only
  7677. SINIX used HAVE_STREAMS...)  Experimental for now.  One good byproduct of this
  7678. is that the new linux makefile entry (xlinux) is not only simplified but much
  7679. more flexible -- almost a configure script in itself, but without the previous
  7680. deeply nested if-then-else's, so new tests can be easily added.
  7681. ckupty.c, makefile, 5 Jun 2001.
  7682.  
  7683. After additional testing and verification of new Linux entry, removed the
  7684. old one and made the new the "make linux" target.  Made sure the ptys work
  7685. on Solaris, SunOS, Linux, and SINIX.  makefile, 6 Jun 2001.
  7686.  
  7687. From Jeff, 7 Jun 2001:
  7688.  
  7689.  . New makefile targets:
  7690.      solaris2xg+openssl+zlib+pam+shadow
  7691.      solaris8g+openssl+zlib+pam+shadow
  7692.      solaris8g+krb4
  7693.  . ckupper() added to ckclib.[ch], like cklower().
  7694.  . Fix to a debug() statement for packet CRC, ckcfn2.c.
  7695.  . Change SET TELNET COMPORT to COM-PORT to match RFC spelling, ckuus[r3].c.
  7696.  . Move misplaced paren in dump[rs]buf() printf(): ckcfn3.c.
  7697.  . New ckuath.c, ckctel.h, ckcnet.c, ck_ssl.c (didn't look at them).
  7698.  
  7699. Jeff also changed the -d command-line option to produce a timestamped debug
  7700. log, probably temporarily and forgot to put it back, but since there is no
  7701. way to do this from the command line, I added a quick hack to turn on
  7702. timestamping if -d is included more than once, in the spirit of many other
  7703. UNIX programs that select the debugging level by the number -d's.  prescan():
  7704. ckuus4.c, 7 Jun 2001.
  7705.  
  7706. Made -DSOLARIS8 imply -DSOLARIS7, which, in turn, implies 2.6, 2.5, 2.4, ...
  7707. (in other words, added the missing "each Solaris version implies all earlier
  7708. ones" clause for Solaris 8).  Added the various SOLARISxx version symbols to
  7709. SHOW FEATURES (back to 2.4).  ckcdeb.h, ckuus5.c, 7 Jun 2001.
  7710.  
  7711. Simplified Solaris makefile targets by removing -Dxxx's that are now taken
  7712. care of ckcdeb.h.  makefile, 7 Jun 2001.
  7713.  
  7714. From Lucas Hart: Addition of machine-model info for OSF/1 and Solaris.
  7715. Changed the governing #ifdefs to be conservative about which versions get
  7716. this code (Tru64 UNIX only, not all OSF/1's, and Solaris 2.5 and later) since 
  7717. we can't verify on earlier versions.  Used by debug log, \v(model), and
  7718. SHOW FEATURES.  sysinit(): ckutio.c, 7 Jun 2001.
  7719.  
  7720. From Lucas: Fix an off-by one error in setting the architecture name in
  7721. the VMS version (VA instead of VAX, etc).  ckvtio.c, 7 Jun 2001.
  7722.  
  7723. From Jeff, 24 Jun 2001:
  7724.  . Add #include <netinet/tcp.h> to pick up ... ckcnet.h
  7725.  . Fix a null-pointer-dereferencing vulnerability in zzstring(): ckuus4.c.
  7726.  . Add prototype for ckupper(): ckclib.h.
  7727.  . Add FD_SETSIZE display to SHOW FEATURES: ckuus5.c.
  7728.  . Fill in a missing IKSD REMOTE LOGIN case: ckcpro.w.
  7729.  . Fix an HTTP proxy host identification detail in netopen(): ckcnet.c.
  7730.  . Fix a pair of potential 1-byte memory leaks: ckctel.c.
  7731.  . Fix FTP OPEN to expand variables in username, password, & acct: ckcftp.c.
  7732.  . New ck_crp.c and ckuath.c modules.
  7733.  . Updated and new security targets + new, secure RH7.1 target: makefile.
  7734.  
  7735. Jeff reported a problem in which "def xx ask \%c prompt:" would not display
  7736. the prompt when xx is executed, which I can't reproduce in C-Kermit or K95.
  7737. But in fooling with this I noticed that you can't type ? in the response text
  7738. any more.  It worked in 6.0 and has been broken since 7.0.  Fixed in gtword(),
  7739. which needed a special case for '?' in ASK.  ckucmd.c, 24 Jun 2001.
  7740.  
  7741. A related but more difficult problem is when a command contains a '?'  because
  7742. it was typed with a preceding '\' to suppress its normal help function, it
  7743. goes into the command buffer with the '\' stripped; thus when you recall the
  7744. command with Ctrl-P gtword() thinks you typed '?' for help.  gtword() already
  7745. had a flag, chsrc, that tells whether the current character came from the
  7746. keyboard, so I just needed to test it before entering the code that processes
  7747. ?, Esc, Tab, Rubout, ^U, etc.  ckucmd.c, 24 Jun 2001.
  7748.  
  7749. There was a related problem with files that have question marks in their names.
  7750. Suppose a file is named "abc?123".  If you want Kermit to TYPE it, you can't
  7751. use "type abc?123" because that gives help.  If you use "type abc\123", this
  7752. forces the command parser to accept the question mark, but when cmifi() gets
  7753. result, it thinks it's a wildcard rather than a literal character.  So it must
  7754. be quoted for cmifi() too: "type abc\\\?123".  This command works (but it
  7755. didn't work in 6.0 and 7.0), and now recalling it works too.
  7756.  
  7757. One last item in this area: also skip the ?/Esc/Tab/Rub/^U/etc processing if
  7758. stdin is not a tty.  gtword(): ckucmd.c, 24 Jun 2001.
  7759.  
  7760. Jeff said "mget makefile ck[cu_]*.[cwh]" did not work between K95 and CK,
  7761. but it works for me, no matter which side is the client and which is the
  7762. server.  All the files are sent correctly and nobody says "file not found".
  7763.  
  7764. Dell Coleman <dell@aleph.tum.com> mentioned recently that SET FILE
  7765. DOWNLOAD-DIRECTORY did not work for XYZMODEM.  There's no reason why it
  7766. shouldn't.  Added code for this to the non-Kermit section of xxproto():
  7767. ckcpro.w, 24 Jun 2001.
  7768.  
  7769. We already have a GREP command and a /COUNT option, but no way to access the
  7770. result programmatically, so I added an optional variable-name argument to
  7771. /COUNT, e.g. "grep /count:\%x XYZ ckc*.c".  ckuus[26].c, 24 Jun 2001.
  7772.  
  7773. Changed dumprbuf() and dumpsbuf() to avoid warnings on machines with 64-bit
  7774. pointers; needs testing on Tru64 5.0A (which I don't have access to):
  7775. ckcfn3.c.  Commented out some debug() statements in ckuxla.c for the same
  7776. reason.  It's pretty much no longer ok to assign addresses to ints or even
  7777. to longs, or to print them, without taking special pains.  24 Jun 2001.
  7778.  
  7779. Gerry Belanger wanted an idle limit in C-Kermit, like there is in K95.
  7780. It's easy enough to add in the select() versions as SET TERMINAL IDLE-LIMIT
  7781. (rather than CONNECT /IDLE-LIMIT:n, which is too tied up with #ifdef OS2's).
  7782. SET TERMINAL IDLE-LIMIT should now also be effective in K95.
  7783. ckuusr.h, ckuus[27].c, ckucns.c, 24 Jun 2001.
  7784.  
  7785. But what should happen when the idle-limit goes off?  In k95, it simply
  7786. returns to command mode.  There is no indication of *why* it returned to
  7787. command mode, so how can a script know what to do?  Added a new variable:
  7788. \v(cx_status).  Values are listed in ckcker.h as CSX_xxx, and are set in
  7789. ckucns.c in every spot where it returns.  We can mess with the values for now,
  7790. but they have to be stable before we release, since scripts will depend on the
  7791. actual numeric values.  To add to K95, search ckucns.c for all occurrences of
  7792. "cx_status" and add the corresponding statements in the K95 modules; ditto for
  7793. VMS, etc (still to be done).  For docs, note that idle-limit is enforced only
  7794. while CONNECT mode is active; not in command mode, and not when PUSH'd from
  7795. CONNECT mode, not while executing APCs, not while running scripts, etc.  Maybe
  7796. this could be done in K95 (which has threads), but not in C-Kermit.
  7797. ckcker.h, ckuus4.c, ckucns.c, 24 Jun 2001.
  7798.  
  7799. This is fine for scripts, but what if we want the connection to hang up
  7800. automatically after an idle timeout without making the user run a script?
  7801. (Which is what Gerry wanted in the first place.)  What we really need is a way
  7802. to specify the idle timeout and the timeout action separately: return to
  7803. command mode but keep the connection open, send a string and remain in CONNECT
  7804. mode, hangup and return to command mode, or whatever else we can think of.
  7805.  
  7806. From Jeff: new CSX_blah (CONNECT status) values for K95 (but I wish you would
  7807. use shorter symbols in the universal header files -- some old compilers might
  7808. choke on these -- nothing is gained by making them so long).  From me:
  7809. IDLE_blah symbols for idle actions.  ckcker.h, 25 Jun 2001.
  7810.  
  7811. Added:
  7812.  
  7813.   SET TERMINAL IDLE-TIMEOUT <sec>
  7814.   SET TERMINAL IDLE-ACTION { HANGUP, OUTPUT <string>, RETURN, EXIT, ... }
  7815.  
  7816. This supersedes SET TERM IDLE-SEND (which still works but is invisible).  The
  7817. idle timeout is now tt_idlelimit (secs), but SET TERM IDLE-STRING also still
  7818. sets tt_idlesnd_tmo in case anybody still refers to it.  SET TERM IDLE-ACTION
  7819. sets tt_idleact; the values are defined in ckuusr.h as IDLE_blah symbols.
  7820. Changed SHOW TERMINAL to show new TERMINAL IDLE-blah settings.  ckuusr.[ch],
  7821. ckuus7.c, 25 Jun 2001.
  7822.  
  7823. Changed UNIX select() CONNECT module to follow the new TERMINAL IDLE-ACTION
  7824. and IDLE-TIMEOUT settings.  See CKTIDLE sections.  ckucns.c, 25 Jun 2001.
  7825.  
  7826. Removed TERMINAL IDLE-SEND from the HELP text and added help text for the
  7827. two new options.  Also removed the clause that says that variables and Kverbs
  7828. are evaluated at transmission time, because this was never true (the cmtxt()
  7829. call that parses the string passes it through xxstring()).  ckuus2.c,
  7830. 25 Jun 2001.
  7831.  
  7832. Uppercased HELP, INTRO, LICENSE, and SUPPORT keywords in the top-level command
  7833. table so they stand out better in top-level ?-help.  Made the following top
  7834. level commands invisible, since they are confusing and/or rarely used and/or
  7835. "deprecated" and/or useless at top level: ASSERT, EIGHTBIT, IKSD, LOCAL, LS,
  7836. QUERY, and REINPUT (IKSD is confusing because, if you didn't know what it did,
  7837. it could just as easily start an IKSD server as make a connection to one; I
  7838. can always make it visible again, but maybe we need a less confusing name for
  7839. telnet'ing to an IKSD server.)  ckuusr.c, 25 Jun 2001.
  7840.  
  7841. Added an SSHCMD symbol to ckuusr.h, which is defined if NETPTY is defined
  7842. and NOPUSH is not defined, or if SSH is defined.  25 Jun 2001.
  7843.  
  7844. In the NETPTY case only, added SSH and SET SSH COMMAND commands, which appear
  7845. if SSHCMD is defined.  The default SSH command is "ssh -e none".  The SET SSH
  7846. COMMAND value is shown by SHOW NET.  Also filled in HELP SSH and HELP SET SSH.
  7847. This makes SSH visible, and creates a transparent connection by default so
  7848. we can transfer file through it (normally its esape character is tilde, like
  7849. rlogin and cu, which would clobber the very first Kermit packet).
  7850. ckuusr.[ch], ckuus[2347].c, ckucns.c.  25 Jun 2001.
  7851.  
  7852. Note: on watsun, the SSH command usually works, but sometimes fails with
  7853. "/dev/ttyp6: permission denied" -- I don't recall seeing this before, but
  7854. I didn't touch the pty module or ttopen()...
  7855.  
  7856. Removed the telephone section from the SUPPORT command text.  Everybody should
  7857. be able to handle email by now.  ckuus6.c, 25 Jun 2001.
  7858.  
  7859. Fixed out-of-order keywords in TELNET-command switch table.
  7860. ckuus7.c, 25 Jun 2001.
  7861.  
  7862. Added a second argument to gtword() for options, changed all calls to gtword()
  7863. to supply 0 for this arg.  Then tried defining an option to disable ?-help
  7864. and \-quoting in fields that were in doublequotes, but quickly got into big
  7865. trouble so backed off.  ckucmd.c (no changes), 25 Jun 2001.
  7866.  
  7867. Since we're going to have SSH, and because more time has passed, and for extra
  7868. hype, changed the C-Kermit version from 7.1.199 to 8.0.200.  Still need to
  7869. change all the module version numbers...  ckcmai.c, 25 Jun 2001.
  7870.  
  7871. From Jeff: shorten new CSX_xxx symbols in ckcker.h; put \v(cx_status) in
  7872. #ifdef NOLOCAL in ckuus4.c, 26 Jun 2001.
  7873.  
  7874. Added SET ATTRIBUTE FORMAT { ON, OFF } to let C-Kermit adapt to Tandem Kermit
  7875. that sends a whacky record-format code.  ckcmai.c, ckuus7.c, 26 Jun 2001.
  7876.  
  7877. Considered adding a new protocol option to negotiate UTF-8 filenames,
  7878. independent of the file and transfer character set; a great idea in principal,
  7879. but a BIG can of worms in practice.  So I tabled the idea indefinitely
  7880. (writeup available on request).  In any case, at least I worked out a safe
  7881. way to add more capability bits.  26 Jun 2001.
  7882.  
  7883. Fix from Jeff for HTTP proxy code.  ckuus7.c, ckcnet.c, ckcftp.c, 27 Jun 2001.
  7884.  
  7885. New SSL targets for Solaris 2.6 from Joerg Heitkoetter.  Makefile, 27 Jun 2001.
  7886.  
  7887. Changed version strings in all modules from 7.1.xxx to 8.0.xxx. 27 Jun 2001.
  7888.  
  7889. Set cx_status in VMS CONNECT module.  ckvcon.c, 27 Jun 2001.
  7890.  
  7891. Moved shostrdef() prototype from ckuus7.c to to ckuusr.h, and added casts to
  7892. non-(CHAR *) shostrdef() args in ckuus4.c, 27 Jun 2001.
  7893.  
  7894. Added missing \n\ at end of continued string constant in HELP SSH text.
  7895. ckuus2.c, 27 Jun 2001.
  7896.  
  7897. Added missing #ifdef CKTIDLE..#endif around getiact().  ckuus7.c, 27 Jun 2001.
  7898.  
  7899. Fixed Ctrl-\u in VMS CONNECT on Telnet connection -- it didn't do anything,
  7900. now it closes the connection.  ckvcon.c, 27 Jun 2001.
  7901.  
  7902. Discovered that the FAST and CAUTIOUS (but not ROBUST) commands were commented
  7903. out.  My notes show that this happened 25 Mar 1999 but then I thought I undid
  7904. it a week later, but evidently I only undid for ROBUST and not the other two.
  7905. Now they are uncommented but invisible, which was the original intention.
  7906. Strange that nobody noticed this in 2+ years...  ckuusr.c, 27 Jun 2001.
  7907.  
  7908. Mark Sapiro reported the FreeBSD 4.x echoing problem had resurfaced in FBSD
  7909. 4.0 in Beta.01.  Unfortunately I only have access to 3.3 and 4.3.  It doesn't
  7910. happen on either of those...
  7911.  
  7912. SSH on FreeBSD 4.3 localhost connection: interactive connection works, scripts
  7913. work, but streaming file transfers just sit there in the first data packet.
  7914. Turning streaming off fixes it.  It also works with streaming on, but only
  7915. when the packet size is 1K or less.  The same thing happens with a
  7916. long-distance SSH connection, so evidently it's a problem with the FreeBSD
  7917. pty.  However, there is no problem RECEIVing with streaming on an SSH
  7918. connection (and we get pretty good speed too, like 700Kbps).
  7919.  
  7920. Still on FreeBSD...  Discovered that neither it nor any of the other *BSDs
  7921. included Rlogin support, not that it matters much since you can't use it
  7922. unless you're root.  Added BSD44 to the list of RLOGCODE platforms in ckcnet.h
  7923. (adds about 7K to the binary), 27 Jun 2001.
  7924.  
  7925. UnixWare 7.1.1: SSH file transfers work fine, streaming and all.
  7926.  
  7927. Discovered that fullscreen file transfer display, when it prints the
  7928. "Network type:" value, indexes into the netname[] array without checking
  7929. bounds.  This array was not updated when NET_PTY was added as a network type,
  7930. so SSH or any other pty-based connection caused a wild memory reference.
  7931. Added code to check the bounds, plus some dummy entries that will show up
  7932. automatically the next time we add a network type without updating this array.
  7933. Also, the netname[] array contained a bogus "SSH" entry, which threw
  7934. everything after it off by one.  ckcnet.h does not define a network type of
  7935. SSH.  ckuusx.c, 27 Jun 2001.
  7936.  
  7937. Corrected spelling "psuedoterminal" -> "pseudoterminal" in several places.
  7938. ckuus4.c, 27 Jun 2001.
  7939.  
  7940. Built without incident on HP-UX, which doesn't have an ssh client installed.
  7941. "ssh watsol" says:
  7942.  
  7943.   /dev/pty/ttyp3: Permission denied
  7944.   ?Initialization failure
  7945.  
  7946. which I don't understand; "pty ssh watsol" does something *slightly* more
  7947. reasonable: enters CONNECT mode and then immediately pops back to the prompt
  7948. (no error message).  "pty telnet watsol", however, works fine.  Hmmmm, but
  7949. after doing these, "ssh watsol" doesn't get the "permission denied" error any
  7950. more and behaves just like "pty ssh watsol".  The same thing was happening on
  7951. watsun yesterday.  I wonder what the deal is...  Anyway, I suppose I could
  7952. try to prevalidate the "ssh" command by doing a PATH search or somesuch, but
  7953. that does not take into account the user's shell aliases and so forth.  So
  7954. unfortunately there's no good way to give a meaningful error message if the
  7955. 'ssh' command is not found.
  7956.  
  7957. Mark Sapiro reports FreeBSD 4.0 OK after all; he used the wrong makefile
  7958. target because the makefile didn't list the freebsd41,42,43 targets in the
  7959. comments at top.  Fixed in makefile, 28 Jun 2001.
  7960.  
  7961. Changed logpkt() to convert the packet-start character to Caret-Letter
  7962. notation so looking at packet logs in the Kermit terminal screen does not
  7963. trigger an autodownload.  ckcfn2.c, 28 Jun 2001.
  7964.  
  7965. HELP SET TERM didn't include IDLE-TIMEOUT.  ckuus2.c, 28 Jun 2001.
  7966.  
  7967. Feature-set builds on Linux, gcc 2.96, 28 Jun 2001:
  7968.  
  7969. Build           Size    Savings     Corrections needed
  7970.  Full        1984671          -      None
  7971.  NOSPL       1667990     316681      ckucmd.c ckuus6.c
  7972.  NOCSETS     1607616     377055      none
  7973.  NONET       1710743     273928      ckuusx.c
  7974.  NOFTP       1843513     141158      none
  7975.  NODEBUG     1769572     215099      none
  7976.  NOHELP      1699954     284717      none
  7977.  NOLOCAL     1445894     538777      ckuusr.h
  7978.  NODIAL      1844366     140305      none
  7979.  NOXFER      1452623     532048      none
  7980.  NOICP        479462    1505209      none
  7981.  NOPUSH      1937601      47070      none
  7982.  
  7983. SSH funnies...
  7984.  
  7985.  . /dev/ptyxxx: Permission denied.  Seems to happen just
  7986.    about everywhere, but if you try again, it doesn't happen.
  7987.  
  7988.  . SSH connection to HP-UX 9.05 -- logging out from HP-UX doesn't close the
  7989.    connection (but others OK...)
  7990.  
  7991.  . File transfer works mostly fine.  We get a few errors/retransmissions but
  7992.    that's OK because Kermit does not consider this a reliable connection and
  7993.    so does not stream.  (But AIX gets LOTS of errors unless a small packet
  7994.    size, like 800, is used.)
  7995.  
  7996.  . SSH doesn't use net directory...
  7997.  
  7998.  . Xfer display Network Type: says TCP/IP instead of PTY...
  7999.  
  8000. Added notes about secure entries to makefile.  28 Jun 2001.
  8001.  
  8002. Linux...  The new makefile entry works pretty well (everywhere but Debian 2.1).
  8003.  
  8004. Changes that didn't get into all the binaries, 29 Jun 2001:
  8005.  . zchin() return code correction for ZIFILE, ckufio.c.
  8006.  . Corrections to HTTP command error handling, ckcnet.c.
  8007.  . Print error message on pty allocation failure, ckupty.c.
  8008.  
  8009. ---C-Kermit 8.0.200 Beta.02---
  8010.  
  8011. Added sco32v505x and sco32v505xnet entries that work on my SCO OSR5.0.5
  8012. installation.  makefile, 29 Jun 2001. 
  8013.  
  8014. Added linuxnp entry for Linuxes that have /dev/ptmx but do not have grantpt(),
  8015. unlockpt(), or ptsname(), such as Debian 2.1.  makefile, 29 Jun 2001. 
  8016.  
  8017. Fixed typos reported in SCO OSR5.0.5 gcc targets reported by Emilio Perea.
  8018. makefile, 30 Jun 2001.
  8019.  
  8020. Added -DNETPTY to Ultrix 4.4 and 4.5 entries and put #include <string.h>
  8021. within #ifndef ultrix..#endif in ckupty.h, so the Ultrix version can be
  8022. compiled with PTY support.  But it doesn't work at runtime.  The base Ultrix
  8023. 4.x entry had -DNODEBUG, so removed that and rebuilt to debug (which went
  8024. OK despite warning about "bizarre relocation errors" in the makefile
  8025. comments):
  8026.  
  8027.   pty_getpty() found pty master[/dev/ptyp1]
  8028.   pty_getpty() slavebuf [2][/dev/ttyp1]
  8029.   do_pty() Xline[/dev/ttyp1]
  8030.   do_pty()[Slave starts]
  8031.   getptyslave()
  8032.   ptyint_void_association()[setsid()]
  8033.   ptyint_void_association() open(/dev/tty,O_RDWR)[/dev/tty]=-1
  8034.  
  8035. Here we try to get a handle on /dev/tty so we can do a TIOCNOTTY ioctl on
  8036. it to void the association with the console, but the open() fails (why?)
  8037. But according to the code, this is not fatal...
  8038.  
  8039.   pty_open_ctty() slave[/dev/ttyp1]
  8040.   ptyint_void_association()[setsid()]
  8041.   ptyint_void_association() open(/dev/tty,O_RDWR)[/dev/tty]=-1  <-- same deal
  8042.   pty_open_ctty() open ok[/dev/ttyp1]
  8043.   pty_initialize_slave()[fd]=7
  8044.   pty_initialize_slave()[pid]=3575
  8045.   pty_open_slave() open failed[/dev/tty]
  8046.   getptyslave()[Unable to open slave]=44806918
  8047.   do_pty()[getptyslave() fails - exiting]
  8048.   do_pty()[Slave fails to initialize]
  8049.  
  8050. Another failure to open /dev/tty.  A peek at the code reveals that all these
  8051. failures are in #ifndef NO_DEVTTY sections... Sure enough, defining NO_DEVTTY
  8052. removes those sections and makes it work.  makefile, ckupty.c, 30 Jun 2001.
  8053. (But later reports indicate that the Ultrix pty driver is not well buffered
  8054. and flow-controlled and can't handle file transfer thru ssh.)
  8055.  
  8056. Minor adjustments to the new ultrix44 and 45 makefile targets (which worked
  8057. with DEC make) for GNU make.  1 Jul 2001.
  8058.  
  8059. Updated Coherent 4.2 makefile target from Fred Smith.  makefile, 2 Jul 2001.
  8060.  
  8061. Put "#include <netinet/tcp.h>" in #ifndef SV68R3V6..#endif to fix Sys V R3
  8062. build on Motorola 68000 (Gerry Belanger).  This one might need to be
  8063. generalized to all System V prior to SVR4.  ckcnet.h, 2 Jul 2001.
  8064.  
  8065. Emilio Perea confirmed that the sco32v505x entries work on a vanilla 5.0.5
  8066. system, so I replaced sco32v505 entries (that didn't work on either mine or
  8067. his) with them.  makefile, 2 Jul 2001.
  8068.  
  8069. Updated sv68r3v6 target to use xermit instead of wermit and added -DSELECT
  8070. (Gerry Belanger).  makefile, 3 Jul 2001.
  8071.  
  8072. Improved error reporting for pty module.  ckupty.c, 5 Jul 2001.
  8073.  
  8074. From Jeff:
  8075.  . SET SSL {DSA,RSA}-CERTS-CHAIN-FILE command.
  8076.  . HTTP OPEN, HTTP CLOSE: persistent, separate HTTP connections.
  8077. ck_ssl.c ck_ssl.h ckcdeb.h ckcftp.c ckcmai.c ckcnet.c ckcnet.h ckuath.c
  8078. ckupty.c ckupty.h ckuus2.c ckuus3.c ckuus7.c ckuusr.c ckuusr.h, 5 Jul 2001.
  8079.  
  8080. Replaced strdup() calls with makestr().  ckcnet.c, 5 Jul 2001.
  8081.  
  8082. Added HTTP OPEN /SSL /TLS switches.  ckuusr.c, 5 Jul 2001.
  8083.  
  8084. Discovered that all the HTTP blah /ARRAY:a commands created array elements
  8085. with trailing CRLFs.  Fixed in about 20 repetitious code chunks in ckcnet.c,
  8086. 5 Jul 2001.
  8087.  
  8088. Looked at parsing "email-style" dates like "Fri, 26 Nov 1999 23:12:22 GMT",
  8089. which are found in HTTP headers...  If you remove "Fri, " and " GMT", it's
  8090. parseable.  It's easy enough to remove the day of week from the front, but
  8091. what about the GMT?  Here we run into exactly the same problems we had with
  8092. FTP.  We have no way of converting from GMT to local time, nor of recording
  8093. the timezone if it's not GMT.  Suppose we want to use an HTTP header like:
  8094.  
  8095.   Last-Modified: Mon, 06 Sep 1999 22:35:58 GMT
  8096.  
  8097. to compare with some local date (e.g. a file date, or an /AFTER or /BEFORE
  8098. date).  We could do this by (a) stripping the DOW, (b) verifying that the
  8099. timezone is GMT (UCS, whatever) and then stripping it, (c) parsing the
  8100. result, (d) converting to internal format (sec since 19700101 00:00:00),
  8101. converting the local date to internal format GMT, and (e) comparing.
  8102. Similarly for asctime() format, like "Thu Jul  5 11:48:56 EDT 2001".
  8103. The hard part is the timezone, not the additional date formats.  Therefore,
  8104. I'm deferring any work on adding /BEFORE and /AFTER switches to HTTP
  8105. until at least one user asks for them.
  8106.  
  8107. Similarly for searching HTTP headers for a specific tag and getting its value.
  8108. This is easily done in a script:
  8109.  
  8110.   http open www.columbia.edu
  8111.   if fail stop 1 HTTP OPEN failed
  8112.   http /array:a get kermit/index.html /dev/null
  8113.   if fail stop 1 HTTP GET failed
  8114.   for \%i 1 \fdim(&a) 1 {
  8115.       .\%x := \findex(:,\&a[\%i])
  8116.       if not \%x { echo BAD LINE, continue }
  8117.       echo TAG = "\fleft(\&a[\%i],\%x-1)"
  8118.       echo VAL = "\fltrim(\fsubstr(\&a[\%i],\%x+1))"
  8119.   }
  8120.   http close
  8121.  
  8122. Or to do a tag search (e.g. for Date:), replace the loop with:
  8123.  
  8124.   .\%i = \farraylook(Date:*,&a)
  8125.   .\%x := \findex(:,\&a[\%i])
  8126.   if not \%x { echo BAD LINE, continue }
  8127.   echo VAL = "\fltrim(\fsubstr(\&a[\%i],\%x+1))"
  8128.  
  8129. (We can't use \fsplit() to break the string because the value itself might
  8130. contain :'s.)
  8131.  
  8132. It would, of course, be possible to add Yet Another Function to split a string
  8133. into two pieces, breaking on the first colon (or equal sign, whatever), but we
  8134. already have so many other functions like this (but slightly different), I
  8135. think it would add more confusion than usefulness, especially since it would
  8136. need to return two values.
  8137.  
  8138. Discovered that HTTP arrays were (a) missing the first element, and (b)
  8139. contained an empty last element.  Fixed in http_mkarray() to account for
  8140. the fact that the argument array is 0-based but Kermit arrays are 1-based.
  8141. ckcnet.c, 5 Jul 2001.
  8142.  
  8143. From Jeff, new FTP and HTTP variables:
  8144.  
  8145.  ftp_fd         - current file descriptor
  8146.  ftp_security   - security method negotiated
  8147.  ftp_cpl        - command channel privacy mode
  8148.  ftp_dpl        - data channel privacy mode
  8149.  http_security  - security method negotiated
  8150.  http_fd        - current file descriptor
  8151.  http_connected - are we?
  8152.  http_host      - hostname of http server
  8153.  http_code      - last status code
  8154.  http_message   - last status message
  8155.  
  8156. Plus change in default ciphers for FTP SRP, correction to authtype variable,
  8157. which did not take into account difference between client and server mode.
  8158. ckuusr.h ckuus4.c ckcftp.c ckcnet.c, 5 Jul 2001.
  8159.  
  8160. Added missing CK_SSL #ifdefs to new ckcnet.c code.  ckcnet.c, 5 Jul 2001.
  8161.  
  8162. Some time in the past year-and-a-half I changed FOR loops to allow macros as
  8163. loop variables.  This turns out to work for some variable names but not
  8164. others.  For example, it works for i but not for x.  Why?  Because somewhere
  8165. in the bowels of the parser, a backslash is being inserted in front of the
  8166. variable name on the assumption that it's a backslash variable (which needs to
  8167. be quoted).  This doesn't hurt "i" because "\i" means just "\i", but "\x" is a
  8168. hex-code introducer.  It turns out we're not doing this in the code at all --
  8169. it's simply the consequence of the master FOR macro definition in ckuus5.c:
  8170.  
  8171.  /* FOR macro */
  8172.  char *for_def[] = { "_assign _for\\v(cmdlevel) { _getargs,",
  8173.  "def \\\\\\%1 \\feval(\\%2),:_..top,if \\%5 \\\\\\%1 \\%3 goto _..bot,",
  8174.  "\\%6,:_..inc,incr \\\\\\%1 \\%4,goto _..top,:_..bot,_putargs},",
  8175.  "def break goto _..bot, def continue goto _..inc,",
  8176.  "do _for\\v(cmdlevel) \\%1 \\%2 \\%3 \\%4 { \\%5 },_assign _for\\v(cmdlevel)",
  8177.  ""};
  8178.  
  8179. which is appropriate for \%x loop variables, but not for loop variables that
  8180. are macros.  So we solve this by having two FOR macros, one for each case.
  8181. ckuus[56].c, 5 Jul 2001.
  8182.  
  8183. Dat Nguyen reported trouble with FTP MGET /LISTFILE: and once I figured out
  8184. how to reproduce it, it only took all evening to fix it.  To make a long story
  8185. short: at some point the code says "src = mgetlist[mgetx];".  Later, we use
  8186. the src pointer for making some comparisons to decide whether a file should be
  8187. skipped.  However, between these two places, it was possible for
  8188. mgetlist[mgetx] to be freed and reallocated, thus leaving src pointing at some
  8189. random thing, which, since it didn't compare as expected, caused the file to
  8190. be skipped.  It was hard to find, because sometimes the old freed string
  8191. pointed by src was still there (depends on your free() implementation, state
  8192. of the heap, etc) so nothing seemed to be wrong.  The obvious solution was to
  8193. make sure the src pointer is up to date before using it.  ckcftp.c,
  8194. 5 Jul 2001.
  8195.  
  8196. Added SET EXIT HANGUP { OFF, ON }, ON by default.  When OFF, doclean()
  8197. (invoked by doexit()) skips the section that hangs up and closes the
  8198. communication device.  ckcmai.c, ckuus[235x].c, 6 Jul 2001.
  8199.  
  8200. Updated hostmode.ksc and hostmdm.ksc to fix many problems: the multiple
  8201. config files feature didn't work at all, various spurious error messages
  8202. came out, and it didn't do anything useful if COMMPORT was not defined
  8203. (as it is not by default, so in this case I made it offer to use TAPI).
  8204. 6 Jul 2001.
  8205.  
  8206. From Jeff, 7 Jul 2001:
  8207.  . Minor change to FTP authtype variable: ckcftp.c, ckcnet.c.
  8208.  . Minor syntax adjustments: ckuusr.c, ckuus4.c.
  8209.  
  8210. The GREP command allowed ^ and $ pattern anchors, but only because of special
  8211. code in dogrep() to preprocess the pattern before sending it to ckmatch().
  8212. But if GREP can do it, why not also other GREP-like functions, such as
  8213. \farraylook(), \fsearch(), \frsearch(), TYPE /MATCH:, and IF MATCH?  So rather
  8214. than hack up each of these commands to handle ^ and $, I added a new option to
  8215. ckmatch(), opts bit 2: when set, ckmatch() allows anchors (and the absence of
  8216. an anchor implies a '*').  Then I changed each of the commands and functions
  8217. listed to set this bit in the ckmatch() call.  Obviously the new bit must be
  8218. used with caution.  For example, it should NEVER be set by code that is
  8219. matching filenames, or else "delete x" would delete all files whose names
  8220. contained an "x", rather than just the "x" file.  Anyway the changes should be
  8221. safe because they affect only the commands and functions listed.  ckcfns.c,
  8222. ckcftp.c, ckclib.c, ckucmd.c, ckufio.c, ckuus[456x].c, 7 Jul 2001.
  8223.  
  8224.   anchored     floating
  8225.     foo          ^foo$
  8226.     *foo         foo$
  8227.     foo*         ^foo
  8228.     *foo*        foo
  8229.  
  8230. Split HELP WILDCARD and HELP PATTERN.  ckuus2.c, 7 Jul 2001.
  8231.  
  8232. Yesterday's changes broke \fsearch(), which works by looping through the
  8233. string and calling ckmatch() each time through the loop.  Since \fsearch()
  8234. matches are now floating by default, then if it succeeds at all, it always
  8235. succeeds on the first trip thru the loop, thus returning a match position of
  8236. 1.  This raises the old question about how to make ckmatch() itself return the
  8237. match position -- then we wouldn't need a loop.  So I went back and finally
  8238. did it.  \fsearch() now simply reports ckmatch()'s return value.  ckclib.c,
  8239. ckuus4.c, 8 Jul 2001.
  8240.  
  8241. But now \frsearch has a problem: ^xxx searches succeed even when xxx is not at
  8242. the beginning of the string.  That's because we're looping backwards thru the
  8243. string and calling ckmatch() repeatedly on increasingly long right substrings.
  8244. But that's easy to fix: if the pattern starts with ^, there is no point
  8245. searching from the right, so \frsearch(^xxx) is treated like \fsearch(^xxx).
  8246. ckuus4.c, 8 Jul 2001.
  8247.  
  8248. Then I put together a thorough test suite and uncovered some other problems,
  8249. some of which had always been there.  
  8250.  
  8251. Yesterday's changes also broke commands like "sho var ftp", today's fixes
  8252. fixed them.
  8253.  
  8254. But today's code breaks at least two things; matching of:
  8255.  . Patterns that contain quoted metacharacters
  8256.  . Alternation lists that follow the second occurrence of a string,
  8257.    e.g. \fsearch(mno{xxx,yyy,pqr},mnozzzmnopqr)
  8258.  
  8259. From Jeff, 9 Jul 2001... Jeff's notes:
  8260.  
  8261. ckuusr.c ckuus4.c ckcnet.c ckuath.c 
  8262.  
  8263. typo in ckuus4.c
  8264.  
  8265. attempts to make the http code more robust.  apparently it is possible
  8266. for the http server to close the socket since it did not receive a
  8267. request in time but for the write() call on socket to succeed.  
  8268.  
  8269. changed http /user: to allow an empty user name.  this is allowed by
  8270. http authentication.  although I am doing something wrong still in the
  8271. http_xxx() functions in that case because the string I am generating
  8272. does not match the string generated by Netscape in the case of a null
  8273. username.
  8274.  
  8275. discovered a few places in the kerberos code where an invalid kerberos
  8276. config file was resulting in our passing a null pointer to the
  8277. kerberos libraries.  The kerberos libraries do not check pointers for
  8278. validity before use.
  8279.  
  8280. ckuus7.c ckcnet.c
  8281.  
  8282. SHOW AUTH was not displaying IP addresses set with SET AUTH K5
  8283. ADDRESSES
  8284.  
  8285. The Reverse DNS lookups were breaking the HTTP GET request when there
  8286. was no reverse DNS entry for the ip-address.  The HTTP server would
  8287. timeout the connection before the DNS query would  timeout.  Changed
  8288. the code to only perform reverse DNS lookups for HTTP OPEN if SET TCP
  8289. REVERSE-DNS-LOOKUP is ON.
  8290.  
  8291. (end Jeff's notes)
  8292.  
  8293. Back to ckmatch()...  After yesterday's changes the torture tests turn up a
  8294. few problems with \fsearch().  What they all boil down to is: ckmatch() never
  8295. handled backing up the pattern after failure in all cases.  But this was
  8296. masked by the facts that it never had to return a match position before, and
  8297. that we called it in a loop, which had the same effect but (a) at far greater
  8298. cost, and (b) it's the place of ckmatch() to do it, not the caller.  I got
  8299. some of this fixed today, but still need to do more.  This is worthwhile
  8300. work for many reasons, including (a) it can speed up INPUT by orders of
  8301. magnitude, and (b) ckmatch will be able to return the string segment that
  8302. matched the pattern, which is a powerful SNOBOL feature that will be
  8303. incredibly useful in scripts.  Until now, you could search for a pattern,
  8304. but there was never a way to find out what the pattern matched; when this
  8305. works, after a pattern-match succeeds, you can say "what did I find?"
  8306. (And before I leave ckmatch(), I might want to add true regexp capability,
  8307. e.g. "[0-9]+" means one or more digits.)  ckclib.c, 9 Jul 2001 (to be cont'd).
  8308.  
  8309. readblock() conflicts with a QNX6 name.  Fixed by an #define in ckuus6.c.
  8310. New qnx_rtp makefile target.  Kirk Russell <kirussel@cisco.com>, 9 Jul 2001.
  8311.  
  8312. Kirk also pointed out that QNX6 open() gets an error for /dev/tty with
  8313. O_NONBLOCK.  Added QNX6-specific code for this to do_open(), ckutio.c,
  8314. 9 Jul 2001.
  8315.  
  8316. Added QNX6 to ckuver.h.  9 Jul 2001.
  8317.  
  8318. Sebastian Larco <Sebastian.Larco@nextel.com.ar> reported that GET
  8319. /MOVE-TO:xxxx didn't work for him.  For me, it dumps core.  Problem: a piece
  8320. of MGET list-processing code was being executed in this case, when there
  8321. was no list to process.  Fixed in doftpget(): ckcftp.c, 9 Jul 2001.
  8322.  
  8323. Kirk Russell pointed out that the OpenBSD version lacked POSIX RTS/CTS and
  8324. that its lockfile directory was wrong.  Fixed in ckcdeb.h, ckuver.h, ckutio.c,
  8325. 10 Jul 2001.
  8326.  
  8327. Added __OpenBSD__ to SHOW FEATURES.  ckuus5.c, 10 Jul 2001.
  8328.  
  8329. Added makefile target for QNX6.  10 Jul 2001.
  8330.  
  8331. Testing serial-port/modem transfers in OpenBSD... First at 57600bps:
  8332.  
  8333.                 Upload    Download     Remarks
  8334. Elapsed time:    06:40      06:48       Flow control lights never blinked
  8335. Max window:          9          1       during upload or download.
  8336. Error count:         0          0
  8337. Effective CPS:    4669       4662
  8338. Peak data rate:   4772       4723
  8339.  
  8340. Again at 115200:
  8341.  
  8342.                 Upload    Download     Remarks
  8343. Elapsed time:    05:24       03:34      On upload, CTS and TxD lights
  8344. Max window:         13           1      blinked in lockstep; flow control
  8345. Error count:         0           0      worked perfectly.  On download, the
  8346. Effective CPS:    5881        8872      the lights never blinked (the computer
  8347. Peak data rate:   5908        9072      is faster than the modem).
  8348.  
  8349. OpenBSD 2.5 does not let me set the speed to 230400, even though it is listed
  8350. in termios.h -- the driver rejects it.
  8351.  
  8352. Finally at 19200 bps...
  8353.  
  8354.                 Upload    Download     Remarks
  8355. Elapsed time:    20:22       20:24       On upload, flow-control lights never
  8356. Max window:          5           1       blink.  On download...  same thing.
  8357. Error count:         0           0       Again, the computer is faster than
  8358. Effective CPS:    1557        1555       the modem, so we never see RTS/RxD
  8359. Peak data rate:   1593        1583       action.
  8360.  
  8361. From Jeff, 10 Jul 2001:
  8362.  . NT needs struct _stat rather than struct stat, ckuus7.c, ckcftp.c.
  8363.  . NT needs struct _utimbuf rather than struct utimbuf, ckcftp.c.
  8364.  . Lots of #define blah _blah" for NT C lib routines, ckcdeb.h.
  8365.  . HTTP should be undefined when TCPSOCKET not defined.  ckcdeb.h.
  8366.  . Corrections to LIBS clause for linux+srp+openssl target: makefile.
  8367.  
  8368. Jeff's notes:
  8369.  
  8370. correction to http_get_chunked_length() which was broken by Saturday's
  8371. edits to remove end of lines from http arrays
  8372.  
  8373. I applied the changes to the SRP library to ckuath.c.  I have still to
  8374. implement the changes for ckcftp.c.
  8375.  
  8376. In the process I ran into a problem with incompatible libraries that
  8377. caused me to tighten the compilation rules.  This resulted in a new
  8378. #define be used for the NT builds: __STDC__.  The side-effects of this
  8379. were many.  A large number of functions now need to be called by the
  8380. ANSI names since the K&R names are no longer supported.  See the list
  8381. I added to the bottom of ckcdeb.h.
  8382.  
  8383. The old SRP authentication code is still accessible by defining
  8384. PRE_SRP_1_7_3.  There is no way to set this based upon the srp header
  8385. files.  I am simply going to have to assume that people are using
  8386. 1.7.3 and explain the changes that need to be made to the makefile
  8387. entry in case they are still using an older version.
  8388.  
  8389. (end Jeff's notes)
  8390.  
  8391. SET EXIT HANGUP OFF still didn't work because ttclos() called tthang()
  8392. (reported by Keith Doyle).  Fixed in ckutio.c, 11 Jul 2001.
  8393.  
  8394. Removed redundant -DBPS_xxx's from qnx6 makefile target, verified by Kirk
  8395. Russell, 11 Jul 2001.
  8396.  
  8397. Fix from Kirk Russell to make do_open() compile on QNX6, ckutio.c, 11 Jul 2001.
  8398.  
  8399. FTP GET /RENAME, /MOVE-TO, and /SERVER-RENAME needed more work:
  8400.  . global tmpbuf[] was being overwritten, as Jeff noticed.
  8401.  . GET was improperly requiring /RENAME-TO arg to contain \v(filename).
  8402.  . Transaction log entries said rename/move failed when it succeeded.
  8403. Fixed in doftpget(): ckcftp.c, 11 Jul 2001.
  8404.  
  8405. The following now work right, including the logging:
  8406.  get /rename-to:justastring ckuusr.h
  8407.  get /move-to:../tmp3 ckuusr.c
  8408.  get /server-rename:delete.me ckuusr.c
  8409.  get /server-rename:undelete.me /rename-to:itworked delete.me
  8410.  get /server-rename:delete.me.again /move-to:../tmp3 undelete.me
  8411.  get /as-name:ASNAME /rename-to:NEWNAME ckuusr.h
  8412.  
  8413. Changed IF MATCH back to anchored; otherwise "if match abcd bc" succeeds,
  8414. which might confuse people.  ckuus6.c, 11 Jul 2000.
  8415.  
  8416. Back to ckmatch()...  I fixed the problem with matches like:
  8417.  
  8418.   \fsearch(mno{xxx,yyy,pqr},abcmnozzzmnopqr)
  8419.  
  8420. where mno matches the first mno, but zzz doesn't match any of the alternation
  8421. strings, so we have to restart the search.  ckclib.c, 11 Jul 2000.
  8422.  
  8423. Now all the torture tests pass with one exception: any pattern involving '*'
  8424. followed by a quoted character, for example:
  8425.  
  8426.  if match ab?yz a*\\?yz
  8427.  
  8428. This one actually dumped core due to stack overflow.  As is so often the case
  8429. when code becomes ungainly and incomprehensible, the fix was not to add code,
  8430. but to take code away.  ckclib.c, 11 Jul 2001.
  8431.  
  8432. Now that all the tests pass, the next thing is add more tests, and sure enough
  8433. we find a new case that doesn't pass:
  8434.  
  8435.   \fsearch({ck[cuw]*.[cwh],makefile},ckutio.c)
  8436.  
  8437. Here the alternation list is not embedded within a larger pattern --
  8438. another edge case.  I'll fix it tomorrow.
  8439.  
  8440. From Jeff:
  8441.  
  8442.  . moved Bleep constants from ckuusr.h to ckcker.h since they are not
  8443.    really user interface values and I didn't want to include ckuusr.h in
  8444.    ck_ssl.c
  8445.  
  8446.  . added code to check the version number of the OpenSSL library which is
  8447.    loaded with Kermit.  This could be a DLL on Windows OR a shared
  8448.    library on Unix.  OpenSSL releases are not binary compatible.
  8449.    Therefore, if the Kermit build does not match the library version
  8450.    there could be serious problems some of which might be extremely
  8451.    hard to track down.  The default behavior is to disable SSL/TLS
  8452.    support but allow Kermit to continue.
  8453.  
  8454.  . Re-ordered the initialization of telnet and ssl so that the telnet
  8455.    options will be configured properly if there was an OpenSSL library
  8456.    mismatch.
  8457.  
  8458.  . Fixed end of lines for HTTP HEAD when saving the headers to a file
  8459.  
  8460.  . Moved the #define for des_fixup_parity as it is now required for new
  8461.    versions of OpenSSL.
  8462.  
  8463. ckcmai.c ck_ssl.c ckcker.h ckuusr.h ckuath.c ck_crp.c ckcnet.c, , 12 Jul 2001.
  8464.  
  8465. Yesterday's ckmatch() problem: not a ckmatch() problem.  The syntax:
  8466.  
  8467.   \fsearch({ck[cuw]*.[cwh],makefile},ckutio.c)
  8468.  
  8469. does not work because {} around a function argument is used for grouping.
  8470. These work:
  8471.  
  8472.   \fsearch({{ck[cuw]*.[cwh],makefile}},ckutio.c)
  8473.   \fsearch("{ck[cuw]*.[cwh],makefile}","ckutio.c")
  8474.  
  8475. (Gee if I can't remember the syntax rules, who can???)
  8476.  
  8477. Jeff reported "show var ftp" busted again.  But only in Windows: missing case
  8478. in #ifdef sequence in ckmatch, in the globbing sectionw where we make "*" stop
  8479. at the first directory separator.  Also, ckmatch() should not have been called
  8480. with the globbing flag by SHOW FUNC to begin with.  SHOW MAC also called
  8481. ckmatch() with globbing bit.  ckclib.c, ckuus[5x].c, 13 Jul 2001.
  8482.  
  8483. I looked into making ckmatch() record the string segment that matched the
  8484. pattern, and I actually got it mostly working, but it's too costly in
  8485. performance (ckmatch() can be called tens of thousands of times for a single
  8486. wildcard match), and there's no good way to return the value, since all the
  8487. operations that call ckmatch() already return some other kind of value
  8488. (success/failure, position, etc).  So let's table this until it comes up
  8489. again.  13 Jul 2001.
  8490.  
  8491. Updated ~fdc/public_html/ckermit3.html.  13 Jul 2001.
  8492.  
  8493. From Jeff: Kerberos Keytab selection commands, ckuusr.h, ckuus[237].c,
  8494. ckcnet.c, ck_ssl.c, ckuath.c, 14 Jul 2001.
  8495.  
  8496. In doinput(), ckmatch() is called in a loop so we can get the match position.
  8497. This is no longer necessary; now it can be called once with option bit 2
  8498. (floating pattern) and it returns the match position.  ckuus4.c, 14 Jul 2001.
  8499.  
  8500. ckmatch() did not do case-independent matches of [A-Z][a-z] patterns correctly.
  8501. Fixed in ckclib.c, 14 Jul 2001.
  8502.  
  8503. The new ckmatch() makes it easier to recognize additional date-time formats.
  8504. Added recognition of actime() format with and without timezone (but I don't
  8505. do anything about timezone conversion).  cmcvtdate(): ckclib.c, 14 Jul 2001.
  8506.  
  8507. From Jeff: For the people  cannot stand the switching between terminal and
  8508. command mode when APCs are used:
  8509.  
  8510.   SET TERM APC NO-INPUT, NO-INPUT-UNCHECKED
  8511.  
  8512. In order to do this I changed the apcstatus variable to store a bitmask and
  8513. not fixed values.  ck_des.c ckcker.h ckuat2.h ckucns.c ckucon.c ckuus2.c
  8514. ckuus3.c ckuus5.c ckuus6.c ckuus7.c ckuusr.c ckuusx.c, 15 Jul 2001.
  8515.  
  8516. Suppose I want to handle the GMT timezone in cmcvtdate() when converting to a
  8517. Kermit-format local time string.  In Unix I could use localtime(), which
  8518. converts GMT to local time.  But localtime() takes a time_t.  Given a GMT time
  8519. string, then, I can parse all the fields, create a struct tm from them, and
  8520. then convert to time_t somehow...  Hmmm, haven't we been here before, lots of
  8521. times?  Perhaps once and for all we need to define a ck?fio.c API for
  8522. converting GMT to local time based on Kermit-format date-time strings:
  8523.  
  8524.   char * zlocaltime(char * gmtstring)
  8525.  
  8526. This hides all the hideous date/time APIs from the mainline code.  Done in
  8527. ckufio.c, ckcdeb.h, 15 Jul 2001.
  8528.  
  8529. To add zlocaltime() for non-UNIX platforms, add a zlocaltime() routine to
  8530. cku?io.c and then change the ZLOCALTIME definition in ckcdeb.h to include the
  8531. new platform.
  8532.  
  8533. Made cmcvtdate() call zlocaltime() when given an Asctime-format string that
  8534. includes a GMT timezone, and therefore return a local date-time string.  This
  8535. won't have much effect, since we rarely encounter a Asctime+Timezone date
  8536. string in real life, but you can see it work if you type, e.g.:
  8537.  
  8538.   date Sun Jul 15 15:42:47 GMT 2001
  8539.  
  8540. or:
  8541.  
  8542.   echo \fcvtdate(Sun Jul 15 15:42:47 GMT 2001)
  8543.  
  8544. at the C-Kermit> prompt.  This opens up some new possibilities, e.g.
  8545. parsing dates in HTTP headers in an update script.  It also might let us
  8546. simplify some of the FTP date-time code, and it might eventually be useful
  8547. in Kermit protocol too.
  8548.  
  8549. Next, maybe I'll add more date formats, e.g. like these from e-mail:
  8550.  
  8551.   Date: Thu, 10 Nov 94 10:50:47 EST
  8552.   Date: Fri, 20 Oct 1995 18:35:15 -0400 (EDT)
  8553.   Date: Wed, 27 Mar 96 10:56:04 EST
  8554.   Date: Thu, 15 May 1997 00:44:25 -0400
  8555.   Date: Fri, 24 Mar 2000 14:19:59 EST
  8556.   Date: Sun, 9 Apr 2000 06:46:46 +0100
  8557.   Date: Fri, 2 Mar 2001 16:49:03 -0500 (EST)
  8558.   Date: Mon, 9 Apr 2001 13:05:23 EDT
  8559.   Date: Mon, 23 Apr 2001 13:55:29 -0600 (MDT)
  8560.   Date: Mon, 4 Jun 2001 09:00:44 -0400
  8561.   Date: Fri, 08 Jun 2001 05:31:11 -0700
  8562.   Date: Wed, 20 Jun 2001 03:00:20 GMT
  8563.   Date: Tue, 26 Jun 2001 13:33:21 +0200
  8564.   Date: Tue, 26 Jun 2001 10:19:45 -0400 (EDT)
  8565.   Date: Fri, 13 Jul 2001 12:54:29 -0700 (PDT)
  8566.   Date: 14 Jul 2001 16:26:45 GMT
  8567.   Date: 14 Jul 2001 21:53:33 +0200
  8568.   Date: Sat, 14 Jul 2001 11:49:29
  8569.  
  8570. and also maybe GMT timezone recognition for the formats we already support,
  8571. and maybe a new \function() to convert GMT to local time.  Then we probably
  8572. could also use local-to-GMT conversions too, etc etc.
  8573.  
  8574. Jeff added zlocaltime() to K95: ckcdeb.h (plus K95-specific modules),
  8575. 16 Jul 2001.
  8576.  
  8577. I'm getting core dumps after a series of complex pattern matches.  Turns
  8578. out to be a memory leak, in which I didn't check that a calculated offset
  8579. could be negative.  Fixed in ckmatch(): 16 Jul 2001.
  8580.  
  8581. Changed ECHO to *not* try to preserve previous behavior with text enclosed in
  8582. doublequotes.  This exception to the rules was just too confusing, and would
  8583. probably benefit very few people compared to the many it would confound.  So
  8584. in other words, now:
  8585.  
  8586.   echo "foo"
  8587.  
  8588. prints foo without the quotes.  ckuusr.c, 18 Jul 2001.
  8589.  
  8590. Rewrote cmcvtdate() to recognize ISO 8061 format date-time strings:
  8591.  
  8592.  . Allow 'T' or 't' as date-time separator.
  8593.  . Allow hhmmss with no colons
  8594.  . Allow hhmm and hh (trailing fields omitted default to 00).
  8595.  . Allow Z after time == GMT/UTC
  8596.  . Allow GMT or UTC after time
  8597.  . Allow +/- hh:mm[:ss] to express timezone (GMT offset)
  8598.  
  8599. So now we can handle (among many others):
  8600.  
  8601.   20010718 19:21:15
  8602.   20010718-19:21:15
  8603.   20010718-192115
  8604.   20010718_192115
  8605.   20010718T192115
  8606.   20010718t192115
  8607.   20010718X192115
  8608.   18 Jul 2001 192115
  8609.   18-Jul-2001 1921
  8610.   18-Jul-2001T1921
  8611.   18-Jul-2001t1921
  8612.   18-Jul-2001 1921Z
  8613.   18-Jul-2001 1921 GMT
  8614.   18-Jul-2001 1921 +0100
  8615.   18-Jul-2001 1921 -0100
  8616.   18-Jul-2001 1921 -0200
  8617.   18-Jul-2001 1921 -03:00
  8618.   18-Jul-2001 1921 -04:00:00
  8619.   18-Jul-2001 1921 -0500
  8620.   18-Jul-2001 1921 +2300
  8621.   18-Jul-2001 1921 -2300
  8622.  
  8623. For now any other timezone is treated as an error (since we have no way of
  8624. knowing what to do with it).  It is unfortunate that we can't even recognize
  8625. our own timezone but I have no idea where to start.  For example ours could be
  8626. EST or EDT, or it could be EST5EDT or who knows what else, plus in UNIX I
  8627. don't even see any API that returns it (not all UNIXes have $TZ, and even if
  8628. they do, what's the format?).  This means if we get a time like "18-Jul-2001
  8629. 19:21:00 EDT" we choke on EDT even if it is our own timezone.  So this is a
  8630. pending issue, as is the handling of formats like:
  8631.  
  8632.   Mon, 9 Apr 2001 13:05:23 EDT
  8633.   Tue, 26 Jun 2001 10:19:45 -0400 (EDT)
  8634.  
  8635. (gobble and ignore day of week, discard trailing timezone comment, etc), and
  8636. other fractured email-style dates.  ckucmd.c, 18 Jul 2001.
  8637.  
  8638. Added date error-string, to be queried when cmcvtdate() returns -1; made
  8639. DATE command print it when cmcvtdate() gets an error.  ckucmd.c, ckuusr.c,
  8640. 19 Jul 2001.
  8641.  
  8642. Added ability to recognize English days of week:
  8643.  . If entire date is a day name, it is replaced by the corresponding date.
  8644.  . If time is given, it is used; otherwise 00:00:00 is supplied.
  8645.  . If date starts with day name and comma, we skip past and ignore it.
  8646.  . Day names are Kermit keywords, so can be spelled out or abbreviated.
  8647.  
  8648. Thus the following are accepted as valid dates:
  8649.  friday                     <-- time 00:00:00 is supplied
  8650.  fri                        <-- same as friday
  8651.  friday 12:34:45            <-- given time is used
  8652.  fri, 19 Jul 2001           <-- "fri, " stripped and ignored, 00:00:00 supplied
  8653.  fri, 19 Jul 2001 12:34:45  <-- ditto but given time is used
  8654.  friday 19 jul 2001 12:34   <-- rejected because no comma
  8655.  etc.
  8656.  
  8657. Other changes required to accept RFC2822 email date-time formats:
  8658.  . Accept timezone "UT" == UTC == GMT (OK)
  8659.  . Anything trailing stuff in parens is a comment (OK)
  8660.  . Date-time +/- xxxx == local time +/- GMT offset (OK)
  8661.  . Max secs can be 60 (because of leap second) (OK)
  8662.  . Fractions of seconds are handled (OK)
  8663.  . GMT offset is always 4 digits (OK)
  8664.  . 2-digit year: 00-49: add 2000; 50-99: add 1900 (OK)
  8665.  . 3-digit year: add 1900 (OK)
  8666.  
  8667. All this work is done but it broke a lot of previously working formats so
  8668. more work is needed before I upload.
  8669.  
  8670. 20 Jul 2001: cmcvtdate() now handles just about any conceivable ISO 8601 or
  8671. RFC 822 or RFC 2822 or Asctime() date format, plus many others besides.  
  8672.  
  8673. Timezone conversion is performed:
  8674.  . If timezone is Z, UT, UTC, or GMT.
  8675.  . If GMT/UTC offset given (e.g. +0400, -0830, with some format flexibility).
  8676.  . For the following USA timezones as specified in RFC 2822:
  8677.    EDT EST CDT CST MDT MST PDT PST
  8678.  
  8679. Plus it adds clever heuristics like, if a time is given without colons to
  8680. separate the fields, e.g. "230", and if the number of digits is odd, a leading
  8681. zero is implied so "230" becomes "02:30:00" rather than "23:00:00".  Other
  8682. niceties:
  8683.  
  8684.  . Days of week (e.g. SATURDAY) are accepted as symbolic dates.
  8685.  . Days of week and month names (and symbolic dates like TOMORROW)
  8686.    can be spelled out or abbreviated.
  8687.  . RFC 2822 windowing for 2-digit and 3-digit years.
  8688.  . AM/PM notation supported.
  8689.  . Fractional seconds supported, rounded to nearest second.
  8690.  . Day of week can be followed by date, which takes precedence,
  8691.    e.g. Sun, 9 Apr 2000 06:46:46 +0100 (comma optional).
  8692.  . Day of month is validated against calendar taking leap year into account.
  8693.  . Month name can now come first, as in "Jan 23, 2001".
  8694.  . If a string can't be parsed, the DATE command tells exactly why.
  8695.    
  8696. Still to do:
  8697.  . Check each result carefully for correctness (again).
  8698.  . Use cmdatemsg in other contexts like \fcvtdate(), etc.
  8699.  . Clean up voluminous debug() calls (after more testing).
  8700.  . Check carefully for memory leaks.
  8701.  . Check what happens without ZLOCALTIME defined.
  8702.  . Handle non-GMT timezones in Asctime() dates.
  8703.  . Add an option to return the result in various formats, at least
  8704.    with "_" rather than " " as date-time separator.
  8705.  . Write a sample HTTP script that GETs stuff after a certain date.
  8706.  
  8707. And eventually:
  8708.  . Adapt this code to Kermit protocol, solving the GMT problem by allowing
  8709.    an optional GMT offset in A-Packet dates.
  8710.  
  8711. Not done, probably won't do:
  8712.  . Handling non-English day, month names.
  8713.  . User-defined rules for handling ambiguous cases like 10/11/2001.
  8714.  . The case where a fraction of a second pushes us across a date boundary
  8715.    (in this case I just drop the fraction).
  8716.  . No allowance for years after 9999.  Years 0000-9999 are allowed.
  8717.  . In strings like "Wed, 20 Jul 2001" we don't check whether 20 Jul 2001
  8718.    really is a Wednesday.  Easy to do but adds overhead.
  8719.  . Nothing is done about medieval calendar adjustments.
  8720.  
  8721. For docs: timezone conversions are done by underlying OS; any errors are
  8722. the OS's fault.  Example: <date> <time> GMT might convert correctly to
  8723. local time for years prior to 1970 in UNIX.
  8724.  
  8725. Also: need to document acceptable date-time formats in detail before I
  8726. forget...
  8727.  
  8728. From Jeff: fix for appending/or-not dirsep to getenv("TMP") ("TEMP"), etc,
  8729. which caused a lot of trouble with FTP MGET.  ckcftp.c, ckuus4.c, 20 Jul 2001.
  8730.  
  8731. From Jeff: Adjustments to server timeout code for K95, and filling in the
  8732. missing FTP IBMSELECT code.  ckcpro.w, ckcftp.c, 21 Jul 2001.
  8733.  
  8734. Moved interpretation of -B (force Background) command-line option from
  8735. doarg() to prescan() so it will prevent concb() execution by the parser(),
  8736. which clobbers VMS C-Kermit when it runs under a Web browser such as Apache.
  8737. ckuus4.c, 21 Jul 2001.
  8738.  
  8739. New VMS congm() code from Hunter Goatley for testing whether the console is
  8740. a real terminal.  ckvtio.c, 21 Jul 2001.
  8741.  
  8742. Totally reworked the SSH-related preprocessor symbols.  Now they are:
  8743.  
  8744.   NOSSH        Disables all forms of SSH support
  8745.   SSHBUILTIN   Built-in SSH code (K95)
  8746.   SSHCMD       Extern SSH command (UNIX)
  8747.   ANYSSH       Defined if either SSHBUILTIN or SSHCMD is defined
  8748.   SSH          K95 (defined if SSHBUILTIN is defined)
  8749.  
  8750. The SSH symbol should not be used in ck[cu]*.* code, where we need to
  8751. distinguish whether it's internal or external.  You might need to rework
  8752. this if SSHBUILTIN applies to Windows but not OS/2.  ckcdeb.h, 21 Jul 2001.
  8753.  
  8754. Changed all #ifdef SSH in ckcnet.c to #ifdef SSHBUILTIN.  21 Jul 2001.
  8755.  
  8756. Added SET and SHOW SSH commands for built-in SSH (parse only):
  8757.  
  8758.   SET SSH AGENT-FORWARDING { ON, OFF }
  8759.   SET SSH X11-FORWARDING { ON, OFF }
  8760.   SET SSH VERSION { 1, 2, AUTO }
  8761.   SET SSH IDENTITY-FILE <input-file>
  8762.   SET SSH PRIVILEGED-PORT { ON, OFF, AUTO }
  8763.   SET SSH CIPHER <cipher-list>
  8764.   SET SSH MAC <mac-list>
  8765.   SET SSH COMPRESSION { ON, OFF }
  8766.   SET SSH COMMAND-AS-SUBSYSTEM { ON, OFF }
  8767.   SET SSH QUIET { ON, OFF }
  8768.   SET SSH VERBOSE { 0, 1, 2, 3, 4 }
  8769.   SET SSH AUTO-V2-REKEY <seconds>
  8770.  
  8771. It's all within #ifdef ANYSSH..#endif in ckuus[37].c.  21 Jul 2001.
  8772.  
  8773. Added Built-In SSH command and subcommands (parse only):
  8774.  
  8775.   SSH OPEN host { command }
  8776.   SSH V2-REKEY
  8777.   SSH FORWARD-LOCAL-PORT  listen-port to-host   to-port
  8778.   SSH FORWARD-REMOTE-PORT listen-port from-host to-port
  8779.  
  8780. ckuusr.c, 21 Jul 2001.
  8781.  
  8782. Added SET HOST [ switches ] name [ port ] /SSH[:command].  I put the /SSH
  8783. switch with the other trailing switches since that's where /RLOGIN and /TELNET
  8784. are.  The /SSH switch has an optional argument, which is a remote command to
  8785. execute.  If no command argument is included, a regular terminal connection
  8786. should be made.  Of course the command is a cmfld(), so if it contains any
  8787. spaces it must be enclosed in {} or "".  This code was not even compiled, let
  8788. alone tested.  See the SSHBUILTIN sections of ckuus7.c, 21 Jul 2001.
  8789.  
  8790. The actions need to be filled in, as well as whatever needs doing in setlin(),
  8791. and the help text.
  8792.  
  8793. Back to dates...  Made cmdate() print the new, informative error message,
  8794. and it works fine with SEND /AFTER: etc.  ckucmd.c, 21 Jul 2001.
  8795.  
  8796. Made the DATE command apply brstrip() since there's no reason to complain
  8797. about quoted dates.  ckuusr.c, 21 Jul 2001.
  8798.  
  8799. From Jeff: corrections to typos, comments, etc, and addition of SHOW FEATURES
  8800. text for SSH.  ckcdeb.h, ckuus[r357].c, 23 Jul 2001.
  8801.  
  8802. Fix call to shossh() to be in #ifdef ANYSSH rather than #ifndef NOSSH.
  8803. ckuus5.c, 23 Jul 2001.
  8804.  
  8805. AYACCUC (Add Yet Another Char / Unsigned Char Cast).  Whoever thought up
  8806. signed chars should be sentenced to ten years writing character and string
  8807. processing code that supports 8-bit characters using a strict ANSI C compiler
  8808. that does not have a -funsigned_char option.  shostrdef(): ckuus5.c,
  8809. 23 Jul 2001.
  8810.  
  8811. Some Kerberos stuff from Jeff: ckcftp.c, ckuath.c, 25 Jul 2001.
  8812.  
  8813. Dat Nguyen reported problems with Kermit SEND /RECURSIVE and FTP MPUT
  8814. /RECURSIVE on AIX.  At least the following things happen:
  8815.  
  8816.  . "rdir" with no filespec made the client send "LIST rdir":
  8817.      (/home/fdc/) C-Kermit>rdir
  8818.      ---> PASV
  8819.      227 Entering Passive Mode (128,59,39,2,8,171)
  8820.      ---> LIST rdir
  8821.      150 Opening ASCII mode data connection for /bin/ls.
  8822.      226 Transfer complete.
  8823.    It wasn't obvious why this was happening but I tightened up the code
  8824.    in doftpdir() a bit and it stopped happening.
  8825.  
  8826.  . "rcd" with no directory doesn't work (server says "~: no such directory"):
  8827.      (/home/fdc/aixbin/) C-Kermit>rcd
  8828.      ---> CWD
  8829.      550 ~: No such file or directory.
  8830.     Did this ever work? (This is obviously not a problem with the client...)
  8831.  
  8832.  . "mput /recursive tree" did nothing ("tree" is a directory name).
  8833.  . "mput /recursive tree/*" worked fine.  Ditto for "tree/.".
  8834.  . But Kermit "send /recursive tree" worked fine.
  8835.  
  8836. Turns out this is not AIX-specific -- it's the same on the Sun.  Debug logs
  8837. show that zxpand() and friends are working fine; the full recursive file list
  8838. is returned in all cases.  But if you don't include the "/*", FTP ignores it,
  8839. whereas KERMIT SEND uses it.
  8840.  
  8841. It looks like the difference is that FTP MPUT makes a cmlist[] of filespecs,
  8842. whereas Kermit SEND only takes one filespec, and the result is pre-expanded.
  8843. Kermit MSEND does not allow a /RECURSIVE switch.  Anyway, /RECURSIVE isn't the
  8844. issue, since "ftp mput tree" has the same problem.  OK, so with Kermit SEND,
  8845. sndsrc is -1, and gnfile just calls znext() on the list that's already there.
  8846. Whereas with FTP MPUT, sndsrc is > 0, indicating a list of filespecs in
  8847. cmlist[], which tells gnfile() to expand each one, which it does.  THE PROBLEM
  8848. IS... the filespec is simply "tree", which expands to "tree".  It turns out
  8849. Kermit MSEND has exactly the same problem, and always has.
  8850.  
  8851. So how is nzxpand() supposed to know that a directory name should be expanded
  8852. to its contents?  How about this: if the recursive flag is set and the
  8853. argument is a directory, append the appropriate dirsep and wildcard to it.
  8854. But hmmmm, UNIX nzxpand already does that...  Finally it hit me: gnfile()
  8855. needs to call nzxpand() with the ZX_FILONLY option bit set, because (a) if
  8856. it's not set, nzxpand() does not open the directory, and (b) gnfile() is
  8857. only called by the file sender anyway, so why would it ever need to return
  8858. a directory name?  So I made this 1-bit change to gnfile() and it seems to
  8859. do the trick, at least for /RECURSIVE.  But not for non-recursive sends
  8860. or puts.  Should it?  It's a toss-up, so the safe thing to do is leave it
  8861. as is.  ckcfns.c, 25 Jul 2001.
  8862.  
  8863.  . Also we seem to be following links again.  We should NOT follow links
  8864.    in recursive sends, at least not by default.  I took care of this once
  8865.    before (see notes of 7 Mar 2001), but now it's broken.
  8866.  
  8867. DIRECTORY /NOFOLLOWLINKS and DIRECTORY /FOLLOWLINKS both wind up calling
  8868. nzxpand() with the nolinks flag set; thus the switch has no effect; DIRECTORY
  8869. never follows links.  FTP MPUT doesn't even have these switches.  SEND has the
  8870. switches, and they actually seem to set the option bit for nzxpand()
  8871. correctly, but SEND /NOFOLLOWLINKS still follows links.  This is messy, and
  8872. has to be fixed on a case by case basis.  The problem comes from parsing
  8873. switches in a loop; if any of them affects the CMIFI flags, cmfdbi() must be
  8874. called immediately with the new flags.  This was not being done consistently
  8875. in the DIRECTORY code.  OK, that's fixed is domydir(): ckuus6.c, 25 Jul 2001.
  8876.  
  8877. However, the /[NO]FOLLOWLINKS switches are effective only on recursive
  8878. operations; "dir foo" where foo is a link to bar, still shows "foo -> bar".
  8879. Should it?  UNIX ls lets you choose: "ls -l" shows "foo -> bar", but "ls -Ll"
  8880. shows foo as if it were bar.  I should make Kermit act this way too.  Or
  8881. not...  On second thought it seems that the following-links business applies
  8882. only to directories...  SEND /NOFOLLOWLINKS does not follow *directory* links.
  8883. The parsing is fine.  So the real question is: should /NOFOLLOWLINKS apply to
  8884. regular files too?
  8885.  
  8886. OK, so still to do:
  8887.  . Figure this out.
  8888.  . Add the /[NO]FOLLOWLINKS switches to FTP [M]PUT.
  8889.  
  8890. Added code to cmkey() and gtword() to allow the following to work:
  8891.  
  8892.   define \%x echo one two three four five ...
  8893.   \%x
  8894.  
  8895. that is, to execute a command from a variable, since it's counterintuitive
  8896. that this can't be done.  The code works, but it breaks GOTO (and everything
  8897. that depends on GOTO, including FOR, WHILE, and SWITCH), so I left it within
  8898. #ifdef M_UNGW..#endif, and left M_UNGW undefined.  ckucmd.c, 26 Jul 2001.
  8899.  
  8900. OK back to symlinks...  What should DIR /NOFOLLOW do?  It should just *show*
  8901. symlinks (that's what it does now).  But what should SEND or MPUT /NOFOLLOW
  8902. do?  They should *skip* symlinks, right?  How does DIRECTORY know to show
  8903. symlinks?  It calls zgetfs() on each file, which sets zgfs_dir and zgfs_link.
  8904. Well, SEND already does the right thing with links to directories, just not
  8905. with links to files.  Should this be changed?  Let's say it should.  Then it
  8906. has to be done in fileselect().  Which means nolinks needs to become a global
  8907. flag, like recursive, with all the same saving and restoring, etc.  What
  8908. should the default be?  Don't follow links in all cases: DIRECTORY, DELETE,
  8909. SEND, and everything else.  OK, so I made nolinks global and changed DIR and
  8910. SEND to use the global value.  ckcmai.c, ckuus[r6x].c, 26 Jul 2001.
  8911.  
  8912. Then I changed fileselect() to skip symbolic links if nolinks != 0.  This
  8913. prevents SEND from sending any file that is a link.  This has the rather
  8914. surprising effect of refusing to send a single file even if you mention it by
  8915. name, e.g. "send foo" where foo is a link, but we'll deal with that later.
  8916. ckuusx.c, 26 Jul 2001.
  8917.  
  8918. Added /[NO]FOLLOWLINKS switches to FTP MPUT and made it work like SEND.
  8919. ckcftp.c, 26 Jul 2001.
  8920.  
  8921. Here's a good one: if you FTP MPUT /RECURSIVE, your current remote directory
  8922. at the end of the transfer is the directory of the file last sent, which might
  8923. be rather far down in the tree.  How to restore the original remote directory
  8924. at the end of the recursive MPUT?  Well, FTP protocol is too stupid to let you
  8925. get the server's current directory in any reliable format, so I added an
  8926. up/down counter.  If at the end of the recursive MPUT, it is > 0, I do that
  8927. many CDUPs.  ckcftp.c, 26 Jul 2001.
  8928.  
  8929. Added invisible local CDUP command.  ckuusr.[ch], 26 Jul 2001.
  8930.  
  8931. Added REMOTE CDUP command and RCDUP synonym (works for FTP only).
  8932. ckuusr.h, ckuus7.c, ckcftp.c, 26 Jul 2001.
  8933.  
  8934. Back to SEND.  If they say "send blah" and "blah" is link, then send
  8935. whatever it points to, as long as "blah" is not wild and /RECURSIVE
  8936. wasn't given.  Ditto for FTP PUT.  ckuusr.c, ckcftp.c, 26 Jul 2001.
  8937.  
  8938. I'm still not sure this is the best behavior, but let's leave it this way for
  8939. a while and see how it feels.  Remember, the whole idea of avoiding symlinks
  8940. is to not send entire file systems that might be pointed to by a seemingly
  8941. innocent symlink.  But if we say /NOFOLLOWLINKS, then that should be
  8942. consistent unless we're willing to add even more switches saying whether links
  8943. should or should not be followed separately for regular files and directories
  8944. which seems like overkill.
  8945.  
  8946. Should the /[NO]FOLLOWLINKS switches be added to DELETE?  No, DELETE should
  8947. never follow links.  It should, however, delete them.  Made sure this worked
  8948. OK (some minor adjustments were needed because of the changes to fileselect()).
  8949. ckuus6.c, 26 Jul 2001.
  8950.  
  8951. SEND /MAIL:address /SUBJECT:"a b c"...  Problems with the sender: It looks
  8952. like the address is truncated and/or corrupted; spaces in the subject are
  8953. replaced by _'s.  Problems with the receiver: Linux receives the file but then
  8954. hangs forever (actually it dumps core).  The last thing in the log is:
  8955.  
  8956.   zxcmd[Mail -s "testing_7_8_9" fdc@columbia.edu]=3
  8957.   zxcmd out=1
  8958.  
  8959. First, the underscores: The problem is, nzrtol() is called by rcvfil(), and
  8960. rcvfil() is called when the F packet arrives, which is *before* the A packet,
  8961. so we don't know yet that it's an e-mail subject.  To fix, copy the original
  8962. F-packet contents to a new buffer, and later if it turns out to be an email
  8963. subject, we use the original rather than the converted name.  ckcmai.c,
  8964. ckcpro.w, ckcfn[s3].c, 28 Jul 2001.
  8965.  
  8966. But the real problem is that popen() does not return, but dumps core.
  8967. It took most of the day to figure it out, but the error was that I was not
  8968. malloc'ing enough space for the mail command.  Fixed in rcv_firstdata(),
  8969. ckcpro.w, 28 Jul 2001.
  8970.  
  8971. Dat Nguyen said his "class" script stopped working -- it loops forever.
  8972. Sure enough.  The problem is in this command:
  8973.  
  8974.   _undefine /matching \%1* *\%1
  8975.  
  8976. (where \%1 is an argument of the macro this command is in).  "class Person"
  8977. tries matching "Person*" against all macro names (ok...) but then tries
  8978. matching "*\%1" (instead of *Person) as its second pattern.  This is because
  8979. the first cmfld() for the variable name was set up properly (in cmfdbi()), but
  8980. the second cmfld() (which is called directly) that collects the second and
  8981. subsequent patterns, did not take into account the difference between
  8982. UNDEFINE and _UNDEFINE.  Fixed in doundef(): ckuus6.c, 29 Jul 2001.
  8983.  
  8984. The previous problem was always there, ever since [_]UNDEF /MATCHING was
  8985. introduced.  The reason the class script started looping has to do with the
  8986. recent changes to ckmatch().  Of course this wouldn't have happened if we were
  8987. not feeding ckmatch() a bogus pattern (*\%1 instead of *Person), but *\%1
  8988. still should not break ckmatch().  It turns out a couple spots were missing
  8989. the test for the target string running out.  ckmatch(): ckclib.c, 29 Jul 2001.
  8990.  
  8991. Gerry Belanger noticed that SET TERM IDLE-TIMEOUT xxx, SET TERM IDLE-ACTION
  8992. HANGUP didn't work if the modem was configured to ignore DTR and MODEM
  8993. HANGUP-METHOD was MODEM-COMMAND.  The CONNECT module was calling tthang()
  8994. instead of mdmhup(), and mdmhup() wasn't using the MODEM HANGUP-METHOD anyway
  8995. if the modem type was GENERIC.  ckudia.c, ckucns.c, 29 Jul 2001.
  8996.  
  8997. In any command, if a switch was preceded by two or more spaces, its argument
  8998. (if any) would not be picked up.  Fixed in gtword(): ckucmd.c, 30 Jul 2001.
  8999.  
  9000. Ever since we added recursive sends, it has been a limitation that empty
  9001. directories are skipped.  This is because Kermit protocol has no provision
  9002. for "transferring" empty directories.  However, there's no reason the FTP
  9003. client should not be able to handle this:
  9004.  
  9005.  . doftpput() needs to tell cmifi() "files AND directories" if /RECURSIVE.
  9006.  . gnfile() needs to distinguish between Kermit and FTP sends.
  9007.  . In gnfile(), if it's FTP MPUT /RECURSIVE, don't skip over directories.
  9008.  . In doftpput(), after calling syncdir(), don't send the file if it's
  9009.    a directory; syncdir() has already created it or ensured that it exists.
  9010.  
  9011. Now we really can re-create a directory tree with FTP (but not with Kermit),
  9012. except for symlinks.  If we don't follow symlinks, the links are skipped and
  9013. ignored.  If we do follow them, we send what they point to.  There is no
  9014. protocol for *transferring* symlinks with FTP (or Kermit).  ckcfns.c,
  9015. ckcftp.c, 30 Jul 2001.
  9016.  
  9017. Changed DEL /TREE to supply a default filespec of *, *.*, etc, depending on
  9018. platform.  ckuus6.c, 31 Jul 2001.
  9019.  
  9020. Updated FTP MPUT help text for /[NO]FOLLOWLINKS.  ckcftp.c, 31 Jul 2001.
  9021.  
  9022. Fixed FTP MPUT /PERMISSIONS:ON /RECURSIVE to send SITE CHMOD for the remote
  9023. filename, not the local one.  ckcftp.c, 31 Jul 2001.
  9024.  
  9025. Fixed FTP [M]PUT /PERMISSIONS:ON to allow just "/PERMISSIONS" without an
  9026. argument (ON or OFF) to mean ON.  ckcftp.c, 31 Jul 2001.
  9027.  
  9028. Added /PERMISSIONS, /AFTER, /BEFORE, etc, to the FTP [M]GET switch table, so
  9029. we can give an error message if somebody tries to use them; otherwise it's
  9030. treated as a filename, very confusing.  ckcftp.c, 31 Jul 2001.
  9031.  
  9032. PeterE reported some trouble with CHMOD and while trying to track it down,
  9033. I consistently got core dumps.  The dumps turned out to be a red herring;
  9034. the problem was in a debug() statement.  Fixed in zxpand(), ckufio.c,
  9035. 1 Aug 2001.
  9036.  
  9037. Anyway, one problem was that a command like "chmod 777 foo" would not give an
  9038. error message if it failed.  That's because error messages were given only if
  9039. /VERBOSE was included.  I changed this to give an error message if either
  9040. /VERBOSE was given or if the command mentioned only one file.  Also I changed
  9041. the error message from "Access denied" to the actual errno-associated error
  9042. string.  douchmod(): ckuus3.c, 1 Aug 2001.
  9043.  
  9044. The real problem: "chmod 777 ." (or any other number) either totally fails (if
  9045. the directory is empty) or else changes the permissions of a subdirectory of
  9046. the current directory.  What a mess...  I totally sidestepped it by changing
  9047. douchmod() to not call znext() if the filespec was not wild and the file count
  9048. was 1, and instead to just use whatever string the user typed.  douchmod():
  9049. ckuus3.c, 1 Aug 2001.
  9050.  
  9051. Added makefile target and herald for SCO OpenUNIX 8.0.  makefile, ckuver.h,
  9052. 2 Aug 2001.
  9053.  
  9054. Greg Wright noticed that FTP PUT /AFTER:-1DAYS * ignored the /AFTER clause.
  9055. This is peculiar to FTP -- it works fine with Kermit SEND, DIRECTORY, etc.
  9056. The parsing code forgot to set pv[n].ival = 1.  Fixed in doftpput(): ckcftp.c,
  9057. 2 Aug 2001.
  9058.  
  9059. Made SET DEBUG visible.  ckuusr.c, 2 Aug 2001.
  9060.  
  9061. Fixed RENAME to allow renaming of directories; dorename(): ckuus6.c,
  9062. 2 Aug 2001.
  9063.  
  9064. Added /TIMEOUT:n switch to ASK and ASKQ so we don't have to set and unset a
  9065. global flag every time we want to ASK with a timeout.  If anybody asks, I can
  9066. also add it to GETC, GETOK, etc, but that's a bit trickier.  ckuus[26].c,
  9067. 2 Aug 2001.
  9068.  
  9069. Jason Heskett <jason.heskett@response.com.au> reported garbage values for
  9070. \%1..9 after SHIFT on SCO.  But it doesn't happen on Sun.  But I could
  9071. reproduce it on Linux/i386.  Turns out the SHIFT code was being a bit too
  9072. clever about moving pointers around to avoid makestr() calls.  Replacing the
  9073. tricky code with straightforward makestr() calls fixed it.  "First make it
  9074. fast, then make it work" :-)  doshift(): ckuus5.c, 7 Aug 2001.
  9075.  
  9076. Added MDTM-format date-time recognition to cmcvtdate() so it can be used to
  9077. parse FTP messages.  ckucmd.c, 7 Aug 2001.
  9078.  
  9079. Started working on delta times, a precursor to generalized date-time
  9080. arithmetic.  The parsing code is in, towards the end of cmcvtdate() but I
  9081. didn't have time to debug it, or to actually do the arithmetic.  ckucmd.c,
  9082. 7 Aug 2001.
  9083.  
  9084. Delta time, cont'd...  Since a date-time can have both a GMT offset and a
  9085. delta time, or one or the other, I had to tighten up on the syntax so if only
  9086. one is given, we know which one it is.  GMT offsets, according to the RFCs
  9087. (and all email samples I've seen), must be exactly four digits with no colon.
  9088. Delta times must either be not four digits, or must include a colon.  Thus
  9089. "13:05 +1000" has a GMT offset, but "13:05 +10:00" has a delta time.  Anyway,
  9090. I've worked the parsing in and I fixed most things that it broke, but have
  9091. not yet done the actual calculations at the end.  ckucmd.c, 8 Aug 2001.
  9092.  
  9093. More fixing and improving cmcvtdate():
  9094.  . Allow ':' as date-time separator since VMS allows it.
  9095.  . Better notification of invalid date-time separators and incomplete dates.
  9096.  . Support for non-GMT timezones in Asctime() date formats.
  9097.  . Detection of pure garbage like lkjlkjlkj.
  9098.  . Support for times with one or two leading ':' characters.
  9099.  . Add symbolic date-time NOW (like TODAY, but current time rather than 00:00)
  9100. ckucmd.c, 9 Aug 2001.
  9101.  
  9102. Added delta-time computation.  Now any date can be followed by a delta time,
  9103. e.g. "9-Aug-2001 17:05:27 +1:15:00", "tomorrow+1year", "today+3d12:34:56",
  9104. etc.  There are still a few wrinkles to be ironed out, though, for example,
  9105. a delta time causes the timezone to be ignored.  Will fix tomorrow.
  9106. ckucmd.c, 9 Aug 2001.
  9107.  
  9108. Fixed delta times to work right after timezone adjustment.  And added
  9109. "+1xhh:mm:ss" notation for delta time, where x = d,w,m,y for days, weeks,
  9110. months, years.  ckucmd.c, 10 Aug 2001.
  9111.  
  9112. Wrote new Dates and Times section for ckermit3.html:
  9113.  
  9114.   http://www.columbia.edu/~fdc/ckermit3.html#x8.13
  9115.  
  9116. mjd() (and \fmjd() and everything else that called mjd()) had the following
  9117. problem:
  9118.  
  9119.   mjd(28 feb 2100) = 88127
  9120.   mjd(29 feb 2100) = -1    <-- no such day.
  9121.   mjd( 1 mar 2100) = 88129
  9122.  
  9123. Turns out there was a systematic error producing Julian dates beginning 1
  9124. March 2100: 3 out of every 4 centuries would skip a day; the problem has been
  9125. there since MJDs were introduced in C-Kermit 7.0.  I fixed it for 2100-9999 by
  9126. adding a short table-based correction.  Not as elegant as fixing the math, but
  9127. it does the job for the next 7999 years.  But oops, there's a worse problem in
  9128. the opposite direction, for dates prior to 1 March 1897: instead of skipping a
  9129. day on non-leap years, it duplicates a day on leap years.  OK, I backed off on
  9130. the table idea, ripped out the mjd() code, and replaced it with a formula that
  9131. works for all years from 0000 t0 9999 on the Gregorian calendar.  ckuus4.c,
  9132. 11 Aug 2001.
  9133.  
  9134. After fixing MJDs, I discovered a problem with (for example)
  9135. "11 Aug 2001 +1000years" because it looks like a GMT offset with junk after
  9136. it, so I changed the GMT-offset parser to pass its string along to the
  9137. delta-time parser if it thinks there's an error.  ckucmd.c, 11 Aug 2001.
  9138.  
  9139. Fixed cmcvtdate() result to always left-0-pad year, month, and day to keep the
  9140. fields fixed, even when given inputs like 2001/9/18.  ckucmd.c, 11 Aug 2001.
  9141.  
  9142. Updated date-time section of my working copy of ckermit3.upd.  11 Aug 2001.
  9143.  
  9144. Having come up with delta times as a data type, this made it easy to add a new
  9145. built-in function, \fdiffdates(d1,d2), that subtracts one date-time from
  9146. another and returns the difference as a delta time.  It works fine but I still
  9147. have to add the niceties like informative error messages, help text, etc.
  9148. Also need to add functions to compare dates and to convert a local date-time
  9149. to GMT, and then I should be finished with dates & times for a while.
  9150. ckuusr.h, ckuus4.c, ckucmd.c, 11 Aug 2001.
  9151.  
  9152. From Jeff: \faddr2name() and \fname2addr() IP name/address conversion.
  9153. ckuusr.h, ckuus4.c, ckcnet.c, 12 Aug 2001.
  9154.  
  9155. Rewrote the date differencing routine, cmdiffdate() after additional testing
  9156. showed it didn't always work fine after all.  ckuus4.c, ckucmd.c, 12 Aug 2001.
  9157.  
  9158. Saw that cmcvtdate() needed to manage a circular buffer of return values,
  9159. because of nested calls where intermediate results were being overwritten even
  9160. though we were still using them.  This required changing it to return a string
  9161. pointer, rather than an int, and changing all of its callers not to refer to
  9162. cmdatebuf[] for the result.  Ditto for cmdiffdate().  ckucmd.[ch], ckcnet.c,
  9163. ckuus[r4].c, 12 Aug 2001.
  9164.  
  9165. Added \fcmpdates() to compare two dates, returns -1, 0, or 1, like strcmp().
  9166. ckuusr.h, ckuus4.c, 12 Aug 2001.
  9167.  
  9168. Added \futcdate() to convert any date-time to GMT (UTC).  ckuusr.h, ckuus4.c,
  9169. 12 Aug 2001.
  9170.  
  9171. Added help text for \fdiffdates(), \fcmpdates(), \faddr2name(), \futcdate(),
  9172. and \fname2addr().  ckuus2.c, 12 Aug 2001.
  9173.  
  9174. Fixed \fcmpdates() to actually return 1, 0, -1 as documented, rather than
  9175. random positive number, 0, random negative number.  ckucmd.c, 13 Aug 2001.
  9176.  
  9177. Fixed cmcvtdate() not to fail on dates like 1/1/2001 because month and
  9178. day are ambiguous.  If they are both 12 or less and equal then who cares.
  9179. ckucmd.c, 13 Aug 2001.
  9180.  
  9181. Jeff noticed that "declare \&a[\m(max_svcs)]" got an error.  This turned out
  9182. to be a double-ended problem that happened only when a DECLARE command used a
  9183. variable as the dimension, and the variable was not defined.  The first problem
  9184. was arraybounds() writing into its argument because it used the wrong pointer;
  9185. the second is too complicated to explain.  ckuus[r5].c, 14 Aug 2001.
  9186.  
  9187. Greg Wright complained that FTP DELETE /QUIET * prints a complaint about the
  9188. SIZE command for each file.  Doesn't happen here.  Anyway, there's no reason
  9189. why FTP DELETE should be sending SIZE commands (other than it shares code
  9190. with FTP MGET), so I changed doftpget() to not send SIZE commands if the
  9191. user's command was FTP DELETE or MDELETE.  ckcftp.c, 14 Aug 2001.
  9192.  
  9193. Added a note about removing -DDCLTIMEVAL to the SCO 5.0.5 entries in case of
  9194. complaints about timeval or timezone; I had to add -DDCLTIMEVAL to make it
  9195. build on my OSR505 system, but evidently it causes conflicts on others.
  9196. makefile, 14 Aug 2001.
  9197.  
  9198. SET FILE STRINGSPACE and LISTSIZE were a bit tangled because initspace() had
  9199. confusing arguments: an array name and a length, but the length was not the
  9200. length of the argument array, but of the string space.  To deconfuse matters,
  9201. I got rid of the array argument, since only one array is used anyway, and I
  9202. made sure the length argument was always the stringspace length and not the
  9203. maximum number of filenames (as it was in at least two places).  ckufio.c,
  9204. 14 Aug 2001.
  9205.  
  9206. Somebody (PeterE?) had asked that the debug log should show the current
  9207. connection and some info about it, if a connection was already open when the
  9208. log was started.  Added to debopn(): ckuus4.c, 14 Aug 2001.
  9209.  
  9210. Added #ifdef HADDRLIST around unguarded calls to ck_copyhostent().
  9211. ckcnet.c, 14 Aug 2001.
  9212.  
  9213. From Jeff: fixes for HADDRLIST versus ck_copyhostent() and AIX.  ckcnet.[ch],
  9214. ckuus5.c, 16 Aug 2001.
  9215.  
  9216. Yesterday's simplification of initspace() was a disaster and broke just about
  9217. everything related to files.  Put it back to two parameters and all seems well
  9218. again.  Also added some debugging statements to zshcmd() since somebody had a
  9219. problem with it and it didn't have any debugging.  ckufio.c, 16 Aug 2001.
  9220.  
  9221. From Jeff: We know that no one uses global system init files because if they
  9222. did, then the -y parameter would have been ignored on their systems.  second,
  9223. it adds prior to checking the home directory a test for CKERMIT.INI and then
  9224. CKERMIT_INI environment variables and treats them as if they were ~/.kermrc.
  9225. ckuus5.c, 20 Aug 2001.
  9226.  
  9227. PeterE reported that if you have a local file that lacks write permission, and
  9228. you try to REGET it, that REGET fails with "Permission denied" even if the
  9229. remote file is the same size as the local one.  If this happens during a
  9230. wildcard transfer, it kills the rest of the transfer.  The debug log shows
  9231. that rcvfil() is calling znewn() to get a backup file name, which doesn't make
  9232. sense since we're not going to create a backup file.  Well, this turns out to
  9233. be a big problem.  It's the old story.  When Kermit gets the F-packet, it
  9234. calls rcvfil(), which, among other things, calculates the output file name
  9235. based on the FILE COLLISION setting, so it can send the name back in the ACK
  9236. to the F packet, so the sender can display and/or log it.  But at this point
  9237. it has not yet received the A packet that contains the Recover disposition, so
  9238. it has no way of knowing it should not do this.  OK, but we should still be
  9239. able to get past this...  And we do.  The receiver sends back the local file
  9240. length in ACK(A).  The sender sees that this is equal to the original file
  9241. length and sends the Z packet.  Here we call opena() even though we don't have
  9242. to, and this is where "Permission denied" occurs.  The trick is to have
  9243. opena() skip opening the file and return a special code in this circumstance
  9244. (doing REGET and remote file size == local file size), and then the <rattr>Z
  9245. handler in the protocol module can set the appropriate flags to keep reof()
  9246. from trying to close the file.  This keeps multifile REGETs from failing
  9247. needlessly in case of write-protected files that don't need updating.
  9248. (It's still not perfect though -- the transaction log is a bit misleading
  9249. about this, but it always has been, so that's a separate problem).
  9250. ckcpro.w, ckcfn[s3].c, 20 Aug 2001.
  9251.  
  9252. PeterE also noticed that "dir blah" says "blah not found or not accessible"
  9253. if user doesn't have read permission on blah, even if they have search
  9254. permission on the directory.  Fixed in zchki(), ckufio.c, 20 Aug 2001.
  9255.  
  9256. Dat Nguyen wants FTP { MPUT, MGET } /UPDATE /SIMULATE, that shows what would
  9257. happen if an update operation were done, without actually doing it.  I started
  9258. on this but didn't finish.  ckuusr.h, ckcftp.c, 20 Aug 2001.
  9259.  
  9260. A user reported SET FILE EOF CTRL-Z doesn't work in K-95 (true).  In testing
  9261. this, I also found that scanfile() mistakenly diagnosed text files that
  9262. contain Ctrl-Z's as binary.  This was because it was insisting that any
  9263. Ctrl-Z's must be at the end of the file, but in fact they can be anywhere in
  9264. the file.  Changed scanfile() to treat Ctrl-Z as a legal text-file character,
  9265. regardless of platform or settings and, only if FILE EOF is set to CTRL-Z, to
  9266. ignore possible junk after the Ctrl-Z (which might otherwise make it look like
  9267. a binary file) if Ctrl-Z is the first control character in the file other than
  9268. CR, LF, HT, and FF.  I'm a bit uncomfortable with this last bit, though, since
  9269. it can make Kermit misdiagnose a binary file whose first non-text character
  9270. happens to be Ctrl-Z as a text file, which would corrupt it in transfer (it's
  9271. generally better to err towards binary, but the risk here doesn't seem too bad
  9272. since it can only happen with SET FILE EOF CTRL-Z, and most true binary files
  9273. have lots of NULs at the beginning).  ckuusx.c, 21 Aug 2001.
  9274.  
  9275. Adapted Jeff's K95 fix for SET FILE EOF CTRL-Z (even though Unix doesn't
  9276. support this).  ckufio.c, 21 Aug 2001.
  9277.  
  9278. Changed #ifdefs to enable SET FILE EOF CTRL-Z for Unix.  ckcdeb.h, 21 Aug 2001.
  9279.  
  9280. Corrected a bug in which FTP PUT would erroneously say "Read access denied"
  9281. when given a wildcard, if the previous FTP PUT command had been given for a
  9282. single file for which read access really was denied.  ckcftp.c, 22 Aug 2001.
  9283.  
  9284. Worked some more on FTP PUT /SIMULATE.  Uncoupled it from /UPDATE, so now it
  9285. works with any FTP PUT command.  Made it show its result in the currently
  9286. selected file transfer display; thus no logs need be active.  This required
  9287. defining a set of skip reason codes SKP_xxx and corresponding strings, and
  9288. including the codes in the ckscreen(SCR_ST,ST_SKIP,...) call as the third
  9289. argument.  Note that files that are skipped because of local-file selectors
  9290. are not listed because gnfile() doesn't return their names.  ckcker.h,
  9291. ckuusx.c, ckcftp.c, 22 Aug 2001.
  9292.  
  9293. Fixed a bug where FTP PUT with selectors would sometimes say "?No files
  9294. selected" even when files had been selected.  ckcftp.c, 22 Aug 2001.
  9295.  
  9296. From Jeff: Fix SET TERM IDLE-SEND which was broken when SET TERM IDLE-ACTION
  9297. was added.  ckuus7.c, 23 Aug 2001.
  9298.  
  9299. Discovered HELP FUNC VERIFY text was (a) misformatted and (b) wrong; it had
  9300. the arguments reversed.  Fixed in ckuus2.c, 23 Aug 2001.
  9301.  
  9302. FTP suppressed error messages during file transfer except when XFER DISPLAY
  9303. was BRIEF, but this caused trouble for operations such as FTP PUT /UPDATE *
  9304. when a local file did not have a counterpart on the server ("blah: No such
  9305. file or directory").  Removed the exception for BRIEF.  ckcftp.c, 23 Aug 2001.
  9306.  
  9307. Last night's FTP PUT /UPDATE /SIMULATE (a) said it would send files whose
  9308. modtimes were equal to the remote's (which was true, but should not have been)
  9309. and (b) did not differentiate between "older than" and "equal to" in its skip
  9310. reason.  Fixed in ckcker.h, ckuusx.c, ckcftp.c, 23 Aug 2001.
  9311.  
  9312. PeterE noticed that the BRIEF file transfer display was messed up when using
  9313. REGET and files were skipped.  It's because reof() skipped calling clsof() in
  9314. this case, but clsof() was the one that tied off each line of the display.
  9315. Fixed in ckcpro.w, 23 Aug 2001.
  9316.  
  9317. But now the original problem is back: REGET * fails when a local file lacks
  9318. write permission, even though the remote file is the same size and doesn't
  9319. need to be downloaded.  Always remember: when we need a file's size, call
  9320. zgetfs() rather than zchki().  The latter checks access, zgetfs() just gets
  9321. the size.  ckcfn3.c, 23 Aug 2001.
  9322.  
  9323. Filled in skip reasons for the few remaining screen(SCR_ST,ST_SKIP,...) calls
  9324. that didn't include them.  Fixed a glitch in the Kermit SEND display for when
  9325. a source file was read-protected.  ckcfns.c, ckcpro.w, 23 Aug 2001.
  9326.  
  9327. Added \fdelta2secs() to convert from delta time to seconds.  Typical use:
  9328. script saves start time, then accumulates some kind of count, then when
  9329. finished it gets the elapsed time with \fdiffdates() as a delta time.  To get
  9330. the events per second (or v.v.) use \fdelta2secs() to convert the delta time
  9331. to seconds and divide.  With sizeof(long) == 32, works for deltas up to 24854
  9332. days or about 63 years.  ckuusr.h, ckucmd.c, ckuus[24].c, 23 Aug 2001.
  9333.  
  9334. Updated http://www.columbia.edu/~fdc/ckermit3.html with new stuff. 23 Aug 2001.
  9335.  
  9336. From Jeff: support for FTP HOST commands.  ckcftp.c, 24 Aug 2001.
  9337.  
  9338. PeterE noticed that file-transfer display during REGET was still fractured
  9339. for XFER DISPLAY SERIAL.  Fixed in ckuusx.c, 24 Aug 2001.
  9340.  
  9341. PeterE also noticed that REGET did not work for empty files.  Fixed in
  9342. gattr(): ckcfn3.c, 24 Aug 2001.
  9343.  
  9344. HELP SET AUTH text said SET AUTHENTICATE when the keyword is actually
  9345. AUTHENTICATION.  ckuus2.c, 24 Aug 2001.
  9346.  
  9347. From Jeff: Insert a missing item (13) in the dialmsg[] table, which caused
  9348. all the subsequent messages to be off by one (i.e. wrong).  ckucia.c,
  9349. 26 Aug 2001.
  9350.  
  9351. From Jeff: HTTP changes to decouple terminal and file output of server
  9352. responses.  I changed /TYPE to /TOSCREEN to match switch terminology used in
  9353. other commands.  ckcnet.h, ckuusr.c, ckcnet.c, 26 Aug 2001.
  9354.  
  9355. From Jeff: Some clarifications to SSL-related help text. ckuus2.c, 26 Aug 2001.
  9356.  
  9357. Noticed the HTTP command was invisible, made it visible. ckuusr.c, 26 Aug 2001.
  9358.  
  9359. Also, I thought that "http get index.html" discarding its results was a bit
  9360. counterintuitive (it's definitely contrary to what all our other GET commands
  9361. do), so I changed it to make the default output file be the input file's name
  9362. with any path stripped, but only if /TOSCREEN was not in effect.  An output
  9363. file can still be specified in any case.  (It looks like the same thing had
  9364. already been done for HTTP HEAD, but I thought HTTP HEAD was not supposed to
  9365. have a default output file, so I commented that part out; maybe the HEAD code
  9366. was supposed to be for GET).  I also made HTTP PUT work like HTTP GET, in
  9367. reverse: the default remote filename is the same as the local one, but with
  9368. any path stripped.  Adjusted HELP HTTP text to match these changes.
  9369. ckuus[r2].c, 26 Aug 2001.
  9370.  
  9371. Changed redhat71 makefile target to include -DNONOSETBUF, since Red Hat seems
  9372. to have broken curses in the now-familiar manner; this does the trick in the
  9373. crudest possible manner.  Later Thomas Dickey suggested something much more
  9374. gross, but also less drastic: putenv("NCURSES_NO_SETBUF=1").  I put this in
  9375. sysinit() within #ifdef NCURSESNOSETBUF..#endif.  Also added a designer banner
  9376. for RH7.1 to make it even more obvious that this is a special build.  ckutio.c,
  9377. ckuver.h, makefile, 27 Aug 2001.
  9378.  
  9379. For the record, Thomas's words were:
  9380.  
  9381.   the problem in short:  it's nice to set buffered I/O but POSIX declines to
  9382.   provide a mechanism to turn it on/off (core dumps result from my attempts to
  9383.   do that - I don't know why, since it's a obvious thing to allow, but bear in
  9384.   mind that some of POSIX simply documents design problems ;-).
  9385.  
  9386.   I have a workaround:  prevent ncurses from setting buffered I/O in the first
  9387.   place - useful for kermit.  That's in 981212 (well before ncurses 5.0, which
  9388.   was almost a year later).  So this fix, if palatable, should apply to most of
  9389.   the installs.  (Solaris has the same problem for the versions I was able to
  9390.   test - 2.5.1, 2.6 and Solaris7).
  9391.  
  9392.   (man ncurses lists the environment variables)
  9393.  
  9394.      NCURSES_NO_SETBUF
  9395.           Normally ncurses enables buffered output during  ter-
  9396.           minal  initialization.   This  is  done  (as  in SVr4
  9397.           curses) for performance reasons.   For  testing  pur-
  9398.           poses, both of ncurses and certain applications, this
  9399.           feature    is    made    optional.     Setting    the
  9400.           NCURSES_NO_SETBUF variable disables output buffering,
  9401.           leaving the output  in  the  original  (usually  line
  9402.           buffered) mode.
  9403.  
  9404.   If you were to do a
  9405.       putenv("NCURSES_NO_SETBUF=1");
  9406.   in kermit, I think it would work.
  9407.  
  9408. From Jeff: enable X Windows Forwarding whenever CK_AUTHENTICATION is defined.
  9409. Make HTTP /TOSCREEN sticky again.  Rearrange ckcnet.h so HADDRLIST stuff is
  9410. done in the right order (to fix Tru64 build).  ckcdeb.h, ckcftp.c, ckcnet.h,
  9411. 27 Aug 2001.
  9412.  
  9413. From Lucas Hart: fixes for Rlogin error messages, except for checking EACCES
  9414. in the Rlogin hint for UNIX, since we can't pull in errno.h without a whole
  9415. big rigamarole.  ckcnet.c, ckuus7.c, 27 Aug 2001.
  9416.  
  9417. Massimo D'Ulisse reported that references to \v(setlinemsg) could dump core.
  9418. There was a mixture of makestr() and regular assignments; I changed all the
  9419. assignments to makestr() calls.  ckuus7.c, 27 Aug 2001.
  9420.  
  9421. From Jeff: CK_FORWARD_X cannot be used on OS/2 because of missing headers;
  9422. Peter's stdio catch; fix for Lucas tn_push() problem; corrections to makefile
  9423. + new secure Solaris 7-8 entries.  ckcdeb.h, ckctel.c, ckcnet.[ch], makefile,
  9424. 28 Aug 2001.
  9425.  
  9426. Changed default output file for HTTP HEAD to be none if /ARRAY or /TOSCREEN,
  9427. and otherwise basename(remote-file).head.  ckuusr.c, 28 Aug 2001.
  9428.  
  9429. Updated HTTP section of ckermit3.html again, and adapted text from Jeff about
  9430. HTTP security options.  28 Aug 2001.
  9431.  
  9432. Fixed ckgetservice() to treat service names case-independently.  ckcnet.c,
  9433. 28 Aug 2001.
  9434.  
  9435. Added URL parsing to HTTP OPEN and HTTP GET.  If an HTTP OPEN URL includes a
  9436. pathname, it acts like GET.  If HTTP GET is given with a URL, it does an
  9437. open.  In both cases, the connection is closed automatically after the GET.
  9438. If a URL is given without a path, it's just a hostname, and works like the
  9439. switches and the connection stays open.  Seems to work fine except I couldn't
  9440. build the SSL version on ftp.kermit because:
  9441.  
  9442.   ckuus3.c:10838: ssl_rsa_cert_chain_file not declared.
  9443.  
  9444. ckuusr.c, 28 Aug 2001.
  9445.  
  9446. Redid the HTTP parser.  Now every command that accepts a remote filename also
  9447. accepts a URL in its place.  If a URL is given and includes a path, the
  9448. command is a one-shot, i.e. opens the connection, does the action, closes the
  9449. connection.  ckuusr.c, 29 Aug 2001.
  9450.  
  9451. Some minor updates from Jeff: ckcdeb.h, ckuusr.c, ckuath.c, 1 Sep 2001.
  9452.  
  9453. Changed IF EXIST to call zgetfs() rather than zchki().  ckuus6.c, 1 Sep 2001.
  9454.  
  9455. Updated HELP HTTP text.  ckuus2.c, 1 Sep 2001.
  9456.  
  9457. Updated HTTP section of ckermit3.html again, 1 Sep 2001.
  9458.  
  9459. It's wasteful to call scanfile() if the file is a directory.  Fixed in
  9460. putfile(): ckcftp.c, 2 Sep 2001.
  9461.  
  9462. Discovered that scanfile() always calls matchname(), rather than only when
  9463. filescan is disabled, as was intended.  Fixed in scanfile(): ckuusx.c,
  9464. 2 Sep 2001.
  9465.  
  9466. Dat Nguyen reported that FTP MPUT /RECURSIVE started skipping empty
  9467. directories, even though this worked when I added the feature a month ago.
  9468. But now I don't see how sending empty directories could ever have worked;
  9469. there was no code to do it.  Added the code.  ckcftp.c, 2 Sep 2001.
  9470.  
  9471. While debugging this, I discovered that "delete /tree ~/blah/*" fails, but
  9472. the same command works if I use the actual path rather than tilde.  Debug
  9473. log shows that Kermit is working right, but silly watsun symlinks are messing
  9474. me up (see /etc/passwd).
  9475.  
  9476. Also it says "Not a deletable file: ..." when no files match.  Fixed up the
  9477. DELETE error messages (again).  ckuus6.c, 2 Sep 2001.
  9478.  
  9479. Sending a tree of empty directories with FTP prints unwanted messages when
  9480. doing the CWD commands in syncdir(), like "CWD command successful".  I don't
  9481. see any reason for it; ftp_vbm is 0, and it's not an error message.  But I
  9482. don't dare touch the FTP message code, so I guess we'll have to live with it.
  9483. Anyway, now it's possible to send a wide, deep tree composed of any mixture
  9484. empty directories and directories with files.
  9485.  
  9486. How can FTP PUT /RECURSIVE /UPDATE /SIMULATE possibly work?  If it can't
  9487. create directories on the server, then it can't descend.  Currently, syncdir()
  9488. creates the directories anyway.  Added code to make syncdir() not create
  9489. directories if /SIMULATE.  ckcftp.c, 2 Sep 2001.
  9490.  
  9491. Changed syncdir() to call screen() when it creates a directory.  ckcftp.c,
  9492. 2 Sep 2001.
  9493.  
  9494. From Jeff:
  9495.  
  9496.   Fixed routine status messages so they could be viewed during file
  9497.   transfer when SET FTP DEBUG ON and SET FILE DISPLAY BRIEF
  9498.  
  9499.   Fixed simulated recursive PUTs so that they actually simulate the
  9500.   creation of directories instead of treating a directory creation as a
  9501.   failure condition.
  9502.  
  9503.   Fixed a missing return() in the SSL/TLS auth code that resulted in a
  9504.   failure during the transmission of the first message to the server.
  9505.  
  9506.   Note: when 'displa' was originally added the ckcftp.c module it was
  9507.   put there to track whether or not the full screen display had been
  9508.   activated.  The SSL/TLS code relies on this original interpretation so
  9509.   that it knows whether or not ftscreen() should be called with SCR_TC
  9510.   if the user might be prompted to authorize a certificate.
  9511.  
  9512. ckcftp.c, ckuusx.c, 4 Sep 2001.
  9513.  
  9514. Dat Nguyen wanted FTP MPUT /UPDATE display and transaction log entries to
  9515. distinguish between sending a file because it is newer than the remote, and
  9516. sending the file because it doesn't exist on the remote side.  Done by adding
  9517. a couple more SKP_xxx codes and corresponding messages.  ckcker.h, ckcftp.c,
  9518. ckuusx.c, 5 Sep 2001.
  9519.  
  9520. FTP PUT /LISTFILE: was broken.  The statement that assigned the filename
  9521. had mysteriously disappeared.  ckcftp.c, 6 Sep 2001.
  9522.  
  9523. Fixed FTP MPUT /SIMULATE's WOULD CREATE DIRECTORY message to show the full
  9524. path rather than just the current segment.  ckcftp.c, 6 Sep 2001.
  9525.  
  9526. Added a very simple way to trap Ctrl-C in scripts.  If a macro named ON_CTRLC
  9527. is defined, it is executed just prior to rolling back the command stack, and
  9528. then it is undefined; thus it must be defined for each use.  This is done in
  9529. just a couple of extra lines in fixcmd().  ckuus5.c, 6 Sep 2001.
  9530.  
  9531. Changed \ftrim() and \fltrim(), which are supposed to trim "whitespace" by
  9532. default, to include CR and LF in their definition of whitespace.  Useful,
  9533. e.g., with \ftrim(\v(input)) after "input 10 \10".  ckuus4.c, 6 Sep 2001.
  9534.  
  9535. "ftp put /recursive /listfile:blah" didn't work because cmifi() sets the &wild
  9536. flag if recursive != 0, and we don't want the /listfile: argument to be wild.
  9537. Fixed by checking the filespec for wildness too.  ckcftp.c, 7 Sep 2001.
  9538.  
  9539. "ftp mput /listfile:blah" failed, either with a random error message or no
  9540. message at all.  But "put" (rather than "mput") worked OK.  This is because
  9541. the PUT/MPUT difference was taking precedence over the /LISTFILE: switch in
  9542. setting things up for gnfile(), so I reversed the precedence by making
  9543. /LISTFILE turn MPUT into PUT.  ckcftp.c, 7 Sep 2001.
  9544.  
  9545. A command like "ftp put /listfile:foo bar" does not make sense.  Either you
  9546. have a listfile or you give a filespec, but not both.  Yet the parser let
  9547. you do this (and of course it didn't work).  Fixed doftpput() to not allow
  9548. this combination.  ckcftp.c, 7 Sep 2001.
  9549.  
  9550. Discovered that Ctrl-C can clobber command recall.  This is nothing new, i.e.
  9551. ON_CTRLC didn't have anything to do with it, but it did make it obvious.  It
  9552. happens whenever we turn off recall for commands like ASK, GETOK, etc, and
  9553. then Ctrl-C out of that command: the previous recall setting is not restored.
  9554. I went through all affected modules and cleaned it up.  ckucmd.c,
  9555. ckuus[367].c, 7 Sep 2001.
  9556.  
  9557. Fixes to UUCP lockfile handling for OpenBSD from Christian Weisgerber.
  9558. makefile, ckutio.c, 7 Sep 2001.
  9559.  
  9560. From Jeff: Fix to file xfer statistics (file count).  ckuusx.c, 8 Sep 2001.
  9561.  
  9562. Filled in a couple missing transaction log calls for FTP PUT /SIMULATE.
  9563. ckcftp.c, 8 Sep 2001.
  9564.  
  9565. Lucas Hart pointed out that "ftp quit" didn't work as expected (i.e. as
  9566. a synonym for FTP BYE).  That's because "quit" isn't in the FTP keyword table,
  9567. so it was taken as a hostname, i.e. a request to make a new connection when
  9568. another connection was already open, giving the "OK to close?" message.  Added
  9569. QUIT as an invisible synonym for BYE (and CLOSE).  ckcftp.c, 8 Sep 2001.
  9570.  
  9571. About a month ago Jeff mentioned that Kermit's RECEIVE command didn't work
  9572. when an FTP connection was open.  RECEIVE was erroneously lumped together with
  9573. GET in doxget() when dispatching to the FTP module.  RECEIVE, of course, would
  9574. not apply to an FTP connection.  Fixed in ckuus6.c, 8 Sep 2001.
  9575.  
  9576. Some perror()'s in ckcnet.c were not guarded by "if (!quiet)".  9 Sep 2001.
  9577.  
  9578. Begin build-all Sun Sep  9 12:50:57 2001.
  9579.  
  9580. Feature-set builds on Linux, gcc 2.96:
  9581.  
  9582.             Previous       New
  9583. Build           Size      Size    Growth     Corrections
  9584.  Full        1984671   2041303     56632         
  9585.  NOSPL       1667990   1717241     49251     ckucmd.c ckuus5.c
  9586.  NOCSETS     1607616   1664120     56504
  9587.  NONET       1710743   1747095     36352     ckuusx.c
  9588.  NOFTP       1843513   1896562     53049
  9589.  NODEBUG     1769572   1814108     44536
  9590.  NOHELP      1699954   1749458     49504
  9591.  NOLOCAL     1445894   1480948     35054     ckucmd.c
  9592.  NODIAL      1844366   1900838     56472
  9593.  NOXFER      1452623   1501348     48725     ckucmd.c ckuusx.c
  9594.  NOICP        479462    489490     10028     ckuus4.c ckuusx.c
  9595.  NOPUSH      1937601   1993359     55758
  9596.  
  9597. I decided there was no harm in letting Thomas Dickey's
  9598. putenv("NCURSES_NO_SETBUF=1") statement execute in all versions of UNIX.  This
  9599. should sidestep the ncurses bug automatically on all platforms with relatively
  9600. recent ncurses versions without having to do special builds.  ckutio.c,
  9601. 9 Sep 2001.
  9602.  
  9603. Added prototypes for ckaddr2name() and ckname2addr().  ckcnet.h, 9 Sep 2001.
  9604.  
  9605. Added makefile target for FreeBSD 4.4.  9 Sep 2001.
  9606.  
  9607. #ifdef'd out the ck{name,addr}2{addr,name}() function contents for HP-UX 5.00,
  9608. which doesn't have gethostbyaddr().  ckcnet.c, 9 Sep 2001.
  9609.  
  9610. ---C-Kermit 8.0.200 Beta.03---
  9611.  
  9612. Added -DNODEBUG back to the ultrix44 CFLAGS, because without it it still gets
  9613. relocation errors (on MIPS), even though other Ultrix entries don't.  makefile,
  9614. 25 Sep 2001.
  9615.  
  9616. Changed all HP-UX makefile entries to use consistent 4-digit version numbers:
  9617. hpux0500, hpux0650, ... hpux1100.  makefile, 26 Sep 2001.
  9618.  
  9619. From PeterE: a few typos in new HP-UX makefile targets fixed, 1-11 Oct 2001.
  9620.  
  9621. \futcdate() needed #ifdef CKFLOAT..#endif because it uses cmdiffdate(), which
  9622. uses floating-point arithmetic.  ckuus4.c, 7 Oct 2001.
  9623.  
  9624. From Jeff: SET TERM TYPE ADM3A.  ckuusr.h, ckuus[57].c, 12 Oct 2001.
  9625.  
  9626. PeterE complained there was no command-line option to turn off permission
  9627. setting.  True.  There is a "--permissions:xxx" option, but that's for IKSD
  9628. to set permissions of incoming files on anonymous connections.  There are
  9629. no single letters left.  For now, -C "set attr protect off" can be used.
  9630.  
  9631. Dat Nguyen had a couple reports about the FTP client.
  9632.  
  9633.  . mput /update * where source and destination directories were identical
  9634.    sent the files anyway.
  9635.    - with /simulate: no, it works right.
  9636.    - without /simulate: ditto.
  9637.  
  9638.  . mput'ing from a listfile doesn't work if listfile contains full pathnames.
  9639.    - find /w/fdc/tmpx -print > xxx, ftp mput /recu /upd /sim /listfile:xxx
  9640.    - find . -print > xxx, ftp mput /recu /upd /sim /listfile:xxx
  9641.  
  9642. First, with listfile containing relative paths:
  9643.   rcd tmp4
  9644.   ftp mput /listfile:tmp2/x /update /recursive /simu <-- works
  9645.   ftp mput /listfile:tmp2/x /update /recursive       <-- works (sends files)
  9646.   ftp mput /listfile:tmp2/x /update /recursive       <-- works (skips them)
  9647.   ftp mput /listfile:tmp2/x /update /recursive /simu <-- works
  9648.  
  9649. Then with listfile containing absolute paths:
  9650.   Same series of commands still works right.
  9651.  
  9652. Added /OUTPUT: to GREP.  What's the point of GREP'ing in a script if you
  9653. can't put the result anywhere?  dogrep(): ckuus6.c, 12 Oct 2001.
  9654.  
  9655. Ditto for TYPE, HEAD, TAIL.  ckuus[r2567].c, 12 Oct 2001.
  9656.  
  9657. Added missing HELP MORE.  ckuus2.c, 12 Oct 2001.
  9658.  
  9659. Fixed a typo in dotype() that broke more-prompting.  ckuus6.c, 13 Oct 2001.
  9660.  
  9661. Changed CAT from an invisible synonym for TYPE to a separate keyword that's
  9662. equivalent to TYPE /NOPAGE, just as MORE is equivalent to TYPE /PAGE.
  9663. ckuusr.[ch], 13 Oct 2001.
  9664.  
  9665. Fixed command-line help to show the program name, which had somehow gone
  9666. missing since 7.0.  ckuusy.c, 13 Oct 2001.
  9667.  
  9668. Changed "kermit -h" to list all options.  There's no longer any point in
  9669. trying to make option list fit on a 24x80 screen.  ckuusy.c, 13 Oct 2001.
  9670.  
  9671. TYPE, GREP, and friends, when given with /OUTPUT:, were vulnerable to ^C.
  9672. If this was done repeatedly, we'd run out of file handles.  Made the output
  9673. file pointer static and cleared it on SIGINT as well as any other time it
  9674. was not equal to 'stdout' when it should have been.  ckuus[r6].c, 14 Oct 2001.
  9675.  
  9676. Removed all debug("XXX...",...) statements -- temporary debug() calls that
  9677. should have been cleaned up after whatever debugging session they were used
  9678. for, that were cluttering up the debug log.  ckcmai.c, ckcfn2.c, ckucmd.c,
  9679. ckucns.c, ckucon.c, ckuus[r57].c, 14 Oct 2001.
  9680.  
  9681. Discovered that askmore()'s state could be lost after Ctrl-C.  Many routines
  9682. set xaskmore to the value of some other variable, e.g. 'paging', which might
  9683. be -1.  If such a routine is interrupted and xaskmore's value is left that
  9684. way, then "if (xaskmore)" succeeds where it shouldn't have.  The whole
  9685. xaskmore/saveask business was such a big mess, I cleaned it out and replaced
  9686. it with a clean, simple scheme.  ckuus[r3567x].c, 14 Oct 2001.
  9687.  
  9688. Added /OUTPUT: switch to DIRECTORY.  This is especially handy with DIR /BRIEF,
  9689. which now, when given in combination with /OUTPUT:, creates a file list usable
  9690. by other commands (or programs) -- one filename per line -- with all the file
  9691. selection criteria applied.  ckucmd.[ch], ckuusr.[ch], ckuus2.c, 14 Oct 2001.
  9692.  
  9693. By the way: if you want to get a brief listing in one column, rather than in
  9694. as many columns as fit across the screen, use /BRIEF /OUTPUT:/dev/tty.
  9695.  
  9696. The GETOK dialog (which parses a keyword: yes, no, ok) did not give help.
  9697. Fixed in doask(), ckuus6.c, 14 Oct 2001.
  9698.  
  9699. Added TYPE /NUMBER to add line numbers.  ckuusr.h, ckuus[r26].c, 14 Oct 2001.
  9700.  
  9701. Added \v(timestamp), which gives current yyyymmdd hh:mm:ss.  Previously you
  9702. always had to call two functions to get this.  ckuusr.h, ckuus4.c, 14 Oct 2001.
  9703.  
  9704. Added \v(hour), hour of the day (0-23).  ckuusr.h, ckuus4.c, 14 Oct 2001.
  9705.  
  9706. Made sure that NOLOCAL implied NOHTTP and that NONET implied NOFTP.
  9707. ckcdeb.h, 14 Oct 2001.
  9708.  
  9709. Changed ckcker.h to enforce a max send-packet size of 4000 for IRIX 6.4
  9710. and earlier because of its broken Telnet server.  ckcker.h, 14 Oct 2001.
  9711.  
  9712. The standard C-Kermit init file is gross and outdated and needs to be retired.
  9713. I considered this but it can't be done without breaking the book, existing
  9714. practice, etc.  So instead I just trimmed it.  No more:
  9715.  
  9716.  . Setting fullscreen mode depending on platform - the code now does this.
  9717.  . EDIT macro <-- obsolete.
  9718.  . TSEND BSEND etc <-- obsolete.
  9719.  . PCGET, PCSEND, etc <-- obsolete
  9720.  
  9721. Then to make it load much faster automatically, I changed it to skip over all
  9722. the ACCESS, UNIXLOGIN, etc etc, definitions if a services directory is not
  9723. found.  None of this should break anything.  ckermit.ini, 14 Oct 2001.
  9724.  
  9725. Removed anachronisms from ckermod.ini, 14 Oct 2001.
  9726.  
  9727. Ran trial feature-deselection builds on Linux, gcc 2.96, 14 Oct 2001:
  9728.  
  9729.             Previous       New
  9730. Build           Size      Size    Growth     Corrections
  9731.  Full        2041303   2042420     1117
  9732.  NOSPL       1717241   1719158     1917
  9733.  NOCSETS     1664120   1665205     1085
  9734.  NONET       1747095   1747333      238
  9735.  NOFTP       1896562   1897679     1117
  9736.  NODEBUG     1814108   1817017     2909
  9737.  NOHELP      1749458   1756537     7079      ckuusy.c
  9738.  NOLOCAL     1480948   1483345     2397
  9739.  NODIAL      1900838   1902083     1245
  9740.  NOXFER      1501348   1502593     1245      ckuus[6x].c
  9741.  NOICP        489490    489250     -240
  9742.  NOPUSH      1993359   1994380     1021
  9743.  NOUNICODE         -   1749406        -
  9744.  NOIKSD            -   1991903        -
  9745.  NOFLOAT           -   2004863        -
  9746.  NOPTY             -   2032563        -
  9747.  NOUUCP            -   2042292        -
  9748.  NOCKXYZ           -   2035662        -
  9749.  NOSYSLOG          -   2035940        -
  9750.  NOWTMP            -   2040754        -
  9751.  NONZXPAND         -   2041468        -      ckufio.c
  9752.  NOZXREWIND        -   2042587        -      ckufio.c
  9753.  NOREALPATH        -   2036711        -
  9754.  NOCKSPEED         -   2036001        -      ckcpro.w, ckuus5.c
  9755.  NOSERVER          -   2013903        -
  9756.  NOCKTIMERS        -   2039324        -
  9757.  NOPATTERNS        -   2031118        -
  9758.  NOSTREAMING       -   2038282        -      ckcpro.w, ckcfns.c, ckcfn2.c
  9759.  NOAUTODL          -   2038144        -      ckucmd.c
  9760.  NOSYMLINK         -   2039187        -
  9761.  NOMSEND           -   2036037        -      ckcftp.c
  9762.  NOTLOG            -   2027148        -
  9763.  NOCKXXCHAR        -   2039759        -
  9764.  MINIDIAL          -   2012919        -
  9765.  IKSDONLY          -   1516001        -
  9766.  NOHTTP            -   2001883        -
  9767.  NOBROWSER         -   2034640        -
  9768.  NOLOGIN           -   1991903        -
  9769.  NO_COMPORT        -   2023673        -
  9770.  NOSSH             -   2040580        -
  9771.  NOSCRIPT          -   2034849        -
  9772.  NOSETKEY          -   2037489        -
  9773.  NOXMIT            -   2029710        -
  9774.  NOAPC             -   2033714        -
  9775.  NOTCPOPTS         -   2028875        -
  9776.  NOSTAT            -   2042228        -
  9777.  NOLSTAT           -   2041360        -
  9778.  NOCHANNELIO       -   2010894        -
  9779.  NOCKEXEC          -   2010894        -
  9780.  NOFAST            -   2041116        -
  9781.  NOHWPARITY        -   2040836        -
  9782.  NOUNPREFIXZERO    -   2042292        -
  9783.  NOCAL             -   2040680        -
  9784.  NORECURSE         -   2038395        -
  9785.  NOURL             -   2036486        -      ckuus[r4y].c, ckcmai.c, ckcftp.c
  9786.  NOTRIGGER         -   2039146        -      ckuus5.c
  9787.  NOFRILLS          -   1852991        -
  9788.  NORLOGIN          -   2036165        -
  9789.  redhat71          -   4463183        -      (many warnings in security code)
  9790.  
  9791. A user reported a build failure when #defining NODEBUG in ckcsym.h.  It turns
  9792. out that recently created modules have not been #including it.  Fixed in
  9793. ckupty.c, ckcftp.c, ckuath.c, ck_des.c, ck_crp.c, ck_ssl.c, 14 Oct 2001.
  9794.  
  9795. Fixed a typo (missing quotes) in the new 'kermit -h' help text.
  9796. ckuusy.c, 15 Oct 2001.
  9797.  
  9798. Changed #ifdef TCPSOCKET around 'extern int ttnproto;' to #ifdef TNCODE for
  9799. HP-UX 8.00.  ckcpro.w, 15 Oct 2001.
  9800.  
  9801. Guarded all references to zmkdir() in ckcftp.c by #ifndef NOMKDIR, and to
  9802. zfseek() by #ifndef NORESEND.  15 Oct 2001.
  9803.  
  9804. Changed extended command-line options to not require the interactive
  9805. command parser, and made regular and extended options help available in
  9806. NOICP builds.  ckuusy.c, 15 Oct 2001.
  9807.  
  9808. Modified the Linux entry to account for platforms (like Debian 2.1 and
  9809. Slackware 4.0) that have /dev/ptmx but don't have grantpt() or other
  9810. associated functions in the libraries.  I suppose this must be yet another
  9811. libc/glibc issue.  Anyway, now "make linux" works on both late-model Linuxes
  9812. like RH7.1, as well as on Debian 2.1 and Slackware 4.0, and should work again
  9813. for any Linux.  makefile, 15 Oct 2001.
  9814.  
  9815. Wrote scripts to automate building with various CFLAGS and combinations of
  9816. CFLAGS.  New combinations:
  9817.  
  9818.  NOSPL+NOCSETS                   1342585
  9819.  NOICP+NOCSETS                    497033
  9820.  NOICP+NOCSETS+NONET              385488
  9821.  NOICP+NOCSETS+NOLOCAL            335406
  9822.  NODEBUG+NOICP+NOCSETS+NOLOCAL    242370   ckufio.c
  9823.  NOCTRLZ                         2040932
  9824.  NOPERMS                         2034654
  9825.  NOMKDIR                         2036810
  9826.  NOREDIRECT                      2029701
  9827.  NORESEND                        2036338
  9828.  NOTTGWSIZE+NORLOGIN             2032565   (NOTTGWSIZE fails without NORLOGIN)
  9829.  NOTIMEZONE                      2042273   ckutio.c
  9830.  NOPARSEN                        2040699   ckutio.c
  9831.  NOMDMHUP                        2040508
  9832.  NOLOGDIAL                       2032801   ckuus4.c
  9833.  NOSEXP                          2020846
  9834.  
  9835. The smallest C-Kermit I can build on Linux is NODEBUG NOICP NOCSETS NOLOCAL
  9836. plus a bunch of other relatively inconsequential NOxxxx's, which comes out to
  9837. about 234K.
  9838.  
  9839. How do you tell if it's libc or glibc?
  9840. strings libc.a | grep glibc | wc -l (or libc.so.n.nn...)
  9841.  
  9842. Regular builds (I'm not saving binaries this time):
  9843.  [ok] AIX 3.2.5
  9844.  [  ] AIX 4.1.1
  9845.  [  ] AIX 4.2.x
  9846.  [ok] AIX 4.3.2
  9847.  [..] AIX 4.3.3 gcc  <-- huey, libm is missing, can't link. compiles ok tho.
  9848.  [  ] AIX 5.xxx?
  9849.  [ok] BSDI 4.1
  9850.  [ok] BSDI 4.2
  9851.  [  ] DG/UX 5.44R3.10
  9852.  [ok] DG/UX 5.44R4.11
  9853.  [ok] FreeBSD 2.2.8 Intel (libc)
  9854.  [ok] FreeBSD 3.3 Intel (libc) <-- really libc?
  9855.  [ok] FreeBSD 3.4 Intel (libc) <-- really libc?
  9856.  [ok] FreeBSD 4.4 Intel (libc) <-- really libc?
  9857.  [ok] IRIX 6.5.13f
  9858.  [ok] HP-UX: 5.21 (no tcp)
  9859.  [ok] HP-UX: 5.21 (tcp)
  9860.  [ok] HP-UX: 6.x
  9861.  [  ] HP-UX: 7.x
  9862.  [ok] HP-UX: 8.00 (tcp, no curses)
  9863.  [ok] HP-UX: 8.00 (no tcp, no curses)
  9864.  [ok] HP-UX: 8.00 (tcp, curses)
  9865.  [ok] HP-UX: 9.05
  9866.  [ok] HP-UX: 10.20 (non-Ansi C)
  9867.  [ok] HP-UX: 10.20 (Ansi C)
  9868.  [  ] HP-UX: 11.00
  9869.  [  ] HP-UX: 11i
  9870.  [ok] Linux: Debian 2.1 Intel (libc)
  9871.  [ok] Linux: Slackware 4.0 (libc) and 8.0 Intel (glibc)
  9872.  [ok] Linux: RH 5.2, 6.1, 7.0, 7.1 Intel (all glibc)
  9873.  [ok] Linux: RH 6.2 Alpha
  9874.  [ok] Linux: RH 6.2 Sparc
  9875.  [ok] Linux: SuSE 6.4 (glibc), SuSE 7.0 Intel (glibc)
  9876.  [ok] Linux PPC 2000q4
  9877.  [ok] Mac OS X Darwin 1.3.3
  9878.  [ok] Motorola MVME 167 68K, NetBSD 1.5.2
  9879.  [ok] Motorola MVME 147 68K, System V/68 R3
  9880.  [ok] Motorola MVME 197 88K, System V/88 R4
  9881.  [ok] Motorola MVME 187 88K, System V/88 R4
  9882.  [ok] Motorola MVME 197 88K, System V/88 R4 V4.4
  9883.  [ok] NetBSD 1.4.1
  9884.  [ok] NeXT 68040 NeXTSTEP 3.1
  9885.  [ok] OpenBSD 2.5, 2.8
  9886.  [ok] QNX 4.25
  9887.  [ok] SCO Xenix 2.3.4 with & without TCP/IP
  9888.  [ok] SCO UNIX 3.2v4.2 with (*) & without TCP/IP
  9889.  [ok] SCO Open Server 5.0.2, 5.0.5, 5.0.6 with & without TCP/IP
  9890.  [ok] SCO Unixware 2.1.0, 2.1.3
  9891.  [  ] SCO Unixware 7.0.1
  9892.  [ok] SCO Unixware 7.1.1
  9893.  [ok] SCO (Caldera) Open UNIX 8.0
  9894.  [ok] SINIX 5.42
  9895.  [ok] Solaris 2.5.1 Sparc Sun cc
  9896.  [ok] Solaris 2.6 Intel gcc
  9897.  [ok] Solaris 7 Sparc Sun cc
  9898.  [ok] Solaris 8 Intel gcc
  9899.  [ok] Solaris 8 Sparc Sun cc
  9900.  [ok] Solaris 8 Sparc gcc
  9901.  [ok] SunOS 4.1.3 gcc
  9902.  [ok] SunOS 4.1.3 cc (non-Ansi)
  9903.  [ok] Tru64 UNIX 4.0E
  9904.  [ok] Ultrix 4.5 VAX
  9905.  [ok] VMS 5.5 VAX nonet
  9906.  [ok] VMS 5.5 VAX UCX 2.0
  9907.  [ok] VMS 7.1 VAX nonet (**)
  9908.  [ok] VMS 7.1 VAX + TGV 4.1 (**)
  9909.  [ok] VMS 6.2 Alpha nonet
  9910.  [ok] VMS 6.2 Alpha + UCX 4.0
  9911.  [ok] VMS 7.1 Alpha nonet
  9912.  [ok] VMS 7.1 Alpha + UCX 4.2
  9913.  [ok] VMS 7.1 Alpha + TGV 4.2
  9914.  [ok] VMS 7.1 Alpha + TCPware 5.4
  9915.  [ok] VMS 7.2 Alpha nonet
  9916.  [ok] VMS 7.2 Alpha + TGV 4.3
  9917.  [ok] VMS 7.3 Alpha nonet
  9918.  [ok] VMS 7.3 Alpha + TGV 4.3
  9919.  
  9920. (*) I get some warnings in ckcftp.c, but FTP connections & transfers work ok.
  9921.  
  9922. Fixed hpux0500 target to carry forward LIBS clause of any other target (such
  9923. as hpux0500wintcp) that called it.  makefile, 16 Oct 2001.
  9924.  
  9925. Lab disk for UW 7.0.1 boots but doesn't find net.  But all the others are OK.
  9926. Maybe it has to do with internal Ethernet card being enabled?
  9927.  
  9928. (**) I let the ckuus4.c compile on baton (VMS 7.1 VAX 3100) run 24 hours
  9929. and gave up.  Restarted the build as 'make m "" "" "/NOOPT"'.  This gets past
  9930. it.  16 Oct 2001.
  9931.  
  9932. FTP CD did not print "readme" messages sent by the server, except the first
  9933. one.  That's because the first message was a 230, but subsequent ones were
  9934. 250, which are not printed unless FTP VERBOSE is ON.  But regular FTP clients
  9935. print both kinds of messages, so I changed FTP CD call ftpdocwd() with the
  9936. vbm argument set to 1 rather than -1, which produces the desired effect.
  9937. ckcftp.c, 17 Oct 2001.  (For docs: suppress CD messages with SET QUIET ON
  9938. or send password starting with "-"; I could have added SET FTP CD-MESSAGE but
  9939. why add another level of confusion...)
  9940.  
  9941. Added --noperms extended cmdline option, to turn off Permissions attribute,
  9942. for PeterE.  ckuusr.h, ckuusy.c, 17 Oct 2001.
  9943.  
  9944. Updated NEWS text.  ckuus2.c, 17 Oct 2001.
  9945.  
  9946. It has always been annoying that you have to be so careful with commas in
  9947. macro definitions, since comma is the command separator.  The classic problem
  9948. occurs in ECHO commands:
  9949.  
  9950.   define foo {
  9951.       (some command)
  9952.       if fail echo Sorry, blah failed...
  9953.   }
  9954.  
  9955. This would result in Kermit trying to execute a "blah" command.  This could
  9956. always be handled by enclosing the text in braces:
  9957.  
  9958.   define foo {
  9959.       (some command)
  9960.       if fail echo {Sorry, blah failed...}
  9961.   }
  9962.  
  9963. but doublequotes (more intuitive) should have worked too.  Now they do:
  9964.  
  9965.   define foo {
  9966.       (some command)
  9967.       if fail echo "Sorry, blah failed..."
  9968.   }
  9969.  
  9970. This is a rather fundamental change, but all the torture-test scripts still
  9971. work fine and I can't find anything that it breaks.  Back off by defining
  9972. NODQMACRO.  getncm(): ckuus5.c, 19 Oct 2001.
  9973.  
  9974. A code snippet in the extended-options parser got misplaced when adding
  9975. --noperms causing "statement not reached" in HP-UX 6.x.  Fixed in doxarg():
  9976. ckuusy.c, 19 Oct 2001.
  9977.  
  9978. Although we support telnet, iksd, and ftp URLs on the command line, we don't
  9979. support http ones.  The URL-parsing bit in cmdlin() needed generalization,
  9980. which I did, adding a switch() for the URL type (service).  But I didn't fill
  9981. in the http case since it's a bit complicated and involves security.  Deferred
  9982. until after 8.0 unless Jeff wants to do it (find "URL_HTTP:" in ckuusy.c.
  9983. Also deferred -- there is no support for (r)login URLs or command-line
  9984. personality (no big deal, nobody has ever noticed).  Is there such a thing as
  9985. an SSH URL?  19 Oct 2001.
  9986.  
  9987. Added \fdos2unixpath() and \funix2dospath(), which mainly just switch slash
  9988. and backslash, but also do something dumb with disk letters (DOS) and tilde
  9989. (~).  These are mainly just for notational convenience and speed in scripts
  9990. that have to deal with DOS pathnames -- \fdos2unix(\m(blah)) looks better
  9991. than \freplace(\m(blah),\\,/).  ckuus4.c, 19 Oct 2001.
  9992.  
  9993. The use of "2" in function names instead of "to" is a bit cutesy and obviously
  9994. English-centric, so I made invisible aliases for all such functions with "to"
  9995. instead.  ckuus4.c, 19 Oct 2001.
  9996.  
  9997. Kerbang scripts did not get their arguments if the script writer accidentally
  9998. left any whitespace after the '+'.  The shell really should have trimmed the
  9999. line but apparently can't be relied on to do this.  So now Kermit checks for
  10000. either complete string "+", or '+' followed by whitespace.  ckuus[45].c,
  10001. 19 Oct 2001.
  10002.  
  10003. "echo \%*" at the prompt doesn't show Kermit's command-line arguments.  This
  10004. turns out to be too hard to fix without breaking kerbang scripts, etc, so I
  10005. left it alone (added some code and then commented it out).  19 Oct 2001.
  10006.  
  10007. From Jeff: rearrange command-line parsing and add support for HTTP URLs as
  10008. command-line arguments.  ckcker.h, ckuus[4y].c, 20 Oct 2001.
  10009.  
  10010. From Jeff: "urlparse() now breaks up the url with the proper path.  '/' should
  10011. not be stripped from either the beginning or end of the path.  Replaced the
  10012. url_hos, ... variables with structs."  Plus fill in some missing HTTP code,
  10013. plus SSH-related changes for K95.  ckuusy.c ckcmai.c ckuusr.c ckcftp.c
  10014. ckuus4.c ckuus3.c ckcker.h ck_des.c.  21 Oct 2001.
  10015.  
  10016. Ran 77 different feature-test builds.  A few #ifdef adjustments were needed
  10017. for new URL code, etc.  ckuusr.c, ckuusy.c.  21 Oct 2001.
  10018.  
  10019. Fixes from Jeff for kermit (iksd) URLs.  ckuusy.c, ckctel.c, 22 Oct 2001.
  10020.  
  10021. Added -R (recursive) option to ftp command-line personality.  This took just
  10022. a couple lines of code.  Works OK for put, but it doesn't work with GET.
  10023. In debugging this, I find that MGET /RECURSIVE doesn't seem to work right
  10024. either...  (Did it ever?)  Here is remote directory tmpx:
  10025.  
  10026.   drwxrwx---       512  2001-09-02 16:23:32  a
  10027.   drwxrwx---       512  2001-09-02 16:23:32  a/a_a
  10028.   drwxrwx---       512  2001-09-02 16:23:33  a/a_b
  10029.   drwxrwx---       512  2001-09-02 16:23:32  a/a_b/a_b_a
  10030.   drwxrwx---       512  2001-09-02 16:23:32  a/a_b/a_b_b
  10031.   drwxrwx---       512  2001-09-02 16:23:32  a/a_b/a_b_b/a_b_b_a
  10032.   drwxrwx---       512  2001-09-02 16:23:33  a/a_b/a_b_c
  10033.   -rw-rw-rw-      6263  2001-09-02 16:23:33  a/a_b/a_b_c/some.txt
  10034.   -rw-rw----      6263  2001-09-02 16:23:33  a/a_b/moon.doc
  10035.   drwxrwx---       512  2001-09-02 16:23:32  a/a_c
  10036.   drwxrwx---       512  2001-09-02 16:23:33  b
  10037.   drwxrwx---       512  2001-09-02 16:23:32  b/b_a
  10038.   drwxrwx---       512  2001-09-02 16:23:33  b/b_b
  10039.   -rw-rw-rw-         0  2001-09-02 16:23:33  b/b_b/empty-file
  10040.   drwxrwx---       512  2001-09-02 16:23:33  b/b_c
  10041.   drwxrwx---       512  2001-09-02 16:23:33  c
  10042.   drwxrwx---       512  2001-09-02 16:23:33  c/c_a
  10043.   drwxrwx---       512  2001-09-02 16:23:33  c/c_b
  10044.   drwxrwx---       512  2001-09-02 16:23:33  c/c_c
  10045.   -rw-rw----         0  2001-10-22 13:26:13  foo
  10046.  
  10047. mget /recursive tmpx 
  10048. rcd tmpx, mget /recursive .
  10049.   These both create tmpx locally, but put only the "foo" file into it.
  10050.  
  10051. mget /recursive tmpx/* 
  10052. rcd tmpx, mget /recursive *
  10053.   These don't create tmpx at all, and they don't recurse.  They put the
  10054.   "foo" file into the current directory.
  10055.  
  10056. Did this ever work?  Beta.03: Same.  Beta.02: ditto...  What's the problem?
  10057. First of all, the server (wu-ftpd) is not sending the full list.  Instead it
  10058. sends:
  10059.  
  10060.   tmpx/a
  10061.   tmpx/b
  10062.   tmpx/c
  10063.   tmpx/foo
  10064.  
  10065. So there's no way would could get the whole tree based on NLST from wu-ftpd.
  10066. Ditto for ProFTPD...  I must have misunderstood the behavior of the server.
  10067. See notes of 22 Oct 2000 and 5 Jan 2001 (search thru this file for paragraphs
  10068. containing NLST).  Now I don't think any server EVER returned a full-depth
  10069. recursive list.  It's just that if you sent it a directory name, rather than a
  10070. filename or wildcard, it listed the contents of the directory, which might
  10071. include the names of subdirectories, but it did NOT descend into their
  10072. subdirectories.  Or if you sent the server "NLST *" then it actually DID open
  10073. the subdirectories and listed the REGULAR files in them, but did not list the
  10074. subdirectories themselves.  Recursive GETs can go up to two levels deep, but
  10075. that's all.
  10076.  
  10077. This means we can't use a single NLST file; we have to use a whole stack of
  10078. them.  And traversing the stack is not simple, since we get lists not only
  10079. like this (that list directory files like a, b, and c):
  10080.  
  10081.   tmpx/a
  10082.   tmpx/b
  10083.   tmpx/c
  10084.   tmpx/foo
  10085.  
  10086. but also like this (that list only regular files):
  10087.  
  10088.   a/one
  10089.   a/two
  10090.   foo
  10091.  
  10092. in which case we would have to INFER the directory tree structure based on
  10093. guesses, heuristics, and assumptions.  It's doable, of course (ncftp does it),
  10094. but gross.  If we know whether the server is on Unix, we can recognize the
  10095. path syntax.  For each file in the list we can try to CD to it, and if that
  10096. fails we peel back the path segments and try to CD, etc.  But then we have to
  10097. keep track of where we've been, etc.  At this late date I hesitate to make
  10098. such fundamental changes -- it's almost a total redesign, and could easily
  10099. break a lot of obscure code that compensates for servers that don't return
  10100. path segments when they should, and that syncs remote and local tree position.
  10101. Anyway, our documentation has always said that that MGET /RECURSIVE is not to
  10102. be trusted; we just have to say it more emphatically now.  It actually does
  10103. work if the server returns a truly recursive list including full (relative)
  10104. paths.  We just don't happen to know of any servers that do this.  So a
  10105. reliable GET /RECURSIVE will have to wait until after 8.0, at which point we
  10106. can use MLST, and/or write some kind of AI program to parse every conceivable
  10107. NLST format.  All this also applies to FTP DELETE /RECURSIVE too.
  10108. 23 Oct 2001.
  10109.  
  10110. While debugging MGET /RECURSIVE I discovered that:
  10111.  
  10112.   ftp open \m(host) /user:fdc
  10113.   if success blah
  10114.  
  10115. succeeded (with or without subsequent switches) if \m(host) was empty.
  10116. No connection would be open, \v(ftp_connected) would be 0, but IF SUCCESS
  10117. would be true and "blah" would be executed.  Fixed in doxftp(): ckcftp.c,
  10118. 23 Oct 2001.
  10119.  
  10120. From Jeff: I had to make some subtle adjustments to the password handling code
  10121. to allow PAM support to work with the new versions of Linux.  Also, added a
  10122. hack to allow passwords sent with REMOTE LOGIN to be authenticated with PAM.
  10123. ckufio.c, ckuus7.c, 24 Oct 2001.
  10124.  
  10125. Added code to temporarily disable debug logging around password entry.  This
  10126. was done by adding Yet Another Global Variable, debok, which is normally 1,
  10127. meaning it's OK to write debug log entries.  Any place in the code that parses
  10128. a password, set it to 0.  I also set it to 0 for the ASKQ command, which is
  10129. normally used for obtaining passwords in a script.  debok goes back to 1
  10130. automatically at the top of the parse loop and in the SIGINT trap.  This is
  10131. simpler than saving deblog and restoring it, and less sensitive to traps, etc.
  10132. Obviously it's not foolproof because Kermit doesn't always know what's a
  10133. password but it's better than before.  Search for "debok" to find all places
  10134. where I put it.  ckcdeb.h, ckuus[r567].c, ckcftp.c, 24 Oct 2001.
  10135.  
  10136. Changed ftp to accept multiple -d's, and if more than one to turn timestamps.
  10137. ckcftp.c, 24 Oct 2001.
  10138.  
  10139. Added rudimentary http command-line personality.  Changed some of the http_*()
  10140. routines to check string arguments for nullness since they dumped core when
  10141. passed null pointers.  Filled in code for -g(et); it works as long as it is
  10142. given a pathname it likes, e.g. that starts with '/'.  Do pathnames have to
  10143. start with '/'?  If so, maybe we can supply one if it's missing, as in: http
  10144. www.columbia.edu -g kermit/index.html.  -H (head) works; I'm not sure how to
  10145. test -p (put).  However, -p might be slightly counterintuitive, since the -l
  10146. switch is *required* to specify the local file, and the -p option specifies
  10147. the remote path, unlike with Kermit and FTP command lines, where the -s or -p
  10148. option specifies the local file and -a specifies the remote.  If you give a
  10149. hostname but no action, you get the command prompt with a connection open to
  10150. the HTTP server on the host.  Still needs the -z (security) option filled in.
  10151. The ftp command-line personality already has a -z parser (though not
  10152. completely filled in), so it would be best to break out the code from the 'z'
  10153. section of doftparg() in ckcftp.c and share it between FTP and HTTP.
  10154. ckuusy.c, ckcnet.c, 24 Oct 2001.
  10155.  
  10156. From Jeff: security options for FTP and HTTP command-line personalities.
  10157. ckcftp.c, ckuusy.c, 25 Oct 2001.
  10158.  
  10159. Added missing CK_SSL #ifdefs.  Fixed the http usage message and internal
  10160. checking, but didn't change the interface.  Now a remote path is always
  10161. required, and a local path is required for PUT.  Rearranged code to check
  10162. that options are OK before opening the connection.  ckuusy.c, 25 Oct 2001.
  10163.  
  10164. Discovered that:
  10165.  
  10166.   ./http http://www.columbia.edu/kermit/index.html
  10167.  
  10168. didn't work.  That's because main() set howcalled = I_AM_HTTP based on the
  10169. program name, but prescan() only checked URLs if howcalled == I_AM_KERMIT.
  10170. Changed prescan() to always check URLs.  This has the curious side-effect
  10171. of letting the URL override the program invocation name, so commands like:
  10172.  
  10173.   ./http ftp://kermit.columbia.edu/kermit/
  10174.   ./http telnet:watsun
  10175.  
  10176. work (not every combination does, but who cares).  ckuus4.c, 25 Oct 2001.
  10177.  
  10178. Moved an #ifdef in ckctel.c to allow building with NOTTGWSIZE.  25 Oct 2001.
  10179.  
  10180. From Jeff: Some fixes for FTP URLs.  ckcftp.c, 25 Oct 2001.
  10181.  
  10182. From Jeff: Code and tables to to make matchname() work not only on local
  10183. filenames but also on foreign ones.  Fixed some bugs in the tables and in
  10184. matchname().  ckcker.h, ckuusx.c, ckcftp.c, 26 Oct 2001.
  10185.  
  10186. From Jeff: Updates to support VT420 extensions (rectangle clear / copy)
  10187. to VT320 in K95.  ckuusr.h, 27 Oct 2001.
  10188.  
  10189. It occurred to me that operations over all files in a big directory (i.e.
  10190. when the pattern is "*", a very common case) could be sped up by treating this
  10191. pattern specially and not actually doing any matching.  This was done by
  10192. adding three lines of code before each of the two calls to ckmatch() in
  10193. traverse().  Initial tests showed a 100% speedup, but more thorough testing
  10194. produced less dramatic reductions in elapsed times.  These are all on local
  10195. disks on a slow computer (watsun):
  10196.  
  10197.                                Old    New Improved   Remarks
  10198.   3000-file flat directory    5.86   5.39    8.7%     20 trials nonrecursive
  10199.  14000-file directory tree   43.82  38.73   13.1%     10 trials recursive
  10200.  
  10201. On NFS disks, the bottleneck is NFS, so there's no difference.  On a much
  10202. faster computer (900 MHz PC with Linux):
  10203.  
  10204.                                Old    New Improved   Remarks
  10205.   9800-file directory tree   0.297  0.269   10.4%     100 trials recursive
  10206.  
  10207. Looks like it's worth keeping.  #define NOSKIPMATCH to get rid of it in case
  10208. it causes trouble.  This change is for Unix only; I don't think the idea
  10209. applies to K95, which uses a system service to make file lists from patterns,
  10210. rather than calling ckmatch().  ckufio.c, 27 Oct 2001.
  10211.  
  10212. Thomas Pinkl noticed that Kermit couldn't dial out from a Linux port that had
  10213. an mgetty() on it.  Reason: Kermit opened the device first, THEN got the
  10214. lockfile.  The reason for this is buried in 16+ years of history.  Briefly:
  10215. Kermit usually has to run setuid or setgid in order to create a lockfile.  If
  10216. you give a SET LINE command for a device that happens to be your job's
  10217. controlling terminal, Kermit doesn't have to create a lockfile, and in fact
  10218. should not create one, and would fail if it tried to if it did not have the
  10219. required privileges.  But you can't find out if two tty device names are
  10220. equivalent until you have a file descriptor that you can give to ttyname().
  10221. I rewrote ttopen() to get the lock first (like cu does), which eliminates the
  10222. race condition.  The downside is you can no longer say "set line /dev/ttyp0"
  10223. or whatever, where /dev/ttyp0 is your login terminal, without trying to
  10224. create a lockfile, which fails if C-Kermit lacks privs, and if it succeeds,
  10225. it has created a lockfile where it didn't create one before.  This all takes
  10226. place in ttopen() as follows:
  10227.  
  10228.   #ifdef OPENFIRST (which isn't defined)
  10229.      old code
  10230.   #else /* OPENFIRST */
  10231.      new code
  10232.   #endif /* OPENFIRST */
  10233.  
  10234. So #define OPENFIRST in ckutio.c to back off.  ckutio.c, 27 Oct 2001.
  10235.  
  10236. Testing on Debian Linux 2.1...  Get previous Kermit binary, put it in
  10237. group "dialout" and give it sgid bit.  Also put /var/lock in group dialout.
  10238. With old Kermit: "set line /dev/ttyS0" works ok.  Leaving the first copy with
  10239. the device open and starting a second copy and giving it the same command
  10240. opens the device briefly, then fails to get a lock, then closes the device.
  10241. No apparent harm is done (e.g. modem signals are not affected, probably
  10242. because this is not the last close).
  10243.  
  10244. Now new Kermit binary, same deal.  Works as expected: second Kermit fails
  10245. to get lock and so doesn't try to open the device.
  10246.  
  10247. Discovered why failing SET LINE in Linux didn't print the error string: no
  10248. code whatsoever is selected for Linux in ck_errstr().  Defining USE_STRERROR
  10249. seems to fix it but who knows how many other Linuxes it will break...
  10250. Hopefully none if it builds on Debian 2.1 (old, libc), Red Hat 5.2, and Red
  10251. Hat 7.1 (new, glibc).  Also discovered some bogus #ifdefs in ck_errstr(), but
  10252. fixing them didn't help Linux.  ckuusx.c, makefile, 27 Oct 2001.
  10253.  
  10254. Another problem was if the user did "cd /dev, set line tty".  Then the
  10255. "/dev/tty" comparison would fail, and Kermit would create a lock file for
  10256. "tty", which, if it worked, might prevent other Kermit users from using their
  10257. own login terminal.  I fixed this by using zfnqfp() to translate the device
  10258. name into a full name (in most cases by calling realpath()).  ttopen():
  10259. ckutio.c, 27 Oct 2001.
  10260.  
  10261. Added aix50 and aix51 targets.  makefile, ckcdeb.h, ckuver.h, 29 Oct 2001.
  10262.  
  10263. Testing Linux dialout at 115200bps from Debian 2.1...  After file transfer it
  10264. lost the ability to get modem signals...  Uploads were going about 150 cps,
  10265. but downloads at 6500 cps...  Interrupting a download and restarting it --
  10266. screen is fractured, curses is all over the place -- ^L sort of refreshes but
  10267. not really...  But then I did all this again and everything was fine.  Except
  10268. uploading.  Well, the modem's ARQ light is going on and off constantly,
  10269. indicating a horrible connection, and the CTS light is off all this time.  No
  10270. that's not it....  In fact, the ARQ light starts to blink the instant I start
  10271. sending.  If I tell Kermit to HANGUP and then to EXIT, I get the exit warning:
  10272. (a) it can't read modem signals any more; (b) it shouldn't give the exit
  10273. warning anway because I *told* it to hang up.  If I dial the same connection
  10274. from Windows, also at 115200 bps, there are no problems at all with uploading
  10275. (ccts4).
  10276.  
  10277. OK, so maybe it's just Debian.  Let's try Red Hat 7.1...  Same thing.  ARQ
  10278. and CTS light go off for long periods, uploads go nowhere.  But cranking the
  10279. speed down to 57600 it works perfectly.  Also, interlocking with other
  10280. programs works fine -- e.g. "set line /dev/ttyS0" from another Kermit while
  10281. a big upload is progress is not disruptive.  Interrupting with X or ^C
  10282. works fine, no curses or terminal modes problems.  Tried everything again on
  10283. Debian at 57600 and it's OK, another wild goose chase, live and learn.
  10284.  
  10285. Linux: Ctrl-\L (Long Break) isn't long at all.  Not Kermit's fault.  Kermit
  10286. calls tcsendbreak() exactly as documented in the manual page and info topic,
  10287. i.e. with a nonzero argument (4, in fact), which is supposed to result in a
  10288. spacing condition lasting between 4*0.25 and 4*0.5 seconds, i.e. between 1 and
  10289. 2 seconds.  In fact, Linux tcsendbreak() appears to ignore its argument.
  10290. (POSIX 1003.1 says a nonzero argument is "implementation dependent", so I'm
  10291. following the Linux docs).
  10292.  
  10293. From Jeff: Make current Telnet connection default hostname for FTP OPEN.
  10294. Fix a couple of the Telnet Com Port negotiations.  ckcftp.c, ckctel.c,
  10295. 30 Oct 2001.
  10296.  
  10297. Turned debok back on in a couple places where passwords might have been
  10298. prompted for outside of command mode.  ckuus[47].c, 30 Oct 2001.
  10299.  
  10300. A correction to the ttopen() change from 3 days ago, to restrict it to serial
  10301. connections only, not network connections.  ckutio.c, 30 Oct 2001.
  10302.  
  10303. Telnet COM Port fixes from Jeff: ckutio.c, ckctel.c, 1 Nov 2001.
  10304.  
  10305. Rolled version number back from RC.1 to Beta.04, since after all this we're
  10306. going to need another round of Beta testing.  ckcmai.c, 1 Nov 2001.
  10307.  
  10308. PeterE reported the following trouble, related to the changes I made to
  10309. ttopen() on 27 Oct 2001.  Suppose I place a call using a Telnet modem server:
  10310. "set host blah 2000, set modem type usr, dial..."  So far so good.  Then the
  10311. connection is broken and a REDIAL command is given.  At this point, due to the
  10312. silly convention that a negative modem type is a network connection, that we
  10313. undo in the modem-server scenario by giving a SET MODEM TYPE command *after*
  10314. opening the port, the negative modem type is lost.  REDIAL calls ttopen()
  10315. again but this time, since the modem type is positive, it thinks the server
  10316. name is a serial device name and puts it through zfnqfp(), which prepends the
  10317. current directory to it.  My question is: how could REDIAL under these
  10318. circumstances EVER have worked, even before the 27 Oct changes?  Answer: it
  10319. didn't.  The same error occurs: "No such file or directory" (hostname is
  10320. treated like a device name).  Now that we're promoting Telnet COM Port
  10321. cability, this needs to be fixed.  There are two ways to fix it, both equally
  10322. ugly.  One is with Still More Global Flags...  The other is for ttopen() to
  10323. try to "parse" the device name.  The latter is more or less transparent to the
  10324. rest of the program but it's platform-specific and risky (more risky in
  10325. Windows and VMS, where device names have no special syntax, than in Unix).  So
  10326. let's go with the flags.  In Unix, this turns out to be fairly easy: if ttname
  10327. (the ttopen name argument) == ttnmsv (the stored copy of the previous ttopen
  10328. name argument) and netconn > 0 (a static flag), we're reopening the previous
  10329. network connection, no matter what the modem-type argument says.  Otherwise we
  10330. proceed to the regular code, which still seems to work (e.g. I can DIAL a
  10331. serial port and then REDIAL it, can still TELNET, even after REDIALing, etc).
  10332. ckutio.c, 2 Nov 2001.
  10333.  
  10334. Ditto (REDIAL fix) for VMS.  ckvtio.c, 2 Nov 2001.
  10335.  
  10336. Bob R installed libm.a on Huey so now I can build C-Kermit on AIX 4.3.3
  10337. with gcc.
  10338.  
  10339. Added missing "help func errstring" text.  ckuus2.c, 2 Nov 2001.
  10340.  
  10341. In Debian 2.1 Linux ttgmdm() K_MDMCTL defined but ttgmdm() TIOCMGET ioctl()
  10342. returns -1 after the the modem hung up; can't get modem signals.  This makes
  10343. Kermit ask the "OK to exit?" question when it shouldn't.  in_chk() did not
  10344. treat this error as a disconnection.  Added a (for now Linux-only) check in
  10345. in_chk() so if ttgmdm() gets errno 5 when doing the TIOCMGET ioctl(), it's
  10346. treated like CD dropped.  ckutio.c, 2 Nov 2001.
  10347.  
  10348. How about RH7.1?...  Exactly the same behavior.  Does this mean I broke
  10349. something or that I found another Linux glitch?  Trying the same thing on
  10350. HP-UX with a pre-today binary, everything works right: carrier drops, Kermit
  10351. pops back to prompt automatically, SHOW MODEM can still get modem signals, and
  10352. EXIT doesn't ask for permission.  Ditto on some others, so Linux seems to be
  10353. the only problem child.  Verified that the new code also works on RH7.1 and
  10354. HP-UX 10.20.  2 Nov 2001.
  10355.  
  10356. Tried the new code on NetBSD.  "set line /dev/tty00" dumps core.  Long story,
  10357. here's the short version: Calling zfnqfp() from ttopen() is something new:
  10358.  
  10359.   if (zfnqfp(ttname,DEVNAMLEN+1,fullname)) { ... }
  10360.  
  10361. Previously it was usually called for regular filenames (not device names) and
  10362. therefore with result buffers that were CKMAXPATH in length.  zfnqfp(), on
  10363. platforms that support it, uses realpath():
  10364.  
  10365.   char *
  10366.   realpath(const char *pathname, char resolvedname[MAXPATHLEN]);
  10367.  
  10368. ckcdeb.h typically defines DEVNAMLEN to be shorter than MAXPATHLEN.  But in
  10369. Unix, a device name *is* a path name.  NetBSD realpath() apparently uses
  10370. strncpy() to write its result, which pads with NULs to the full length, thus
  10371. (in this case) writing past the end of buffer and clobbering the call stack.
  10372. Solution: make DEVNAMLEN the same as CKMAXPATH (which in most cases is based
  10373. on MAXPATHLEN).  But since zfnqfp() can be called with a buffer of absolutely
  10374. any size, we can no longer have realpath() write its result directly into
  10375. zfnqfp()'s argument buffer.  Instead, it must write into a local buffer of
  10376. MAXPATHLEN bytes, then check that the result fits into the caller's buffer: if
  10377. not, fail; if so, safely ckstrncpy() the result to it.  The days of scrimping
  10378. on buffers to save memory are over.  ckcdeb.h, cku[ft]io.c, 3 Nov 2001.
  10379.  
  10380. I also discovered that <sys/param.h> was not #included in the NetBSD build,
  10381. so we never picked up the MAXPATHLEN definition from the header files, and
  10382. therefore defaulted to 1024 (which, as it happens, is what it should be).
  10383. <sys/param.h> is where such important symbols as NULL, MAXNAMELEN, and
  10384. MAXPATHLEN are defined.  Should I #include it?  There are many arguments for
  10385. and against (e.g. breaking currently working builds), but the realpath()
  10386. episode makes it mandatory.  If we are ever going to call realpath(), we HAVE
  10387. to know what MAXPATHLEN is so we can allocate adequate result buffers,
  10388. otherwise we get core dumps or worse.  Looking in the standards, I can't find
  10389. any reference to param.h in SVID R3 or R4 or in POSIX 1003.1, or for that
  10390. matter to MAXPATHLEN either (note: neither realpath() nor MAXPATHLEN are
  10391. POSIX).  But a quick survey shows the following platforms have it:
  10392.  
  10393.  . AIX 3.2.5
  10394.  . AIX 4.3.3
  10395.  . BSDI 4.1
  10396.  . DG/UX 5.4R3.10
  10397.  . FreeBSD 2.2.8
  10398.  . FreeBSD 3.4
  10399.  . FreeBSD 4.4
  10400.  . HP-UX 5.21
  10401.  . HP-UX 8.00
  10402.  . HP-UX 10.20
  10403.  . IRIX 6.5
  10404.  . Linux RH5.2 and kernel 2.1.125
  10405.  . Linux RH7.0 and kernel 2.2.19
  10406.  . NeXTSTEP 3.1 (/NextDeveloper/Headers/bsd/sys/param.h)
  10407.  . NetBSD 1.4.1
  10408.  . Open Unix 8
  10409.  . QNX 4.25 
  10410.  . SCO OSR5.0.6
  10411.  . SCO UNIX 3.2v4.2
  10412.  . SCO Xenix 2.3.4
  10413.  . SINIX 5.42
  10414.  . Solaris 2.5.1
  10415.  . Ultrix 4.5
  10416.  . Unixware 7.1.1
  10417.  
  10418. In fact, of all the Unixes I checked, none didn't have it, except we know
  10419. that Tandy Xenix didn't.  So I added #include <sys/param.h> to ckcdeb.h
  10420. within #ifndef NO_PARAM_H, #ifdef UNIX, #ifndef TRS16, and removed explicit
  10421. #includes for it from ckcnet.h, ckupty.h, ckufio.c, ckutio.c, 3 Nov 2001.
  10422.  
  10423. There are scattered reports that <sys/param.h> definitions, e.g. of MAX and
  10424. MIN macros, plus common words like BAD (in AIX), cause conflicts, as do
  10425. mixing and matching of <sys/param.h> and <limits.h> #includes.  We'll see
  10426. what shakes out in the next build-all, and back off by defining NO_PARAM_H
  10427. for any platform that needs it.  A quick set of trial builds came up clean:
  10428. SunOS, Linux (RH7.0 now gets CKMAXPATH of 4095, yikes!), NetBSD, IRIX 6.5,
  10429. Unixware 7.1.1, VMS 7.1 (after #ifdef adjustments to ckvvms.h and ckuusx.c),
  10430. HP-UX 10.20 (non-ANSI C), Solaris 2.5.1, AIX 4.3.3/gcc, plus my build-with-
  10431. hundreds-of-different-feature-combinations script on Linux.  3 Nov 2001.
  10432.  
  10433. Abbreviations for the Telnet COM-Port Control keywords from Jeff,
  10434. ckuus[r3].c, 3 Nov 2001.
  10435.  
  10436. Jeff's Telnet COM-Port changes from a few days ago broke the NOHWPARITY
  10437. build.  Fixed by adding #ifndef's to ckutio.c, 2 Nov 2001.
  10438.  
  10439. Many changes resulting from a lengthy Beta.03 report from Nick Efthymiou
  10440. <NEFTH@pacbell.net>, 3 Nov 2001.  Here's a brief summary, followed by the
  10441. narrative:
  10442.  
  10443.  . Telnet-only variable tx #ifdef'd in ckucon.c.
  10444.  . USE_MEMCPY improvements: ckcdeb.h, ckclib.c.
  10445.  . ANSI declaration for ulongtohex(): ckclib.c.
  10446.  . ANSI declaration for fileselect(): ckuusx.c.
  10447.  . Simplified prototypes and declarations for ckmak[x]msg(): ckclib.[ch].
  10448.  . RUN-class commands could fail on execute-only files: ckufio.c.
  10449.  . MAILCMD needed to be "mailx" in HP-UX.
  10450.  . Commented out Unix zmail() because it's not used: ckufio.c.
  10451.  
  10452. (Begin Nick E. narrative)
  10453.  
  10454. > Apply the supplied patch to ckuus5.c - it removes unused variables, and
  10455. > introduces the conditional HAVE_STRCHR which, when defined,
  10456. > indicates that the system's strchr() function is adequate and need not be 
  10457. > replaced by the static windex().
  10458. >
  10459. These are too dangerous:
  10460.  
  10461.  1. How does HAVE_STRCHR get defined?
  10462.  
  10463.  2. How can you be sure that <string.h> exists?
  10464.  
  10465.  3. Commenting out declarations for variables with names like p, q, i, etc,
  10466.     in large routines that are full of #ifdefs almost always breaks some
  10467.     build other than the ones you tried.
  10468.  
  10469. > Kermit uses the conditional USE_MEMCPY, documented in ckccfg.txt,
  10470. > to indicate that the system's memXXX() functions are adequate and need
  10471. > not be replaced by, say, ckmemcpy(). Patch 3, to be applied to ckclib.c,
  10472. > ensures that ckmemcpy() is not compiled when the conditional is provided.
  10473. >
  10474. Your diffs are a bit hard for me to follow, since I do them by hand and they
  10475. are not context diffs, plus many of them wrapped in the mail.  But anyway I
  10476. take your point.  I changed all references to ckmemcpy() in the code
  10477. (ckctel.c and ckuus6.c) to plain memcpy() (which is #defined to be
  10478. ckmemcpy() if USE_MEMCPY is not defined) and put the ckmemcpy() definition
  10479. in ckclib.c within #ifndef USE_MEMCPY..#endif.
  10480.  
  10481. > It also adds a prototype which is needed by the SCO 3.2v4.2 system
  10482. > compiler (which otherwise issues a warning).
  10483. >
  10484. I couldn't see where or how you did this, so I did it myself in ckcdeb.h:
  10485.  
  10486.   #ifndef USE_MEMCPY
  10487.   #define memcpy(a,b,c) ckmemcpy((a),(b),(c))
  10488.   #else
  10489.   #ifdef CK_SCO32V4
  10490.   /* Because the prototype isn't picked up in the normal header files */
  10491.   _PROTOTYP( void *memcpy, void *, const void *, size_t));
  10492.   #endif /* CK_SCO32V4 */
  10493.   #endif /* USE_MEMCPY */
  10494.  
  10495. But I still get warnings, e.g.:
  10496.  
  10497.   ckcftp.c(10685) : warning C4049: 'argument' : indirection to different types
  10498.   ckcftp.c(10685) : warning C4024: 'ckmemcpy' : different types : parameter 1
  10499.   ckcftp.c(10685) : warning C4049: 'argument' : indirection to different types
  10500.   ckcftp.c(10685) : warning C4024: 'ckmemcpy' : different types : parameter 2
  10501.   ckcftp.c(10691) : warning C4049: 'argument' : indirection to different types
  10502.   ckcftp.c(10691) : warning C4024: 'ckmemcpy' : different types : parameter 1
  10503.   ckcftp.c(10691) : warning C4049: 'argument' : indirection to different types
  10504.   ckcftp.c(10691) : warning C4024: 'ckmemcpy' : different types : parameter 2
  10505.  
  10506. But these too are spurious.  (void *) should not clash with anything.  This
  10507. kind of thing is probably why I started adding -DNOANSI to the sco32v4
  10508. builds...
  10509.  
  10510. > ckuus6.c
  10511. > ==============
  10512. > (2059)  warning: i unused in function ludial 
  10513. > (2644)  warning: p unused in function dodial 
  10514. > (3241)  warning: c unused in function dotype 
  10515. > (4873)  warning: i unused in function domydir 
  10516. > (5826)  warning: i redefinition hides earlier one 
  10517. > (5826)  warning: i unused in function dodel 
  10518. > (5341)  warning: j unused in function dodel 
  10519. > (6941)  warning: i unused in function docopy 
  10520. > (7358)  warning: i unused in function dorenam 
  10521. > (8600)  warning: n unused in function dogta 
  10522. > (8700)  warning: i unused in function dogoto 
  10523. > (9868)  warning: q unused in function doif 
  10524.  
  10525. I'm not touching these, it always ends in tears.  See reason (3) above.
  10526.  
  10527. $ sccsdiff -r3.1 -r3.2 SCCS/s.ckclib.c
  10528. < ulongtohex(z,n) unsigned long z; int n; {
  10529. ---
  10530. > #ifdef CK_ANSIC
  10531. > ulongtohex( unsigned long z, int n )
  10532. > #else
  10533. > ulongtohex(z,n) unsigned long z; int n; 
  10534. > #endif    /* CK_ANSIC */
  10535. > {
  10536.  
  10537. Good catch, thanks.
  10538.  
  10539. > Apply the supplied patch to ckuusx.c - it adds a prototype needed by the
  10540. > SCO 3.2v4.2 compiler which otherwise issues a warning:
  10541. >
  10542. > [fileselect() needed ansi definition for ansi C builds)
  10543. >
  10544. Ditto.  This cut down on the warnings but "make sco32v4net" still gave a few.
  10545. Most of the remaining warnings were from ckclib.c ckmakmsg() and ckmakxmsg(),
  10546. because of overzealous use of the "const" qualifier, which didn't seem to
  10547. bother any other ANSI compiler, but since it's not needed I removed it and
  10548. poof, no more warnings about these routines.  There some other warnings too
  10549. in this build but as far as I can tell, they're all bogus (e.g. some function
  10550. argument doesn't agree with the prototype -- but it does -- or when using a
  10551. conditional expression as a function argument).  I'd like to compare with
  10552. "make sco32v4netgcc" for comparison but I don't have access to that
  10553. combination.
  10554.  
  10555. Although getting rid of the const qualifier from the ckmak[x]msg()
  10556. declarations and prototypes got rid of a lot of stupid warnings, it also
  10557. resulted in a few new ones, e.g.
  10558.  
  10559.   ckcnet.c: In function `locate_srv_dns':
  10560.   ckcnet.c:12776: warning: passing arg 4 of `ckmakxmsg' discards `const' from
  10561.   pointer target type
  10562.  
  10563. This is because an argument of locate_srv_dns() is qualified as const, and
  10564. yet it is passed to a function as a non-const parameter.  This is just plain
  10565. stupid.  There is no way to make this warning go away, because there is no
  10566. way to cast a const item to "not-const".  Sometimes ANSI C is way more
  10567. trouble than it's worth.  To make the new warnings go away, I removed the
  10568. useless const qualifiers from the prototypes and declarations of
  10569. locate_srv_dns() and locate_txt_rr().
  10570.  
  10571. > This is the fifth of 6 related messages. It summarizes the build status
  10572. > on SCO System V/386 Rel 3.2v4.2, discusses a bug and a workaround, and
  10573. > proposes that BROWSER be added to the default capabilities included in
  10574. > the makefile for the sco32v4 and sco32v4ns targets.
  10575. >
  10576. > As shipped, kermit (wermit) built out-of-the-box. I'm including the
  10577. > features made available through the default build in the hope they are
  10578. > useful:
  10579. >
  10580. > When testing the build, the following error condition is reported when
  10581. > kermit attempts to "set editor /usr/bin/vi" during startup:
  10582. > ?Read permission denied - /usr/bin/vi
  10583. >
  10584. > The root cause is: the test in zchki() is x = access(s,R_OK); which fails,
  10585. > because SCO installs vi with restrictive permissions. The test (on unix)
  10586. > should still be whether the external tool is executable, not whether it is
  10587. > writable.
  10588. >
  10589. This is interesting.  I didn't know that "execute-only" on a regular file
  10590. had any special meaning in Unix.  In days of yore, e.g. on TOPS-20, it
  10591. really did mean something (you could RUN it but you could not COPY, SAVE,
  10592. or DDT (debug) it).  In the Unixes I know, -x implies -r.  In the couple
  10593. that I tested just now, the current code works fine with x-only files (that
  10594. is, access() itself believes that -x implies -r).  Maybe SCO is different.
  10595. (OK, I just checked SCO 3.2v4.2 -- yup, it's different.)
  10596.  
  10597. > Without addressing the root cause, the following workaround...
  10598. >
  10599. I think it's easier to address the root cause.  Let's assume that -x always
  10600. implies -r.  Then all I have to do change the access() call in zchki().
  10601. It should not do any harm, since the access() is only used informatively
  10602. anyway.  If it turns out later (after parse time, during command execution)
  10603. that Kermit or its user doesn't have the required access to the file, the
  10604. operation will fail anyway.
  10605.  
  10606. > 1. Install the attached script "editor" in /usr/local/lib/kermit and set
  10607. >    permissions to 755.
  10608. > 2. Change ckermit.ini to set edit to the script (which is world-readable,
  10609. >    therefore passes the test in zchki()).
  10610. >
  10611. > The same workaround may need to be applied on systems that wish to use
  10612. > kermit's BROWSE command. As shipped, kermit does not include -DBROWSER for
  10613. > SCO 3.2v4.2, but it is safe to add the capability to the sco32v4 and
  10614. > sco32v4ns make targets.
  10615. >
  10616. BROWSER is defined automatically only for network builds.  You get it, for
  10617. example, in the sco32v4net target.  There might be a reason for this, but
  10618. probably not.  But I'm not sure I want to mess with all the tangled #ifdefs
  10619. in ckcdeb.h to undo this so close to the final release, but I'll add it to
  10620. my list.
  10621.  
  10622. > The kermit website (http://www.columbia.edu/kermit/ck70bugs.html) notes
  10623. > there are known challenges with the mail transport:
  10624. >
  10625. > #15:
  10626. > The MAIL command doesn't work at all due to an error in the command parser.
  10627. > Use the alternative form, SEND /MAIL:address filename, instead.
  10628. >
  10629. It rings a bell, but I can't find anything about this in my notes, but in any
  10630. case, it works now:
  10631.  
  10632.   mail [ <switches> ] <filename> <address>
  10633.  
  10634. For example:
  10635.  
  10636.   mail foo.bar fdc@columbia.edu
  10637.  
  10638. and:
  10639.  
  10640.   mail /subject:"this is a test" oofa.txt fdc@columbia.edu
  10641.  
  10642. both work, at least in today's code.
  10643.  
  10644. > #16:
  10645. > The server side of the MAIL (SEND /MAIL) command doesn't work on HP-UX. It
  10646. > tries to deliver the mail with the "Mail" command, but in HP-UX the name of
  10647. > the command is "mailx". Similar problems might exist on other platforms. The
  10648. > only workaround is to put a symlink from Mail to mailx somewhere in your
  10649. > PATH: Mail -> /usr/bin/mailx.
  10650. >
  10651. Silly me.  I always knew this, and yet somehow it never got into the code.
  10652.  
  10653. > Adding the configuration option CK_MAILCMD allows us to partially adress
  10654. > #16, in that it becomes possible to provide compile-time overrides to the
  10655. > mail tool used.  In ckufio.c, we then have:
  10656.  
  10657. > #ifdef UNIX
  10658. > #ifdef CK_MAILCMD
  10659. > char *MAILCMD = CK_MAILCMD;
  10660. > #else
  10661. > char *MAILCMD = "Mail";
  10662. > #endif /* CK_MAILCMD */
  10663.  
  10664. It's easier to just follow the current model and add an #ifdef for HPUX
  10665. so MAILCMD is defined right, which I did.
  10666.  
  10667. > While tracking down why mail was not working in the beta, I noticed that
  10668. > the actual execution path for the command did not use zmail() at all. The
  10669. > function has been obsoleted when UNIX is defined.  The patch to ckufio.c
  10670. > removes the dead code by conditionally not including zmail() in that case.
  10671. > The real mail submit operation occurs in rcv_firstdata() in ckcpro.c, and
  10672. > the only place where zmail() is invoked is from reof() in ckcfns.c (but
  10673. > not for UNIX).
  10674.  
  10675. OK.  It's part of the API described in ckcplm.txt, but I guess anybody who
  10676. tries to use it in Unix and finds it missing will figure out what happened.
  10677.  
  10678. > With these changes, the SEND /MAIL command worked as expected. However,
  10679. > there are two more issues with it's current implementation:
  10680.  
  10681. > 1. The command specification includes a /SUBJECT switch. The
  10682. >    implementation ignores the value supplied through the /SUBJECT switch,
  10683. >    and automatically populates the subject from the filename.
  10684. >
  10685. Only if the /SUBJECT: switch is omitted (or it is included without an
  10686. argument).
  10687.  
  10688. >    I believe an
  10689. >    improved implementation would retain the user-supplied subject when
  10690. >    possible, and would default to subject=filename when no subject has been
  10691. >    specified.
  10692.  
  10693. This is indeed how it works.  If it didn't work that way before, I must have
  10694. fixed it.
  10695.  
  10696. > 2. Missing support for international characters in the last leg of the
  10697. >    transfer (from the remote host to the mail recipient). The simple "Mail"
  10698. >    or "mailx" command supports US-ascii, but will fail to preserve other
  10699. >    character sets. Kermit could provide a similar level of I18N support for
  10700. >    the MAIL command as it does everywhere else by using a mime-enabled mail
  10701. >    tool, using something like (mailto is part of Nat Borenstein's mm package)
  10702. >    mailto -a ISO-8859-8 -s Subject recipient-address if it were possible to
  10703. >    pass the value of SET TRANSFER CHARACTER-SET to the mail tool.
  10704.  
  10705. Good point, but there is no standard mail tool aside from "mail".  I use
  10706. "Mail" and "mailx" just so I can specify a subject, and as you have seen,
  10707. choosing the right one for each platform can be problematic.  I'll add this
  10708. to the list for a future release (some way to let the user specify a mail
  10709. client and build a command line for it, including charset variables and
  10710. converters between Kermit and MIME charset names).
  10711.  
  10712. (End of Nick E. narrative, 3 Nov 2001)
  10713.  
  10714. Reran the build-lots-'o-configurations script on Linux plus a few more
  10715. sample builds, all ok.  Builds cleanly on VMS with DEC C 6.0, which is
  10716. notoriously picky.
  10717.  
  10718. Verified that VMS doesn't have param.h.  4 Nov 2001.
  10719.  
  10720. Testing ttopen(), lockfiles, etc, in SCO OSR5.0.5 with /dev/tty1A...
  10721.  
  10722.   SET LINE        OK
  10723.   lock1           LCK..tty1A
  10724.   lock2           LCK..tty1a
  10725.   modem signals   Unavailable
  10726.   max speed       38400
  10727.   BREAK           OK
  10728.   Long BREAK      short instead of long
  10729.  
  10730. DIAL doesn't work.  Something is screwed up with modem signals.  SHOW MODEM
  10731. can't get modem signals (TIOCMGET ioctl gets error 22: invalid argument; i.e.
  10732. the TIOCMGET function is defined but doesn't work).  SET LINE brings up DTR
  10733. and RTS, but DIAL drops them both and leaves them off.  SET DIAL HANGUP OFF
  10734. makes dialing work, and once the connection is made, everything works fine.
  10735.  
  10736. Every day something new...  Rebuilding with -DNOCOTFMC doesn't help.  SET
  10737. MODEM HANGUP-METHOD MODEM-COMMAND makes it work.  Diagnosis: we're using POSIX
  10738. tcsetattr() to set the speed to 0 and then restore it, the only way I know of
  10739. in OSR5 to hang up a modem.  It would be preferable to use TIOCCDTR/TIOCSDTR
  10740. but they aren't available in OSR5.  So we get the current input and output
  10741. speeds (e.g. 15 = 38400), set them both to 0, wait half a sec, and restore
  10742. them.  But restoring them doesn't work, even though the tcsetattr() calls do
  10743. not give any error indication.  If this all sounds familiar, it should be; see
  10744. notes of 3 Jun 1999.
  10745.  
  10746. Also in SCO OSR505, fast baud rates (up to 921600) are defined, why aren't we
  10747. picking them up?  You can never tell when today's header files are so full of:
  10748.  
  10749.   #if !defined(_XOPEN_SOURCE) && !defined(_POSIX_SOURCE)
  10750.  
  10751. to keep applications from doing anything useful.  But the section in
  10752. <sys/termio.h> that defines B57600, etc, does not seem to be protected by
  10753. them.  C-Kermit 7.0 picks up the speeds, 8.0 does not.  I think my SCO 5.0.5
  10754. installation is bollixed.  I must have built the working C-Kermit 7.0 binary
  10755. on somebody else's 5.0.5 system.  The current sources, built on an offsite OSR
  10756. 5.0.6 system, get all the high speeds and, who knows, maybe the other stuff
  10757. works too -- I can't tell because I don't have SET LINE privs.
  10758.  
  10759. ANYWAY, with "set modem hangup modem-command" the new code works fine on
  10760. OSR5.0.5 at 38400 bps, exactly like Beta.03, except that the primary and
  10761. secondary lockfile names are reversed -- who cares, as long as both of them
  10762. are created.
  10763.  
  10764. How about my other SCO disks?  Unixware 7.0.1 itself is broken -- the net
  10765. doesn't come up and you can't log in, even on the console.  OSR5.0.2 doesn't
  10766. pick the high speeds because there ARE no high speeds.  Dialing is just like
  10767. in 5.0.5, except that DTR comes back on.  But since RTS doesn't come back on,
  10768. the modem still won't listen.  The version 7.0 binary behaves exactly the same
  10769. when MODEM HANGUP-METHOD is RS232, so I didn't break anything.
  10770.  
  10771. Conclusion: Dropping DTR is problematic in SCO OS's, and perhaps it always was
  10772. but I never noticed because previously MODEM HANGUP-METHOD was MODEM-COMMAND.
  10773. The reason I changed the default hangup method from <sec>+++<sec>ATH0 to
  10774. dropping DTR was so it would work equally on dialed and direct connections,
  10775. now that the default modem type is GENERIC rather than DIRECT (NONE).  But I
  10776. forgot the degree to which tthang() can not be relied upon, e.g. in cases like
  10777. this where the underlying APIs simply do not work.  So we have to put the
  10778. default back as it was, but still avoid sending modem commands to hang up a
  10779. direct connection.  Remember, now that the default modem type is GENERIC,
  10780. serial connections are no longer direct by default, so mdmhup() can't just
  10781. test the modem type flag.  Now it must make two more tests when mdmtyp > 0:
  10782.  
  10783.  1. Since the user can dial without giving a SET MODEM TYPE command,
  10784.     test that the current connection was dialed with (dialsta == DIA_OK).
  10785.     This required new code all over setlin() to clear dialsta.
  10786.  
  10787.  2. Since the user can give a SET MODEM TYPE command and then try to hang
  10788.     up before dialing, a new flag 'mdmset', indicates that the user gave
  10789.     an explicit SET MODEM TYPE command (for an actual modem type, not NONE).
  10790.  
  10791.  3. The mdmset flag is also set at the beginning of ckdial().  Since the
  10792.     user gave a DIAL command, we know there must be a modem.  And since
  10793.     ckdial() calls mdmhup() when DIAL HANGUP is ON (as it is by default),
  10794.     this flag better be set before the hangup attempt.
  10795.  
  10796. So mdmhup() returns without doing anything if mdmtyp is 0, or if mdmset is 0,
  10797. or if dialsta == DIA_OK; I think this covers all the bases.  Also I added a
  10798. big context-sensitive hint for dial failure to dodial().  ckuusr.h,
  10799. ckuus[36].c, ckudia.c, 4 Nov 2001.
  10800.  
  10801. Testing on Unixware 2.1.3...  Can't "set line /dev/tty00" because ttlock()
  10802. tries to get an advisory kernel lock with lockf().  But that can't work any
  10803. more because lockf() requires a file descriptor and we don't get a file
  10804. descriptor until after we've locked the file.  All references to lockf() and
  10805. ttyfd commented out from ttlock() and ttunlck(), and tunlck() was changed to
  10806. remove the lockfile *after* closing the device, rather than before.  ckutio.c,
  10807. 4 Nov 2001.
  10808.  
  10809. Tried dialing with the phone cord disconnected.  Modem said NO DIAL TONE but
  10810. Kermit said NO CARRIER and set dialsta to the wrong code.  The dialmsg[] array
  10811. had an extra NULL element between 13 and 20.  Fixed in ckudia.c, the hints
  10812. work pretty well now, as does SHOW DIAL.  4 Nov 2001.
  10813.  
  10814. If I turn the modem off and DIAL, it gets no response to the init string, but
  10815. after 6 tries it still tries to dial.  There was no code to handle the "no
  10816. response from modem" case.  I added it.  ckcker.h, ckudia.c, 4 Nov 2001.
  10817.  
  10818. Bela Lubkin suggested some things to try to get DTR & RTS to drop and come
  10819. back up in OSR5 (only do output side, do the close(open()) hack, push a NUL)
  10820. but none of them made a difference in 5.0.2 or 5.0.5.  This stuff only works
  10821. in 5.0.6a.  4 Nov 2001.
  10822.  
  10823. Tried one last trick for hanging up the OSR5 port:
  10824.  
  10825.   tcgetattr(ttyfd, &ttcur);
  10826.   close(ttyfd);
  10827.   (pause)
  10828.   ttyfd = open(name,O_RDWR|O_NONBLOCK);
  10829.   tcsetattr(ttyfd,TCSADRAIN,&ttcur);
  10830.  
  10831. It works: DTR and RTS come back up again, but you can't write to the device
  10832. any more afterwards.  The error is 11: "Resource temporarily unavailable".
  10833. 5 Nov 2001.
  10834.  
  10835. I also discovered TIOCMBIC/TIOCMBIS in the OSR5 <sys/termio.h> file, but
  10836. they were protected by #ifdef _SVID3..#endif.  With good reason apparently,
  10837. since they are no-ops.
  10838.  
  10839. Added a loud warning message if anybody gives SET MODEM HANGUP-METHOD
  10840. RS232-SIGNAL in SCO OSR5.  ckuus3.c, 5 Nov 2001.
  10841.  
  10842. Verified that if Kermit gets SIGINT while its curses display is up, it calls
  10843. endwin().  I had my doubts because of some odd behavior I saw a few weeks ago,
  10844. but there must be some other explanation.
  10845.  
  10846. From Nick E:
  10847.  . Supply missing paren for memcpy() prototype: ckcdeb.h.
  10848.  . Additional filetypes for text/binary patterns: ckuusx.c.
  10849.      text:   .cc,  .pl,  .pod, .pm,  .m4
  10850.      binary: .vxd, .snd, .au,  .voc, .mpg, .mpeg
  10851.  
  10852. I added some of these to the Win32 and VMS pattern lists too.  ckuusx.c,
  10853. 5 Nov 2001.
  10854.  
  10855. Nick also reported that when a file arrives as mail, the FTP-format
  10856. transaction log omits the "filename" field, thus wrecking the record since the
  10857. fields are positional.  There's a static fullname[] buffer in ckufio.c;
  10858. evidently this does not get filled in when receiving a file as mail (or to
  10859. be printed, etc).  I worked around this in the dumbest possible way: if
  10860. fullname[0] is NUL, I substitute "(pipe)".  zclose(): ckufio.c, 5 Nov 2001.
  10861.  
  10862. Testing the previous report revealed several other weaknesses:
  10863.  . The transaction log is appended to rather than overwritten...
  10864.  . The fullname[] buffer is not cleared out at the beginning of each transfer.
  10865.  . We call zchko() on the message subject.  Of course how can we avoid it,
  10866.    since we don't know yet that it's going to be mail...  It can fail if
  10867.    it includes any slashes...
  10868.  
  10869. The first one is apparently intentional.  I fixed the second one.  Can't do
  10870. anything about the third one.  ckufio.c, 5 Nov 2001.
  10871.  
  10872. Back to modem signals... Checking the latest code on OSR5.0.6a, which is not
  10873. on-site so I can't look at the modem lights or hear the noises...  The good
  10874. news: we pick up the high serial speeds.  tthang() seems to work (it's hard to
  10875. tell without seeing the modem lights, but with "set modem hangup rs232" and
  10876. "dial hangup on", a DIAL command is able to send AT commands and read the
  10877. replies, so either it didn't really hang up at all, or else it brought DTR and
  10878. RTS both back up as it should).  The TIOCMGET ioctl in ttgmdm() doesn't fail.
  10879. The bad news: the modem-signal mask obtained by TIOCMGET is all 0's and
  10880. although dialing works, i/o after dialing doesn't work at all: write() gets an
  10881. i/o error because after a successful DIAL we unset O_NONBLOCK on the file
  10882. descriptor.
  10883.  
  10884. From Jeff: More corrections for Telnet ComPort:
  10885.  . disable reliable in the right places
  10886.  . disable clear-channel in the right places
  10887.  . set the baud rate properly; query existing baud rate if -1
  10888. ckutio.c ckcfns.c ckuus7.c ckctel.c, 5 Nov 2001.
  10889.  
  10890. Before leaving OSR5, it was still bothering me that we were not picking up the
  10891. high speeds from <sys/termio.h>.  I wrote a very simple program that just
  10892. #includes this file and then prints the speed symbols that are defined.  They
  10893. only go up thru B38400, yet <sys/termio.h> goes all the way up to B921600, and
  10894. there are no #ifdefs getting in the way of the higher speeds.  Eventually I
  10895. figured out that OSR5 cc doesn't look in /usr/include at all, it looks in
  10896. /udk/usr/include, and sure enough /udk/usr/include/sys/termio.h is only a tiny
  10897. fragment of the visible copy that I thought I was using.
  10898.  
  10899. It turns out that OSR5 has *two* development environments: /bin/cc (which
  10900. I don't have on my 5.0.5 disk) and the "UDK", which I do have.  The UDK is
  10901. supposed to be a common development environment for OSR5 and Unixware, and
  10902. therefore is a subset of both that pleases nobody.  I'll either have to
  10903. reinstall 5.0.5 or else build elsewhere.
  10904.  
  10905. PeterE discovered a bunch of debug() statements that included unescaped
  10906. backslashes, like debug(F1xx,"\v(editor)",...).  Fixed in ckuus4.c, 6 Nov 2001.
  10907.  
  10908. The dialmsg[] array declaration was inside #ifdef BIGBUFOK..#endif, which
  10909. broke compilation on "small" builds like HP-UX 8.00.  Removed the #ifdef.
  10910. ckudia.c, 6 Nov 2001.
  10911.  
  10912. Jeff noticed that TELNET /PASSWORD:xxx <host> shut off the debug log until
  10913. the next return to command state.  Fixed in ckucns.c and ckucon.c by setting
  10914. debok = 1 immediately upon entry to conect().  Also at the point where
  10915. cmcfm() succeeds in ckucmd.c.  We're going to have a similar problem with
  10916. REMOTE LOGIN, but that one's harder to avoid, since the password shows up 
  10917. later in packets.  7 Nov 2001.
  10918.  
  10919. PeterE said that on certain HP-UX versions, ttlock() was being called by
  10920. ttopen(), so no lockfile was created.  Actually the bug was not related to
  10921. the OS or version: "xlocal = strcmp(ttname,CTTNAM);" should have been
  10922. "xlocal = (strcmp(ttname,CTTNAM) != 0);".  ttopen(): ckutio.c, 7 Nov 2001.
  10923.  
  10924. Minor adjustments to text/binary pattern lists.  ckuusx.c, 7 Nov 2001.
  10925.  
  10926. PeterE reports still more failures with REDIAL from a Telnet modem server,
  10927. same reason: zfnqfp() prepends a path to the server's hostname.
  10928.  
  10929. I got an SCO OSR505 binary built with /bin/cc from Fred Smith and tried it
  10930. on my 505 system:
  10931.  
  10932.  . "set speed ?" shows the high serial speeds.
  10933.  . It gets the lockfiles right (plural: two in this case).
  10934.  . It dials OK in its default configuration at 57600 bps.
  10935.  . Modem signals are still inaccessible (sio driver's fault).
  10936.  . Uploads fail miserably but it doesn't seem to be Kermit's fault;
  10937.    the modem's CTS light goes out and its Retrain light blinks forever.
  10938.  . Tried again at 38400 -- much better; upload works perfectly (window
  10939.    size: 30, packet length 4000).
  10940.  
  10941. I don't see any flow control happening at 38400.  Does this mean that RTS/CTS
  10942. doesn't actually work in 505?
  10943.  
  10944.  . Dialing again with MODEM HANGUP RS232...  Same as before, it's the
  10945.    Roach Motel for DTR and RTS.
  10946.  
  10947. Dialing again at 57600, this time it works almost normally; the previous time
  10948. must have been a fluke.  But still I notice the modem's RTS light going out
  10949. for 5-10 seconds at a time, which makes no sense since when uploading, only a
  10950. tiny dribble of ACKs comes back to us.
  10951.  
  10952. Adjusted DIAL hints not to give all sorts of irrelevant suggestions when the
  10953. call failed because the line was busy.  ckuus6.c, 7 Nov 2001.
  10954.  
  10955. PeterE found another scenario where REDIAL of a Telnet terminal-server modem
  10956. didn't work.  I attempted to account for this situation too.  It's not
  10957. science; it's finding what combinations of global variables are set to what
  10958. values after different types of calls.  ttopen(): ckutio.c, 7 Nov 2001.
  10959.  
  10960. New ckcftp.c from Jeff:
  10961.  
  10962.   It is impossible to cancel (ABOR) a file transfer when AUTH TLS has
  10963.   been negotiated.  This is not because of any failure in C-Kermit.  It's
  10964.   due to the architecture of all of the FTP servers on Unix.
  10965.  
  10966.   I need to test the TLS version of WFTPD Pro.
  10967.  
  10968.   The problem with the Unix servers is the reliance on the SIGURG
  10969.   interrupt handler to detect the incoming command on the control
  10970.   channel.  The servers are not select() based.  They use blocking reads
  10971.   on the data channel and only read from the control channel if the
  10972.   receipt of OOB data triggers a SIGURG.  When using the SSL/TLS you do
  10973.   not have the use of OOB data.  The urgent pointer cannot be set.
  10974.  
  10975.   What C-Kermit was doing wrong prior to these fixes was to attempt to
  10976.   send the ABOR command as is done with other security protocols.  Those
  10977.   protocols send each command message as an independently encrypted
  10978.   block.  So it is possible to mix TELNET commands on the control
  10979.   channel with encrypted messages.  When using SSL/TLS, if you send any
  10980.   data underneath the SSL/TLS session you will corrupt the SSL/TLS data
  10981.   stream.  The command must be sent in the data stream but this prevents
  10982.   the generation of the SIGURG signal.  The command is therefore not
  10983.   received until after the file transfer is complete.
  10984.  
  10985.   The end result looks like:
  10986.  
  10987.      GET k95g.exe (binary) (5573675 bytes)---> PASV
  10988.     227 Entering Passive Mode (128,59,31,95,4,67). ---> RETR k95g.exe
  10989.     150 Opening BINARY mode data connection for k95g.exe (5573675 bytes).
  10990.     Certificate[0] altSubjectName DNS=ftp.kermit.columbia.edu
  10991.     Certificate[0] altSubjectName DNS=ftp.columbia.edu
  10992.     Certificate[0] altSubjectName IPAddr=128.59.31.95
  10993.     ^C...
  10994.     226 Transfer complete.
  10995.     500 No command to abort.
  10996.     : INTERRUPTED
  10997.  
  10998.   I'm going to have to spend time to get a description of this problem
  10999.   into the Internet-Draft for FTP over TLS.
  11000.  
  11001. ckcftp.c, 8 Nov 2001.
  11002.  
  11003. The hack that was used to get hardware flow-control into SCO OSR5 (defining
  11004. _SVID3 before #including <sys/termiox.h> and undefining after) was adapted to
  11005. <sys/termios.h> for SCO OSR5.0.6a, and new makefile targets sco32v506a[net]
  11006. were added.  makefile, ckutio.c, ckuver.h, 8 Nov 2001.
  11007.  
  11008. Testing this on 5.0.6a, however, I still get:
  11009.  
  11010.  Carrier Detect      (CD):  Off
  11011.  Dataset Ready       (DSR): Off
  11012.  Clear To Send       (CTS): Off
  11013.  Ring Indicator      (RI):  Off
  11014.  Data Terminal Ready (DTR): Off
  11015.  Request To Send     (RTS): Off
  11016.  
  11017. The disgusting hack was not sufficiently disgusting.  Forget the stupid
  11018. header file, define the symbols ourselves.  Luckily we already have a CFLAG
  11019. just for this: NEEDMDMDEFS.  This works, at least insofar as the sio driver
  11020. lets it: it shows signals *from* the modem but not signals *to* the modem.
  11021. ckutio.c, makefile, 8 Nov 2001.
  11022.  
  11023.  Carrier Detect      (CD):  Off
  11024.  Dataset Ready       (DSR): On
  11025.  Clear To Send       (CTS): On
  11026.  Ring Indicator      (RI):  Off
  11027.  Data Terminal Ready (DTR): Off  <-- Should be On too (and is in reality).
  11028.  Request To Send     (RTS): Off
  11029.  
  11030. Back to 5.0.5...  It's a long and pointless story, so I'll skip it and only
  11031. say that I finally figured out a brute-force method of making tthang() work
  11032. in 5.0.0-5.0.5 (I don't know yet about 5.0.6, but should be able to try this
  11033. in a week or so, when it arrives).  Basically, I get the current attributes,
  11034. close() the device, pause, open() it again with O_RDWR|O_NDELAY, set the
  11035. CLOCAL flag in the saved attributes (since we can't expect carrier to be on
  11036. after hanging up), and then set the attributes from the saved ones.  This is
  11037. a very slight variation on something I tried before but this one works.  The
  11038. CLOCAL bit seems to make the difference.  ckutio.c, 8 Nov 2001.
  11039.  
  11040. Commented out the big warning for OSR5 in the SET MODEM HANGUP RS232 command.
  11041. ckuus3.c, 8 Nov 2001.
  11042.  
  11043. Serial ports seem to be back in style!  A posting from Adrian Godwin
  11044. complained that you can't SET STOP-BITS 2 unless you have first SET PARITY
  11045. HARDWARE xxx (xxx = something other than NONE).  Fixed in ttvt() and ttpkt():
  11046. ckutio.c.  Changed the STOPBITS definition to something more general and moved
  11047. it from ckuus3.c to ckcdeb.h, and adjusted a bunch of #ifdefs in the SET
  11048. command tables in ckuus3.c.  8 Nov 2001.
  11049.  
  11050. Tried to chase down a report from PeterE of one Kermit grabbing away the
  11051. lockfile from another one in HP-UX 9.xx, but can't reproduce it, will await
  11052. more evidence.  8 Nov 2001.
  11053.  
  11054. Fixed telcmd[] TELOPT command keyword array to be in order; otherwise
  11055. commands like "telopt do blah" could not be parsed.  ckuusr.c, 8 Nov 2001.
  11056.  
  11057. PeterE reports continued problems with REDIALing a Telnet-based modem
  11058. server.  I tried reproducing them with a local Cisco modem server, but of
  11059. course found lots of other problems (this was my first trial run with the
  11060. RFC 2217 TELNET COM-PORT code):
  11061.  
  11062.  . You have to include the /TELNET switch on the SET HOST command.
  11063.  . The connection is called reliable so streaming is used (and fails).
  11064.  . SHOW COMM doesn't say the modem type.
  11065.  
  11066. Plus some non-problems:
  11067.  
  11068.  . SET SPEED ? properly lists the server's speeds, not the local ones.
  11069.  . Prefixing needs to be CAUTIOUS because of the terminal server's esc char.
  11070.  . If I log out from the dialed host, Kermit doesn't pop back to its prompt
  11071.    because the terminal server doesn't close the TCP connection.
  11072.  . If I put a server on the far end and say BYE, I can't REDIAL (same reason).
  11073.  
  11074. First let's look at Peter's reports.  If we do this without /TELNET, we get an
  11075. equivalent scenario (a Telnet-based modem server without Com-Port Control):
  11076.  
  11077.  [ok] Can dial OK.
  11078.  [ok] Can redial if the Telnet connection to server is still open.
  11079.  [no] Can redial if the Telnet connection to server is closed.
  11080.  
  11081. In the latter case it says "connection refused".  Debug log shows:
  11082.  
  11083.  . ttopen() correctly catches the intention and calls netopen().
  11084.  . netopen() ok, telnet opts negotiated, returns 0.
  11085.  . ttpkt() calls stty(), which fails.
  11086.  . Therefore we call ttclos().
  11087.  
  11088. At this point we somehow find ourselves in ttopen()->netopen() again,
  11089. apparently so we can send DO LOGOUT, but this results in ttol() write error
  11090. 32, EPIPE (broken pipe).  So then we call ttopen()->netopen() again and this
  11091. time we get error 61, Connection Refused.  The big problem seems to be loss of
  11092. the netconn setting, causing ttpkt() to take the serial path.  Well, that was
  11093. easy enough to fix -- one line added to ttopen() ("netconn = 1;" after
  11094. netopen() returns successfully).  This fixes it, except REDIAL still doesn't
  11095. work, because when we open a new connection we have to log in again.
  11096. Everything else was right though: it remembered the host, the TCP port, and
  11097. the modem type.  ckutio.c, 9 Nov 2001.
  11098.  
  11099. Now let's look at the RFC 2217 stuff.  Jeff says he can rearrange the Telnet
  11100. module to do what tn_ini() would have done on on Port 23 or with the /TELNET
  11101. switch but taking into account what's been negotiated so far, if the host
  11102. starts sending Telnet negotiations.
  11103.  
  11104. Meanwhile Kermit thinks Telnet COM Port connection is reliable...  The problem
  11105. was in the Telnet section of setlin(): it checked istncomport() before setting
  11106. it to reliable, but unfortunately it already *was* reliable.  Instead it
  11107. should set reliable off if istncomport() != 0 and on if it is 0.  That takes
  11108. care of RFC2117...  For non-RFC2117 Telnet modem servers, we should also set
  11109. reliable off whenever a DIAL-class command completes successfully.  This
  11110. covers all the bases except hardwired (non-dialed) serial connections on
  11111. non-RFC2117 reverse terminal servers.  Worked OK for me in several tests.
  11112. Plus I added debug() statements everywhere 'reliable' is changed to catch any
  11113. further glitches.  ckuus[37x].c, ckudia.c, 9 Nov 2001.
  11114.  
  11115. Fixes to typos in my SET STOP-BITS changes from Adrian Godwin: ckutio.c,
  11116. 9 Nov 2001.  With these changes he confirms it works in QNX6, i.e. actually
  11117. changes the stop bits.
  11118.  
  11119. Filled in HELP WAIT to describe the new FILE options.  ckuus2.c, 9 Nov 2001.
  11120.  
  11121. From Jeff:
  11122.  
  11123.   Took your changes and added my own.  Telnet is a little bit
  11124.   smarter now.  If you connect to a service using /telnet-no-init
  11125.   and then the server sends a telnet command Kermit will now send
  11126.   its initial set of telnet negotiations complete with waits for
  11127.   authentication.
  11128.     However, it should be noted that if this is done in a script there is
  11129.   a strong possibility there will be timeout problems in the first
  11130.   INPUT.  Just as is described in telnet.html.  Remember, this is why
  11131.   all of the telnet code went into netopen() in the first place.  But it
  11132.   is probably better now then it was before because now the telnet
  11133.   policies as described by SET TELOPT commands are enforced whenever
  11134.   telnet negotiations are used.
  11135.     I changed the default on SET TELOPT COM-PORT from ACCEPT to REQUEST.
  11136.     The new changes resulted in another 'reliable' issue.  Fixed in two
  11137.   places.  New files: ckctel.c ckuus4.c
  11138.  
  11139. Gave OSR5.0.5 a workout to make sure recent tthang() changes did not interfere
  11140. with terminal connection (ttvt()) or file transfer (ttpkt()).  With MODEM
  11141. HANGUP MODEM-COMMAND, all is well.  With MODEM HANGUP RS232-SIGNAL, terminal
  11142. connection is OK, but upon entry to ttpkt() the connection hangs up.  Debug
  11143. log says:
  11144.  
  11145.   SVORPOSIX myfillbuf calling read()
  11146.   SVORPOSIX myfillbuf=0
  11147.   SVORPOSIX myfillbuf ttcarr=2
  11148.   SVORPOSIX myfillbuf errno=0
  11149.   HEXDUMP: mygetbuf read (-3 bytes)
  11150.   mygetbuf errno=0
  11151.   ttinl myread failure, n=-3
  11152.   ttinl myread errno=0
  11153.   ttinl non-EINTR -3[closing]
  11154.  
  11155. This means read() is returning -1 but not setting errno.  Not only that, the
  11156. debug log grows to about 30MB during dialing, which suggests the undesirable
  11157. O_NONBLOCK effects predicted by John DuBois on the newsgroup.  His recommended
  11158. fix (unsetting O_NONBLOCK), however, made no difference.  After fooling with
  11159. this for some hours I discovered something new and strange: in OSR5,
  11160. O_NONBLOCK and O_NDELAY are *both* defined.  On most platforms, only or the
  11161. other is defined, and Kermit has always treated them as synonyms.  The header
  11162. file says:
  11163.  
  11164. #define O_NDELAY        0004    /* Non-blocking I/O */
  11165. #define O_NONBLOCK      0200    /* Non-blocking I/0, but different effect */
  11166.  
  11167. Cool.  So using O_NDELAY for opening, rather than O_NONBLOCK, and then
  11168. unsetting it afterwards, seems to do the trick.  Downloads are fine, uploads
  11169. are iffy but I attribute that to the modems around here (ARQ/Retrain light
  11170. blinking 90% of the time).  After a few more trials I got a decent connection
  11171. and convinced myself that it all works.  tthang(): ckutio.c, 10 Nov 2001.
  11172.  
  11173. From Jeff:
  11174.  
  11175.   Fixed a small problem I introduced last night where tn_doop() would
  11176.   lose the change in state of echo or kermit server since it through
  11177.   away the return value of tn_xdoop().
  11178.  
  11179.   Also, fixed the problem where a script
  11180.  
  11181.     set host test.kermit 6001
  11182.     input 1 assword:
  11183.     if success output ...
  11184.  
  11185.   would fail to process the telnet negotiations until the INPUT command
  11186.   thereby causing the timeout value to be exceeded.
  11187.  
  11188.   The trick is really simple and I'm shocked it didn't occur to anyone
  11189.   earlier.  When we are connecting to a non-Telnet port we do not use
  11190.   /RAW but instead /TELNET-NO-INIT.  This means that we configure
  11191.   ourselves as a NVT but do not send any Telnet negotiations UNLESS the
  11192.   host sends them first.  When tn_ini() is called in this mode we have
  11193.   always skipped the transmission of telnet negotiations and simply
  11194.   returned immediately.  This caused two problems:
  11195.  
  11196.    . the policies specified with SET TELOPT commands are ignored since
  11197.      telnet options listed as REQUESTED and REQUIRED will never be asked
  11198.      for unless the server initiates the negotiation
  11199.  
  11200.    . the negotiations do not take place until the first INPUT command
  11201.      and can result in unwanted timeout conditions
  11202.  
  11203.   However, we can avoid both of these problems by:
  11204.  
  11205.    . separating the initial transmission of telnet negotiations into
  11206.      tn_start(), and
  11207.  
  11208.    . calling tn_wait() in tn_ini() when /TELNET-NO-INIT is in effect
  11209.  
  11210.   This adds at most a one second delay to the return of SET HOST when
  11211.   connecting to a port that does not support Telnet negotiations; and
  11212.   results in the full set of telnet negotiations being sent when a
  11213.   telnet command is received from the host.
  11214.  
  11215. ckctel.c, 10 Nov 2001.
  11216.  
  11217. Adrian Godwin found that realpath() doesn't work in QNX6.  -DNOREALPATH added
  11218. to the qnx6 target.  makefile, 10 Nov 2001.
  11219.  
  11220. I verified that realpath() works fine in QNX4, so no changes in the QNX4
  11221. makefile targets.  10 Nov 2001.
  11222.  
  11223. QNX does not use UUCP lockfiles, but some years ago I had installed a
  11224. different form of locking based on device open count, which can be obtained
  11225. only after opening the device.  After the recent rearrangement of the locking
  11226. code, of course, this no longer works.  Moved the relevant code from ttlock()
  11227. to ttopen().  ckutio.c, 10 Nov 2001.
  11228.  
  11229. QNX4 doesn't seem to be sensing CD properly.  The modem says it's on, Kermit
  11230. says it's off.  Ditto for DSR.  It does seem to sense CTS, however, and also
  11231. its output signals, DTR and RTS.  I looked at the code in ttgmdm(), added
  11232. debug statements.  Before dialing, the port status word is 1053451 (0x10130B)
  11233. or in binary 000100000001001100001011.  After dialing, when CD comes up, it's
  11234. the same.  This word is a bit mask for the modem signals, plus some other
  11235. stuff.  Bit 23 is CD, and it's off.  Even if the comments in qioctl.h are
  11236. wrong about the bits, you'd expect to see a change in the status before and
  11237. after dialing, but there is no change.  I compared my code with the code in
  11238. QNX4 stty to read modem signals, and it's identical.  It looks like you have
  11239. to SET CARRIER-WATCH OFF in order to use a serial connection in QNX4.
  11240.  
  11241. More bad news.  Dialing fails in QNX4 if MODEM HANGUP-METHOD is RS232.  It's
  11242. using the regular "posix" method of hanging up (set speed 0, pause, restore
  11243. speed).  The modem signals behave well (DTR goes down and up, RTS stays up)
  11244. but i/o to the modem doesn't work afterwards.  Meanwhile if I SET CARRIER OFF
  11245. and MODEM HANGUP-METHOD MODEM-COMMAND and make a call, CONNECT works OK but
  11246. file transfer hangs up the call instantly.  Sounds just like OSR5.0.5, maybe
  11247. the cure is the same too.
  11248.  
  11249. Checking C-Kermit 7.0 on QNX4...  The problems with modem signals are not
  11250. new.  The 7.0 code gets exactly the same results as the 8.0 code.  BUT...
  11251. transferring files does not make it hang up.
  11252.  
  11253. In case the culprit was tthang() (even though it didn't change for QNX) I
  11254. changed it to use the QNX-specific API ttdropline(ttyfd,500), which (a) works
  11255. fine and (b) doesn't make a bit of difference.  If I don't SET MODEM HANGUP
  11256. RS232, dialing works OK, but the connection drops when I CONNECT.  If I *do*
  11257. SET MODEM HANG RS232 dialing *might* work, and if it does, the connection
  11258. drops as soon as I start a file transfer.
  11259.  
  11260. So then I tried the tricks with CLOCAL and O_NONBLOCK that just worked for
  11261. OSR5.  They made no difference, the connection still hangs up.  Then I noticed
  11262. that the device flags are considerably different before tcdropline() than
  11263. after them and tried restoring them to the before value.  This is obviously
  11264. going to be at least another day's work, so I'll break off now.  10 Nov 2001.
  11265.  
  11266. Next day...  Started Kermit again on QNX4 to try some things, and found it
  11267. (same copy of Kermit, same computer, same modem) behaving differently: this
  11268. time ttgmdm() reports CD is on when it's on, off when it's off (but still
  11269. doesn't sense DSR).  Carrier detection works right.  Go figure.  Maybe the
  11270. connector was loose.  11 Nov 2001.
  11271.  
  11272. More changes from Nick Efthymiou, 11 Nov 2001:
  11273.  
  11274.  . fullname[] needed zeroing out at the end zxcmd() too (e.g. for the
  11275.    transaction log:  ckufio.c.
  11276.  . Use memset() rather than a byte loop in initializing the file input
  11277.    buffer in zinfill() if USE_MEMCPY defined:  ckufio.c.
  11278.  . Make pipe reads nonblocking only if select() is used: zxcmd() ckufio.c.
  11279.  . Some corrected #ifdefs, e.g. to ensure certain variables or buffers are
  11280.    declared only for builds that need them:  cku[ft]io.c.
  11281.  . Removed unused variables: ckufio.c, ckucon.c.
  11282.  . /*ARGSUSGED*/ added here and there to shut up lint.
  11283.  . Casts to shut up sco32v4 compiler: ckuusr.c, ckucon.c.
  11284.  
  11285. Narrative from Nick:
  11286.  
  11287.   "... [the server end of REMOTE] commands sometimes worked, and sometimes
  11288.   produced no result (and no error message).  The reason for this behaviour
  11289.   is a mismatch between the zxcmd() implementation (which sets the pipe
  11290.   reading from the command output to non-blocking) and zinfill(), which only
  11291.   makes use of the non-blocking feature when SELECT is defined.  For
  11292.   historical completeness, I should mention that REMOTE commands [that relayed
  11293.   pipe output] were broken in Kermit 7.0; they worked reliably in 6.0."
  11294.   (But only on non-select() builds, which in 7.0 were precious few.)
  11295.  
  11296. Back to QNX...  Inserted a breakout box between the modem and PC, and it
  11297. shows all signals are as they should be, including DSR.  And strangely enough,
  11298. now Kermit can see DSR too.  Hmmm, guess it was the cable...
  11299.  
  11300. Dialing is totally frotzed.  Aha, the debug log shows: ckdial() calls
  11301. ttopen(), which is supposed to skip opening the device if ttyfd > -1 and the
  11302. name given is the same as the name given last time.  Well in this case, it's
  11303. not: the current name is "/dev/ser1" but the previous name is "//5/dev/ser1",
  11304. obtained from zfnqfp(), so we close the current connection and open a new one,
  11305. which wrecks everything.  The name comparison is apples and oranges.  Either
  11306. we compare the pre-zfnqfp() names, or the post-zfnqfp() ones.  This required
  11307. yet another overhaul of ttopen(), to make sure it uses the original name at
  11308. the appropriate times, and the expanded name at the other appropriate times.
  11309. Now we're back in business: modems signals all behaving, carrier detection ok,
  11310. switching into file-transfer mode doesn't hang up the phone, etc.  ckutio.c,
  11311. 11 Nov 2001.
  11312.  
  11313. HOWEVER... when uploading a file with (say) 30 window slots, we seem to
  11314. consistently stall at the end waiting for the ACKs to the last window (in this
  11315. case about 22 of them).  No problem with downloading...  But the uploading
  11316. pattern is totally repeatable.  At about 85% (of a 100K file, window 2/3
  11317. full), we start getting resends (the reason is not displayed).  The log shows
  11318. that this is because at this point a stream of NAKs came in.  Why?  The log on
  11319. the far end shows data loss on the receiving end.  Whose fault is it?
  11320.  
  11321. There is no evidence that PC-to-modem flow control is working.  The CTS light
  11322. stays on solid...  But bumping the serial speed up to 115200 fries the modem
  11323. (as described in last week's notes) so I can't really tell whether hwfc works
  11324. in QNX.  But anyway, after turning the modem off and on again, uploads at
  11325. 57600 (but not 115200) work fine, no more data loss.  Maybe the USR modem is
  11326. not as terrific as I thought. 10 Nov 2001.  (Later, I finally did see hwfc
  11327. working perfectly between QNX and the modem, on a really bad phone connection.)
  11328.  
  11329. In all this testing of serial connections, it became clear that when Kermit
  11330. calculates timeouts dynamically (which is the default), they can shoot up
  11331. rather quickly to 90 seconds or more just because of a couple of errors, even
  11332. when the typical packet arrival rate is far shorter (like 1-2 seconds).  Today
  11333. it seems I can dependably get awful phone connections, which heighten the
  11334. effect.  Maybe we should cut back on all the fancy math in getrtt() and just
  11335. track the recent packet arrival rate, making the timeout be (say) 1.25 times
  11336. that.  This behaves MUCH better on a good connection.  The timeout doesn't go
  11337. through the roof; the RTT makes good sense considering the window size
  11338. (e.g. if I'm using 30 windows slots of 4K each at 50000 bps = 5000 cps, then I
  11339. have 120KB worth of packets in the window, which take about 24 seconds to get
  11340. through, and that's exactly what the RTT is).  So it works great on a clean
  11341. connection.
  11342.  
  11343. On a lousy connection, however, the timeouts went off too fast, so I made the
  11344. algorithm more conservative:
  11345.  
  11346.  x = current interval (i.e. between most recent 2 incoming packets).
  11347.  y = previous interval
  11348.  timeout = ((2x + y) / 3.0 * 2.66) + 0.5)
  11349.  
  11350. After a few tries, I got a REALLY bad connection (one where the Retrain light
  11351. is blinking and the CTS light Off 80% of the time) and obtained very reasonable
  11352. behavior: timeouts weren't going off prematurely, but neither did they exceed
  11353. the dropout times by ridiculous amounts, and they recovered quickly when the
  11354. channel opened up again.  On a very bad connection like this one, we now get a
  11355. fairly large number of retransmissions (about 33%), but it's better to keep
  11356. the channel busy than to wait a long time for a packet that might never come.
  11357. The stats bear this out: upload throughput on really bad connections goes up
  11358. about tenfold (e.g. from 70cps to 700cps).  ckcfn2.c, 12 Nov 2001.
  11359.  
  11360. Added the following "hot keys" to local-mode file transfer:
  11361.  
  11362.  D: Turn on debugging, open "debug.log" if not already open.
  11363.  d: Turn off debugging but leave log open (if it was open).
  11364.  T: Turn on debug-log timestamps.
  11365.  t: Turn off debug-log timestamps.
  11366.  
  11367. chkint(): ckuusx.c, 12 Nov 2001.
  11368.  
  11369. Also made fullscreen f-t display always show RTT / Timeout field, rather than
  11370. only when timeouts are dynamic.  screenc(): ckuusx.c, 12 Nov 2001.
  11371.  
  11372. By the way, "hot keys" are not exactly hot.  You have to wait for the next
  11373. packet to arrive before chkint() is called and notices a key press, which
  11374. might be a very long time.  This could easily be fixed by adding a select()
  11375. call to ttinc(), but that would be really expensive, plus ttinc() isn't used
  11376. only for for file transfer, but how does it know who's calling it? etc...
  11377.  
  11378. If carrier drops during file transfer we get a big obnoxious hint, but really
  11379. Kermit should just tell them that the connection was lost.  Fixed at the top
  11380. of parser(), ckuus5.c, 12 Nov 2001.
  11381.  
  11382. Removed a reference to the defunct Heinz Heise BBS in the help text.  ckuus2.c,
  11383. 12 Nov 2001.
  11384.  
  11385. Added SET TERMINAL IDLE-ACTION { TELNET-NOP, TELNET-AYT } for Unix only (needs
  11386. to be added to ckoco?.c for K95).  Can't be done in non-SELECT Unix versions,
  11387. nor in VMS, etc (CKTIDLE already takes care of this), and obviously not in
  11388. non-TNCODE versions.  ckcker.h, ckuus[27].c, ckucns.c, 12 Nov 2001.
  11389.  
  11390.   Noticed that watsun's Telnet server returns some mighty strange
  11391.   stuff when you send it AYT, but that happens no matter what the 
  11392.   Telnet client is.  Everything is fine when connecting to a different
  11393.   Telnet server, e.g. on Linux.
  11394.  
  11395. The code in cmdini() that searches for the C-Kermit text files in Unix
  11396. by looking for ckermit2.txt in various directories was changed to look for 
  11397. ckubwr.txt instead.  ckuus5.c, 12 Nov 2001.
  11398.  
  11399. Some fixes to the rtaix and rtaixc makefile targets from Matthew Clarke, for
  11400. AIX 2.2.1 on an RT PC, and an #ifdef adjustment around #include <netdb.h> in
  11401. ckcnet.c, since it was already included from ckcnet.h.  12 Nov 2001.
  11402.  
  11403. Jeff noticed that "kermit -s blah", where blah is a symlink, got a "?No files
  11404. meet selection criteria" error.  See notes of 26 Jul 2001, which said this
  11405. might happen here and there, and would have to be fixed on a case-by-case
  11406. basis.  Fixed in this case in doarg(), by allowing links to be followed unless
  11407. recursion was requested.  ckuusy.c, 12 Nov 2001.
  11408.  
  11409. Tested today's code on RH7.1.  Everything seems OK -- dialing at 57600 with
  11410. DTR-blinking modem-hangup, transferring files both ways, dynamic timeouts, etc
  11411. etc.  At 115200bps, I get the same crummy connection I got with QNX with the
  11412. same results; the new timeouts do their job, etc, so nothing seems broken, and
  11413. much is improved.  12 Nov 2001.
  11414.  
  11415. Made a direct serial connection from one SunOS port to another.  This requires
  11416. even parity, and a low speed like 9600.  This connection revealed there was a
  11417. path through setlin() where reliable was set for a serial port.  Fixed in
  11418. setlin(): ckuus7.c, 12 Nov 2001.
  11419.  
  11420. With the setlin() fix, the Sun port-port connection works fine: modem signals,
  11421. dynamic timeouts, etc.  File transfer chugs along at about 750bps (because of
  11422. all the quoting) but it works.  11 window slots of 4K each are used; RTT = 46
  11423. sec (4096 x 11 / 960 = 46).  Elapsed time: 52 minutes.  The resulting file (a
  11424. copy of the 2.35MB Sparc Kermit binary) executes correctly, of course, without
  11425. even a "chmod +x".
  11426.  
  11427. Testing serial connections on NetBSD 1.4.1...  Everything checks out OK here
  11428. too: toggling DTR, modem signals, uucp line locking, uploading, timeouts, ...
  11429. It's all good.  12 Nov 2001.
  11430.  
  11431. From Jeff: Some cleanups to yesterday's ckucns.c, some changes to SHOW TELOPT,
  11432. ckuus4.c, 13 Nov 2001.
  11433.  
  11434. From Lucas Hart:
  11435.  . Fix bad pointer reference at end of ztime(): ckvtio.c.
  11436.  . Allow OSF/1, Digital Unix, Tru64 to use POSIX wait(): ckcdeb.h.
  11437.  . An all-integer version of cmdiffdate(): ckucmd.c.
  11438.  . All the <sys/wait.h> and wait() craziness removed for OSF/1, Digital
  11439.    Unix, and Tru64 Unix: ckcdeb.h, ckutio.c.  See ckcdeb.h comments.
  11440.  . Let OSF -DPOSIX keep previously defined HERALD: ckuver.h.
  11441.  . Some rearranged #ifdefs and improved zstime() debugging: ckufio.c.
  11442.  . Clarified HELP DATE text: ckuus2.c.
  11443.  . Added some CFLAGS to SHOW FEATURES: ckuus5.c.
  11444.  
  11445. About diffdate(): Lucas said "I don't know the reason for using floating point
  11446. fractional days rather than integer seconds in diffdate, but it can give
  11447. roundoff errors for FLOAT=4 {platform dependent}".  I don't remember why
  11448. either, probably it was just easier.  Lucas saw the following on Tru64 5.0:
  11449.  
  11450.   C-Kermit> .rdate := \v(date) \v(time)
  11451.   C-Kermit>echo \fcvtdate(\m(rdate))   20010917 01:16:02
  11452.   C-Kermit>echo \futcdate(\m(rdate))   20010917 08:17:55 <-- 7-second skew
  11453.  
  11454. I ran my date-time torture test on both Sparc/SunOS and Alpha/VMS before and
  11455. after the change, and the results were identical (the roundoff error didn't
  11456. happen on VMS -- same compiler as Tru64, same hardware, different OS).  Also I
  11457. took the \fdiffdate() and \futcdate() functions out of #ifdef CKFLOAT..#endif.
  11458. Checked to make sure NOFLOAT build runs the same test.  ckuus4.c, 13 Nov 2001.
  11459.  
  11460. Built OK on SunOS, VMS 7.1 Alpha, Tru64 4.0E.  Ran the build-all-subsets
  11461. script on Linux.  Corrections needed in ckuus7.c.  After that, 77 different
  11462. configurations build OK.
  11463.  
  11464. Jeff discovered that if an FTP server returns a recursive file list and the
  11465. client had not asked for it, then every item in the list that includes a path
  11466. generates an error message.  No harm is done, but it's annoying.  Fixed in
  11467. doftpget(): ckcfns.c, 13 Nov 2001.
  11468.  
  11469. The MOVE (SEND /DELETE) command didn't note failure to delete the source file
  11470. in the transaction log.  Similarly for SEND /MOVE and SEND /RENAME.  Fixed in
  11471. ckcpro.w, 14 Nov 2001.
  11472.  
  11473. Fixed new "carrier signal lost" message not to print if the transfer was
  11474. manually interrupted.  ckuus5.c, 14 Nov 2001.
  11475.  
  11476. From Jeff: don't define CKTIDLE in IKSD-only builds.  ckcdeb.h, 14 Nov 2001.
  11477.  
  11478. On all the different platforms where C-Kermit runs, it would be nice to have a
  11479. built-in hint about what the typical port names are, e.g. /dev/cua versus
  11480. /dev/tty00 vs /dev/ttyS1 vs COM1 vs TXA0: etc.  Added this to the HELP SET
  11481. LINE (HELP SET PORT) text in a huge #ifdef clause.  Also updated HELP, INTRO,
  11482. and HELP SET MODEM text.  ckuus2.c, 14 Nov 2001.
  11483.  
  11484. Added -m { active, passive } FTP personality command-line option to select
  11485. active or passive mode on the command line.  ckcftp.c, 14 Nov 2001.
  11486.  
  11487. Fixed typos in HELP SET MODEM TYPE text.  ckuus2.c, 15 Nov 2001.
  11488.  
  11489. Dynamic packet timeouts are working fine, but they had a slightly annoying
  11490. tendency to flip-flop between n and n+1, e.g. 3 and 4.  I changed getrtt() to
  11491. check the result against the previous result, and if it was 1 less, not to
  11492. change it.  This keeps the timeout stable except when conditions really do
  11493. change.  I still let the RTT flip-flop, since that's an actual (if coarse)
  11494. measurement.  ckcfn2.c, 15 Nov 2001.
  11495.  
  11496. The new timeout algorithm is based on the arrival times of the last two
  11497. packets that DID arrive.  It deliberately does not consider the amount of time
  11498. SINCE the last packet arrived.  This keeps the timeout from shooting up into
  11499. the stratosphere as it did before.  So on a very bad connection, we might see
  11500. an RTT above ten minutes, and the timeout still at 2 or 3 seconds (sometimes
  11501. it can spike, e.g. after the modem recovers from a long dropout, but it
  11502. recovers quickly).  Over many trials, this appears to be a workable and better
  11503. strategy.  There is no point in leaving the connection idle for long periods
  11504. of time.  The main danger lies in running up the retry count, which can
  11505. eventually cause the transfer to fail when it might eventually have succeeded.
  11506. But only the user can say whether that is good or bad, and of course they
  11507. always have the ability to change the policy, except until now there was no
  11508. way to specify unlimited retries.  Changed resend() and nak() (the retry-limit
  11509. enforcers) to treat 0 as unlimited.  ckcfn2.c, ckuus[24].c, 15 Nov 2001.
  11510.  
  11511. Improved the SEND failure hints some more.  ckuus5.c, 15 Nov 2001.
  11512.  
  11513. Added do-it-yourself high serial speed definitions for SCO OSR5.0.5 in case
  11514. they weren't picked up from <sys/termio.h>, which happens when building with
  11515. UDK rather than regular SCO /bin/cc.  ckutio.c, 15 Nov 2001.
  11516.  
  11517. TESTING...........  PORT   SPEED  HSL  LCK  MDM  HWFC DIAL HNG  UPLD DNLD DTR
  11518.   HP-UX      10.20  cua0p0 57600   ok   ok   ok   ok   ok   ok   ok   ok   ok
  11519.   FreeBSD      3.3  cuaa0  57600   ok   ok   ok   ok   ok   ok   ok   ok   ok
  11520.   NetBSD     1.4.1  tty00  57600   ok   ok   ok   ok   ok   ok   ok   ok   ok
  11521.   OpenBSD      2.5  tty00  57600   ok   ok   ok   ok   ok   ok   ok   ok   ok
  11522.   Debian       2.1  ttyS0  57600   ok   ok   ok   ok   ok   ok   ok   ok   ok
  11523.   Red Hat      7.1  ttyS0  57600   ok   ok   ok   ok   ok   ok   ok   ok   ok
  11524.   SCO XENIX  2.3.4  tty1A  38400   ok   ok  >NO< n/a   ok  >NO<  ok   ok   ok 
  11525.   SCO OSR5   5.0.5  tty1A  38400   ok   ok  >NO<  ok   ok   ok   ok   ok  >NO<
  11526.   Unixware   2.1.3  tty00  38400   ok   ok   ok   ok   ok   ok   ok   ok   ok
  11527.   QNX         4.25  ser1   57600   ok  n/a   ok   ok   ok   ok   ok   ok   ok
  11528.   Solaris      2.6  cua/a  57600   ok   ok   ok   ok   ok   ok   ok   ok   ok
  11529.   Solaris      2.6  cua/a 115200   ok   ok   ok   ok   ok   ok   ok   ok   ok
  11530.   Solaris      2.8  cua/a 115200   ok   ok   ok   ok   ok   ok   ok   ok   ok
  11531.   Tru64 UNIX  4.0E  ttyd1  57600   ok   ok   ok   ??   ok   ok   ok   ok   ok
  11532.   NeXTSTEP     3.1  cufa   57600   ok   ok   ok   ok   ok   ok   ok   ok   ok
  11533.   VMS/Alpha    7.1  TTA0:  57600   ok  n/a/  ok  n/a   ok   ok   ok   ok   ok
  11534.   Windows 95  4.00  COM1  115200   ok  n/a   ok   ok   ok   ok   ok   ok   ok
  11535.   Windows 2K  5.00  COM1  115200   ok  n/a   ok   ok   ok   ok   ok   ok   ok
  11536.  
  11537. In which:
  11538.  
  11539.   HSL  = HELP SET LINE gives appropriate "typical port name"
  11540.   LCK  = UUCP port locking
  11541.   MDM  = modem signal report
  11542.   HWFC = RTS/CTS hardware flow control verified
  11543.   DIAL = Dialing works
  11544.   HNG  = MODEM HANGUP RS232 works and doesn't interfere with dialing
  11545.   DTR  = Modem dropping DTR makes Kermit pop back to prompt
  11546.  
  11547. Notes:
  11548.  
  11549.  . My copy of OSR5.0.5, despite what Bela says, does NOT support 57600.
  11550.    If you SET SPEED 57600, the speed becomes 50.  76800 becomes 75, and
  11551.    115200 becomes 110.
  11552.  
  11553.  . Had to fix tthang() for Unixware 2.1 to use TIOCSDTR instead of the
  11554.    HUP_POSIX hack, which turns out not to work at all (even though it
  11555.    gets no errors).  ckutio.c, 15 Nov 2001.
  11556.  
  11557.  . In Unixware 2.1, after the modem hangs up, Kermit can no longer get
  11558.    modem signals (errno = 6, ENXIO, No such device or address).
  11559.  
  11560.  . XENIX does not support hardware flow control; Xon/Xoff was used.
  11561.  
  11562.  . The NeXT does hardware flow control with "set flow keep, set port /dev/cufa,
  11563.    set modem flow rts/cts".
  11564.  
  11565.  . The table doesn't have room but I also verified for all platforms in this
  11566.    test run: redial, curses display, dynamic timeouts, resend, reget,  Some
  11567.    connections were good some not so good, some awful, so these runs gave
  11568.    Beta.04 a good workout.
  11569.  
  11570.  . I couldn't verify that hardware flow control was working right in Tru64
  11571.    Unix 4.0E.  The TxD and CTS lights seemed to go on and off randomly, but
  11572.    then again the modem was retraining 95% of the time.
  11573.  
  11574. Still to do:
  11575.  
  11576.  *SCO UNIX 3.2v4.2                                 
  11577.  *Unixware   7.0.1                                 
  11578.   OSR5       5.0.2                                 
  11579.  
  11580.  *Doesn't boot right any more, needs rebuilding.
  11581.  
  11582. Added function \fkeywordvalue().  It takes an argument of the form "a=b",
  11583. and assigns the value b to the macro named a.  This is for use in macros,
  11584. to make it super-easy to pass keyword (rather than positional) parameters.
  11585. Put this inside a macro or command file:
  11586.  
  11587.   for \%i 1 \v(argc)-1 1 {
  11588.       if not \fkeywordval(\&_[\%i]) end 1 Bad parameter: "\&_[\%i]"
  11589.   }
  11590.  
  11591. and then invoke it with any number of parameters like this in any order,
  11592. e.g. for a macro called MYDIAL:
  11593.  
  11594.   mydial number=7654321 modem=usrobotics speed=57600
  11595.  
  11596. We could have done this before with \fsplit(), but it required allocating
  11597. an array.  ckuusr.h, ckuus[24].c, 15 Nov 2001.
  11598.  
  11599. New makefile from Jeff with all the security-related entries redone to
  11600. use symbols rather than hardwired paths for header files and libraries,
  11601. plus a few minor touchups from me (including a few entries that had spaces
  11602. where there should have been tabs).  15 Nov 2001.
  11603.  
  11604. Booted QNX and built there, seemed to take much longer than usual (i.e. a
  11605. couple days ago...) and then it dumped core in malloc() (zzstring() calls
  11606. malloc() to allocate vnambuf, but malloc() crashes rather than returning
  11607. NULL).  Turns out this is nothing new: it happens whenever we give arguments
  11608. in a TAKE command.  I'll chase this down tomorrow.
  11609.  
  11610. Next day...  The Solaris 8 gcc build dumps core too when you give it a TAKE
  11611. command with parameters.  The problem was in dotake(): the filename given by
  11612. the user was replaced with a fully qualified version without recalculating the
  11613. length before malloc'ing space for it.  ckuus6.c, 16 Nov 2001.
  11614.  
  11615. I had the SV68 and SV88 typical port names reversed; fixed in ckuus2.c,
  11616. 16 Nov 2001.
  11617.  
  11618. Added ttglckdir() for UNIX only, which returns the name of the UUCP lockfile
  11619. directory, which is shown by SHOW COMM when C-Kermit is in remote mode (of
  11620. course the lockfile info is already shown when we have a serial connection,
  11621. but previously there was no way to find out the lockfile directory name
  11622. before trying to open a port).  ckutio.c, ckuus4.c, 16 Nov 2001.
  11623.  
  11624. Moved "typical port name" code to a separate routine, ttgtpn(), and now
  11625. also call it from SHOW COMM when in remote mode.  ckuus[2x].c, 16 Nov 2001.
  11626.  
  11627. XENIX curses build has suddenly started failing with conflicting definitions
  11628. and syntax errors in curses.h and tcap.h...  Fixed by making sure that
  11629. M_TERMINFO was defined and M_TERMCAP was *not* defined before including
  11630. <curses.h>.  I don't know why this comes up only now...  ckuusx.c.  Also
  11631. changed sco234c and sco234netc targets to link with libtinfo rather than
  11632. libcurses and libtermcap.   makefile, 16 Nov 2001.
  11633.  
  11634. In exercising the XENIX version, found that:
  11635.  
  11636.  . The dialout device is /dev/tty1A as in other SCO OS's.  Added this to
  11637.    ttgtpn(): ckuusx.c.   16 Nov 2001.  
  11638.  
  11639.  . MODEM HANGUP-METHOD RS232 does not work: DTR goes down and stays down.
  11640.    It uses the TCXONC ioctl, whatever that is...  It does not return an
  11641.    error.  I'll need to look at the manuals when they arrive.
  11642.  
  11643. Discovered \v(platform) had a spurious leading dash.  Fixed in nvlook():
  11644. ckuus4.c, 16 Nov 2001.
  11645.  
  11646. Redid the SET LINE (SET PORT) help text again.  ckuus2.c, 17 Nov 2001.
  11647.  
  11648. Added ttgtpn() prototype to ckuusr.h, 17 Nov 2001.
  11649.  
  11650. Added ttglckdir() prototype to ckcdeb.h, 17 Nov 2001.
  11651.  
  11652. Tested dialing with Windows 95 and 2000, both OK.  17 Nov 2001.
  11653.  
  11654. Tested dialing with VMS 7.1.  Happened to get a connection that still managed
  11655. to trick getrtt() into calculating huge timeouts while downloading, even while
  11656. the RTT was much smaller (like 100 times smaller).  Added another heuristic to
  11657. getrtt(): if calculated timeout > 3 * RTT, use 3 * RTT instead.
  11658. ckcfn2.c, 17 Nov 2001.
  11659.  
  11660. Added typical port name /dev/ttyd1 for OSF/1 = Digital Unix = Tru64.
  11661. Tested dialing with Tru65, ok.  ckuusx.c, 17 Nov 2001.
  11662.  
  11663. New makefile from Jeff: one correction + new comments for secure targets.
  11664. Also new CA Certs file, ca_certs.pem.  17 Nov 2001.
  11665.  
  11666. During the build-all:
  11667.  
  11668.  . sco32v4net still gets lots of warnings in the TCP/IP modules.
  11669.    But it works.
  11670.  
  11671.  . I was able to complete the qnx_nto2+ build for the first time but:
  11672.    - There were hundreds of nonfatal compiler warnings.
  11673.    - I had to use QNX wart (built by hand).
  11674.    - It starts up and runs but:
  11675.      . Startup banner says "unknown platform"
  11676.      . Can't make TCP/IP connections ("socket error")
  11677.      . Can't make serial connections (misapplication of UUCP lockfile code)
  11678.    A few touchups, however, allowed the Neutrino target to get past the wart
  11679.    glitch, add a designer banner, and avoid the UUCP lockfile foulups.  But
  11680.    it still doesn't work.  I can open the serial port but there is no
  11681.    control over modem signals.  If I send characters I can see the lights
  11682.    blink but I don't get anything back.  makefile, ckuver.h, 17 Nov 2001.
  11683.  
  11684. The rest of the build-all went OK.  Converted the new html man-page/tutorial
  11685. to nroff and removed all references to ckuker.cpp from the makefile.
  11686. ckuker.nr, makefile, 18 Nov 2001.  Also updated ckermit3.html.
  11687.  
  11688. ---C-Kermit 8.0.200 Beta.04---
  11689.  
  11690. Removed -O from RT PC targets, since it takes over a week to build with
  11691. optimization.  makefile, 19 Nov 2001.
  11692.  
  11693. Made new SCO OSR5.0.4 targets without -O, which crashes the /usr/ccs/bin/cc
  11694. compiler instantly.  makefile, 19 Nov 2001.
  11695.  
  11696. Carl Friend verified that adding -G7 to the ultrix44 CFLAGS makes it link OK.
  11697. makefile, 21 Nov 2001.
  11698.  
  11699. Andy Harper discovered that C-Kermit Beta.04 on Solaris 8 thought it was in
  11700. local mode when it should have been in remote mode, because the new realpath()
  11701. call in ttopen() was turning "/dev/tty" into "/devices/pseudo/sy@0:tty", which
  11702. obviously doesn't match "/dev/tty".  This has no end of dire consequences --
  11703. terminal modes fouled up, deafness to signals...  Cure: in ttopen(), don't
  11704. run the device name through zfnqfp() (front end for realpath()) if it already
  11705. matches the generic controlling terminal name ("/dev/tty" in this case).
  11706. ckutio.c, 21 Nov 2001.
  11707.  
  11708. New aix41g target from Carl Friend.  makefile, 22 Nov 2001.
  11709.  
  11710. Updated VMS build procedure from Dave Sneddon for UCX 5.1.  ckvker.com,
  11711. 22 Nov 2001.
  11712.  
  11713. From Jeff:
  11714.  . Add 3rd arg to ftpopen(): ckuusy.c, ckuusr.h
  11715.  . Fix an unquoted \ in help text: ckuus2.c
  11716.  . Add SSH to netnames[] table: ckuusx.c
  11717.  . Add SHOW IKSD: ckuusr.h, ckuus7.c
  11718.  . Add "SRP USE-NEW-API: ckuusr.h, ckuus3.c
  11719.  . Increase SSH verbosity: ckuus3.c
  11720.  . Some SSH and RLOGIN/SIGURG adjustments: ckcnet.c
  11721.  . Adjustments to SHOW NET for SSH: ckuus4.c
  11722.  . Redo NP_xxx virtual terminal protocols types: ckcnet.h
  11723.  . Adjustments to SSH command parsing: ckuusr.c, ckuus7.c
  11724.  . Add FTP over TLS: ckcftp.c
  11725.  . Lots of new secure Linux targets: makefile
  11726. 1 Dec 2001.
  11727.  
  11728. Fixed typos in DIAL message: "Is your modem is turned on?" (and no \n),
  11729. and made the DIAL-time missing-modem-signal warnings obey SET QUIET.
  11730. ckuus6.c, 1 Dec 2001.
  11731.  
  11732. Added hardwired definitions TIOCM_xxx modem signals for SCO OSR5 (Thos. Pinkl)
  11733. which <sys/termio.h> hides from us because of POSIX strictness.  This should
  11734. make modem-signal sensing work (but not carrier detection during i/o).
  11735. ckutio.c, 1 Dec 2001.
  11736.  
  11737. Updated HELP TRANSMIT.  ckuus2.c, 1 Dec 2001.
  11738.  
  11739. Added special code to TRANSMIT to handle binary mode with no echo and no
  11740. pause.  In this case, instead of sending a character at a time, it buffers
  11741. them.  Now TRANSMIT'ing a 32K binary file (on a Telnet connection) is
  11742. instantaneous rather than taking several minutes.  transmit(): ckuus4.c,
  11743. 1 Dec 2001.
  11744.  
  11745. Added /NOECHO switch to TRANSMIT.  ckuus[r24].c, 1 Dec 2001.
  11746.  
  11747. But in testing, the transmitted result invariably drops the 8719th character.
  11748. The debug log reveals that all characters were read successfully, and ttol()
  11749. reports all buffers were sent successfully.  IACs were doubled correctly.  The
  11750. dropped character is a NUL within a run of NULs.  Let's see what happens with
  11751. a different file...  Aha, the real problem is: whenever we send a CR (^M), the
  11752. next character is dropped (whatever it is, doesn't matter).  Kermit doesn't
  11753. seem to be doing anything wrong; is the problem on the collecting end ("stty
  11754. raw ; cat > foo")?  Evidently: when transmitting to a different OS, all
  11755. Ctrl-V's drop out.  OK, phew, Kermit is fine.  The ultimate test is as
  11756. follows: On the receiving end do:
  11757.  
  11758.   set host * 3000 /raw-socket
  11759.   (wait for connection)
  11760.   set session-log binary
  11761.   log session
  11762.   connect
  11763.  
  11764. On the sending end do:
  11765.  
  11766.   set host blah 3000 /raw-socket
  11767.   xmit /binary /nowait /noecho filename
  11768.   hangup
  11769.  
  11770. where "filename" is any file at all (e.g. a gzipped file).  The resulting
  11771. session log is identical to the original file.
  11772.  
  11773. Fixed a typo in HELP FOPEN.  ckuus2.c, 1 Dec 2001.
  11774.  
  11775. More revisions to HELP SET LINE/PORT for K95.  ckuus2.c, 1 Dec 2001.
  11776.  
  11777. Unix makefile: Changed MANEXT from l (letter) to 1 (digit) since that's what
  11778. everybody expects it to be.  Changed "make install" to use $(BINARY) for the
  11779. name of the executable to be installed, rather than "wermit".  Got rid of
  11780. "make manpage".  Got rid of ckcaaa.txt and ckuaaa.txt from "make install".
  11781. 1 Dec 2001.
  11782.  
  11783. Fixed a malformatted dialing hint.  ckudia.c, 1 Dec 2001.
  11784.  
  11785. Added a new target for NetBSD 1.5, which changed the specs for tputs()
  11786. (the third arg function pointer from void (*) to int (*)).  makefile,
  11787. 1 Dec 2001.
  11788.  
  11789. Sven Holmstr÷m reported that the phone-number code did not handle PBX internal
  11790. calls in the unmarked-area-code case.  Test case:
  11791.  
  11792.   set dial pbx-outside-prefix 00
  11793.   set dial pbx-exchange 3
  11794.   set dial area-code 21
  11795.   set dial country-code 46
  11796.   lookup +46 21 39999
  11797.  
  11798. All C-Kermit versions produced the result "0039999".  Fixed in dncvt().  Now
  11799. we get "9999".  ckuus6.c, 1 Dec 2001.
  11800.  
  11801. Improved HELP SET SPEED text.  ckuus2.c, 2 Dec 2001.
  11802.  
  11803. Improved SET SPEED ? help and error message text.  ckuus3.c, 2 Dec 2001.
  11804.  
  11805. Improved debugging in ddinc() and dook() for clearly recording the modem's
  11806. response to a command, and not making *three* entries for every character
  11807. that arrives (needs testing).  ckudial.c, 2 Dec 2001.
  11808.  
  11809. Added SINIX /dev/ttyc1 to list of typical serial-port names (ttgtpn()):
  11810. ckuusx.c, 2 Dec 2001.
  11811.  
  11812. In SET SEND TIMEOUT <n> DYNAMIC [ <min> [ <max> ] ], the min parameter was
  11813. ignored.  Fixed in getrtt(): ckcfn2.c, 2 Dec 2001.
  11814.  
  11815. FTP OPEN parsing was wrong.  The optional port is supposed to come before
  11816. the switches, but the parser did it the other way around.  Also, Jeff put
  11817. the /SSL /TLS switches in with the other ones, but they should come before
  11818. the hostname rather than after the end, so Kermit can default the port
  11819. correctly.  Fixed in ckcftp.c, 2 Dec 2001.
  11820.  
  11821. The new FTP OPEN command had a problem with switch parsing.  In:
  11822. "FTP OPEN hostname ? /USER:blah ", the switch argument was missed.  It looks
  11823. like if you ask for help in a field that can be a switch or something else,
  11824. the field's switchness is forgotten.  This problem has been there ever since
  11825. switches were added; in cmkey2(), one of the gtword()'s wasn't being passed
  11826. its break-character argument.  ckucmd.c, 2 Dec 2001.
  11827.  
  11828. But there's more.  If you type "ftp open blah /user: ", it's supposed complain
  11829. that an argument (for "/user:") is required, but it doesn't; instead it does
  11830. that dopey thing that happens when parsing code is sloppy: it moves the cursor
  11831. to the beginning of the command without erasing the command.  This turns out
  11832. to be a simple oversight in openftp(): it should check the return code of
  11833. cmfld() when parsing switch arguments.  In fact, you should be allowed to
  11834. to say "/user: " (with no arg) to undo any global FTP or LOGIN USER, so I
  11835. fixed that; ditto for /password: and /account:.  ckcftp.c, 2 Dec 2001.
  11836.  
  11837. From Jeff, 3 Dec 2001:
  11838.  
  11839.   ckuusr.h ckuus3.c ck_ssl.c ck_ssl.h ckcnet.c ckuath.c ckuath.h ckcdeb.h:
  11840.  
  11841.   Removed SET AUTH SRP USE-NEW-API .  I finally found the bug I have
  11842.   been looking for that I have been unable to find for several months.
  11843.   I was referencing the wrong variable.  We continue to support both the
  11844.   old a new apis, but now the use of the api is determined at
  11845.   compilation time based upon the version of SRP being compiled against.
  11846.  
  11847.   The rest of the changes are related to a restructing of the code that
  11848.   dynamicly loads and unloaded the ssleay32.dll and libeay32.dll
  11849.   libraries.  The SSH library needs to link against libeay32.dll but
  11850.   not ssleay32.dll.  Most of the changes are in the cko modules but some
  11851.   function name changes and movement of prototypes affected other files.
  11852.  
  11853.   ckcnet.c:
  11854.   Fixed the /NO-TELNET-INIT bug
  11855.  
  11856. Adjusted #include <time.h> #ifdefs for 4.2BSD.  ckucns.c, ckcftp.c, 3 Dec 2001.
  11857.  
  11858. From Jeff: Updated SHOW FEATURES for FTP and HTTP.  ckuus5.c, 4 Dec 2001.
  11859.  
  11860. Deleted old HP-UX 5.00 makefile targets since the new one worked out ok.
  11861. makefile, 4 Dec 2001.
  11862.  
  11863. Fixed OSF/1, Digital Unix, and Tru64 heralds.  ckuver.h, 4 Dec 2001.
  11864.  
  11865. Patches to allow modem control in QNX6 from Adrian Godwin: ckutio.c,
  11866. ckuusx.c, makefile, 4 Dec 2001.
  11867.  
  11868. Added lying #ifdefs to allow QNX6 to use QNX4 ttlock()/ttunlck().
  11869. ckutio.c, 4 Dec 2001.
  11870.  
  11871. Lars Kellogg-Stedman pointed out that the PTY and SSH commands failed to 
  11872. print an error message if a PTY could not be allocated.  Added messages
  11873. to setlin() in ckuus7.c and to the XXSSH code in ckuusr.c, 4 Dec 2001.
  11874.  
  11875. SET TERMINAL AUTODOWNLOAD { ..., ERROR { STOP, CONTINUE } }:
  11876.  
  11877.   ckcmai.c (adl_err definition)
  11878.   ckuusr.h (TAD_ERR symbol)
  11879.   ckuus7.c (parsing)
  11880.   ckuus6.c (action)
  11881.   ckuus5.c (SHOW TERM)
  11882.   ckuus2.c (HELP SET TERM)
  11883.  
  11884. Note: I did not do this for SET INPUT AUTODOWNLOAD; maybe if anybody needs it.
  11885. 4 Dec 2001.
  11886.  
  11887. Verified that SVR4 lockfile name was correct, or at least that it agrees
  11888. with mgetty's.  Changed the code to use %u rather than %d, since that's what
  11889. mgetty uses, and because it is safe to do so since %u is in SVID for SVR4,
  11890. and the code is #ifdef SVR4..#endif.  ckutio.c, 5 Dec 2001.
  11891.  
  11892. From Sven Holmstr÷m: enable CKHTTP for OSF/1 - Digital Unix - Tru64, to allow
  11893. FTP thru firewalls via HTTP proxy.  ckcdeb.h, 5 Dec 2001.
  11894.  
  11895. From Lucas Hart:
  11896.  . Fix a typo in cmdiffdate() that could wreck the result: ckucmd.c.
  11897.  . Improved help text for DATE: ckuus2.c.
  11898.  . and...:
  11899.  
  11900. (a)  For my CKHTTP builds on du50, I added -DCKHTTP -DUTIMEH to KFLAGS
  11901. A more general approach would be to add OSF to the CKHTTP feature list
  11902. in CKCDEB.H and port the UTIMEH selection from CKUFIO.C to CKCNET.C
  11903.  
  11904. I looked at utime.h on
  11905.     SunOS 4.1.1      from S5R2 1.1
  11906.     Solaris 8      /* SVr4.0 1.3   */                                        
  11907. to see how to include it on those systems.  Since Solaris8 is SVR4,
  11908. I expect ATTSV would be more general and include HPUX9, which is SVR3.
  11909. Changed POSIX to SVORPOSIX so as to include Solaris etc. as well as HPUX9.  
  11910. Don't know if SunOS 4.0 also has utime defined, but I put in SUNOS4 to 
  11911. cover SunOS 4.1,
  11912.  
  11913. #ifdef CMDATE2TM
  11914. #ifdef SVORPOSIX
  11915. #define UTIMEH
  11916. #else
  11917. #ifdef OSF
  11918. #define UTIMEH
  11919. #else
  11920. #ifdef SUNOS4
  11921. #define UTIMEH
  11922. #endif /* SUNOS4 */
  11923. #endif /* OSF */
  11924. #endif /* SVORPOSIX */
  11925. #endif /* CMDATE2TM */
  11926.  
  11927. I haven't seen the failure to include utime.h produce any compiler errors, 
  11928. but rather, in http_date, the lack causes the file modification time to 
  11929. not be set to "Last Modified" and the current date to be used instead.
  11930. (end quote from Lucas)
  11931.  
  11932. It seems we have blocks of #ifdefs like this in various source modules like
  11933. ckufio.c, ckcnet.c, and ckcftp.c, which are totally inconsistent.  So I moved
  11934. the block of #ifdefs to ckcdeb.h and generalized them, and added an extra
  11935. level of #ifndef protection because of all the makefile targets that define
  11936. UTIMEH or SYSUTIMEH.  I used SVR4ORPOSIX rather than SVORPOSIX because I can't
  11937. find any reference to utime() in SVID for SVR3.  I am hoping this rather
  11938. drastic change will cause no harm because (a) it's no different than what was
  11939. already in ckcftp.c except that SVR4, SUNOS4, and OSF are added; (b) Lucas has
  11940. verified this on OSF and SunOS; (c) I can verify on SunOS; and (d) SVR4
  11941. includes utime().  These changes should enable file date-setting functions in
  11942. places where they were not enabled before (Kermit, FTP, HTTP) for lots of
  11943. platforms (various HP-UX's, OSF/1 and its descendents, Solaris and anything
  11944. else based on SVR4...).  Built OK on SunOS 4.1.3 (BSD), SINIX 5.42 (SVR4),
  11945. Linux (POSIX), Solaris 2.5.1...  ckcdeb.h, ckcftp.c, ckcnet.c, ckuus5.c,
  11946. 5 Dec 2001.
  11947.  
  11948. Added SVORPOSIX, SVR4ORPOSIX, OS2ORUNIX, OS2ORVMS, VMSORUNIX to SHOW FEATURES.
  11949. ckuus5.c, 5 Dec 2001.
  11950.  
  11951. From Lucas, cont'd: "(b) There is an error in http_date, 
  11952.  
  11953.     ckstrncpy(ldate,&date[j+1],20);
  11954.  
  11955. The date string is 20 characters, so the buffer size should be 21.
  11956. Once that is corrected, it turns out that the date is written after applying 
  11957. any seasonal correction.  If the buffer length is changed to 25, or longer, 
  11958. to pass the " GMT", the file date is converted to localtime but any seasonal 
  11959. time correction is still incorrectly applied."  Changed the ckstrncpy()
  11960. length parameter from 20 to 25.  ckcnet.c, 5 Dec 2001.
  11961.  
  11962. More from Lucas: "On the systems to which I have access (SunOS 4.1.1, Solaris
  11963. 8, and Tru64), setting tm_isdst to -1 maintains the correct timezone offsets,
  11964. i.e., writes the specified (GMT) time if the buffer size is 21, or the
  11965. contemporaneous localtime if the buffer size is 25.  Perhaps tm_isdst should
  11966. be set in cmdate2tm(), rather than only in http_date."  Added this for
  11967. SunOS, Solaris 2.5 and later, Tru64, and Linux.  Maybe it should just be
  11968. unconditional, since all "man mktime" pages say tm_isdst exists, even though
  11969. they are not terribly clear about its semantics.  ckcnet.c, 5 Dec 2001.
  11970.  
  11971. Removed the QNX6 kludge for line locking; Adrian Godwin tried it and it
  11972. doesn't work: QNX6 doesn't have a struct _dev_info_entry, nor the
  11973. sys/dev.h that it presumably would be declared in.  ckutio.c, 5 Dec 2001.
  11974.  
  11975. From Jeff: #ifdef adjustments to unbreak the [SYS]UTIMEH changes for
  11976. NetBSD 1.5.2, OpenBSD 2.8, etc: ckufio.c, ckcftp.c, 6 Dec 2001.
  11977.  
  11978. From Sven: Fixes to the Digital Unix 3.2 makefile target, which compiled
  11979. ckuus6.c and ckuusx.c separately; a couple important CFLAGS were not carried
  11980. over.  makefile, 6 Dec 2001.
  11981.  
  11982. From Lucas: a fix for asctime() format conversion.  cmcvtdate(): ckucmd.c,
  11983. 6 Dec 2001.
  11984.  
  11985. From Lucas: change #ifdef SUNOS4 for UTIMEH to SUNOS41, since we really
  11986. don't know about SunOS 4.0.  ckcdeb.h, 6 Dec 2001.
  11987.  
  11988. From Lucas: More updates to HELP DATE.  ckuus2.c, 6 Dec 2001.
  11989.  
  11990. Changed cascaded #ifdefs around t_tm.tm_isdst in http_date() to be
  11991. #ifndef NOTM_ISDST, which we can set in makefile CFLAGS as needed during the
  11992. build-all.  ckcnet.c, 6 Dec 2001.
  11993.  
  11994. Added a tru64-51 target.  makefile, ckuver.h, 6 Dec 2001.
  11995.  
  11996. From Sven: comment out some OSF/1-1.3-specific #ifdefs regarding getpwnam(),
  11997. etc, in ckufio.c, to make warnings go away.  6 Dec 2001.
  11998.  
  11999. As Sven reported a few days ago: in Tru64 Unix 5.1, starting the current
  12000. C-Kermit with the standard 7.0 init file, the ECHO commands in .kermrc and
  12001. .mykermrc are executed, but nothing comes out on the screen.  But if I add any
  12002. kind of debugging (-d on the command line, SET TAKE ECHO ON prior to executing
  12003. the file), the messages do come out.  If I replace the standard .kermrc with a
  12004. simple one, there are no problems.  If I replace the 7.0 standard .kermrc with
  12005. the 8.0 one, there are also no problems.  After shuffling the init files back
  12006. and forth a few times, suddenly the problem disappeared and I can't make it
  12007. happen no matter what I do.  OK, let's put this aside for a while and catch up
  12008. on other things...
  12009.  
  12010. Lots of casts and prototypes for IA64, Alpha, etc.  ckcftp.c, ckcnet.c,
  12011. ckuus4.c, ckuus5.c, ...
  12012.  
  12013. Problem on Red Hat 7.1 / ia64.  I give Kermit a RECEIVE command and it
  12014. says: "/dev/tty: No such device or address".  Of course there is such a
  12015. device or address, but for some reason open() fails.  Added code to ttopen()
  12016. to account for this: if opening the console device fails, just set ttyfd
  12017. to 0 and pretend we succeeded.  Then we get a bit further, up to the
  12018. fcntl() call where we unset O_NDELAY, which fails miserably, but then it
  12019. probably should, since this is stdin.  It turns out we never set O_NDELAY
  12020. in remote mode anyway, so there is no reason to try and unset it.  Making
  12021. this change gets us out of ttopen() but then we fail in ttpk() on the
  12022. tcsattr() call with errno = 9: "Bad file descriptor".  Well, I could keep
  12023. chasing this through all the code, but it all stems from not getting a
  12024. real file descriptor from open() on /dev/tty.  Turns out there's nothing
  12025. I can do about it; the following program gets exactly the same errors:
  12026.  
  12027.   extern int errno;
  12028.  
  12029.   main() {
  12030.     int fd;
  12031.     errno = 0;
  12032.     fd = open("/dev/tty",2);
  12033.     printf("fd = %d\n",fd);
  12034.     printf("errno = %d\n",errno);
  12035.   }
  12036.  
  12037. uname -a:
  12038.   Linux spe190 2.4.9-12smp #1 SMP Tue Oct 30 17:55:42 EST 2001 ia64 unknown
  12039.  
  12040. /etc/issue:
  12041.   Red Hat Linux release 7.1 (Seawolf)
  12042.   Kernel 2.4.9-12smp on a 4-processor ia64
  12043.  
  12044. This does not happen on any other platform, including RH7.1 on other
  12045. architectures, and including SuSE 7.2 on ia64.  Gave up and posted a query
  12046. to the Linux newsgroup.  ckutio.c, 6 Dec 2001.
  12047.  
  12048. Built the following binaries successfully at the Compaq hosting site.
  12049. Can't make connections from there so could only test remote-mode sending
  12050. and receiving (each binary sent itself):
  12051.  
  12052.   cku200b04.freebsd44-alpha-4.4
  12053.   cku200b04.linux-alpha-db2.2
  12054.   cku200b04.linux-alpha-rh7.1
  12055.   cku200b04.linux-alpha-su7.1
  12056.   cku200b04.linux-i386-db2.2
  12057.   cku200b04.linux-i386-md8.1
  12058.   cku200b04.linux-i386-rh7.2
  12059.   cku200b04.linux-i386-su7.3
  12060.   cku200b04.linux-i386-tu6.5
  12061.   cku200b04.linux-ia64-su7.2
  12062.   cku200b04.netbsd15-alpha-1.5.1
  12063.   cku200b04.tru64-51-5.1a
  12064.  
  12065. Note that the SuSE IA64 binary works fine; the /dev/tty open failure is
  12066. peculiar to Red Hat 7.1.
  12067.  
  12068. Added -DUTIMEH into HP-UX 9.xx target (verified by PeterE).  makefile,
  12069. 7 Dec 2001.
  12070.  
  12071. Fixed some \"'s and capitalization in printf() strings (PeterE): ckuus?.c,
  12072. 7 Dec 2001.
  12073.  
  12074. From Jeff: Fix out-of-order SET TERM AUTODOWNLOAD keywords.  ckuus7.c,
  12075. 7 Dec 2001.
  12076.  
  12077. Reduced default receive packet lengths for HP-UX 5 and 6 from 4K to 500
  12078. (PeterE).  ckcker.h, 7 Dec 2001.
  12079.  
  12080. The problem with Tru64 5.1 turned out to be a nonproblem.  When I gave Sven
  12081. the binary that I built on 5.1A (Rev 1885), it worked OK for him on 5.1
  12082. (Rev 732).  However, I did discover that a 4.0G binary, when run on 5.1A,
  12083. had the same problems that Sven reported.  7 Dec 2001.
  12084.  
  12085. Changed HP-UX 11.xx target to (a) allow for xx's larger than 09 (it's now
  12086. up to 20), and (b) link with libcurses instead of libHcurses for 11.11 and
  12087. later (but with lHcurses in 11.00).  Thanks to Doug Hoskins at HP.
  12088. makefile, 7 Dec 2001.
  12089.  
  12090. Verified SVR4 lockfile name format from SVR4 (Solaris 7) ulockf.c.  7 Dec 2001.
  12091.  
  12092. The problem with Red Hat 7.1 on IA64 turned out to be an OS configuration
  12093. error; "virtual terminals" were not included at install time.  7 Dec 2001.
  12094.  
  12095. From Jeff: HELP FIREWALL text.  ckuusr.[ch], ckuus2.c, 7 Dec 2001.
  12096.  
  12097. From Jeff: Some new SOCKS stuff, ckuusr.h ckuus[345].c, 7 Dec 2001.
  12098.  
  12099. Fixed FIREWALL keyword to not show up in top-level ?, ckuusr.c, 7 Dec 2001.
  12100.  
  12101. Assorted text-message changes: ckuus[r26].c, 7 Dec 2001.
  12102.  
  12103. Changed test ID from Beta.04+ to RC.2.  ckcmai.c, 7 Dec 2001.
  12104.  
  12105. From Matthew Clarke <Matthew_Clarke@mindlink.bc.ca>, updates for AIX 2.2.1
  12106. on the IBM RT PC.  makefile; ckucmd.c, ckufio.c (location of syslog.h);
  12107. ckcdeb.h (define SELECT).  8 Dec 2001. 
  12108.  
  12109. From Lucas: hpux1000gcc target for HP-UX 10.00-11.xx, makefile, 8 Dec 2001.
  12110.  
  12111. Added prototype for sho_iks() to ckuus5.c, 8 Dec 2001.
  12112.  
  12113. Jeff discovered a problem with command-line URLs at the last moment and
  12114. fixed it in ckuus4.c, 8 Dec 2001.
  12115.  
  12116. Found that urlparse() was excluded by NOCMDL, yet it was needed outside the
  12117. command-line parser.  Moved it to above the #ifndef NOCMDL..#endif section.
  12118. ckuusy.c, 8 Dec 2001.
  12119.  
  12120. Found that the NOICP NOCMDL combination (which produces an executable that
  12121. does nothing except run in server mode) was broken; moved a couple #ifdefs
  12122. in ckcmai.c to fix.  8 Dec 2001.
  12123.  
  12124. Added DTR as a synonym for RS232-SIGNAL in SET MODEM HANGUP-METHOD, since I
  12125. always type it that way first.  ckuus[23].c, 8 Dec 2001.
  12126.  
  12127. I finally got Unixware 7.0.1 back, and found that, like OSR5, it can read
  12128. modem signals but ANSI strictness doesn't let applications at them.  Tried
  12129. rebuilding with -DNEEDMDMDEFS and now I can see them, hurray.  HANGUP with
  12130. DTR works.    RTS/CTS works, uploads and downloads work, ...  But like OSR5,
  12131. automatic recognition of carrier dropping does not work.  Added -DNEEDMDMDEFS
  12132. to the makefile target.  Note: Unixware 2.1 did not need this.  8 Dec 2001.
  12133.  
  12134. Made sure Unixware 2.1 modem-signal reading, dialing, DTR hangup, file
  12135. transfer, etc, work right (they do).  But it has the same problem as Debian
  12136. 2.1 (see notes of 2 Nov 2001).  I had intended to address this in a general
  12137. way, now I have: in in_chk(), if we get either an I/O error (errno 5) or "No
  12138. such device or address" (errno 6) when trying to get modem signals, we declare
  12139. the connection lost and, if SET CLOSE-ON-DISCONNECT is ON, we close it, in
  12140. which case we can make subsequent calls without having to do another SET LINE.
  12141. ckutio.c, 8 Dec 2001.
  12142.  
  12143. "make linux KFLAGS=-DNOANSI" doesn't work because some kind of bizarre
  12144. conflict involving logwtmp(), but I'm not going to worry about it because
  12145. Linux just plain doesn't have any non-ANSI compilers, and the logwtmp()
  12146. confusion is specific to Linux.  However, the other 81 builds came up clean,
  12147. and NOANSI builds on SunOS and HP-UX came up clean, so we should be good to go.
  12148.  
  12149. Booted Caldera Open UNIX 8 for the first time...  It has the OSR5 disease of
  12150. not wanting to drop DTR unless you close the device.  I generalized the OSR5
  12151. code in tthang() to depend on a new symbol, HUP_CLOSE_POSIX, which is now
  12152. defined for OSR5 and Open Unix 8, and can be defined on the command for any
  12153. other POSIX-based OS that needs it.  ckutio.c, ckuus5.c, 8 Dec 2001.
  12154.  
  12155. Booted OpenBSD 3.0 for the first time...  Builds OK, but it doesn't know what
  12156. its lockfile directory should be.  Well, it did; it just wouldn't say (in SHOW
  12157. COMM) because it uses the uu_lock() API to hide this from the application.
  12158. But we still want to show it, so the user can find out which directory is
  12159. protected against them.  I added code to do this, but it doesn't make any
  12160. difference.  Finally I did it by brute force in ttglckdir().  Everything else
  12161. works: dialing, DTR dropping, file transfer, etc.  ckutio.c, 8 Dec 2001.
  12162.  
  12163. Booted FreeBSD 4.4 for the first time...  Needed the same treatment as OpenBSD
  12164. so SHOW COMM would tell the lockfile directory.  Otherwise everything is
  12165. perfect: modem signals, DTR, file transfer, ...  ckutio.c, 8 Dec 2001.
  12166.  
  12167. Booted NetBSD 1.5.2 for the first time...  Everything is perfect.
  12168.  
  12169. From Jeff:
  12170.  . Add code to interpret secure URLs for telnets, ftps, https.
  12171.  . Fix a bug in FTP urls where the port was ignored.
  12172.  . Fix a bug in netopen url processing in which the protocol was
  12173.     not set based upon the url service but instead upon the port number.
  12174.  . "kermit telnet://foo -d" should not try to call netopen() with
  12175.    telnet://foo:-d.
  12176. ckcnet.c ckuusy.c ckcftp.c ckuus4.c, 8 Dec 2001.
  12177.  
  12178. The change I made to in_chk() seemed a bit dangerous -- after all, what
  12179. if the modem-signal-getting ioctl() always gets an error on some platform
  12180. or other.  So I added a persistent flag, gotsigs, which is set to 0 when
  12181. a connection is first opened, then set to 1 any time ttgmdm() succeeds.
  12182. So if ttgmdm() fails, we can test this flag to see if it ever succeeded
  12183. before.  If it had, then we can conclude the connection has dropped; otherwise
  12184. maybe it's just that the API doesn't work.  Tested on Unixware 2.1.3 and
  12185. Debian 2.1; seems to be fine.  ckutio.c, 8 Dec 2001.
  12186.  
  12187. Build-all begins 9 Dec 2001 9:00am.  Incidents/milestones:
  12188.  . Transferring the Linux RH7.1 binary back to watsol from ftp.kermit
  12189.    (2.1MB) I had a transfer rate of "(0.368 sec, 5806809 cps)".  Whoa!
  12190.  . Can't find where I put my extra OmniCube cables - need kb cable for Xenix.
  12191.  . Need a DB9 modem cable for the Xenix box.
  12192.  . The Xenix box is making a weird crackling staticky noise.
  12193.  . Made build scripts for Xenix and HP-UX 5.21.
  12194.  . Verified that dialing works with Xenix 2.3.4; had it upload itself
  12195.    over a dialed connection with Xon/Xoff.
  12196.  . Also sent binaries from Xenix with Kermit over Telnet and with Kermit's 
  12197.    FTP client, all OK,
  12198.    except FTP Passive mode doesn't work in Xenix, must use active.  All three
  12199.    sets of binaries compare OK, and also with
  12200.  . I actually got the DG to boot, but it wasn't connected to the new Ethernet,
  12201.    so I had to reboot after reconnecting it, but it crashed during reboot.
  12202.    Turned it off for a few hours.  Booted again; terminal began to flicker
  12203.    and fade; then AOS/VS crashed.  Turned it off again.
  12204.  . Unixware 7.0.1 -- I booted it yesterday, it was fine.  I booted it today,
  12205.    it hangs trying to find the network, just like before Max fixed it Friday.
  12206.    I had to power it off; there was no way to shut down cleanly.
  12207.  . Watsun kept getting file table full every few hours.
  12208.  
  12209. New HP-UX 10-11 targets accounting for PA-RISC/IA64 differences from PeterE,
  12210. verified by Doug Hosking at HP.  makefile, 10 Dec 2001
  12211.  
  12212. B2000 arrived; dual boots HP-UX 11.00 and 11.11.  Built 8.0 on both, using new
  12213. makefile, with all three optimization strengths (fast!), but can't dial out.
  12214. Assume it's because /dev/cua0p0 is not configured; only tty0p0.  Later... Yes,
  12215. that's it.  It's easy to fix, just "add a modem" in Sam.  10 Dec 2001.
  12216.  
  12217. Removed -DNOLEARN from coherent42 target (Fred Smith).  makefile, 11 Dec 2001.
  12218.  
  12219. Updated version numbers in CKVOLD.COM.  11 Dec 2001.
  12220.  
  12221. HP-UX 11.xx GCC target from PeterE.  makefile, 11 Dec 2001.
  12222.  
  12223. Fixed broken reference from du50 to tru64-50.  makefile, 11 Dec 2001.
  12224.  
  12225. Fixed a typo in the hpux1000 target (PeterE).  makefile, 12 Dec 2001.
  12226.  
  12227. Totally redid the "make install" target.  makefile, 13 Dec 2001.
  12228.  
  12229. PeterE totally redid my new "make install" target and also simplified
  12230. the main linux target.  makefile, 14 Dec 2001.
  12231.  
  12232. More updates for the rtaix entries from Matthew Clarke.  makefile, 16 Dec 2001.
  12233.  
  12234. Checked to make sure "make linux" still works on Debian 2.1 (it does).
  12235.  
  12236. *************************
  12237. (End)
  12238.