dh_installchangelogs: adjust to use ckc301.txt. changelog: explain -O1 usage
[ckermit.git] / ckc301.txt
1 C-KERMIT 9.0 CHANGE LOG (Changes since 8.0.207 / K95 2.1.3 January 2003)
2
3   Chronological order.
4   Go to the bottom to find the newest edits.
5
6   F. da Cruz, The Kermit Project, Columbia University, NYC.
7   Last update: 28 June 2011.
8
9 FTP USER, FTP ACCOUNT, plus the various prompts and switches for FTP username,
10 password, and account all neglected to strip quotes, and in most cases quotes
11 are necessary to specify a username that contains spaces.  ckcftp.c,
12 15 Jan 2003.
13
14 FTP MPUT f1 f2 f3... gets a parse error if any of the fn's do not match an
15 existing file.  This is bad for scripts.  In doftpput(), cmfdb() looks for
16 keywords (switches) or CMIFI.  When it hits CMIFI, it exits from the initial
17 parse loop and then does additional cmifi()s in a loop until done.  The most
18 obvious fix is to parse each field with cmfdb(CMIFI,CMFLD), i.e. fall back to
19 CMFLD if CMIFI doesn't match anything.  Then if CMFLD was used, we don't add
20 the filespec to the list.  This is a rather big change but it seems to work.
21 No error messages or failures happen for non-matching fields, but an error
22 message is printed (and the MPUT command fails) if none of the fields match
23 any files.  This fix got in too late for 2.1.3; workaround: use C-Shell
24 like wildcard list (ftp mput "{*.abc,foo.*}").  ckcftp.c, 16 Jan 2003.
25
26 GREP did not pass its pattern through the expander, thus variables could
27 not be used for patterns.  This must have been an oversight -- I can't find
28 anything in my notes about it.  Fixed in dogrep(): ckuus6.c, 24 Jan 2003.
29
30 New makefile target for HP-UX 11.xx with OpenSSL from Tapani Tarvainen.
31 makefile, 31 Jan 2003.
32
33 From Jeff:
34  . Avoid core dump when dereferencing tnc_get_signature(): ckuus4.c.
35  . Bump version numbers to 8.0.208, 2.1.4: ckcmai.c.
36
37 Added /NOLOGIN to FTP [OPEN].  ckcftp.c, 10 Feb 2003.
38
39 Don't dump core if FTP DEBUG is ON and FTP OPEN does not include a service.
40 openftp(): ckcftp.c, 10 Feb 2003.
41
42 HELP PATTERN text incorrectly identified commands and functions with
43 floating and anchored patterns.  The corrected lists are:
44 Floating: GREP, TYPE /MATCH:, /EXCEPT: patterns, \farraylook(),
45 Anchored: IF MATCH, file-matching wildcards, \fsearch(), \frsearch()
46 ckuus2.c, 10 Feb 2003.     
47
48 INPUT n \fpattern(xxx) did not work for case-independent comparisons.
49 Fixed in doinput(): ckuus4.c, 10 Feb 2003.
50
51 It seems \fpattern() didn't work with MINPUT at all.  There was no code to
52 handle \fpattern() in the MINPUT parse loop, so it never worked.  The code
53 had to be totally rewritten to use cmfld() in a loop, rather than cmtxt()
54 and then cksplit().  Furthermore, whenever any of the fields was an
55 \fjoin(), this had to be split.  ckuusr.c, 10 Feb 2003.
56
57 Macro replacement via \m() and \fdefinition() does not work as advertised
58 (i.e. case sensitively) for associative array elements; e.g. \m(xxx<abc>) is
59 treated the same as \m(xxx<ABC>), contrary to section 7.10.10 of the C-Kermit
60 7.0 update notes, and to the fact that the two really do exist separately.
61 Fixed by adding a static function isaarray(s) which succeeds if s is an
62 associative array reference and fails otherwise, and then having \m()
63 and \fdef() call mxxlook() (case-sensitive lookup) if isaarray(), otherwise
64 (as before) mxlook()).  ckuus4.c, 11 Feb 2003.
65
66 Fixed FTP OPEN to allow the /USER switch to override SET FTP AUTOLOGIN OFF,
67 just as /NOLOGIN overrides SET FTP AUTOLOGIN ON.  ckcftp.c, 11 Feb 2003.
68
69 In K95, "set key \1234 \27H" (any SET KEY command in which the first char of
70 the definition was backslash, and the ONLY character after the backslash
71 quantity was an uppercase letter, that letter would be lowercased).  Diagnosis:
72 xlookup() poking its argument (see notes from July 2000).  Jeff sent a fix.
73 ckucmd.c, 15 Feb 2003.
74
75 Ran my S-Expression torture test to make sure Sexps still worked.  They do,
76 except the bitwise & and | operators were broken, e.g. (& 7 2) and (| 1 2 4)
77 get "Invalid operand" errors.  Jeff's code had added an early failure return
78 from the lookup loop when when a single-byte keyword matched a keyword that
79 started with the same byte but was more than one byte long.  So "&" would hit
80 "&&" and fail instead of continuing its search (xlookup tables aren't sorted
81 so there can be no early return).  Fixed in xlookup(): ckucmd.c, 16 Feb 2003.
82
83 Got rid of "krbmit" target from makefile.  It's still there, but we don't
84 use it any more.  All secure targets now use "xermit", and produce a binary
85 called wermit, just like the regular ones do (except the old ckucon.c ones).
86 Non-secure targets, since they don't define any of the security symbols,
87 wind up compiling and linking to (mostly) empty security modules.  makefile,
88 15 Feb 2003.
89
90 Added \fcvtdate(xxx,3) to format its result in MDTM format (yyyymmddhhmmss,
91 all numeric, no spaces or punctuation).  Of course these numeric strings
92 are too big to be 32-bit numbers and are useless for arithmetic, but they're
93 useful for lexical comparison, etc.  ckuus[24].c, 16 Feb 2003.
94
95 The following FTP commands did not set FAILURE when they failed: RMDIR,
96 CD, CDUP, Fixed in the corresponding doftpblah() routines.  ckcftp.c,
97 16 Feb 2003.
98
99 RENAME would sometimes not print an error message when it failed, e.g. in K95
100 when the destination file already existed.  ckuus6.c, 17 Feb 2003.
101
102 Fixed COPY error messages, which did not come out in standard format when
103 /LIST was not included.  ckuus6.c, 17 Feb 2003.
104
105 Fixed #ifdefs in ck_crp.c to allow nonsecure builds on old platforms like
106 System V/68 R3.  19 Feb 2003.
107
108 Similar treatment for ck_ssl.c.  20 Feb 2003.
109
110 From Jeff, 21 Feb 2003:
111  . AIX53 and AIX52 symbols for ckcdeb.h, makefile.
112  . New gcc targets for various AIX 4.x/5.x versions: makefile.
113  . Copyright date updates: ck_crp.c, ck_ssl.c.
114  . ENABLE/DISABLE QUERY broken because keyword table out of order: ckuusr.c.
115  . Fixed the use of HTTP proxies for HTTP [RE]OPEN for Unix: ckcnet.c.
116
117 Also for K95 only: Allow file transfer when K95 is invoked on the remote end
118 of a connection to a Pragma Systems Terminal Server connection; automatically
119 SET EXIT HANGUP OFF when invoked with open port handle ("k95 -l nnnn").
120
121 "cd a*" failed even when "a*" matched only one directory.  Fixed in cmifi():
122 ckucmd.c, 21 Feb 2003.
123
124 In the Unix version, replace "extern int errno;" with "#include <errno.h>"
125 if __GLIBC__ is defined, since glibc now defines a thread-specific errno.
126 ckcdeb.h, 26 Feb 2003.
127
128 Added #ifdefs to skip compilation of ckuath.c in nonsecure builds.  Tested
129 by building both secure and regular versions in Linux.  ckuath.c, 26 Feb 2003.
130
131 Ran the build-in-84-different-configurations script on Linux to make sure it
132 still builds with all different combinations of feature selection options.
133 All OK.  26 Feb 2003.
134
135 Built on VMS.  Needed to add a prototype for mxxlook*() to ckuusr.h; built
136 OK otherwise.  26 Feb 2003.
137
138 From Jeff: More #ifdef shuffling for nonsecure builds: ckuath.c, ck_ssl.c,
139 27 Feb 2003.
140
141 Added code to ensure \v(download) ends in a directory separator in Unix,
142 Windows, and OS/2.  ckuus7.c, 27 Feb 2003.
143
144 Added code to K95 zfnqfp() to tack on directory separator when returning
145 a directory name.  ckofio.c, 27 Feb 2003.
146
147 Somehow an old copy of ckuath.c popped to replace the new one.  Put the new
148 one back.  28 Feb 2003.
149
150 From Jeff: Fix typo in my K95 zfnqfp() code from yesterday; fixes for handling
151 UNCs uniformly, no matter which way their slashes are leaning.  ckofio.c,
152 28 Feb 2003.
153
154 At Jeff Mezei's suggestion, separate text and binary mode open sequences
155 for VMS session log.  ckvfio.c, 28 Feb 2003.
156
157 Added freebsd48 target for FreeBSD 4.8.  makefile, 1 Mar 2003.
158
159 Changed Mac OS X entries to include -DUSE_STRERROR.  makefile, 2 Mar 2003.
160
161 Fixed GETOK /GUI to evaluate its text argument.  ckuus6.c, 3 Mar 2003.
162
163 Jeff fixed the K95 Dialer QUICK dialog to (a) allow templates, and (b) have
164 a Save-As option.  3 Mar 2003.
165
166 Jeff fixed a problem with the Xmodem-CRC checksum being crunched whenever
167 there was a retransmission.  7 Mar 2003.
168
169 Added target/banner for Tru64 5.1B.  makefile, ckuver.h, 5 Mar 2003.
170
171 In Unix, the zcopy() routine (used by the COPY command) reset the user's umask
172 to 0 for the remainder of the Kermit process lifetime.  The bug was in
173 ckufio.c 8.0.194, 24 Oct 2002, and is fixed in ckufio.c 8.0.195, 6 Mar 2003.
174 Of course this happened after building 155 C-Kermit 8.0.208 binaries.  (But
175 before officially releasing 8.0.208.)
176
177 In the VMS version, changed:
178
179         while ((n--) && xx_inc(2) > -1) ;
180 to:
181         while ((n--) && xx_inc(2) >= 0) ;
182
183 to suppress the "...is being compared with a relational operator to a constant
184 whose value is not greater than zero" warning.  ckvtio.c, 7 Mar 2002.
185
186 Added a debug call to dologend in hopes of catching overzealous Locus
187 switching, which seems to happen only in K95.  ckuus3.c, 7 Mar 2002.
188
189 Rebuilt binaries for some of the more current Unix releases: AIX 4.3.3-5.1,
190 Solaris 7-9 , Red Hat 7.0-8.0, Slackware 8.1, Freebsd 4.7-4.8, NetBSD 1.6,
191 OpenBSD 3.2, Unixware 7.1.3, Open Unix 8, OSR5.0.6a, etc.  A Unix binary with
192 COPY umask fix shows a 6 Mar 2003 date for "UNIX File support" in SHOW
193 VERSIONS; a binary without the fix shows 24 Oct 2002.
194
195 C-Kermit 8.0.208 dated 14 March 2003 released on 10 March 2003.
196
197 ---8.0.208---
198
199 From Jeff 13 Mar 2003:
200  . Updated SSL module allows importation of tickets from host.
201  . freebsd50+openssl target: makefile.
202  . FTP PUT /PERMISSIONS error message for K95: ckcftp.c.
203  
204 Fixed MINPUT to strip quotes or braces from around targets (this was broken
205 on Feb 10th).  Thanks to Jason Heskett for discovering and reporting this
206 (killer) bug.  ckuusr.c, 14 Mar 2003.
207
208 Changed version number to 209 Dev.00.  ckcmai.c, 14 Mar 2003.
209
210 While debugging the alphapage script, I found that the command "minput 8 \6\13
211 \21\13 \13\27\4\13 \30\13" gets "?Not confirmed" in 8.0.208 and 8.0.209, but
212 not in 206 and earlier.  This problem too was introduced on Feb 10th by
213 changing MINPUT parsing from cmtxt() followed by cksplit() to cmfld() in a
214 loop.  cmfld() uses setatm() to return its result and of course setatm()
215 breaks on \13.  Changing setatm() not to do this would break everything else.
216 But cmfld() has no arguments that let us tell it to do anything different in
217 this case.  Changing the API would be a disaster.  The only solution is to add
218 an "MINPUT ACTIVE" (minputactive) global variable that tells cmfld() to tell
219 setatm() not to break on CR.  Now MINPUT with braced targets containing CR
220 and/or LF works in 209, 206, and 201 (but not 208).  ckucmd.c, ckuusr.c,
221 ckuus5.c, 15 Mar 2003.
222
223 MINPUT n \fjoin(&a) works OK if all the members of \&a[] are text strings, but
224 if they are strings of control chars (as above), they don't get separated by
225 the spaces.  For example in:
226
227   dcl \&a[] = "\4\5" "\6\7" xxx
228   minput 10 \fjoin(&a)
229
230 MINPUT gets two targets: "aaa" and "\4\5 \6\7 xxx".  The bug was in the
231 cksplit() call in the \fjoin() case of MINPUT: it needed to specify an
232 include set consisting of all the control characters except NUL.  ckuusr.c,
233 16 Mar 2003.
234
235 But there's still a problem:
236
237   dcl \&a[] = "\4\5\13\10" "\6\7" "xxx"
238
239 creates an array whose first member is "^D^E (one doublequote included).  But
240 if braces are used instead, there's no problem.  Same deal as MINPUT: cmfld()
241 breaks on CR or LF, thus the end quote is lost.  If I set minputactive for
242 DECLARE initializers too, that fixes it.  Is there any reason not to do this?
243 Can't think of any (famous last words)...  ckuusr.c, 16 Mar 2003.
244
245 Since it has multiple applications, changed the flag's name from minputactive
246 to keepallchars.  ckucmd.c, ckuus[r5].c, 16 Mar 2003.
247
248 \v(exedir) wasn't being set correctly (it included the program name as well
249 as the directory).  Fixed in getexedir(): ckuus4.c, 16 Mar 2003.
250
251 SET CARRIER-WATCH <Esc> "auto matic" (spurious space in supplied keyword).
252 Cosmetic only; it still worked.  Fixed in setdcd(): ckuus3.c, 16 Mar 2003.
253
254 "directory a b c" listed too many files -- all files whose names END WITH a,
255 b, or c, rather than the files whose names WERE a, b, or c.  Diagnosis: The
256 filespec is changed into a pattern: {a,b,c}, which is the correct form.  It is
257 passed to nzxpand(), which goes through the directory getting filenames and
258 sending each one to ckmatch() with the given pattern.  ckmatch() receives the
259 correct pattern but then prepends a "*" -- that's not right.  It's not just
260 in filename matching either.  The following succeeds when it shouldn't:
261
262   if match xxxxc {{a,b,c}} <command>
263
264 Changing ckmatch() to not prepend the "*" to each segment fixes the command
265 above but breaks lots of others.  Running through the "match" torture-test
266 script shows the problem occurs only when the {a,b,c} list is the entire
267 pattern, and not embedded within a larger pattern.  Testing for this case
268 fixed the problem.  ckmatch(): ckclib.c, 16 Mar 2003.
269
270 Fixed FTP MODTIME to not print anything if QUIET ON.  ckcftp.c, 16 Mar 2003.
271
272 Picked up a new ckuath.c from Jeff, not sure what the changes are. 16 Mar 2003.
273
274 Did a few regular and secure builds to make sure I didn't wreck anything.
275
276 Changed version number to 209 (final).  ckcmai.c, 16 Mar 2003.
277
278 Jason Heskett found another bug: if you define a macro FOO inside the
279 definition of another macro BAR, and FOO's definition includes an odd number
280 of doublequotes (such as 1), FOO's definition absorbs the rest of BAR's
281 definition.  Example:
282
283   def TEST {
284     .foo = {X"}
285     sho mac foo
286   }
287   do test
288   sho mac foo
289
290 Results in:
291
292   foo = {X"}, sho mac foo
293
294 Diagnosis: the TEST definition becomes:
295
296   def TEST .foo = {X"}, sho mac foo
297
298 and the macro reader is erroneously treating the doublequote as an open
299 quote, and then automatically closes the quote at the end of the definition.
300 The error is that a doublequote should be significant only at the beginning of
301 a field.  But the macro reader isn't a command parser; it doesn't know what
302 a field is -- it's just looking for commas and skipping over quoted ones.
303 First we have to fix an oversight: SET COMMAND DOUBLEQUOTING OFF should have
304 worked here, but it wasn't tested in this case.  Fixed in getncm(): ckuus5.c,
305 17 Mar 2003.
306
307 There are only certain cases where it makes sense to treat doublequotes as
308 signicant:
309
310  . An open quote must be at the beginning or preceded by a space.
311  . A close quote is only at the end or else followed by a space.
312
313 This too was fixed in getncm(): ckuus5.c, 17 Mar 2003.
314
315 A fix from Jeff SSL/TLS FTP data decoding.  ckcftp.c, 18 Mar 2003.
316
317 Tried building C-Kermit on a Cray Y-MP with UNICOS 9.0.  "int suspend",
318 declared in ckcmai.c and used in many modules, conflicts with:
319
320   unistd.h:extern int suspend __((int _Category, int _Id));
321
322 The "=Dsuspend=xsuspend" trick doesn't work for this; there is no way around
323 the conflict other than to rename the variable: ckcmai.c, ckutio.c,
324 ckuus[35xy].c.  26 Mar 2003.  VMS and K95 not affected.
325
326 OK that gets us past ckcmai.c...  Then in ckutio.c I had to add a new #ifdef
327 around the LFDEVNO setting, because the Cray didn't have mkdev.h.  Could not
328 find a Cray-specific manifest symbol, so I made a new makefile target (cray9)
329 that sets this symbol.  Having done this I have no idea what kind of lockfile
330 would be created, but I also doubt if anybody dials out from a Cray.  The
331 binary should run a C90, J90, or Y-MP.  makefile, 26 Mar 2003.
332
333 Added a target for SCO OSR5.0.7.  makefile, ckuver.h, 30 Mar 2003.
334
335 Changed since 208:
336 makefile ckuver.h ckcmai.c ckclib.c ckcftp.c ckucmd.c ckuus*.c ckutio.c.
337
338 ---8.0.209---
339
340 From Mark Sapiro, a fix for the March 17th doubleqote fix, getncm(): ckuus5.c,
341 4 Apr 2003.
342
343 From Jeff, 29 Apr 2003:
344  . Corrected target for HP-UX 11.00 + OpenSSL: makefile, 
345  . Do not allow WILL AUTH before WONT START_TLS: ckctel.h ckctel.c
346  . Add hooks for SFTP and SET/SHOW SFTP: ckcdeb.h ckuusr.h ckuusr.c ckuus3.c
347  . Add SKERMIT ckuusr.h ckuusr.c
348  . Add ADM-5 terminal emulation: ckuus7.c, ckuus5.c
349  . Uncomment and update HELP SET SSH V2 AUTO-REKEY: ckuus2.c
350  . Enable IF TERMINAL-MACRO and IF STARTED-FROM-DIALER for C-Kermit: ckuus6.c
351  . Fix conflicting NOSCROLL keyword definition: ckuusr.h
352  . Set ttname when I_AM_SSH: ckuusy.c
353  . Add extended arg parsing for SSH, Rlogin, Telnet: ckuusy.c, ckuus4.c
354  . Security updates: ckuath.c, ck_ssl.c
355  . Change K95 version number to 2.2.0: ckcmai.c
356  . Save K95 term i/o state before executing keyboard macro: ckuus4.c
357  . Add tests for SSH Subsystem active during INPUT/OUTPUT/CONNECT: ckuus[45].c
358  . Enable K95 SET SSH V2 AUTO-REKEY: ckuus3.c
359
360 SFTP and SET SFTP subcommands are implemented up to the case statements.
361
362 Files of mine that Jeff hadn't picked up:
363   ckuver.h ckcftp.c ckutio.c ckuusx.c (just minor changes for last build-all)
364
365 On 4 Jan 2003, SET RECEIVE MOVE-TO was changed to convert is argument to an
366 absolute path, which made it impossible to specify a relative path, then
367 move to different directories and have it apply relatively to each directory.
368 Changed this as follows:
369
370  . Parser uses cmtxt() rather than cmdir() so it won't fail at parse time.
371  . If path is absolute, we fail at parse time if directory doesn't exist.
372  . In reof() we run the the path through xxstring (again, in case deferred
373    evaluation of variables is desired) and then, if not null, use it.
374  . If the directory doesn't exist, rename() fails and reof() returns -4,
375    resulting in a protocol error (this is not a change).  We do NOT create
376    the directory on the fly. 
377
378 I also fixed SET SEND/RECEIVE RENAME-TO to parse with cmtxt() rather than
379 cmdir(), since it's parsing a text template, not a directory name, e.g.
380 "set receive rename-to file-\v(time)-v(date)-\v(pid)".  This was totally
381 broken, since when I don't know.  We don't call xxstring() in this parse, so
382 evaluation is always deferred -- I'd better not change this.  ckuus7.c,
383 ckcfns.c, 1 May 2003.
384
385 From Jeff, Sat May  3 14:15:23 2003:
386  . Pick up the right isascii definition for K95: ckctel.c
387  . malloc...  ckuath.c (new safe malloc routines for K95)
388  . Add author listing: ckuus5.c
389  . SSH Heartbeat support (K95 only): ckuus[23].c
390  . Prescan --height and --width to avoid window resizing at startup: ckuusy.c
391  . Add checks for fatal() or doexit() called from sysinit(): ckuusx.c
392  . Move some K95-specific definitions to ckoker.h: ckcdeb.h
393  . Add support for ON_CD macro in zchdir(): ckufio.c
394  . Add a command to let FTP client authenticate with SSLv2: ckcftp.c
395  . Fix parsing of FTP file facts like "UNIX.mode": ckcftp.c
396
397 ON_CD will need some explaining (to be done).  It's implemented for Unix,
398 VMS, WIndows, and OS/2.
399
400 The FTP file facts fix came from first exposure to the new OpenBSD FTP
401 server: ftp://ftp7.usa.openbsd.org/pub/os/OpenBSD/3.3/i386/
402 The period in "UNIX.mode" caused an erroneous word break, adding junk to
403 the filename.
404
405 About the malloc changes, Jeff says "K95 is not behaving well in low memory
406 environments.  I'm not sure that C-Kermit does much better.  The program does
407 not crash but it certainly does not behave the way the user expects it to.
408 I'm beginning to think that any malloc() error should be treated as fatal."
409
410 Not visible in these changes because it's in K95-specific modules: Jeff made
411 SET ATTRIBUTES OFF and SET ATTRIBUTES DATE OFF apply to XYZMODEM transfers.
412
413 From Jeff, 11 May 2003:
414  . Add support for SSH Keepalive to relevant SET command (K95): ckuus3.c
415  . Reduce max overlapped i/o requests from 30 to 7 (K95): ckuus7.c
416  . Don't call sysinit() in fatal(): ckuusx.c.
417  . Some new conditionalizations for SSL module: ck_ssl.c
418
419 The doublequote-parsing fixes from March and April broke the SWITCH statement,
420 which is implemented by internally defining, then executing, a macro.  If I
421 drop back to the old dumb handling of doublequotes, everything is fixed except
422 the problem of March 17th.  But can we really expect getncm() to pre-guess
423 what the parser is going to do?  getncm()'s only job is to find command
424 boundaries, which are represented by commas.  Commas, however, is needed IN
425 commands too.  We take a comma literally if it is quoted with \, or is inside
426 a matched pair of braces, parens, or doublequotes.  It is not unreasonable to
427 require a doublequote in a macro definition to be prefixed by \ when it is to
428 be taken literally.  The proper response to Jason Heskett's complaint of March
429 17th should have been to leave the code alone and recommand an appropriate
430 form of quoting:
431
432   def TEST {
433       .foo = {X\"}
434       sho mac foo
435   }
436
437 And this is what I have done.  Another reason for sticking with the old method
438 is that it's explainable.  The "improved" method, even if it worked, would be
439 be impossible to explain.  Btw, in testing this I noticed that the switch-test
440 script made 8.0.201 dump core.  Today's version is fine.  The problem with
441 quoted strings inside of IF {...} clauses and FOR and WHILE loops is fixed
442 too.  Perhaps "unbroken" would be a better word.  ckuus5.c, 11 May 2003.
443
444 Vace discovered that FTP MGET /EXCEPT:{... (with an unterminated /EXCEPT list)
445 could crash Kermit.  Fixed in ckcftp.c, 11 May 2003.
446
447 CONTINUE should not affect SUCCESS/FAILURE status.  ckuusr.c, 11 May 2003.
448
449 Fixed an oversight that goes back 15 years.  While \{123} is allowed for
450 decimal codes, \x{12} and \o{123} were never handled.  ckucmd.c, 11 May 2003.
451
452 Added support for Red Hat <baudboy.h> and /usr/sbin/lockdev.  Supposedly this
453 allows Kermit to be installed without setuid or setgid bits and still be able
454 to lock and use the serial device.  Compiles and starts, but not tested.
455 ckcdeb.h, makefile, ckutio.c, ckuus5.c, 16 May 2003.
456
457 From Jeff: FTP ASCII send data to host when FTP /SSL was in use was broken.
458 ftp_dpl is set to Clear when FTP /SSL is in use.  This was causing the data to
459 be written to the socket with send() instead of the OpenSSL routines.
460 ckcftp.c, ckuath.c, 21 May 2003.
461
462 From Jeff: Stuff for Kerberos 524: ckcdeb.h.  Fixes for FTP; "FTP ASCII send
463 data did not properly compute the end of line translations.  On Unix (and
464 similar platforms) the end of line was correct for no character sets but
465 incorrect when character sets were specified.  On Windows/OS2, the end of line
466 was correct when character sets were specified and incorrect when they were
467 not.  On MAC, both were broken.  Also, FTP Send Byte counts were incorrect
468 when character sets were specified."  ckcftp.c.  17 Jun 2003.
469
470 From Jeff: fixes to HTTP /AGENT: and /USER: switch action: ckcnet.c ckuus3.c
471 ck_crp.c ckcftp.c ckuus2.c ckuusy.c ckuusr.c ckcnet.h, 21 Jun 2003.
472
473 From Jeff: Fix SET DIALER BACKSPACE so it can override a previous SET KEY
474 (e.g. from INI file): ckuus7.c.  Some SSL/TLS updates: ck_ssl.c.  HTTP support
475 for VMS and other VMS improvements (e.g. a way to not have to hardwire the
476 C-Kermit version number into the build script) from Martin Vorlaender:
477 ckcnet.h, ckuus[r3].c, ckcdeb.h, ckvtio.c, ckcnet.c, ckvker.com.  Built on
478 Solaris (gcc/ansi) and SunOS (cc/k&r).  The new VMS script tests the VMS
479 version and includes HTTP support only for VMS 6.2 or later.  2 Jul 2003.
480
481 Tried to build on our last VMS system but it seems to be dead.  Looks like a
482 head crash (makes really loud noises, boot says DKA0 not recognized) (fooey, I
483 just paid good money to renew the VMS license).  Tried building at another
484 site with:
485
486   Process Software MultiNet V4.3 Rev A-X,
487   Compaq AlphaServer ES40, OpenVMS AXP V7.3
488   Compaq C V6.4-008 on OpenVMS Alpha V7.3
489
490 Had to make a few corrections to ckvker.com.  But still, compilation of
491 ckcnet.c bombs, indicating that the SELECT definition somehow got lost
492 somewhere since the 209 release (i.e. no SELECT type is defined so it falls
493 thru to "SELECT is required for this code").  But I don't see anything in
494 ckcdeb.h or ckcnet.[ch] that would explain this.  Not ckvker.com either
495 (putting the old one back gives the same result).  OK, I give up, maybe it's
496 just that I haven't tried building it on MultiNet recently.  What about UCX?
497 Aha, builds fine there except for warnings about mlook, dodo, and parser in
498 ckvfio.c (because of ON_CD) -- I suppose I have #include <ckucmd.h>... (done)
499 Anyhow it builds OK and the HTTP code is active and almost works (HTTP OPEN
500 works; HTTP GET seems to succeed but creates an empty file every time).  Tried
501 building under MultiNet at another installation; same bad result.
502
503 OK so why won't it build for MultiNet?  Comparing ckcnet.c with the 209
504 version, not a single #ifdef or #include is changed.  Tried building with
505 p3="NOHTTP" -- builds OK, aha.  Where's the problem?  Not ckcnet.h...
506 Not ckcdeb.h...  OK I give up, will revisit this next time I get time to
507 do anything with the code.
508
509 Later Jeff said "Martin did not implement VMS networking for the HTTP code.
510 All he did was activate the #define HTTP which happens to work because his
511 connections are using SSL/TLS connections.  http_inc(), http_tol(), etc have
512 no support for VMS networking regardless of whether it is UCX or MULTINET.
513 The vast majority of HTTP connections are not secured by SSL/TLS.  It makes no
514 sense to support HTTP on VMS until someone is willing to either do the work or
515 pay have the work done to implement VMS networking in that code base."  So the
516 fix is to not enable HTTP for VMS after all.  Removed the CKHTTP definition
517 for VMS from ckcdeb.h, 6 Jul 2003.
518
519 Fixed ckvfio.c to #include <ckuusr.h> (instead of <ckucmd.h>) to pick up 
520 missing prototypes.  6 Jul 2003.
521
522 From Arthur Marsh: solaris2xg+openssl+zlib+srp+pam+shadow and the corresponding
523 Solaris 7 target.  makefile, 6 Jul 2003.
524
525 Remove duplicate #includes for <sys/stat.h>, <errno.h>, and <ctype.h> from
526 ckcftp.c.  6 Jul 2003.
527
528 Add -DUSE_MEMCPY to Motorola SV/68 targets because of shuffled #includes in 
529 ckcftp.c.  8 Jul 2003.
530
531 From Jeff: Fix problems mixing SSL and SRP without Kerberos.  Plus a few minor
532 #define comment changes and a reshuffling of #defines in ckcdeb.h to allow me
533 to build on X86 Windows without Kerberos.  ckcdeb.h, ck_crp.c, ckuath.c,
534 10 Jul 2003.
535
536 From Jeff: updated ckuat2.h and ckuath.c, 29 Jul 2003.
537
538 Mats Peterson noticed that a very small Latin-1 file would be incorrectly
539 identified as UCS-2 by scanfile().  Fixed in ckuusx.c, 29 Jul 2003.
540
541 Fixed ACCESS macro definition to account for the fact that FIND is now a
542 built-in command.  ckermit.ini, 30 Jul 2003.
543
544 From Jeff: Fix for typo in urlparse() (svc/hos): ckuusy.c, 18 Aug 2003.
545
546 From Jeff: Redhat9 makefile targets (needed for for OpenSSL 0.9.7):
547 makefile, 19 Aug 2003.
548
549 GREP /NOLIST and /COUNT did too much magic, with some undesirable fallout:
550 "GREP /NOLIST /COUNT:x args" printed "file:count" for each file.  "GREP
551 /COUNT:x /NOLIST args" did not print "file:count", but neither did it set the
552 count variable.  Removed the magic.  Also one of the GREP switches,
553 /LINENUMBERS, was out of order.  Fixed in ckuus6.c, 20 Aug 2003.
554
555 From Jeff: "Reorganizing code to enable building with different subsets of
556 options; a few typos corrected as well."  ckcdeb.h, ckuver.h (for RH9),
557 ckcnet.c, ckuus7.c, ckuus3.c: 24 Aug 2003.
558
559 Scanfile misidentified a big PDF file as text because the first 800K of it
560 *was* text (most other PDF files were correctly tagged as binary).  Fixed
561 by adding a check for the PDF signature at the beginning of the file.
562 scanfile(): ckuusx.c, 25 Aug 2003.
563
564 Ditto for PostScript files, but conservatively.  Signature at beginning of
565 file must begin with "%!PS-Ado".  If it's just "%!" (or something nonstandard
566 like "%%Creator: Windows PSCRIPT") we do a regular scan.  Also added "*.ps"
567 to all binary filename patterns.  ckuusx.c, 4 Sep 2003.
568
569 Ditto (but within #ifndef NOPCLSCAN) for PCL (<ESC>E) and PJL (<ESC>%) files,
570 but no binpatterns (note: ".PCL" is the extension for TOPS-20 EXEC scripts).
571 ckuusx.c, 4 Sep 2003.
572
573 Added comments about OpenSSL 0.9.7 to all linux+openssl targets.
574 makefile, 4 Sep 2003.
575
576 From Jeff: Added - #define ALLOW_KRB_3DES_ENCRYPT.  When this symbol is defined
577 at compilation Kermit will allow non-DES session keys to be used during Telnet
578 Auth.  These session keys can then be used for Telnet Encrypt.  The reason
579 this is not compiled on by default is that the MIT Kerberos Telnet does not
580 follow the RFC for constructing keys for ENCRYPT DES when the keys are longer
581 than 8 bytes in length.  ckuath.c, ckuus5.c, 4 Sep 2003.
582
583 "ftp mget a b c" succeeded if one or more of the files did not exist, even
584 with "set ftp error-action proceed".  This is because the server's NLST file
585 list does not include any files that don't exist, so the client never even
586 tries to get them.  Fortunately, the way the code is structured, this one was
587 easy to fix.  ckcftp.c, 14 Sep 2003.
588
589 From Jeff: Corrected code in ckcnet.c to ensure that Reverse DNS Lookups are
590 not performed if tcp_rdns is OFF.  Fixed ck_krb5_getrealm() to actually return
591 the realm of the credentials cache and not the default realm specified in the
592 krb5.conf file.  Previously krb5_cc_get_principal() was not being called.
593 Fixed ck_krb5_is_tgt_valid() to test the TGT in the current ccache and not the
594 TGT constructed from the default realm.  ckcnet.c, ckuath.c, 14 Sep 2003.
595
596 Marco Bernardi noticed that IF DIRECTORY could produce a false positive if
597 the argument directory had previously been referenced but then removed.  This
598 is because of the clever isdir() cache that was added to speed up recursion
599 through big directory trees.  Changed IF DIRECTORY to make a second check
600 (definitive but more expensive) if isdir() succeeds, and changed the
601 directory-deleting routine, ckmkdir(), to flush the directory cache (UNIX
602 only -- this also should be done in K95 but it's not critical).  This was
603 done by adding a routine, clrdircache() to ckufio.c, which sets prevstat
604 to -1 and prevpath[0] to NUL.  ckcfn3.c, ckuus6.c, ckufio.c, 18 Sep 2003.
605
606 Marco reported the second fix still didn't work for him (even though it did
607 for me).  Rather than try to figure out why, I concluded that the directory
608 cache is just not safe: a directory found a second ago might have been deleted
609 or renamed not only by Kermit but by some other process.  Why did I add this
610 in the first place?  The log says:
611
612   Some debug logs showed that isdir() is often called twice in a row on the
613   same file.  Rather than try to sort out clients, I added a 1-element cache
614   to Unix isdir().  ckufio.c, 24 Apr 2000.
615
616 Experimentation with DIR and DIR /RECURSIVE does not show this happening at
617 all.  So I #ifdef'd out the directory cache (see #ifdef ISDIRCACHE in ckufio.c;
618 ISDIRCACHE is not defined) and backed off the previous changes: ckufio.c,
619 ckcfn3.c, ckuus6.c, 28 Sep 2003.
620
621 From Jeff: Replace the compile time ALLOW_KRB_3DES_ENCRYPT with a run-time
622 command SET TELNET BUG AUTH-KRB5-DES which defaults to ON: ckctel.[ch],
623 ckuus[234].c, ck_crp.c, ckuath.c.  4 Oct 2003.
624
625 Allow DIAL RETRIES to be any positive number, and catch negative ones.
626 Also added code to check for atoi() errors (e.g. truncation).  At least on
627 some platforms (e.g. Solaris) atoi() is supposed to set errno, but it
628 doesn't.  ckuus3.c, ckucmd.c, 4 Oct 2003.
629
630 Added /DEFAULT: to ASK-class commands (ASK, ASKQ, GETOK):
631
632  . For popups: no way to send defaults to popup_readtext() or popup_readpass().
633  . For GUI ASK[Q], pass default to gui_txt_dialog().
634  . For GUI GETOK, convert "yes" "ok" or "no" default to number for uq_ok().
635  . For Text GETOK, add default to cmkey().
636  . For Text ASK[Q], add default to cmtxt().
637  . For GETC, GETKEY, and READ: no changes.
638
639 GETOK, ASK, and ASKQ with /TIMEOUT: no longer fail when the timer goes off
640 if a /DEFAULT was supplied.  The GUI functions (uq_blah) don't seem to
641 support timeouts.  Only the text version has been tested.  ckuus[26].c,
642 4 Oct 2003.
643
644 From Jeff: add /DEFAULT: for popups.  ckuus6.c. 6 Oct 2003.
645
646 Change SET DIAL INTERVAL to be like SET DIAL RETRIES.  ckuus[34].c, 6 Oct 2003.
647
648 Added target for HP-UX 10/11 + OpenSSL built with gcc, from Chris Cheney.
649 Makefile, 12 Oct 2003.
650
651 From Jeff, 6 Nov 2003:
652  . #ifdef adjustments: ckcftp.c, ckcdeb.h
653  . Fix spurious consumption of first byte(s) on Telnet connection: ckctel.c
654  . Another HP PJL test for scanfile: ckuusx.c.
655  . K95: Recognize DG4xx protected fields in DG2xx emulation: ckuus7.c.
656  . Add SSLeay version display to SHOW AUTH command: ckuus7.c
657  . Improved SET MOUSE CLEAR help text: ckuus2.c.
658  . Improved Kverbs help text: ckuus2.c (+ new IBM-3151 Kverbs).
659  . Some changes to ck_ssl.c, ckuath.c.
660
661 From PeterE, 10 Nov 2003:
662  . Improved HP-UX 10/11 makefile targets for OpenSSL.
663  . #ifdef fix for OpenSSL on HP-UX: ck_ssl.c.
664
665 Another new makefile from PeterE with improved and integrated HP-UX targets.
666 12 Nov 2003.
667
668 A couple fixes to the solaris9g+krb5+krb4+openssl+shadow+pam+zlib target
669 from Jeff.  Added a solaris9g+openssl+shadow+pam+zlib target.  makefile,
670 21 Nov 2003.
671
672 From Jeff, 30 Nov 2003:
673  . Fix SEND /MOVE-TO: ckuusr.c.
674  . Fix K95 SET TITLE to allow quotes/braces around text: ckuus7.c.
675  . Improved "set term autodownload ?" response: ckuus5.c.
676  . Fix SHOW FEATURES to specify the protocol for encryption: ckuus5.c
677  . Make {SEND, RECEIVE} {MOVE-TO, RENAME-TO} work for XYZMODEM (K95 only).
678
679 From Jeff: 7 Jan 2004:
680  . At one point Frank started to add a timer parameter to the
681    uq_txt() function but he only did it for the non-ANSI
682    compilers.  I added it for the ANSI compilers, fixed the
683    prototypes and provided a default value easily changed
684    DEFAULT_UQ_TIMEOUT: ckcker.h, ckuus[36].c, ck_ssl.c, ckcftp.c, ckuath.c.
685  . Fixed SET TERMINAL DEBUG ON (typo in variable name): ckuus7.c.
686  . Fixed BEEP INFORMATION; previously it made no sound, now uses
687    MB_ICONQUESTION.  ckuusx.c.
688
689 From Ian Beckwith <ian@nessie.mcc.ac.uk> (Debianization), 7 Jan 2004:
690  . Search dir/ckermit for docs, as well as dir/kermit in cmdini(): ckuus5.c.
691  . New linux+krb5+krb4+openssl+shadow+pam target (kitchen sink minus SRP,
692    which Debian does not distribute): makefile.
693  ? Mangles the DESTDIR support in makefile to install into a staging area:
694    makefile (I didn't take this one yet).
695
696 Updated copyright notices for 2004, all modules.  7 Jan 2004.
697
698 Added INPUT /NOMATCH, allowing INPUT to be used for a fixed amount of time
699 without attempting to match any text or patterns, so it's no longer
700 necessary to "input 600 STRING_THAT_WILL_NEVER_COME".  If /NOMATCH is
701 included, INPUT succeeds if the timeout expires, with \v(instatus) = 1
702 (meaning "timed out"); fails upon interruption or i/o error.  ckuusr.h,
703 ckuus[r24].c, 7 Jan 2004.
704
705 Added SET INPUT SCALE-FACTOR <float>.  This scales all INPUT timeouts by the
706 given factor, allowing time-sensitive scripts to be adjusted to changing
707 conditions such as congested networks or different-speed modems without
708 having to change each INPUT-class command.  This affects only those timeouts
709 that are given in seconds, not as wall-clock times.  Although the scale
710 factor can have a fractional part, the INPUT timeout is still an integer.
711 Added this to SHOW INPUT, and added a \v(inscale) variable for it.
712 ckuusr.h, ckuus[r257].c, 7 Jan 2004.
713
714 undef \%a, \fverify(abc,\%a) returns 0, which makes it look as if \%a is a
715 string composed of a's, b's, and/or c's, when in fact it contains nothing.
716 Changed \fverify() to return -1 in this case.  ckuus4.c, 12 Jan 2004.
717
718 \fcode(xxx) returned an empty string if its argument string was empty.  This
719 makes it unsafe to use in arithmetic or boolean expressions.  Changed it to
720 return 0 if its argument was missing, null, or empty.  ckuus4.c, 12 Jan 2004.
721
722 Updated \verify() and \fcode() help text.  ckuus2.c, 12 Jan 2004.
723
724 While setting up IKSD, Ian Beckwith noticed that including the --initfile:
725 option caused Kermit to start parsing its own Copyright string as if it were
726 the command line, and eventually crash.  I couldn't reproduce on Solaris /
727 Sparc but I could in Linux / i386 (what Ian is using) -- a change from Jeff
728 on 28 Apr 2003 set the command-line arg pointer to a literal empty string in
729 prescan() about line 1740 of of ckuus4.c; the pointer is incremented next
730 time thru the loop, resulting in random memory being referenced.  Fixed by
731 setting the pointer to NULL instead of "".  ckuus4.c, 12 Jan 2004.
732
733 declare \&a[999999999999999] would dump core on some platforms.  atoi()
734 or whatever would truncate the dimension to maxint.  When we add 1 to the
735 result, we get a negative number, which is used as an index, loop test, etc.
736 Fixed both dodcl() and dclarray() to check for (n+1 < 0).  ckuus[r5].c,
737 12 Jan 2004.
738
739 Unix zchki() would fail on /dev/tty, which is unreasonable.  This prevented
740 FOPEN /READ from reading from the terminal.  zchki() already allowed for
741 /dev/null, so I added /dev/tty to the list of specials.  Ditto for FOPEN
742 /WRITE and zchko().  ckufio.c 13 Jan 2004.
743
744 Added untabify() routine to ckclib.[ch], 13 Jan 2004.
745 Added FREAD /TRIM and /UNTABIFY.  ckuus[27].c, 13 Jan 2004.
746 Added \funtabify().  ckuusr.h, ckuus[24].c, 13 Jan 2004.
747
748 Dat Nguyen noticed that (setq u 'p') followed by (u) dumped core.  This was
749 caused by an over-clever optimization that skipped mallocs for short
750 literals, but then went on later to try to free one that hadn't been
751 malloc'd.  Fixed in dosexp(): ckuus3.c, 14 Jan 2004.
752
753 Catch another copyright date.  ckuus5.c, 14 Jan 2004.
754
755 Fixed SWITCH to work even when SET COMMAND DOUBLEQUOTE OFF (from Mark
756 Sapiro).  ckuus5.c, 15 Jan 2004.
757
758 Changed version to 8.0.211 so scripts can test for recently added features.
759 ckcmai.c, 15 Jan 2004.
760
761 Fixed a glitch in K95 "help set port".  ckuus2.c, 20 Jan 2004.
762
763 Fix from Jeff: Connections to a TLS-aware protocol which require a reconnect
764 upon certificate verification failure could not reconnect if the connection
765 was initiated from the command line or via a URL.  ckctel.c ckcmai.c
766 ckuusr.c ckuus7.c ckuusy.c, 20 Jan 2004.
767
768 From Alex Lewin: makefile target and #ifdef for Mac OS X 10.3 (Panther):
769 makefile, ckcnet.c, 7 Feb 2004.
770
771 Added KFLAGS to sco32v507 targets to make PTY and SSH commands work.  The
772 same flags could probably also be added to earlier OSR5 targets but they
773 have not been tested there.  makefile, 7 Feb 2004.
774
775 Checked a complaint that "LOCAL &a" did not make array \&a[] local.  Indeed
776 it did not, and can not.  You have to use the full syntax in the LOCAL
777 command, "LOCAL \&a[]", or else it doesn't know it's not a macro named &a.
778 7 Feb 2004.
779
780 Fixed some confusion in creating IKSD database file and temp-file names.
781 I was calling zfnqfp() without remembering that the path member of the
782 returned struct included the filename, so to get just the directory name,
783 I needed to strip the filename from the right.  ckuusy.c, 2 Mar 2004.
784
785 New ckuath.c, ck_ssl.c from Jeff.  2 Mar 2004.
786
787 Updated Jeff's affiliation in VERSION command text.  ckuusr.c, 2 Mar 2004.
788
789 Designation changed from Dev.00 to Beta.01.  ckcmai.c, 2 Mar 2004.
790
791 Fixed zrename() syslogging -- it had success and failure reversed.
792 Beta.02: ckufio.c, 4 Mar 2004.
793
794 Problem: when accessing IKSD via a kermit:// or iksd:// URL, and a user ID
795 is given but no password, doxarg() set the password to "" instead of leaving
796 it NULL, but all the tests in dourl() are for NULL.  Fixed in doxarg():
797 ckuusy.c, 5 Mar 2004.
798
799 The logic in dourl() about which macro to construct (login and connect,
800 login and get directory listing, or login and fetch a file) was a bit off,
801 so all three cases were not handled.  ckcmai.c, 5 Mar 2004.
802
803 Trial Beta builds:
804  . HP-UX B.11.11 PA-RISC
805  . HP-UX B.11.23 IA64
806  . Tru64 4.0G Alpha
807  . Tru64 5.1B Alpha
808  . Debian 3.0 i386
809  . Red Hat ES 2.1 i386
810  . Slackware 9.1 i386
811  . VMS 7.3-1 Alpha + UCX 5.3
812  . VMS 7.3-1 Alpha no TCP/IP
813  . VMS 7.3 Alpha MultiNet 4.3 A-X
814  . SCO UnixWare 7.1.4 i386
815  . SCO OSR5.0.7 i386
816  . Solaris 9 Sparc
817
818 Fixed compiler warning in doxarg() caused by typo (NULL instead of NUL) in
819 the 5 March doxarg() edit.  ckuusy.c, 9 Mar 2004.
820
821 IKSD (kermit://) command-line URLs did not work right if the client had
822 already preauthenticated with Kerberos or somesuch because they tried to log
823 in again with REMOTE LOGIN.  The macros constructed in doxarg() needed to
824 check \v(authstate) before attempting REMOTE LOGIN.  ckcmai.c, 10 Mar 2004.
825
826 Added ckuker.nr to x.sh (ckdaily upload) and updated ckuker.nr with current
827 version number and dates.  10 Mar 2004.
828
829 Replaced hardwired references to /usr/local in makefile with $(prefix)
830 (which defaults to /usr/local, but can be overridden on the command line),
831 suggested by Nelson Beebe for use with Configure.  10 Mar 2004.
832
833 From Nelson Beebe: In the Kermit makefile in the install target commands,
834 line 981 reads:
835
836         cp $(BINARY) $(DESTDIR)$(BINDIR)/kermit || exit 1;\
837
838 Could you please add this line before it:
839
840         rm -f $(DESTDIR)$(BINDIR)/kermit;\
841
842 Some sites (mine included) keep multiple versions of software around,
843 with hard links between $(prefix)/progname and $(prefix)/progname-x.y.z.
844 Failure to remove the $(prefix)/progname at "make install" time then
845 replaces the old $(prefix)/progname-x.y.z with the new one, destroying
846 an old version that the site wanted to be preserved.  makefile, 10 Mar 2004.
847
848 Minor syntax and typo fixes (mostly prototypes): ckcdeb.h, ckcfns.c,
849 ckclib.c, ckufio.c, ckuusr.h, ckuusx.c, 10 Mar 2004.  (I still have a few
850 more to do.)
851
852 Added CC=$(CC) CC2=$(CC2) to many (but not all) makefile targets that
853 reference other makefile targets.  On some platforms (notably AIX, Solaris,
854 SunOS) there are specific targets for different compilers, so I skipped
855 those.  makefile, 10 Mar 2004.
856
857 Added error checking to kermit:// URL macros, so they don't plow ahead
858 after the connection is closed.  ckcmai.c, 11 Mar 2004.
859
860 Added FreeBSD 4.9 and 5.1 targets (only the herald is affected).
861 makefile, ckuver.h, 11 Mar 2004.
862
863 Added "LIBS=-lcrypt" to bsd44 targets since nowadays crypt is almost always
864 unbundled from libc.  Also added explanatory notes.  makefile, 11 Mar 2004.
865
866 Changed MANDIR to default to $(manroot)/man/man1, and manroot to default
867 to $(prefix).  More adding of CC=$(CC) clauses: {Free,Net,Open}BSD, 4.4BSD.
868 makefile, 11 Mar 2004.
869
870 Miscellaneous cleanups: ckuusx.c, ckcnet.c, ckufio.c, 11 Mar 2004.
871
872 Corrected the check in the linux target to see if /usr/include/crypt.h
873 exists, and if so to define HAVE_CRYPT_H, which is used in ckcdeb.h to
874 #include <crypt.h> to get the prototype for crypt() and prevent bogus
875 conversions on its return type on 64-bit platforms (the previous test wasn't
876 quite right and the resulting symbol wasn't spelled right).  makefile,
877 12 Mar 2004.
878
879 From Jeff, 14 Mar 2004:
880  . Initialize localuidbuf[] in tn_snenv(): ckctel.c.
881  . Remove remote-mode checks in hupok() for K95G only (why?): ckuus3.c.
882  . Add help text for new K95-only TYPE /GUI switches: ckuus2.c.
883  . TYPE /GUI parsing, ...: ckuusr.c.
884  . TYPE /GUI action, dotype(): ckuus6.c
885  . Change Jeff's affiliation: most modules.
886
887 20 Mar 2004: Looked into adding long file support, i.e. handling files more
888 than 2GB (or 4GB) long.  Discovered very quickly this would be a major
889 project.  Each platform has a different API, or environment, or transition
890 plan, or whatever -- a nightmare to handle in portable code.  At the very
891 least we'll need to convert a lot of Kermit variables from long or unsigned
892 long to some new Kermit type, which in turn is #defined or typedef'd
893 appropriately for each platform (to off_t or size_t or whatever).  Then we
894 have to worry about the details of open() vs fopen(); printf() formats (%lld
895 vs %Ld vs %"PRId64"...), platforms like HP-UX where you might have to use
896 different APIs for different file systems on the same computer, etc.  We'll
897 need to confront this soon, but let's get a good stable 8.0.211 release out
898 first!  Meanwhile, for future reference, here are a few articles:
899
900 General: http://freshmeat.net/articles/view/709/
901 Linux:   http://www.ece.utexas.edu/~luo/linux_lfs.html
902 HP-UX:   http://devrsrc1.external.hp.com/STK/partner/lg_files.pdf
903 Solaris: http://wwws.sun.com/software/whitepapers/wp-largefiles/largefiles.pdf
904
905 Looked into FTP timeouts.  It appears I can just call empty() (which is
906 nothing more than a front end for select()) with the desired timeout before
907 any kind of network read.  If it returns <= 0, we have a timeout.  This is
908 not quite the same as using alarm() / signal() around a recv() (which could
909 get stuck) but alarm() / signal() are not not used in the FTP module and are
910 not naturally portable to Windows, but select() is already in use in the FTP
911 module for both Unix and Windows.  This form of timeout could be used
912 portably for both command response and data reads.  What about writes to the
913 command or data socket?  They can get stuck for hours and hours without
914 returning too, but the select() approach won't help here -- we need the
915 actual send() or recv() to time out, or be wrapped in an alarm()/signal()
916 kind of mechanism.  But if we can do that for sends, we can also do it for
917 receives.  Better check with Jeff before I start programming anything.
918 20 Mar 2004.
919
920 Later: Decided to postpone the above two projects (ditto IPv6) until after
921 8.0.211 is released because both will have major impacts on portability.
922 Grumble: all i/o APIs should have been designed from the beginning with a
923 timeout parameter.  To this day, hardly any have this feature.
924
925 3-4 Apr 2004: More 8.0.211 Beta.02+ test builds:
926
927  . FreeBSD 3.3
928  . FreeBSD 4.4
929  . Linux Debian 2.1
930  . Linux RH 6.1
931  . Linux RH 7.1
932  . Linux RH 7.2
933  . Linux RH 9 (with 84 different combinations of feature selection)
934  . Linux SuSE 6.4
935  . Linux SuSE 7.0
936  . NetBSD 1.4.1
937  . NetBSD 1.5.2
938  . OpenBSD 2.5
939  . OpenBSD 3.0
940  . QNX 4.25
941  . SCO UnixWare 2.1.3
942  . SCO UnixWare 7.1.4
943  . SCO OpenServer 5.0.7
944  . SCO XENIX 2.3.4 (no TCP)
945
946 Changes needed: None.
947
948 Problem: SCO XENIX 2.3.4 network build failed in the FTP module with
949 header-file syntax and conflicting-definitions trouble.  I'm not going to
950 try to fix it; 8.0.209 built OK with FTP, so we'll just keep that one
951 available.
952
953 Got access to VMS 8.1 on IA64.  Building the nonet version of C-Kermit
954 required minor modifications to ckvvms.h, ckv[ft]io.c, and ckvcon.c, to
955 account for a third architecture.  Also to SHOW FEATURES in ckuus5.c.  Once
956 that was done, the UCX 5.5 version built OK too.  Starts OK, makes Telnet
957 connection OK, sends files.  Has some obvious glitches though -- "stat"
958 after a file transfer reports 0 elapsed time (in fact it was 00:09:48) and
959 1219174400 cps (when in fact it was 10364).  This doesn't happen on the
960 Alpha.  Btw, the IA64 binary is twice as big as the Alpha one.  Changed
961 to Beta.03.  5 Apr 2004.
962
963 Fixed the ckdaily script to include the makefile and man page in the Zip
964 file (they were not included because the Zip file was intended mainly for
965 VMS users, but some Unix users prefer Zip to tar.gz).  6 Apr 2004.
966
967 Traced problems in VMS/IA64 statistics report to rftimer()/gftimer() in
968 ckvtio.c, which use sys$ and lib$ calls to figure elapsed time.  These work
969 on VAX and Alpha but not IA64.  Sent a report to the chief engineer of the
970 IA64 VMS port; he says it's probably a bug in VMS 8.1 (which is not a real
971 release); he'll make sure it's fixed in 8.2.  As an experiment, tried
972 swapping in the Unix versions of these routines (which call gettimeofday()
973 etc).  They seem work just fine (it hung a couple times but I think that's
974 because the underlying system hung too; trying it later on a new connection,
975 it was fine; however I noticed a BIG discrepancy in throughput between
976 sending and receiving).  Moved definitions for VMS64BIT and VMSI64 to
977 ckcdeb.h so all modules can use them and added them to the SHOW FEATURES
978 display.  Added VMSV80 definition to build procedure.  Beta.03+.  ckcdeb.h,
979 ckcuus5.c, ckcvvms.h, ckvtio.c, ckvker.com, 6 Apr 2004.
980
981 While doing the build-all, I noticed the VMS version did not build with
982 Multinet or older UCX versions, always with the same errors -- undeclared
983 variables, undefined symbols, all TCP/IP related.  This didn't happen a
984 couple weeks ago...  Somehow the order of #includes was messed up --
985 ckuusr.h depended on symbols that are defined in ckcnet.h, but ckcnet.h
986 was being included after ckuusr.h...  this was compounded by two missing
987 commas in ckvker.com.  11 Apr 2004.
988
989 Removed Beta designation, released as 8.0.211, 10 Apr 2004.
990
991 I had somehow lost the edit to ckutio.c that changed the UUCP lockfile for
992 Mac OS X from /var/spool/uucp to /var/spool/lock.  So I slipped it in and
993 re-uploaded version 8.0.211.  You can tell the difference because SHOW
994 VERSIONS has 17 Apr 2004 for the Communications I/O module.  Also the 10.3
995 executable now has a designer banner: "Mac OS X 10.3".  makefile, ckuver.h,
996 ckutio.c, ckuus[45].c, 17 Apr 2004.
997
998 ---8.0.211---
999
1000 Removed "wermit" from "make clean" (how did it get there?).  makefile.
1001
1002 From Jeff, applied 10 May 2004.
1003  . Rearrange #ifdefs that define OS/2-only features. ckcdeb.h.
1004  . Fix two strncat()s that should have been ckstrncat()s.  ckuus7.c.
1005  . Fix two strncat()s that should have been ckstrncat()s.  ckuus4.c.
1006  . Fix one strncat(). ckcfns.c.
1007  . SET FTP CHAR ON used backwards byte order when output to screen.  ckcfns.c.
1008  . Fix two strncat()s.  ckuus3.c.
1009  . Add SET NETWORK TYPE NAMED-PIPE for K95.  ckuus3.c.
1010  . Add "No active connections" message to hupok().  ckuus3.c.
1011  . Fix many strncat()s.  ckcnet.c.
1012  . Fix some strncat()s.  ckcftp.c
1013  . Make FTP port unsigned short for 16383 < port < 65536.  ckcftp.c.
1014  . Improvements to FTP USER command.  ckcftp.c.
1015  . Fix FEAT parsing to allow for various forms of whitespace.  ckcftp.c.
1016
1017 S-Expression (AND FOO BAR) would not short-circuit if FOO's value was 0,
1018 even though short-circuiting code has been there since Day 1.  Similarly for
1019 (OR BAR FOO).  Turns out the first operand was a special case that bypassed
1020 the short-circuit check.  Fixed in dosexp(): ckuus3.c, 10 May 2004.
1021
1022 Red Hat 7.3 (and maybe others) <baudboy.h> referenced open() without first
1023 ensuring it was declared.  The declaration is in <fcntl.h>, which is after
1024 <baudboy.h> in ckutio.c series of #includes.  Made a special case for this.
1025 ckutio.c (see comments), 10 May 2004.
1026
1027 If the local Kermit's parity is set to SPACE and then a file arrives via
1028 autodownload, automatic parity detection improperly switches it to NONE.
1029 Fixed in rpack() by switching parity automatically only if parchk() returns
1030 > 0 (rather than > -1), since NONE and SPACE are indistinguishable.  A
1031 bigger problem still remains: autodownload does not work at all if the
1032 sender is using actual parity bits (even, odd, or mark) and the receiver's
1033 parity is NONE.  ckcfn2.c, 10 May 2004.
1034
1035 When a DIAL MACRO is defined and the phone number is comprised of more than
1036 one "word" (i.e. contains spaces), the dial macro loses the second and
1037 subsequent words after the first call. Fixed in xdial() by inserting quotes
1038 around phone number before passing it to xdial(). ckuus6.c, 10 May 2004.
1039
1040 DIAL MACRO fix was not right; the quotes were kept as part of the phone
1041 number and sent to the modem.  dodo() pokes its argument to separate the
1042 macro argument string into its component arguments.  xdial() is called
1043 repeatedly on the same string, so after the first time, a NUL has been
1044 deposited after the first word of the telephone number.  The fix is to have
1045 xdial() create a pokeable copy of its argument string before calling
1046 dodo(dial-macro,args...).  It might seem odd that dodo pokes its argument,
1047 but making copies would be would be prohibitive in space and time.
1048 ckuus6.c, 23 May 2004.
1049
1050 FTP CD did not strip braces or quotes from around its argument.  Fixed in
1051 doftprmt(): ckcftp.c, 23 May 2004.
1052
1053 Added client side of REMOTE MESSAGE/RMESSAGE/RMSG: ckuus[r27].c, 23 May 2004.
1054
1055 Server side of REMOTE MESSAGE: ckcpro.w, 23 May 2004.
1056
1057 From Dave Sneddon: an updated CKVKER.COM containing a fix where the
1058 COMPAQ_SSL symbol was not defined but later referenced which generated an
1059 undefined symbol error.  ckvker.com, 5 Jan 2005.
1060
1061 From Andy Tanenbaum (28 May 2005):
1062  . Fix an errant prototype in ckcker.h and ckucmd.h - () instead of (void).
1063  . Add support for MINIX 3.0.  makefile, ckutio.c, ckufio.c, ckuver.h.
1064
1065 Fixed messed-up sndhlp() call which apparently had been jiggered to
1066 compensate for the bad prototype which has now been fixed, ckcpro.w,
1067 12 Jun 2005.
1068
1069 From Jeff (12 June 2005):
1070  . Security updates.  ck_ssl.c, ck_crp.c, ckuath.c.
1071  . Fix bug in K95 SET PRINTER CHARACTER-SET. ckuus3.c.
1072  . Add printer character-set to K95 SHOW PRINTER display. ckuus5,c
1073  . Add SET MSKERMIT FILE-RENAMING to K95. ckuus7.c, ckuusr.h.
1074  . Add help for K95 SET MSKERMIT.  ckuus2.c.
1075  . Add SET GUI CLOSE to K95.  ckuusr.h, ckuus2.c, ckuus3.c
1076  . Add help text for K95 SET GUI MENUBAR and TOOLBAR.  ckuus2.c.
1077  . Add --noclose command-line option for K95.  ckuusy.c
1078  . Add PAM support for Mac OS X.  ckufio.c.
1079  . Add GSSAPI support for Mac OS X.  ckcftp.c.
1080  . Pick up more URL options.  ckcker.h, ckuusy.c.
1081  . Fix bug in delta-time calculation across year boundary.  ckucmd.c.
1082  . Add Secure Endpoints to copyright notices.  ckcmai.c.
1083  . Fix FTP HELP to override unverbose setting.  ckcftp.c.
1084  . Fix assorted minor typos.
1085
1086 From Matthias Kurz: automatic herald generation for NetBSD 2.0 and later,
1087 "make netbsd2".  ckuver.h, makefile, 12 Jun 2005.
1088
1089 Added SET TERMINAL LF-DISPLAY, like CR-DISPLAY but for linefeed rather than
1090 carriage return.  ckuusr.h, ckuus[257x].c, 12 Jun 2005.
1091
1092 Made a command-line option --unbuffered to do what the -DNONOSETBUF
1093 compile-time option does, i.e. force unbuffered console i/o.  Unix only.
1094 ckuusr.h, ckuusy.c, ckutio.c, 12 Jun 2005.
1095
1096 Fixed getiact() (which displays TERM IDLE-ACTION setting) to display
1097 space as \{32}.  ckuus7.c, 12 Jun 2005.
1098
1099 Added LMV as a synonym for LRENAME, which is itself a synonym for LOCAL
1100 RENAME.  ckuusr.c, 12 Jun 2005.
1101
1102 Put HELP SET TERMINAL DG-UNIX-MODE text where it belonged.  ckuus2.c,
1103 12 Jun 2005.
1104
1105 Added IF LINK (Unix only) to test if a filename is a symlink.  Uses the most
1106 simpleminded possible method, calls readlink() to see if it succeeds or fails.
1107 No other method is dependable across different Unixes.  This code should be
1108 portable because I already use readlink() elsewhere within exactly the same
1109 #ifdefs.  ckufio.c, ckuus2.c, ckuus6.c, 12 Jun 2005.
1110
1111 Fixed a bug in which \fdir() wouldn't work when its argument was the nonwild
1112 name of a directory file.  zxpand(): ckufio.c, 12 Jun 2005.
1113
1114 Made \fdirectory() a synonym for \fdirectories().  Made \fdir() an
1115 acceptable abbreviation for these, even though it clashes with \fdirname(),
1116 which still works as before.  ckuus4.c, 12 Jun 2005.
1117
1118 Added the long-needed \flopx() function, to return rightmost pieces of
1119 strings, such as file extensions.  \fstripx() and \flopx() are the
1120 orthogonal functions we need to pick filenames apart from the right:
1121 \stripx(foo.tar.gz) = foo.tar; flopx(foo.tar.gz) = gz.  ckuusr.h, ckuusr.c,
1122 ckuus2.c, 12 Jun 2005.
1123
1124 Removed reference to defunct fax number, ckcmai.c, 12 Jun 2005.
1125
1126 Added -DHAVE_PTMX to linux+krb5+openssl+zlib+shadow+pam.  From Timothy Folks.
1127 makefile, 12 Jun 2005.
1128
1129 Built on Solaris 9 and NetBSD 2.0.
1130
1131 From Jeff: New build target for Mac OS X 10.3 with Kerberos 5 and SSL.
1132 makefile, 14 Jun 2005.
1133
1134 Fixed error in ckuver.h NetBSD #ifdefs.  15 Jun 2005.
1135
1136 Fixed SET TERMINAL IDLE-ACTION OUTPUT to work as documented, namely if the
1137 output string is empty, to send a NUL.  Previously there was no way to make
1138 it send a NUL.  ckuus7.c, 15 Jun 2005.
1139
1140 Suppose (in Unix, for example) a filename contains wildcard characters, such
1141 as {abc}.txt.  When referring to such a file (e.g. in a SEND command), these
1142 characters can be quoted, e.g. \{abc\}.txt.  But if the file list has been
1143 obtained programmatically, e.g. stored in an array, there is no way, short
1144 of tedious, complicated, and error-prone string processing, to reference the
1145 file.  For this we need a way to disable wildcard processing.  I added { ON,
1146 OFF } choices for the SET WILD and SHOW FILE commands: ckuusr.h, ckuus[234].c.
1147 { ON, OFF } turns wildcarding off and on without affecting the { KERMIT,
1148 SHELL } agent choice; it does this by setting a new and separate global
1149 variable, wildena.  Added semantics to ckufio.c.  Crude but effective.  It
1150 might have been more Unixlike to add Yet Another form of quoting but we
1151 have enough of that already (later maybe I'll add a \function() for this).
1152 Needs to be propogated to Windows and VMS.  15 Jun 2005.
1153
1154 Improved and fixed typos in HELP WILDCARD and HELP PATTERN.  ckuus2.c,
1155 15 Jun 2005.
1156
1157 The GREP command, and probably anything else that uses ckmatch() for pattern
1158 matching, failed on patterns like */[0-3]*.html.  The [a-b] handler, when
1159 failing to match at the current position, neglected to back up the pattern
1160 and try again on the remainder of the string.  I also fixed another case, in
1161 which matching a literal string a*b?c against the pattern a[*?]*[?*]c caused
1162 ckmatch() to recurse until it blew up.  ckclib.c, 16 Jun 2005.
1163
1164 Added builds and designer banner for Solaris 10.  makefile, ckuver.h,
1165 27 Jun 2005.
1166
1167 Defined CKHTTP for NetBSD, the HTTP code builds and works fine there.
1168 ckcdeb.h, 2 Jul 2005.
1169
1170 Added #ifndef OSF40..#endif around definition of inet_aton() in ck_ssl()
1171 to allow building in Tru64.  Added tru64-51b+openssl to makefile.
1172 15 Jul 2005.
1173
1174 HTTP GET would fail if the URL contained any metacharacters, no matter how
1175 much you quoted them.  Although it uses cmfld() to parse the (partial) URL,
1176 it then uses cmofi() to get the output filename, which by default is the
1177 "filename" from the URL, which might be something like "rankem.asp?id=1639".
1178 cmofi() refuses to accept unquoted metacharacters in "filenames" and that's
1179 what happens in this case if the output filename is not specified.  Worked
1180 around this by disabling wildcard processing around HTTP GET using the new
1181 "wildena" variable from June 15th.  ckuusr.c, 18 Jul 2005.
1182
1183 Fixed the June 16th fix to the pattern matcher.  I fixed a real problem, but
1184 I made an unrelated optimization that introduced new ones.  ckclib.c,
1185 18 Jul 2005.
1186
1187 Added missing help text for \fb64encode() and \fb64decode().  ckuus2.c,
1188 18 Jul 2005.
1189
1190 Changed SET WILD OFF help text to warn that this setting prevents the
1191 creation of backup files (later I'll have to see if something more useful
1192 can be done about this).  ckuus2.c, 18 Jul 2005.
1193
1194 Built OK on Mac OS X 10.4.2 using macosx103 target (but with some
1195 "signedness" warnings in ckcnet.c and ckcftp.c).  Built on Unixware 7.1.4
1196 with uw7 target.  27-28 Jul 2005. 
1197
1198 Added -DCKHTTP to Mac OS X 10.3-.4 KFLAGS.  Makefile, 4 Aug 2005.
1199
1200 Built on BSDI 4.3.1.  Added -DCKHTTP.  
1201
1202 Compact substring notation extended to accept not only start:length but also
1203 start-end notation.  Thus \s(foo[12:18]) means the substring of foo starting
1204 at position 12 of length 18, and tne new \s(foo[12-18]) means the substring
1205 of foo starting at position 12 and ending with position 18.  Ditto for
1206 \:(\%a), etc.  ckuus4.c, 9 Aug 2005.
1207
1208 See correspondence with Mark Sapiro, Nov 2003 and Sep 2004, about certain
1209 variations on IF syntax having been broken by the introduction of "immediate
1210 macros" circa 1999.  It seems the problem -- variables not being expanded --
1211 always occurs in the ELSE part when (a) the IF condition is false; (b) the
1212 ELSE command is "standalone", i.e. expressed as a separate command after the
1213 IF command (original C-Kermit 5A syntax), and (c) its command list is a block.
1214 This would suggest the problem is in the XXELS parser.
1215
1216 Going back to 1999, I find this:
1217   Fixed a problem Jim Whitby noticed with quoting in ELSE statements.  This
1218   problem was introduced when I unified IF and XIF, and occurs only when
1219   ELSE begins on a line, followed by a { command list } rather than a single
1220   command.  The solution (gross) was to make a special version of pushcmd()
1221   (called pushqcmd()) for this situation, which doubles backslashes while
1222   copying, BUT ONLY IF it's a command list (i.e. starts with "{"); otherwise
1223   we break lots of other stuff.  Result passes Jim's test and still passes
1224   ckedemo.ksc and iftest.ksc.  ckucmd.c, ckuus6.c, 27 Sep 99.
1225
1226 I undid this change and it made no difference to all the other IF
1227 constructions (in fact, it fixed an urelated one that was broken, so now
1228 iftest scores 54 out of 54, instead of 53).  However, it does not fix the
1229 ELSE problem; in fact it pushes it all the way in the other direction:
1230
1231   The opposite occurs any time you try to execute an immediate macro inside a
1232   macro or any other { block }: not only is the variable evaluated, it is
1233   evaluated into nothing.  It looks like this happens only in immediate
1234   macros, i.e. *commands* that start with '{'.  So maybe we really have two
1235   isolated problems, that can each be fixed.
1236
1237 The situation is illustrated by this simple script:
1238
1239   def xx {
1240       if false { echo \%1, echo \%2 }
1241       else { echo \%3, echo \%4 }
1242   }
1243   xx one two three four
1244
1245 With pushqcmd() it echoes the variable names literally; with pushcmd() it 
1246 echoes empty lines.  Since ELSE, when its argument is a block, dispatches
1247 to the immediate-macro handler, it seems we have unified the two problems,
1248 so fixing one should fix the other.
1249
1250 The problem is that we define a new temporary macro and then call dodo() to
1251 execute it.  But if the definition contains macro arguments, we have added a
1252 new level of macro invocation, thus wiping out the current level of args.
1253 The cure is to expand the variables in the immediate macro in the current
1254 context, before executing it.  This means simply changing the cmtxt() call
1255 that reads the immediate macro to specify xxsting as its processing
1256 function, rather than NULL, which is used for real macros to defer their
1257 argument evaluation until after the macro entered.  ckuusr.c, 11 Aug 2005.
1258
1259 Added a new makefile target, macosx10.4, for Mac OS X 10.4.  This one uses
1260 an undocumented trick to get the otherwise unavailable-except-by-clicking
1261 Mac OS X version number (in this case 10.4.2) and stuff it into the HERALD
1262 string.  makefile, 11 Aug 2005.
1263
1264 Built OK on Solaris 9, Solaris 10 (with a few implicit declaration warnings
1265 in ckuusx.c), Mac OS X 10.4.2 (with some warnings in ckcnet.c and ckcftp.c),
1266 Mac OS X 10.3.9 (also using the macos10.4 entry, which gets the right
1267 version number, and gets no warnings at all), RH Enterprise Linux AS4 on AMD
1268 x86_64, Tru64 Unix 4.0F, SCO UnixWare 7.1.4
1269
1270 For docs and/or scriptlib:  Unix C-Kermit can be a stdin/out filter.  The
1271 trick is to use the ASK, ASKQ, or GETC command for input, specifying no
1272 prompt, and ECHO or XECHO for output, e.g.:
1273
1274 while true {
1275     ask line
1276     if fail exit 0
1277     echo \freverse(\m(line))
1278 }
1279 exit 0
1280
1281 FOPEN didn't do anything with the channel number if the open failed, so any
1282 subsequent command that tried to reference it would get a parse error it was
1283 undefined or non-numeric, not very helpful.  Changed FOPEN to set the
1284 channel number to -1 if the file can't be opened.  Now subsequent operations
1285 on the channel fail with "Channel -1: File not open".  I also added two
1286 magic channel numbers: -8 means that any FILE command (besides OPEN and
1287 STATUS) on that channel is a noop that succeeds silently; -9 is a noop that
1288 fails silently.  So now it's possible to simply set a channel number to one
1289 of these values to disable i/o to certain file without getting lots of error
1290 messages.  dofile(): ckuus7.c, 12 Aug 2005.
1291
1292 Added automatic herald construction for UnixWare 7.  makefile, 12 Aug 2005.
1293
1294 Unix isdir() never allowed for arguments that started with tilde, so gave
1295 incorrect results for ~/tmp/ or ~fdc.  The problem was mainly invisible
1296 since most commands that parsed file or directory names used cmifi(), cmdir(),
1297 etc, which did the conversions themselves.  But IF DIRECTORY was an exception,
1298 since its operand had to be treated as just text, and then tested after it
1299 was parsed.  ckufio.c, 13 Aug 2005.
1300
1301 Fixed the following:
1302 "ckuusx.c", line 8959: warning: implicit function declaration: ckgetpeer
1303 "ckufio.c", line 1869: warning: implicit function declaration: ttwait
1304 "ckufio.c", line 2941: warning: implicit function declaration: mlook
1305 "ckufio.c", line 2943: warning: implicit function declaration: dodo
1306 "ckufio.c", line 2944: warning: implicit function declaration: parser
1307 "ckcftp.c", line 2625: warning: implicit function declaration: delta2sec
1308 "ckcftp.c", line 4071: warning: no explicit type given for parameter: prm
1309 "ckcftp.c", line 8389: warning: no explicit type given for parameter: brief
1310 ckuusx.c, ckufio.c, ckcftp.c, ckucmd.h.  13 Aug 2005.
1311
1312 Unbuffered stdout code has never worked because the setbuf(stdout,NULL) call
1313 has to occur before the stdout has been used.  The reason it's needed is
1314 that some Kermit code writes to stderr (which is unbuffered) and other code
1315 writes to stdout, and therefore typescripts can come out jumbled.  Robert
1316 Simmons <robertls@nortel.com> provided the needed clue when he insisted it
1317 worked only when executed at the very beginning of main().  So I moved the
1318 code to that spot.  But since now we also want to make unbuffered a runtime
1319 (command-line) option, I had to do a clunky by-hand pre-prescan inline in
1320 main() to look thru argv[], even before prescan() was called.  ckcmai.c,
1321 ckutio.c, ckuusy.c, 13 Aug 2005.  (Now that this works, it might be a good
1322 idea to remove all use of stderr from Kermit.)
1323
1324 Managed, after some finagling, to build a 64-bit version on Solaris 10 at
1325 Utah Math with Sun cc.  (Can't make any gcc builds at all, 32- or 64-bit,
1326 they all blow up in <sys/siginfo.h>.)  New target: solaris10_64.  makefile,
1327 15 Aug 2005.
1328
1329 The 64-bit Solaris 10 version compiles and links OK and transfers files in
1330 remote mode.  It can make FTP connections and use them, but Telnet connections
1331 always fail with "network unreachable".  This is with all default libs and
1332 include files.  Nelson has a separate set in /usr/local, which he references
1333 explicitly in all his 64-bit builds, but using these makes no difference.
1334 Some data type is wrong in ckcnet.c.  But telnet works fine in 64-bit Linux
1335 and Tru64 builds.  Debug logs trace the difference to netopen() (of course),
1336 the spot where we test the results of inet_addr(), which is already marked
1337 suspicious for 64-bit builds.  It seems that inet_addr() is of type in_addr_t,
1338 which in turn is u_int32, i.e. an unsigned 32-bit int.  Yet the man page says
1339 that failure is indicated by returning -1.  I guess this doesn't matter in
1340 32-bit builds, but in the 64-bit world, the test for failure didn't work
1341 right.  I made a Solaris-specific workaround, and checked that it works in
1342 both 32-bit and 64-builds.  I really hate typedefs.  ckcnet.c, 15 Aug 2005.
1343
1344 Changed the plain-text version (as opposed to the popup or GUI version - the
1345 GUI version, at least, already does this) of ASKQ to echo keystrokes
1346 asterisks rather than simply not echo anything, so it's easier to see what
1347 you're doing, the effects of editing, etc.  Experimental; for now, there's
1348 no way to disable this.  Not sure if there needs to be.  Anyway, to get this
1349 working required a fair amount of cleaning up of gtword(), which was echoing
1350 different ways in different places.  ckuus6.c, ckucmd.c, 15 Aug 2005.
1351
1352 Added a solaris9_64 target for building a 64-bit version on Solaris 9 with
1353 Sun cc.  Verified, using the DIR command and \fsize() function on a 4.4GB
1354 file, that the Solaris 64-bit version of Kermit gets the size correctly, and
1355 that it can copy such a file (thus its fopen/fread/fwrite/fclose interface
1356 works right).  Initiated a large-file transfer between here and Utah over
1357 SSH and verified that it puts the correct file size in the A packet when
1358 sending; the right quantites are shown on the file transfer display (file
1359 size CPS, percent done, etc).  But even at 5Mb/sec, it takes a good while to
1360 transfer 4.4GB, more than 2 hours (not streaming; 30 window slots, 4K
1361 packets, maybe it would go faster with streaming)...  After an hour or so,
1362 it filled up the partition and gave up (gracefully) before it reached the
1363 2GB frontier (drained its pending packets, closed the partial file).
1364 Restarted at 12:54, this time with streaming and 8K packets (the speed
1365 wasn't significantly different).  This time it transferred 95% of the file
1366 (4187660288 bytes) before failing because the disk filled up.  Went to Utah
1367 and started a transfer between two Solaris 10/Sparc hosts; this goes about 8
1368 times faster.  The transfer completed successfully after 17m41s.  All fields
1369 in the f.t. display looked right the whole time.  Then I verified various
1370 other 64-bit combinations transferring the same 4.4GB file:
1371
1372         To................
1373   From  Sol  Amd  i64  Tru      
1374   Sol   OK   OK   OK   OK      Sol = Solaris 10 / Sparc
1375   Amd   OK                     Amd = AMD x86_64 RH Enterprise Linux AS4
1376   i64   OK                     i64 = Intel IA64, RH 2.1AS
1377   Tru                          Tru = Tru64 Unix 4.0F Alpha
1378
1379 (The other combinations are difficult to test for logistical reasons.)
1380
1381 Tried sending the same long file with Kermit's FTP client.  It chugged along
1382 for a while until I stopped it; it would have taken hours to complete.
1383 There is no indication that it wouldn't have worked, assuming the FTP server
1384 could also handle long files, which who knows.  Anyway, Kermit showed all
1385 the right data on the display screen.  17 Aug 2005.
1386
1387 On AMD x86_64 and IA64 native 64-bit Linux builds, the pty routines did not
1388 work at all.  ptsname() dumped core.  If I commented out ptsname(), then the
1389 next thing dumped core.  The same code works on the other 64-bit builds.
1390 Poking around, I see that this version of Linux has an openpty() function,
1391 which I could try using instead of the current API -- grantpty(), etc.  Then
1392 I see that openpty() is already coded into Kermit's pty module,
1393 conditionalized under HAVE_OPENPTY, which has never before been defined for
1394 any build.  I added a test to the makefile linux target (look for the
1395 openpty() prototype in <pty.h>, if found define HAVE_OPENPTY as a CFLAG and
1396 also add -lutil to LNKFLAGS).  Works fine on the problem builds, and also
1397 on previously working 32-bit builds.  makefile, 17 Aug 2005.
1398
1399 Fixed a bug in the ASKQ echo asterisks code, which made the VMS version of
1400 C-Kermit always echo asterisks.  Turns out that some code in the main parse
1401 loop to reset command-specific flags was in the wrong place, which had other
1402 effects too, for example ASKQ temporarily turns off debug logging as a
1403 security measure, but the code to turn it back on was skipped in most cases.
1404 Some other side effects related to the DIRECTORY and CD commands might have
1405 been possible but I haven't seen them.  ckuus[56].c, 23 Aug 2005.
1406
1407 Problem reported when sending a file to VMS when the name in the F packet
1408 starts with a device specification and does not include a directory field,
1409 and PATHNAMES are RELATIVE.  Example: dsk:foo.bar becomes f_oo.bar.  The
1410 code assumes that if there is a device field, it is followed by a directory
1411 field, and it inserts a dot after the '[', which in this case is not there.
1412 Later the dot becomes '_' because of the only-one-dot rule.  Solution: only
1413 insert the dot if there really is an opening bracket.  nzrtol(): ckvfio.c,
1414 23 Aug 2005.
1415
1416 A report on the newsgroup complains that C-Kermit and K95 servers were
1417 sending REMOTE DIR listings with only #J line terminators, rather than #M#J.
1418 Yet all the other REMOTE xxx responses arrived with #M#J.  snddir() was
1419 neglecting to switch to text mode.  ckcfns.c, 26 Aug 2005.
1420
1421 Back to long files.  What happens if 32-bit Kermit is sent a long file?
1422 It gets an A-packet that looks like this:
1423
1424   ^A_"A."U1""B8#120050815 18:28:03!'42920641*4395073536,#775-!7@ )CP
1425
1426 The 32-bit receiver reacts like so:
1427
1428   gattr length[4395073536]=100106240
1429
1430 the first number being the string from the A-packet, the second being the
1431 value of the long int it was converted to by atol().  Clearly not equal in
1432 this case.  When this happens Kermit should reject the file instead of
1433 accepting it and then getting a horrible error a long time later.  Added
1434 code to gattr() to convert the result of atol() back to a string and compare
1435 it with the original string; if they're not equal, reject the file on the
1436 assumption that the only reason this could happen is overflow.  Also some
1437 other code in case the sender sends the only LENGTHK attribute.  Now files
1438 whose lengths are too big for a long int are rejected right away, provided
1439 the sender sends the length in an A packet ahead of the file itself.  If
1440 this new code should ever cause a problem, it can be bypassed with SET
1441 ATTRIBUTE LENGTH OFF.  ckcfn3.c, 26 Aug 2005.
1442
1443 As I recall from when I was testing this a few weeks ago, when the too-big
1444 length is not caught at A-packet time, the transfer fails more or less
1445 gracefully when the first attempt is made to write past the limit.  I went
1446 to doublecheck this by sending a big file from the 64-bit Solaris10 version
1447 to a 32-bit Mac OS X version that does not have today's code.  The Mac
1448 thinks the incoming file is 2GB long when it's really 4GB+.  But in this
1449 case, something new happens!  Although the percent done and transfer rate go
1450 negative, the file keeps coming.  It would seem that Mac OS X lets us create
1451 long files without using any special APIs.  The transfer runs to completion.
1452 Mac OS X Kermit says SUCCESS (but gets the byte count and cps wrong, of
1453 course).  But then a STATUS command says FAILURE.  The file was, however,
1454 transferred successfully; it is exactly the same length and compares byte
1455 for byte with the original.  This tells me that in the Mac OS X version --
1456 and how many others like it??? -- today's rejection code should not be
1457 enabled.  Meanwhile I put today's new code in #ifndef NOCHECKOVERFLOW..#endif,
1458 and defined this symbol in the Mac OS X 10.4 target.  Over time, I'll have
1459 to find out what other platforms have this characteristic.  And of course
1460 I'll also have to do something about file-transfer display, statistics, and
1461 status.  makefile, ckcfn3.c, 26 Aug 2005.
1462
1463 From now on I'm going to bump the Dev.xx number each time I upload a new
1464 ckdaily.  This one will be Dev.02.  ckckmai.c, 26 Aug 2005.
1465
1466 Got rid of all the extraneous FreeBSD 4 and 5 build targets.  Now there's
1467 one (freebsd) for all FreeBSD 4.1 and later.  makefile, 27 Aug 2005.
1468
1469 Mac OS X 10.4 (Tiger) is a 64-bit OS.  Building C-Kermit 0n 10.4.2 without
1470 any special switches stilll gives a 32-bit executable.  Ditto building with
1471 -mpowerpc64.  Further investigation turned up a tip sheet on MySQL that says
1472 you have to include all of these: -mpowerpc64 -mcpu=G5 -mtune=G5 -arch
1473 ppc64.  That did the trick.  New makefile target: macosx10.4_64.  But the
1474 10.4.2 system I tried did not have 64-bit [n]curses or resolv libs, so this
1475 build has no -DNOCURSES -DNO_DNS_SRV.  makefile, 27 Aug 2005.
1476
1477 Created a symbol CK_64BIT to indicate true 64-bit builds at compile time.
1478 Added 64-bit announcement to the startup herald and the VERSION text.
1479 ckcdeb.h, ckuus[r5].c, 27 Aug 2005.
1480
1481 Added a built-in variable \v(bits) to indicate the size of the build
1482 (16, 32, 64, or whatever else sizeof() might report).  ckuusr.h, ckuus4.c,
1483 27 Aug 2005.
1484
1485 Got rid of all the warnings in 64-bit Mac OS X about args to getsockopt(),
1486 getsockname(), and getpeername(), and the comparisons on the return value
1487 of inet_addr().  ckcnet.[ch], 27 Aug 2005.
1488
1489 Now to check the effects on other builds...
1490   Linux on AMD64: ok.
1491   Linux on IA64: ok.
1492   Linux on i386: ok.
1493   Mac OS X 10.3.9 32-bit: ok.
1494   Solaris 10 64-bit: ok.
1495   Solaris 9 32-bit: ok.
1496   Tru64 4.0F: ok.
1497   FreeBSD 4.11: ok.
1498   FreeBSD 5.4 ia64 (64-bit): ok.
1499   FreeBSD 5.4 i386 (32-bit): ok.
1500
1501 The Tru64 5.1B build totally blew up because they have their own unique
1502 sockopt/etc length-argument data type (int!), so I had to roll back on using
1503 socklen_t for this in all 64-bit builds.  Checked to make sure it still
1504 builds on Tru64 4.0F after this change (it does).  ckcnet.h, 27 Aug 2005.
1505
1506 The HP-UX 11i/ia64 build comes out to be 32-bit but thinks it's 64-bit.
1507 CK_64BIT is set because __ia64 is defined.  So how do I actually make a
1508 64-bit HP-UX build?  I tried adding +DD64 to CFLAGS, and this generates
1509 64-bit object files but linking fails to find the needed 64-bit libs
1510 (e.g. -lm).  For now I added an exception for HPUX to the CK_64BIT
1511 definition section.  ckcdeb.h, 27 Aug 2005.
1512
1513 Took the time to verify my recollection about the "graceful failure" on a
1514 regular Pentium Linux system when receiving a too-big file...  OK, it's not
1515 exactly graceful.  It gets a "File size limit exceeded" error; the message
1516 is printed in the middle of the file-transfer display, apparently not by
1517 Kermit, and Kermit exits immediately.  Looks like a trap...  Yup.  "File
1518 size limit exceeded" is SIGXFSZ (25).  What happens if we set it to SIG_IGN?
1519 Just the right thing: The receiver gets "Error writing data" at 2147483647
1520 bytes, sends E-packet to sender with this message, and recovers with total
1521 grace (drains packet buffers, returns to prompt).  ckutio.c, 27 Aug 2005.
1522
1523 Backed off from rejecting a file because its announced size overflows a
1524 long.  Now instead, I set the file size to -2 (a negative size means the
1525 size is unknown, but we have always used -1 for this; -2 means "unknown and
1526 probably too big").  In this case, the f-t display says:
1527
1528   File Size: POSSIBLY EXCEEDS LOCAL FILE SIZE LIMIT
1529
1530 then the user can interrupt it with X or whatever, or can let it run and
1531 see if maybe (as in the case of Mac OS X) it will be accepted anyway.  This
1532 way, we skip all the bogus calculations of percent done, time remaining, etc.
1533 ckcfn3.c, ckuusx.c, 27 Aug 2005.
1534
1535 Discovered that VMS C-Kermit on Alpha and IA64 is a 32-bit application;
1536 sizeof(long) == sizeof(char *) == 4.  Tried adding /POINTER_SIZE=64 to VMS
1537 DECC builds on Alpha and IA64, but the results aren't great.  Tons of
1538 warnings about pointer size mismatches between Kermit pointers and RMS ones,
1539 and the executable doesn't run.  It appears that access to long files
1540 would require a lot of hacking, similar to what's needed for 32-bit Linux.
1541
1542 --- Dev.02: 27 Aug 2005 ---
1543
1544 From Jeff, 28 Aug 2005.
1545  . Fix SSH GLOBAL-KNOWN-HOSTS-FILE / USER-KNOWN-HOSTS-FILE parsing, ckuus3.c.
1546  . Pick up K95STARTFLAGS from environment, ckuus4.c.
1547  . Fix some typos in command-line processing (-q), ckuus4.c.
1548  . Be sure to suppress herald if started with -q, ckuus7.c.
1549  . Fix ssh command-line switches, ckuusy.c.
1550
1551 Eric Smutz complained that HTTP POST was adding an extraneous blank line,
1552 which prevented his application from successfully posting.  RFC 2616 states
1553 (in Section 4.1):
1554
1555    In the interest of robustness, servers SHOULD ignore any empty
1556    line(s) received where a Request-Line is expected. In other words, if
1557    the server is reading the protocol stream at the beginning of a
1558    message and receives a CRLF first, it should ignore the CRLF.
1559
1560    Certain buggy HTTP/1.0 client implementations generate extra CRLF's
1561    after a POST request. To restate what is explicitly forbidden by the
1562    BNF, an HTTP/1.1 client MUST NOT preface or follow a request with an
1563    extra CRLF.
1564
1565 This seems pretty clear.  One section of code in http_post() (just above the
1566 postopen: label) was appending a CRLF to a buffer whose last already was
1567 terminated by CRLF, and then appended a second CRLF; thus two empty lines.
1568 I removed the second one.  ckcnet.c, 28 Aug 2005.
1569
1570 I looked into the 64-bitness of NetBSD, it seems to be like Linux and
1571 FreeBSD on 64-bit hardware, i.e. you just build it there and it works, at
1572 least on Alpha and AMD64, going back to NetBSD 1.4 or 1.5.  But I don't have
1573 access to any of these for verification and documentation on the Web is
1574 scanty.
1575
1576 Checked PeterE's complaint again of warnings in ckutio.c about parameter
1577 list of get[ug]id() and gete[ug]id().  When I "make hpux1100o" on HP-UX
1578 11.11 (PA-RISC), there are definitely no warnings.  He says the same thing
1579 happens on 10.xx, but I don't have access to that any more.  I also did
1580 "make hpux1100o" on HP-UX 11.23 (11i v2) (PA-RISC), also no warnings.
1581 (Except in both cases, a warning about a comment within a comment in
1582 /usr/include/sys/ptyio.h).  On HP-UX 11i v2 on Itanium, however, there are
1583 TONS of warnings, mostly of the "variable set but never used" kind.  Also
1584 "dollar sign used in identifier".  Tracking this last one down, I see it's
1585 complaining about code that's in #ifdefs for other platforms, such as
1586 Apollo Aegis.  Is "aegis" defined in HP-UX 11i v2/IA64?  No!  (It would show
1587 up in SHOW FEATURES if it was.)  Some phase of the compiler is complaining
1588 about code that it should be skipping (and that, in fact, it *is* skipping
1589 it because the build is successful).  It's as if cc is running lint for me
1590 but not telling lint which macros are defined and which are not.
1591
1592 Verified that 64-bit linking fails in the same way for HP-UX 11i v2 on both
1593 IA64 and PA-RISC.  Sent a query to HP.
1594
1595 Compiling ckcnet.c and ckcftp.c got the familiar sockopt-related warnings on
1596 HP-UX 11i v2; turns out it is just like Tru64 Unix in using an int for the
1597 length argument.  Added another special case and the warnings went away.
1598 ckcnet.h, 28 Aug 2005.
1599
1600 Added some stuff to SHOW FEATURES to see what kinds of macros are exposed
1601 (e.g. INT_MAX, LONG_MAX, LLONG_MAX, etc) and also show sizeof(long long) and
1602 sizeof(off_t).  Building this code all over the place will give me an idea
1603 of how widespread these data types are, and to what extent I can tell
1604 whether they are available from clues in the header files.  (At first
1605 glance, it appears that I'm not picking up <limits.h>, but adding an
1606 #include for it is just asking for trouble.)  No complaints about long long
1607 or off_t from Solaris 9 or recent Linuxes.  ckuus5.c, 28 Aug 2005.
1608
1609 Fixed a warning in HP-UX 10 and 11 stemming from some old-style prototypes
1610 in ckutio.c for get[re][gu]id().  ckutio.c, 29 Aug 2005.
1611
1612 Updated minix3 target from Andy Tanenbaum.  makefile, 29 Aug 2005.
1613
1614 PeterE confirms that "long long" and off_t are available in all HP-UX 10 and
1615 11, and in HP-UX 9 on PA-RISC but not Motorola.  30 Aug 2005.
1616
1617 Got 64-bit builds to work on HP-UX.  According to my notes, John Bigg of HP
1618 said (in 1999) that HP-UX 10.30 and later require PA-RISC 1.1, and do not
1619 work on PA-RISC 1.0.  But is PA 1.0 64-bit or what?  Today, Alex McKale of
1620 HP said "The 64-bit binaries will work on all machines that have the same or
1621 later release of HP-UX (excluding PA-RISC 1.1 machines)".  Still need
1622 clarification...  Maybe it's that all IA64 builds can be 64-bit but I need
1623 dual builds for PA-RISC.  Meanwhile I started transfer of a 4GB+ file from
1624 Solaris to HP-UX 11i but it exceeded some quota on the HP long before it
1625 approached the 2G point.  It failed cleanly and up until then it was working
1626 fine (numbers, stats, etc).  30 Aug 2005.
1627
1628 Support of large files in 32-bit builds began in 10.20.  64-bit application
1629 support began in 11.00, but not all machines that run 11.00 support 64 bits.
1630 About long files, see HP /usr/share/doc/lg_files.txt.
1631
1632 PeterE found that certain patterns can still make Kermit loop; example:
1633
1634   if match T01011-00856-21-632-073 *[abc] { echo GOOD } else { echo BAD }
1635   if match T01011-00856-21-632-073 *[a-z] { echo GOOD } else { echo BAD }
1636
1637 The minimum offending pattern is * followed immediately by an [xxx]
1638 construction, followed by anything else, including nothing.  Previous
1639 versions of Kermit handled this one correctly, without looping (but failed
1640 certain matches that should have succeeded).  The new section of code I
1641 added on 15 June, upon failure to match, advances the string pointer and
1642 backs up the pattern to the previous pattern, and starts again
1643 (recursively).  However, there needed to be a corresponding check at entry
1644 for an empty target string.  ckmatch(): ckclib.c, 12 Sep 2005.
1645
1646 PeterE discovered that "kermit -y filethatdoesnotexit" gives an erroneous
1647 error message that names the user's customization, rather than the name
1648 given on the command line.  doinit(): ckuus5.c, 12 Sep 2005.
1649
1650 FREAD does not get an error if it tries to read a record or file or piece of
1651 file that is too big for its buffer.  In particular, FREAD /SIZE:xxx seems
1652 to succeed even if less than xxx was read.  It should fail unless, perhaps,
1653 it successfully read up to the end of the file.  Furthermore, if xxx is
1654 bigger than the file buffer size, it should complain.  The buffer is
1655 line[LINBUFSIZ], 32K.  The lack of failure was due to code in dofile() that
1656 adjusted the given size silently if it was greater than the buffer size,
1657 which I removed, and also added a check when parsing the /SIZE: switch.
1658 dofile(): ckuus7.c, 12 Sep 2005.
1659
1660 That still didn't help with FREAD /SIZE:n returning less than n bytes, even
1661 when they were available.  That's because the underlying routine, z_in(),
1662 didn't check fread()'s return code, which is the number of bytes read.
1663 If fread() has smaller buffers, it needs to be called in a loop.  z_in():
1664 ckuus7.c, 12 Sep 2005.
1665
1666 Flen() fails on strings of length 8192 or more.  The limitation is in the
1667 callers of zzstring, which seem to be specifying an 8K buffer, in this case
1668 fneval().  The operable symbols are FNVALL (max length of value returned by
1669 a function) and MAXARGLEN (maximum length of an argument to a function).  I
1670 changed both of these for BIGBUFOK builds to be CMDBL.  Buffers can never be
1671 infinite, there has to be a limit.  It's important to make everything work
1672 consistently within that limit, and to make something useful happen when the
1673 limit is exceeded.  At this point, I can probably also increase the limits
1674 for modern 32-bit systems, and certainly for 64-bit ones.  Also there's no
1675 point in worrying about 16-bit platforms any more; earlier C-Kermit versions
1676 can still be used on them if necessary. ckuusr.h, 12 Sep 2005.
1677
1678 Special #ifdefs for finding resolv.h and nameser.h in MINIX3 from Andy
1679 Tanenbaum.  ckcnet.c, 20 Sep 2005.
1680
1681 PeterE noticed that ckmatch(), even though it works pretty well now, does a
1682 lot of extra and unnecessary recursion after determining the string and
1683 pattern do not match, at least when the pattern is of the form *[abc].
1684 After several false starts I was able reduce this effect to a minor level
1685 (but not eliminate it all together) by changing a while loop into a do loop.
1686 ckmatch(): ckclib.c, 15 Oct 2005.
1687
1688 Added -DNOLONGLONG to HP-UX 8.00 and earlier builds, and to Motorola-based
1689 HP-UX 9.00 builds.  This is simply to inhibit the test for whether "long
1690 long" is supported by the compiler, since when it isn't, the module
1691 containing the test won't compile.  makefile, ckuus5.c, 16 Oct 2005.
1692
1693 Making ASKQ always echo askterisks is a bad idea, because when it doesn't
1694 echo, it's the perfect way to read silently from stdin, e.g. in a CGI script
1695 (INPUT can also be used for this but it's not as straightforward).  So I put
1696 the default for ASKQ back to no echoing, then gave ASKQ its own switch
1697 table, which is the same as for ASK with the addition of an /ECHO:x switch,
1698 which tells what character to echo.  ckucmd.c, ckuus[26].c, 17 Oct 2005.
1699
1700 Fixed a bug in FTP GET /COMMAND filename commandname; it always dumped core
1701 dereferencing a null string (the nonexistent local asname).  ckcftp.c,
1702 17 Oct 2005.
1703
1704 For docs: if you don't like the funny business that happens when you type
1705 an IF command at the prompt, use XIF instead and it won't happen.  Also note
1706 that commands like "if xxx { echo blah } else { echo blah blah }" don't
1707 work when typed at the prompt; you have to use XIF for this. 
1708
1709 Back to ckmatch()...  Under certain conditions (e.g. patterns like *[abc])
1710 failure to match would not stop the recursion because the string and pattern
1711 arguments are on the stack, as they must be, so there was no way for level
1712 n-1 to know that level n had detected a definitive nonmatch and that no
1713 further attempts at matching were required.  The right way to handle this is
1714 to recode the whole thing as coroutines, the cheap way out is with a global
1715 static flag.  Works perfectly, in the sense that the match.ksc test results
1716 are identical to what they were before and the extra backing up and
1717 recursion are eliminated.  (The Oct 15th fix wasn't really a fix, it broke
1718 a couple of cases.)  ckclib.c, 20 Oct 2005.
1719
1720 ckuus7.c(2987): warning #267: the format string requires additional arguments
1721 (in PURGE command); fixed 20 Oct 2005.
1722
1723 From Andy Tanenbaum, final changes for MINIX3: #ifdef out the inline
1724 definitions for gettimeofday() and readlink().  ckutio.c, 23 Oct 2005.
1725
1726 From Jeff: struct gss_trials initializers changed from gss_mech_krb5 to
1727 ck_gss_mech_krb5.  ckcftp.c, 23 Oct 2005.
1728
1729 From Jeff: some improvements to K95 GUI SHOW TERMINAL.  ckuus5.c, 23 Oct 2005.
1730
1731 Found and corrected some misplaced #ifdefs in shofeat(), ckuus5.c, 23 Oct 2005.
1732
1733 --- Dev.03 ---
1734
1735 Fixed a compiler warning in a debug() statement in zzstring() by adding
1736 parens.  ckuus4.c, 24 Oct 2005.
1737
1738 Added -DNOLONGLONG to sv68r3v6 target, makefile, 25 Oct 2005.
1739
1740 New makefile targets for HP-UX from PeterE to handle the 'long long'
1741 situation.   26 Oct 2005.
1742
1743 From Jeff: changes to support OpenSSL 0.9.8, ck_ssl.h.  ckcasc.h has had
1744 short names defined for ASCII control characters for 20-some years but now
1745 they are causing conflicts, so EM becomes XEM (also for OpenSSL 0.9.8).
1746 Changed K95's default terminal type from VT320 to VT220 because VT320
1747 termcaps/terminfos are disappearing from Unix hosts: ckuus7.c.  Reorganize
1748 the data-types section of SHOW FEATURES to add more macro tests for integral
1749 sizes and to provide for the proper printf formatting in order to allow the
1750 sizes to be output ("You are going to need to be careful because %llx is not
1751 supported on all platforms.  On Windows, it is the same as %lx, 32 bits"):
1752 ckuus5.c, 26 Oct 2005.
1753
1754 Defined NOLONGLONG ckcdeb.h for various old platforms where we know we are
1755 never going to need 64-bit ints (even if they support a long long datatype,
1756 chances are pretty slim they supported 64-bit file sizes).  ckcdeb.h,
1757 26 Oct 2005.
1758
1759 PeterE noticed that GOTO targets can only be 50 characters long.  This was
1760 by design, a long time ago, on the assumption that nobody would make longer
1761 labels.  But in SWITCH statements, case labels can be variables that expand
1762 to anything at all.  If we chop them off at 50, we might execute the wrong
1763 case.  Changed the maximum label size to be 8K, and added code to dogoto()
1764 to check when a label or target is too long and fail, to prevent spurious
1765 GOTO or SWITCH results.  ckuusr.h, ckuus[r6].c, 26 Oct 2005.
1766
1767 Testing revealed there was still a problem with SWITCH case labels that were
1768 variables that expanded into long strings.  Turns out that I was being
1769 too clever when I decided that, if the SWITCH macro was n1 characters long
1770 and the case-label search target was n2 characters long, I only had to
1771 search the first n1-n2+1 characters of the macro definition.  That was true
1772 before I allowed case labels to be variables, but not any more!  Fixed in
1773 dogoto(): ckuus5.c, 26 Oct 2005.
1774
1775 --- Dev.04 ---
1776
1777 Dev.04 didn't actually contain Jeff's data-type changes to shofeat(),
1778 I think I saved the wrong buffer in EMACS...  Fixed now.  27 Oct 2005.
1779
1780 PeterE corrected a typo in the HP-UX 7.00 makefile target.  27 Oct 2005.
1781
1782 PeterE had been reporting problems stress-testing the new SWITCH code, but
1783 only on HP-UX 9, primarily stack overrun.  Turns out to be the HP-UX 9
1784 optimizing compiler's fault.  No optimization, no problems.
1785
1786 PeterE found that even when dogoto() detects a string that is too long
1787 and fails, this does not stop SWITCH from producing a result, which can not
1788 possibly be trusted.  Changed the part of dogoto() that handles this to
1789 not just fail, but also to exit the script immediately and return to top
1790 level.  ckuus6.c, 28 Oct 2005.
1791
1792 An idea popped into my head after having typed too many commands like "dir
1793 ck[cuw]*.[cwh]" to check the list of matching files, and then having to
1794 retype the same filespec in a SEND command: Why not unleash some unused
1795 control character such as Ctrl-K to spit out the most recently entered input
1796 filespec?  It was easy, just a few lines in cmifi2() and gtword(), plus a
1797 couple declarations.  To see all the changes, search for "lastfile" (all the
1798 new code is protected by #ifndef NOLASTFILE).  ckucmd.c, 28 Oct 2005.
1799
1800 I added a new variable \v(lastfilespec) that expands to the same last
1801 filespec, for use in scripts.  ckuusr.h, ckuus4.c, 28 Oct 2005.
1802
1803 The Unix version of C-Kermit failed to put anything in the session log if
1804 SET TERMINAL DEBUG ON.  Rearranged the pertinent clause so logging happens
1805 independent of TERMINAL DEBUG.  For now, since the user who noticed this
1806 wanted debug format to go into the session log, that's what I do.  The
1807 alternative would be to just log the raw incoming stream as usual, or to add
1808 Yet Another SET Command to choose.  ckucns.c, 11 Nov 2005.
1809
1810 Fixed HELP INTRO text.  ckuus2.c, 11 Nov 2005.
1811
1812 Added NOLONGLONG for SV68.  ckcdeb.h, 11 Nov 2005.
1813
1814 --- Dev.05 ---
1815
1816 Added a debug() statement in FTP secure_getbyte() to see what's going on
1817 with Muhamad Taufiq Tajuddin's 205-byte-per-second FTP/SSL downloads.
1818
1819 --- Dev.06 ---
1820
1821 Result: nothing, SSL_get_error() does not report any errors.  Suggested
1822 testing SSL_read()'s return code, if 0 don't update the screen.
1823
1824 Created a new data type CK_OFF_T in ckcdeb.h that will eventually resolve
1825 to whatever each platform uses for file sizes and offsets.  ckcdeb.h,
1826 17 Nov 2005.
1827
1828 Made a new library routine ckfstoa() that converts a file size or offset to
1829 a string.  This is to solve the problem with having to use different
1830 printf() formats for different representations of file size (int, long, long
1831 long, off_t, signed, unsigned, etc).  Replaced a few printf("%l",size) with
1832 printf("%s",ckfstoa(size)) with the expected results.  This is just a start,
1833 the definitions will need adjustment for many platforms, variables need to
1834 be redeclared, and all the offending printf's (and printw's) will have to
1835 hunted down and converted.  ckclib.[ch], ckuus4.c, 17 Nov 2005.
1836
1837 Built a minimal version on Linux with:
1838 make linux "KFLAGS=-DNOLOCAL -DNOICP -DNOCSETS -DNODEBUG"
1839 Worked fine, result was 260K on i686.  21 Nov 2005.
1840
1841 Discovered that Kermit's date parser, contrary to the documentation, failed
1842 to handle strings like "Wed, 13 Feb 2002 17:43:02 -0800 (PST)", which are
1843 commonly found in email.  This was because of an overzealous and misguided
1844 check in the code; once removed, all was well.  ckucmd.c, 26 Nov 2005.
1845
1846 Added a new format code 4 to \fcvtdate() to emit asctime() format, used in
1847 BSD-format email message envelopes (i.e. the "From " line).  shuffledate(),
1848 ckucmd.c, ckuus[24].c, 26 Nov 2005.
1849
1850 Added a new function \femailaddress().  Given a From: or Sender: header line
1851 from an RFC2822-format email address, extracts and returns the actual email
1852 address, such as kermit@columbia.edu.  ckuusr.h, ckuus[42].c, 26 Nov 2005.
1853
1854 Using the new functions, I wrote a script to fetch mail from a POP3 server
1855 over a TLS connection.  But the line-at-a-time input (needed for changing
1856 line terminators and byte-stuffing text lines that start with "From ") is
1857 slow, 17 sec to read 29 messages totaling 175K.
1858
1859 Added INPUT /CLEAR so INPUT can be started with a clean buffer without
1860 requiring a sepearate CLEAR INPUT command.  ckuusr.h, ckuus[r24].c,
1861 27 Nov 2005.
1862
1863 One thing that INPUT was never able to do well was read and save the
1864 complete incoming data stream.  That's because, while waiting for its
1865 target, the buffer might overflow wrap around.  Yet there was never a way to
1866 tell it to stop when its buffer fills up and let me save it.  I added a
1867 /NOWRAP switch that does this.  If the buffer fills up before any other
1868 completion criterion is met, INPUT returns failure, but with \v(instatus)
1869 set to 6 (the next available instatus value).  Thus a program that wants to
1870 read and save (say) an email message from a POP server, which could be any
1871 length at all, and which terminates with <CRLF>.<CRLF> could do this:
1872
1873   set flag off
1874   while open connection {
1875       input /nowrap 10 \13\10.\13\10 # Wait for <CRLF>.<CRLF>
1876       if success {
1877           frwrite /string \%o {\freplace(\v(input),\13\10.\13\10,\13\10)}
1878           set flag on
1879           break
1880       } else if ( == \v(instatus) 6 || == \v(instatus) 1 ) {
1881           frwrite /string \%o {\v(input)}
1882           continue
1883       }
1884       break
1885   }
1886   if flag (handle success)
1887
1888 Note carefully the braces around the FWRITE text; without them, trailing
1889 spaces would be lost.
1890
1891 Previously the only way to INPUT an entire data stream without losing
1892 anything (assuming it was ordinary lines of text that were not "too long"),
1893 was line-by-line:
1894
1895   while open connection {
1896       input /clear 10 \13\10
1897       if fail break
1898       if eq "\v(input)" "$ \13\10" break
1899       fwrite /string \%o {\freplace(\v(input),\13\10,\10)}
1900   }
1901
1902 The new code is 3 times faster using the default INPUT buffer length of 4K.
1903 Raising it to 16K makes it 3.6 times faster (not worth it).  Changing the
1904 POP3 script to use INPUT /NOWRAP makes it about twice as fast (it does more;
1905 it has to do all the byte-stuffing and unstuffing).  27 Nov 2005.
1906
1907 Changed ssl_display_xxx() to just return if SET QUIET ON.  Otherwise there
1908 is no way to suppress the messages.  Also protected a previously unprotected
1909 printf("[SSL - OK]\r\n"); by if ( ssl_verbose_flag ).  ck_ssl.c,
1910 28 Nov 2005.
1911
1912 Discovered that FOPEN /APPEND doesn't work if the file doesn't exist.  It
1913 uses cmiofi() which is a super-hokey front end to cmifi2().  I had code to
1914 call it but for some reason it was commented out, with a note to the effect
1915 it didn't work.  I uncommented it but that didn't help much.  So I wrote an
1916 entirely new cmiofi() that works exactly as it should, using chained FDBs,
1917 _CMIFI to _CMOFI (I think the original cmiofi() predated chained FDBs).
1918 ckuus7.c, ckucmd.c, 29 Nov 2005.
1919
1920 Getting rid of the awful hacks required to call cmiofi() meant I also had to
1921 change the EDIT command, which is the only other place where it's used.
1922 Unfortunately now it's no longer possible to give EDIT without a filename
1923 (to just start an empty editor) but I doubt anyone will notice.  ckuusr.c,
1924 29 Nov 2005.
1925
1926 IF KERBANG didn't always work right.  If a kerbang script TAKEs another
1927 kerbang script, the second one should have IF KERBANG false, but it didn't.
1928 Added a check for \v(cmdlevel) == 1.  Now you can write a wrapper that runs
1929 a kerbang script in a loop, and the latter can use IF KERBANG to know
1930 whether to EXIT (if called at top level) or END (if called by another
1931 script, thus allowing -- in this case -- the loop to continue).  ckuus6.c,
1932 29 Nov 2005.
1933
1934 Changed \flop() and flopx() functions to take a third argument, a number
1935 signifying at which occurrence of the break character to lop, so:
1936
1937   \flopx(sesame.cc.columbia.edu) = edu
1938   \flopx(sesame.cc.columbia.edu,,2) = columbia.edu
1939
1940 ckuus[24].c, 1 Dec 2005.
1941
1942 Built OK on VMS 7.2-1 with MultiNet 4.4.  Built with and without OpenSSL on
1943 Linux OK, ditto Solaris 9.  Built OK on RH Linux AS4 on X86_64 (64-bit);
1944 "show var fsize" (using new ckfstoa()) works OK there.  Also Mac OS X 10.3.9
1945 (32-bit), Tru64 UNIX 4.0F (64-bit), HP-UX 11iv2 (64-bit) (picky new compiler
1946 spews out tons of useless warnings), FreeBSD 6.0 on ia64 (64-bit).
1947
1948 --- Dev.07 ---
1949
1950 Changed "make netbsd" to be a synonym for "make netbsd2" because the
1951 original netbsd target was ancient.  Renamed it to netbsd-old.  makefile,
1952 3 Dec 2005.
1953
1954 Updated INPUT and MINPUT help text.  ckuus2.c, 3 Dec 2005.
1955
1956 Discovered that on a SET PORT /SSL connection, Kermit treats incoming
1957 0xff data bytes (e.g. sent from the POP server) as IACs and goes into Telnet
1958 negotiations.  Jeff says "You will need to implement NP_SSLRAW and NP_TLSRAW
1959 that do the same as NP_TCPRAW but negotiate SSL or TLS as appropriate."
1960 This was not as easy as it sounded, because apparently a lot of the Telnet
1961 code is used by SSL and TLS even when Telnet protocol is not being executed.
1962 I wound up doing this as follows: I added /SSL-RAW and /TLS-RAW to the
1963 switch table.  Rather than disable Telnet, they do exactly what the /SSL and
1964 /TLS switches do, but also set a special flag.  This flag is checked in only
1965 two place: netclos() (to prevent Kermit from sending TELNET LOGOUT when
1966 closing the connection), and tn_doop() (to prevent Kermit from reacting to
1967 incoming IACs; it makes tn_doop() return(3), which means "quoted IAC", which
1968 causes the caller to keep the IAC as data).  ckcnet.h, ckctel.h, ckctel.c,
1969 ckuus7.c, 4 Dec 2005.
1970
1971 The INPUT command did not account for tn_doop() returning 3.  Fixed in
1972 doinput(), ckuus4.c, 4 Dec 2005.
1973
1974 Added another debug() statement in FTP secure_getbyte() to see what's going on
1975 with Muhamad Taufiq Tajuddin's 205-byte-per-second FTP/SSL downloads, plus
1976 new code to test SSL_read()'s return code (byte count); if 0 don't update
1977 the screen.  ckcftp.c, 4 Dec 2005.
1978
1979 --- Dev.08 ---
1980
1981 Fixed a typo in the non-ANSIC definition of ckfstoa().  ckclib.c, 7 Dec 2005.
1982
1983 Our Ctrl-C trap (the ON_CTRLC macro) wasn't working for kerbang files.
1984 Rearranged some code to make it work.  ckcmai.c, 8 Dec 2005.
1985
1986 Started converting code to use CK_OFF_T for file sizes and offsets, and
1987 all [s]printf's to replace "%ld" or whatever with "%s", and the size
1988 variable with a call to ckfstoa().  Since I haven't actually changed the
1989 definition of CK_OFF_T from what all the size variables were to begin
1990 with (i.e. long), it shouldn't do any harm.  So far just ckcfn3.c
1991 10 Dec 2005.
1992
1993 An updated HP-UX 9.xx makefile target from PeterE to fix a core dump that
1994 happens on that platform due to insufficient resources.  14 Dec 2005.
1995
1996 Added debug() statements to http_blah() routines to tell whether the
1997 connection is "chunked".  There seems to be a bad performance problem.
1998 ckcnet.c, 14 Dec 2005.
1999
2000 PeterE complained about ugly DIRECTORY error message, ?No files match -
2001 "{blah}".  The braces are used internally in case the user typed more than
2002 one filespec.  I changed the error message to remove them.  Ditto DELETE.
2003 ckuus6.c, 15 Dec 2005.
2004
2005 The problem with HTTP downloads is that Kermit always does single-character
2006 read() or socket_read() calls (or the SSL equivalent); see http_inc().  I
2007 added buffering code for non-SSL connections only but it's gross because it
2008 has to swap ttyfd and httpfd before calling nettchk().  I tried making a
2009 nettchk() clone that accepts a file descriptor as an argument but it didn't
2010 work because too many other routines that are invoked directly or implicitly
2011 by nettchk() (such as in_chk()) are still hardwired to use ttyfd.  HTTP GETs
2012 are now 20 times faster on the local network (the improvement is less
2013 dramatic over a clogged Internet).  ckcnet.[ch], 15 Dec 2005.
2014
2015 --- Dev.09 ---
2016
2017 HTTP file-descriptor swapping is not thread safe.  Doing it right, of
2018 course, is a big deal, so for now I just don't define HTTP_BUFFERING for
2019 Windows.  ckcnet.c, 15 Dec 2005.
2020
2021 Noticed that HTTP not included in FreeBSD and OpenBSD builds.  Fixed in
2022 ckcdeb.h, 22 Dec 2005.
2023
2024 Fleshed out 32/64-bit data type definitions and changed struct zattr
2025 (file attribute structure) members length and lengthk to have the new
2026 CK_OFF_T type.  Changed final arguments of debug() and tlog() to be the new
2027 LONGLONG type.  ckcdeb.h, 22 Dec 2005.
2028
2029 Changed ckfstoa() to return a signed number in string form, rather than an
2030 unsigned one.  That's because off_t is signed (thank goodness).  Added the
2031 inverse function, ckatofs() so we can convert file sizes and offsets back
2032 and forth between binary number and string.  ckclib.c, 22 Dec 2005.
2033
2034 Changed Attribute Packet reader to convert incoming file size attribute
2035 with ckatofs() rather than atol().  ckcfn3.c, 22 Dec 2005.
2036
2037 Converted debug(), tlog(), ckscreen(), etc, to handle potentially "long long"
2038 arguments by making their "n" argument CK_OFF_T.  ckuusx.c, ckcdeb.h,
2039 22 Dec 2005.
2040
2041 Converted the rest of the source files to use CK_OFF_T for all file size
2042 and offset and byte-count related variables, and converted all references to
2043 these variables in printfs to go through ckfstoa().  Then I built it on
2044 Linux/i386 with:
2045
2046   make linux "KFLAGS=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
2047
2048 which makes off_t be 64 bits and magically makes all the regular file APIs
2049 use 64-bit sizes and offsets without changing the API calls in the source
2050 code.  It's going to be a lot of work to get through all the kinks but I was
2051 able to send a long file, do directory listings of long files, do
2052 \fsize(longfile), etc.  When it sends a file, the length is shown correctly
2053 in the A packet.  If the receiver does not support big numbers, it receives
2054 the file OK anyway, without showing the size, the thermometer, or percent
2055 done (and then will get an error when the file keeps coming after the 2G
2056 mark).  Kermit 95 actually refuses long files for "Size", but only if the
2057 announced is less than 2^63 bytes.  When today's Linux version receives a
2058 file, it shows the length correctly in the file-transfer display, as well as
2059 percent done, thermometer, etc.  Also built this version on true 64-bit
2060 Linux, and it worked fine.  Many files changed, 22 Dec 2005.
2061
2062 For the record, this API is specified in X/Open's Single UNIX Specification
2063 Version 2, which is branded as UNIX 98.  It is called Large File Support, or
2064 LFS, and was developed at the Large File Summit.
2065
2066 It looks like the operative feature-test macro in glibc for transitional
2067 large file support is __USE_LARGEFILE64.  So if this is defined, we can also
2068 supply _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64 automatically for 32-bit
2069 Linux builds.  But there's a Catch-22, you don't know if this is defined
2070 until you read the header files, but you have to define _LARGEFILE_SOURCE
2071 and _FILE_OFFSET_BITS before you read the header files.  Maybe it's good
2072 enough to grep through <features.h> for __USE_LARGEFILE64.  makefile,
2073 23 Dec 2005.
2074
2075 Checked this on true 64-bit Linux.  The same symbols are defined in CFLAGS,
2076 but they do no harm; it builds without complaint and works fine.  24 Dec 2005.
2077
2078 Built it on Red Hat Linux 6.1 from 1999.  This picked up the long file
2079 support too.  Guess 6.1 isn't old enough to not have it!  Kermit seems to
2080 work OK on regular files but I don't have enough disk space to create a long
2081 file, and my bigfile.c program (which creates a long file containing only 1
2082 byte) doesn't work ("fseeko: invalid argument").  It looks like parts of
2083 this API were visible in Linux before they were actually working.
2084 24 Dec 2005.
2085
2086 Converted all fseek() and ftell() to macros that expand to fseek() and ftell()
2087 or fseeko() and ftello() depending on whether _LARGEFILE_SOURCE is defined.
2088 ckufio.c, ckuus7.c, ckuusx.c, 24 Dec 2005.
2089
2090 Made a CK_OFF_T version of cmnum().  It would be a very big deal to just
2091 change cmnum() to return a new type, so another idea is to rename cmnum() to
2092 something else, cmnumw(), change its result argument to CK_OFF_T, and then
2093 make a stub cmnum() to call it to get an int, then call cmnumw() explicitly
2094 any time we need a big number.  ckucmd.c, 24 Dec 2005.
2095
2096 Calling cmnumw() directly requires changes to each routine that uses it.
2097 The INCREMENT and DECREMENT commands, for example, required changes to
2098 doincr(), varval(), and incvar(), and all references to them.  ckuusr.[ch],
2099 ckuus[56].c, 24 Dec 2005.
2100
2101 Calling cmnumw() in chained FDBs required defining a new function code,
2102 _CMNUW, adding a new member to the OFDB struct for returning wide results,
2103 and adding a new case to cmfdb().  ckucmd.[ch], 24 Dec 2005.
2104
2105 Changed FSEEK and FCOUNT to use the new chained FDB interface, now we can
2106 seek and look past 2GB.  ckuus7.c, 24 Dec 2005.
2107
2108 Next come switches, which store their results in a struct stringint.  This
2109 struct was defined in each module where it was used (ckuus[r367].c, ckcftp.c).
2110 I moved the definition to ckuusr.h and added a wval member, which can be
2111 referenced by any switch-parsing code that calls cmnumw().  24 Dec 2005.
2112
2113 Changed SEND /CALIBRATE:n to allow big values of n.  This makes it possible
2114 to test the protocol aspects of long-file transfer without actually having a
2115 long file handy.  ckuusr.c, 24 Dec 2005.
2116
2117 SEND /SMALLER-THAN:n, SEND /LARGER-THAN:n, and and SEND /START:n also now
2118 allow large values of n.  ckuusr.c, 24 Dec 2005.
2119
2120 Changed the algebraic expression evaluator to use wide values.
2121 ckuus5.c, 24 Dec 2005.
2122
2123 Fixed ckfstoa() to handle the case when n is negative and (0 - n) is also
2124 negative, which happens for numbers 2^(n-1) or greater, where n is the
2125 number of bits in the word size we're dealing with, e.g. 64, in which case
2126 2^63 has its sign bit set so seems to be negative.  In such cases, ckfstoa()
2127 returns "OVERFLOW" instead of a numeric string.  We'll have to see how this
2128 plays out but I think it's better to cause a parse error and stop things
2129 dead than to return a spurious number.  ckclib.c, 24 Dec 2005.
2130
2131 Converted the S-Expression handler to use wide integers. ckuus3.c, 24 Dec 2005.
2132
2133 Took all the LONGLONG stuff out of ckcdeb.h, we don't need it.
2134
2135 All of these changes result in 64-bit arithmetic (more or less) on 32-bit
2136 Linux, as well as on true 64-bit platforms.
2137
2138 Rebuilt today's code on Solaris 9 in the 32-bit and 64-bit worlds, on Red
2139 Hat 6.1, Red Hat AS4.2.  I haven't bothered trying a 32/64 hybrid build for
2140 Solaris, since I can build a pure 64-bit version there.  Quick tests show
2141 the large-number arithmetic works OK in all cases except, of course, on pure
2142 32-bit builds (unfortunately I can't find a running Linux system old enough
2143 to verify this for Linux, but it's true for other 32-bit platforms).
2144 24 Dec 2005.
2145
2146 Tried building a hybrid version on Solaris 9 after all since the LFS API is
2147 ostensibly the same as for Linux:
2148
2149  make solaris9 "KFLAGS=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
2150
2151 It built smoothly and the resulting binary is 2.5MB compared to 3.4MB for
2152 the 100% 64-bit version.  Looks like a keeper.  For now, added solaris9lfs
2153 and solaris10lfs entries to the makefile but if these work on PCs we can
2154 make these the regular entries for Solaris 9 and 10.  27 Dec 2005.
2155
2156 Built on Mac OS X 10.4 with the regular target.  It seems that in that case,
2157 off_t is 64 bits anyway.  Noticed that a lot of stuff didn't work, like
2158 exponentiation in S-Expressions.  Tried building it as above, which worked,
2159 and now CK_OFF_T is 64 bits instead of 32, but (^ 2 30) is still 2.0.  In
2160 fact 2-to-the-any-power is 2.0.  It seems that the Mac OS X version did not
2161 have FNFLOAT defined.  It also seems that every test in dosexp() like:
2162
2163   if (result != fpresult) fpflag++;
2164
2165 should have been protected by #ifdef FNFLOAT..#endif /* FNFLOAT */ -- a
2166 double-ended break, as they say in the nuclear power industry.  ckuus3.c,
2167 27 Dec 2005.
2168
2169 Added GREP /EXCEPT:pattern.  ckuus[26].c, 27 Dec 2005.
2170
2171 Fixed a problem with uninitialized pv[].wval (switch-parsing parameter-value)
2172 members that showed up on certain platforms or with certain compilers.  Now
2173 the Mac OS X 10.4 version works.  ckuus[r367].c, ckcftp.c, 28 Dec 2005.
2174
2175 Built on Unixware 7.1.1, a pure 32-bit build, seems fine.  Rebuilt on Red
2176 Hat AS 4.2 just to make sure I didn't break anything, it's OK.  No testing
2177 on HP-UX, etc, because HP testdrive file sytem is full, can't upload anything.
2178 29 Dec 2005.
2179
2180 Commented out the SHOW FEATURES section that displays constants like
2181 INT_MAX, CHAR_MAX, etc, because printing each value in the appropriate
2182 format is too tricky, and we don't need them anyway.  ckuus5.c, 29 Dec 2005.
2183
2184 Updated ckvfio.c to use CK_OFF_T for the relevant variables.  Built and
2185 tested on VMS/Alpha 7.2: file transfer in remote mode; making a Telnet
2186 connection and then local-mode file transfer; S-Expressions, all OK.  Also
2187 built a no-net version OK.  29 Dec 2005.
2188
2189 Built and tested on Red Hat AS4 AMD X86_64, used it to upload new sources to
2190 FreeBSD 4.11.  Built on FreeBSD 4.11/i386.  Here's another one where off_t
2191 is 64 bits, even though long is 32 bits.  But it seems to work ok, not sure
2192 why, when CK_OFF_T is 32 bits.  There is no _LARGEFILE_SOURCE stuff in the
2193 header files.  29 Dec 2005.
2194
2195 Built on Mac OS X 10.3.9 using the new macosx10.4 target to pick up LFS.
2196 Works fine.
2197
2198 Built on Red Hat Linux 4WS on IA64 (64-bit).  Now this one is odd, stat()
2199 fails on big files.  It happens also if I use the "linuxnolfs" target, which
2200 does not define _USE_LARGEFILE or _FILE_OFFSET_BITS=64.  DIRECTORY BIGFILE
2201 shows the size as -1, but if "log debug", it says "no files match", i.e.
2202 different behavior, observer effect.  I hate when that happens.
2203
2204 Let's see if that's an anomoly...  Built on Tru64 Unix 4.0F (64-bit Alpha).
2205 It sees long files just fine.  Rebuilt and checked on x86_64 again... fine.
2206 OK, let's not worry about IA64 yet.
2207
2208 Another small fix to the HP-UX 9.0 target from PeterE.  makefile, 29 Dec 2005.
2209
2210 ---Dev.10---
2211
2212 Code adjustments from Jeff, mainly to the SSL and TLS Raw mode code from
2213 several weeks ago, plus changing some data types in the security code to
2214 CK_OFF_T, plus a different data type for CK_OFF_T for K95 because Windows
2215 size_T isn't signed.  This presumably will allow large-number arithmetic but
2216 it will not give large file access because that will require replacing all C
2217 library file i/o calls (esp. in ckofio.c) with native Windows APIs.  Build
2218 on Solaris 9 with and without SSL and on Linux RH AS4.2 with and without
2219 SSL.  ck_crp.c, ck_ssl.c, ck_ssl.h, ckcdeb.h, ckcftp.c, ckcmai.c, ckcnet.c,
2220 ckcnet.h, ckctel.c, ckuat2.h, ckuus4.c, ckuus7.c, ckuusr.c, 30 Dec 2005.
2221
2222 It was reported that WRITE SESSION always returned a failure status, even
2223 when it succeeded.  The problem was that Unix versions of zsout() and
2224 zsoutl(), for the session log only, were using write() and returning
2225 write()'s return code, which is different from what zsout() and zsoutl() are
2226 documented to return.  Also plugged a couple potential holes in zsoutx()
2227 that I noticed while I was in the neighborhood.  ckufio.c, 30 Dec 2005.
2228
2229 Added FSEEK /FIND:pattern.  This form of FSEEK accepts all the other
2230 switches and arguments and performs the desired seek.  Then, if the seek was
2231 successful, it starts from that point and reads through the file, line by
2232 line, searching for the first line that contains the given string or matches
2233 the given (unanchored) pattern and, if found, sets the file pointer to the
2234 beginning of that line.  Useful, e.g., for very long timestamped logs, where
2235 you want to start processing at a certain date or time; searching for a
2236 particular string is much faster than doing date comparisons on each line.
2237 ckuus[27].c, 30 Dec 2005.
2238
2239 It was annoying me that FILE STATUS (FSTATUS) required a channel number to
2240 be given even if only one file was open, so I supplied the correct default
2241 in that case.  ckuus7.c, 30 Dec 2005.
2242
2243 INPUT /NOWRAP, added recently, is used for efficiently copying the INPUT
2244 stream intact, but it's not good for matching because if the INPUT target is
2245 broken between the end of the previous buffer and the beginning of the next
2246 one, the context is lost and the match does not occur.  I thought of several
2247 ways around this, but they all involve saving a huge amount of context --
2248 old input buffers, the arrays of target strings and corresponding match
2249 positions, etc.  The alternative is fairly simple but it's not transparent
2250 to the user.  Here's what I did in a POP script:
2251
2252     .eom := "\13\10.\13\10"
2253     set flag off                           # FLAG ON = success
2254     while ( open connection && not flag ) {
2255         .oldinput := \fright(\v(input),8)  # Save tail of previous INPUT buffer
2256         input /clear /nowrap 4 \m(eom)     # Get new INPUT buffer
2257         if success {                       # INPUT matched - good
2258             .s := {\freplace(\v(input),\m(eom),\13\10)}
2259             set flag on
2260         } else {                           # No match
2261             .s := \v(input)                # Check if target crossed the border
2262             .oldinput := \m(oldinput)\fsubstr(\v(input),1,8)
2263             if \findex(\m(eom),\m(oldinput)) set flag on
2264         }
2265         ...
2266     }
2267
2268 I think this will be easier to explain than any dangerous and grotesque
2269 magic I might put into doinput() itself.  For now, added a few words about
2270 this to HELP INPUT.  ckuus2.c, 30 Dec 2005.
2271
2272 Back to the pattern matcher.  Noticed that "IF MATCH index.html [a-hj-z]*"
2273 succeeded when it should have failed.  In ckmatch(), the clist section
2274 needed one more clause: it can't float the pattern if an asterisk does not
2275 occur in the pattern before the clist.  This change fixes the problem
2276 without breaking any other cases that weren't already broken, most of which
2277 involve slists, i.e. {string,string,string,...}.  ckclib.c, 30 Dec 2005.
2278
2279 Tried FSEEK /FIND: on a largish file (over 100,000 lines), using it to seek
2280 to a line near the end.  It took 0.756 seconds, compared with Unix grep,
2281 which did the same thing in 0.151 sec.  That's because C-Kermit is using
2282 ckmatch().  But if the search target is not a pattern, it should be a bit
2283 faster to use ckindex().  Yup, 0.554 sec, a 36% improvement.  Can't expect
2284 to compete with grep, though; it's highly tuned for its single purpose.
2285 ckclib.[ch], ckuus7.c, 1 Jan 2006.
2286
2287 Updated visible copyright dates to 2006: ckcmai.c, ckuus2.c, ckuus5.c,
2288 1 Jan 2006.
2289
2290 Noticed that NetBSD 2.0.3 has 64-bit off_t, and that _LARGEFILE_SOURCE is
2291 mentioned in <stdio.h>.  Tried building Kermit with _LARGEFILE_SOURCE added
2292 to CFLAGS, it's good.  Added it to the netbsd target.  makefile, 1 Jan 2006.
2293
2294 Fixed typo, #ifdef CK_NOLONGLONG in ckuus5.c should have been #ifndef
2295 CK_LONGLONG (which, it turns out, we don't use anyway).  2 Jan 2005.
2296
2297 Observed that FreeBSD 4.x has a 64-bit off_t, but does not use the
2298 _LARGEFILE_SOURCE convention.  Reasoning that all versions of FreeBSD have
2299 off_t (I was able to check back to FreeBSD 3.3), I simply #define CK_OFF_T
2300 to be off_t in ckcdeb.h within #ifdef __FreeBSD__ .. #endif.  Another one
2301 down.  This can be done for any platform that is guaranteed to have off_t.
2302 Turns out FreeBSD 3.3 has 64-bit off_t too.  2 Jan 2005.
2303
2304 OpenBSD, same as FreeBSD.  Also, added OS-version-getting thing to makefile
2305 target for the program herald, as in the other BSDs.  Built on OpenBSD 2.5
2306 from 1998, it has 64-bit off_t too.  ckcdeb.h, makefile, 2 Jan 2005.
2307
2308 Dumping the command stack every time there's an error is really too much.
2309 I added SET COMMAND ERROR-DISPLAY {0,1,2,3} to set the verbosity level of
2310 error messages.  Only level 3 dumps the stack.  ckuus[235].c, 2 Jan 2005.
2311
2312 Built on HP-UX 11.11 with _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64.  The
2313 result works fine as far as I can tell.  It sees big files, it can open
2314 them, seek to positions past the 2^31 boundary.  It can send large files.
2315 It can do large-number arithmetic (^ 2 62).  The only problem is that during
2316 compilation, every single modules warns:
2317
2318   cc: "/usr/include/sys/socket.h", line 504: warning 562: Redeclaration of
2319   "sendfile" with a different storage class specifier: "sendfile" will have
2320   internal linkage.
2321   cc: "/usr/include/sys/socket.h", line 505: warning 562: Redeclaration of
2322   "sendpath" with a different storage class specifier: "sendpath" will have
2323   internal linkage.
2324
2325 These warnings should be perfectly harmless since they are not coming from
2326 C-Kermit code, nor does C-Kermit use either one of those functions.  These
2327 warnings don't come out in HP-UX 11i v2, but on that one we get tons and tons
2328 of picky compiler warnings (variables set but not used, defined but not
2329 referenced, etc).  A couple, however, turned out to be valid; one case of
2330 "expression has no effect", and two of "string format incompatible with
2331 data type" (I missed a couple file-size printfs).
2332
2333 There were also numerous warnings about signedness mismatch or sign
2334 conversion of constants like IAC (0xff).  Does the HP-UX Optimizing Compiler
2335 have a compiler flag to make all chars unsigned?  Yes, +uc, but the man page
2336 says "Be careful when using this option.  Your application may have problems
2337 interfacing with HP-UX system libraries and other libraries that do not use
2338 this option".  Sigh, better not use it.
2339
2340 After reviewing "HP-UX Large Files White Paper Version 1.4" and HP's
2341 "Writing Portable Code" documents, I added -D_LARGEFILE_SOURCE
2342 -D_FILE_OFFSET_BITS=64 to the hpux1000 target, which is the basis for all
2343 HP-UX 10.00 and later builds.  Large files are available in HP-UX 10.20 and
2344 later.  10.00 and 10.10 were not real releases, and anyway these flags
2345 should be harmless there unless the large-file implementation was only
2346 partly done.  Built OK on both PA-RISC and IA64, optimized and plain.
2347 makefile, 4 Jan 2006.
2348
2349 Built on FreeBSD 6.0 on IA64.  All OK except I got a warning about the
2350 argument passed to time() in logwtmp() in ckufio.c.  This section had
2351 already been partially fixed; thus I put the improved version into
2352 #ifdef CK_64BIT, which is our newly available symbol that should be
2353 automatically defined for any true 64-bit build.  ckufio.c, 4 Jan 2006.
2354
2355 Finally got around to testing Jeff's changes to SSL/TLS RAW mode from
2356 December 30th against our POP server.  It didn't work, couldn't log in.
2357 Tried backing off the ckctel.c changes first; that allowed login and
2358 communication, but it did not suppress activation of Telnet protocol
2359 whenever a 0xff byte arrived.  Backed off the rest of the changes and now
2360 all is OK again.  ckctel.c, ckcnet.c, ckuus7.c, 9 Jan 2006.
2361
2362 Built on NetBSD 1.4.1 (1999), found that it did not like the large file
2363 assumption -- fseeko() and ftello() do not exist; added a clause to the
2364 netbsd target to check for fseeko and not define _LARGEFILE_SOURCE if not
2365 found.  Oddly enough, off_t is 64 bits anyway, but it doesn't look like the
2366 APIs are half-done.  For example, stat() uses off_t (64 bits) for the file
2367 length, but fseek() uses long (32 bits) and there is no 64-bit analog.
2368 Anyway the new netbsd target works on both 1.4.1 and 1.5.2 (no large files)
2369 and on 2.0.3 (large files).  makefile, 9 Jan 2006.
2370
2371 Built on QNX-32 4.25, which has no large file support.  Got a few strange
2372 compiler (WatCom) warnings, but it built and runs OK.  Noticed that file
2373 transfers into QNX over a Telnet connection can't use streaming, but that's
2374 nothing new to this version; same thing happens with C-Kermit 7.0.  9 Jan 2006.
2375
2376 Built on IRIX 6.5.  I didn't bother with large files there because it does
2377 not support the _LARGEFILE_SOURCE interface; you have to change all the APIs
2378 at the source level from blah() to blah64().  Seems to work fine as a 32-bit
2379 app even though its off_t is 64 bits.  Tried a pure 64-bit IRIX 6.5 build
2380 but it dies in ckcnet.c when it hits SOCKOPT_T and GSOCKNAME_T with "The
2381 identifier 'socklen_t' is undefined".
2382
2383 Looks like I no longer have access to SCO OSR5.
2384
2385 Made a pure 32-bit build on SCO UnixWare 7.1.4, all OK.  Found that this
2386 version also supports LFS, added it to the uw7 target.  makefile, 9 Jan 2006.
2387
2388 --- Dev.11 ---
2389
2390 Evidently the HP-UX bundled (non-ANSI non-optimizing) compiler doesn't like
2391 long integers in switch expressions.  Changed three examples of these in the
2392 S-expression code.  ckuus3.c, 10 Jan 2006.
2393
2394 A section of tstats() where GFTIMER isn't defined (e.g. on Motorola
2395 sv68r3v6) was garbled.  Fixed in ckcfn2.c, 10 Jan 2006.
2396
2397 A fix for setting 921600 bps on Linux from Paul Fulghum, Microgate Systems Ltd.
2398 ttgspd(): ckutio.c, 11 Jan 2006.
2399
2400 Noticed that when I changed the compact substring notation code back on
2401 August 9th, I broke the ability to use arithmetic expressions within the
2402 brackets, which explains some rather odd behavior I saw with some of my
2403 scripts.  Looking more deeply into this, I also see that all the parsers I
2404 have been using up to now for this, as well as for array bounds pairs, have
2405 been inadequate because they never allowed for nested constructions, such as
2406 a member of a bounds pair that itself was an array element, possibly with
2407 another array element as a subscript.  I wrote a new routine for this,
2408 called boundspair(), which is like arraybounds() except it accepts an extra
2409 argument, an array of characters that can serve as bounds-pair delimiters,
2410 and it returns the pair separator that was encountered in another new
2411 argument.  For the alternative substring notation for [startpos-endpos] I
2412 had to change the delimiter from '-' to '_' because '-' can be used in
2413 arithmetic but '_' is not a recognized operator.  This is so I can parse,
2414 e.g. [a:b] or [a_b] in the same context, and then find out which form was
2415 used, e.g. \s(line[9:12]) or \s(line[9_12]); the first string is 4 bytes
2416 long, the second is 12.  Everything seems to be OK now.  \s(line[10]) gives
2417 everything starting at 10, but \s(line[10:0]) gives the null string.  Bad
2418 syntax in the bounds pairs results in a null string; missing pieces of the
2419 bounds pair result in defaults that should be compatible with previous
2420 behavior.  ckuus[45].c, ckuusr.h, 13 Jan 2005.
2421
2422 Changed arraybounds() to call boundsdpair().  This was a rather drastic
2423 change, not strictly necessary, but I think I got all the kinks out.
2424 ckuus5.c, 13 Jan 2005.
2425
2426 Changes from PeterE to the makefile for HP-UX 6 and 7, to accommodate bigger
2427 symbol tables, etc.  19 Jan 2005.
2428
2429 Determined that SCO OSR5.0.6 (and earlier) do(es) not support large files.
2430 Don't know about 5.0.7.  30 Jan 2005.
2431
2432 Created a new build target for SCO OSR6.0.0.  Gets the exact 6.x.x version
2433 dynamically.  Supports large files and big-number arithmetic via CK_OFF_T.
2434 The sockopt() family of functions changed the data types of some of their
2435 arguments since OSR5.  It was already possible to define SOCKOPT_T and
2436 GSOCKNAME_T from the command line but I had to add code to also allow this
2437 for GPEERNAME_T too.  ckcnet.c, makefile, 30 Jan 2005.
2438
2439 Apparently, ever since C-Kermit 7.0 was released, it has never been possible
2440 to use a variable for the as-name in a RECEIVE command in Kermit 95.  This
2441 is because evaluation of the as-name field was deferred until after we could
2442 check whether it might be a directory name (which, in Windows, could start
2443 with a backslash).   This little bit of magic was not a good idea, magic
2444 hardly ever is.  I changed the code to evaluate both as-name fields in the
2445 normal way.  If they want to receive to a directory called "\%1", they'll
2446 just have to spell it differently.  The workaround is to turn the whole
2447 command into a macro and evaluate it before executing it, e.g.:
2448
2449   assign xx receive /as-name:\%1
2450   do xx
2451
2452 ckuus6.c, 1 Feb 2006.
2453
2454 Built OK on FreeBSD 6.1 on AMD64.  Adjusted some copyrights and date stamps.
2455 ckcmai.c, makefile, 8 Feb 2006.
2456
2457 --- Dev.12 ---
2458
2459 Fixed a signed/unsigned char warning in the new boundspair() calling code
2460 in the compact substring notation handler.  ckuus4.c, 9 Feb 2006.
2461
2462 Removed a spurious extra linux+openssl label from the makefile, added
2463 solaris10g_64 synonym.  9 Feb 2006.
2464
2465 Satisfied myself that LFS is OK on Solaris 10 i386, and I'm going to assume
2466 it's also OK on Solaris 9.  Made LFS standard for all Solaris 9 and 10
2467 builds (including the secure ones) except the explicitly 64-bit ones, and
2468 made the provisional solarisXXlfs targets into synonyms.  makefile, 9 Feb 2006.
2469
2470 --- Dev.13 ---
2471
2472 Further attempts at SSL/TLS message suppression when QUIET is ON.
2473 ck_ssl.c, 16 Feb 2006.
2474
2475 From J.Scott Kasten: (quote...) I just uploaded a patch to /kermit/incoming.
2476 The file name is "jsk-patch-for-cku211.diff".  I have also included the
2477 patch as ASCII text in this email below.  This patch may be applied to the
2478 cku211.tar.gz source code via:
2479   cd cku211, patch -p1 <../jsk-patch-for-cku211.diff
2480 The patch adds 4 new build targets:
2481   netbsdwoc - a stripped no curses target for iksd used.
2482   netbsdse  - security enhanced target with srp, ssl, and zlib.
2483   irix65gcc - build on SGI Irix 6.5 platform using gcc.
2484   irix65se  - security enhanced target with srp, ssl, and zlib.
2485 The patch fixes one build target:
2486   irix64gcc - The "-s" option is not supported by gcc under Irix.
2487 I thank all of you in the Kermit Project for such a fine utility.  I
2488 recently had to get a 16 MB file overseas across a spotty communications
2489 link to repair a computer remotely.  Kermit was the only thing that could do
2490 the job, so I wanted to contribute these patches back to the mainstream to
2491 say thanks.  This digitally signed email is a binding contract that
2492 officially assigns the rights to the source code patch (shown below) that I
2493 developed to the Kermit Project at Columbia University. (...end quote)
2494 ck_ssl.c, makefile, 23 Feb 2006.
2495
2496 Changed the new NetBSD target names to be consistent with the conventions
2497 used in most other targets:
2498
2499   netbsdwoc -> netbsdnc
2500   netbsdse  -> netbsd+ssl+srp+zlib
2501   irix65se  -> irix65+ssl+srp+zlib
2502
2503 and removed old, now superfluous, NetBSD targets (old-netbsd, netbst15,
2504 netbst16), leaving synonym labels in their place.  Also updated (crudely)
2505 the Linux target variations (curses instead of nocurses, no curses at all)
2506 to be (appropriately modified) copies of the current linux target.  It would
2507 be nicer to combine them, but this gets the job done.  makefile, 23 Feb 2006.
2508
2509 --- Dev.14 ---
2510
2511 Fixed the HELP command when used with tokens like @, ^, #, and ;.  The first
2512 two had been omitted from the table.  The second two required a new path
2513 into the guts of the parser, since comments are normally stripped at a very
2514 low level.  ckuus[r2].c, ckucmd.c, 24 Feb 2006.
2515
2516 Built on AIX 5.1 ("make aix51") without incident.  Then I tried:
2517
2518  make aix51 "KFLAGS=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
2519
2520 This had no effect.  I found the relevant document ath the IBM website.  It
2521 says to use -D_LARGE_FILES instead.  I added this to the AIX 4.2 target
2522 since (a) IBM says large files are supported by AIX 4.2 and later, and (b)
2523 all Kermit AIX targets past 4.2 use the 4.2 one.  Plus a clause to make
2524 sure CK_OFF_T is defined appropriately.  ckcdeb.h, makefile, 6 Mar 2006.
2525
2526 Added a 32-bit aix51+openssl target.  Builds OK, works fine (tested against
2527 our SSL POP server).  Tried I tried adding -D_LARGE_FILES.  It seems to work
2528 fine, so we'll keep it.  Cleaned up the other aix5blah entries a bit also.
2529 makefile, 6 Mar 2006.
2530
2531 Fixes from J. Scott Kasten to the IRIX 6.4 and 6.5 makefile targets.  They
2532 were badly wrong.  makefile, 6 Mar 2006.
2533
2534 The reason Kermit was looping on directories in IRIX was a classic
2535 "double-ended break".  The makefile targets failed to define DIRENT so
2536 Kermit was open/read on directories rather than opendir()/readdir().  But
2537 then it was also failing to account for the fact that read() would return -1
2538 on error.  The makefile fix adds -DDIRENT, and the read() case in traverse()
2539 now properly terminates its loop on error.  ckufio.c, 6 Mar 2006.
2540
2541 --- Dev.14 ---
2542
2543 In response to a complaint that C-Kermit would not build on HP-UX 11 with
2544 OpenSSL, I tried it myself on both 11.11/PA-RISC and 11i v2/Itanium.  It built
2545 OK on both but I had to add a new target (hpux1000o+openssl-nozlib) for no
2546 Zlib since these boxes did not have it installed.  makefile, 9 Mar 2006.
2547
2548 Added OpenSSL version number display to SHOW FEATURES.  ckuus5.c, 9 Mar 2006.
2549
2550 Gavin Graham noticed that FTP [M]GET /DELETE /MOVE-TO: was rejected with
2551 "?Sorry, /DELETE conflicts with /MOVE or /RENAME".  This check belongs in the
2552 PUT code but not in the GET code.  Commented it out and tested the result.
2553 The combination is now accepted but then Kermit refuses the incoming file as
2554 if it had been given a /SMALLER-THAN: or /LARGER-THAN: switch, which it didn't
2555 happen.  Turns out there was one more place where I wasn't initializing the
2556 new "wide int" member of the switch-parsing pv[] struct.  Once this was fixed,
2557 the /MOVE-TO part still didn't work.  Turned out the /DELETE case was part of
2558 a long if-else-if-else- chain, which effectively made /DELETE and /MOVE-TO: or
2559 /RENAME-TO: mutually exclusive.  Fixed this, now it works fine.  ckcftp.c,
2560 13 Mar 2006.
2561
2562 Got access to AIX 5.3, built there, all OK, including large files. 13 Mar 2006.
2563
2564 --- Dev.16 ---
2565
2566 Patches from Mark Sapiro to suppress getsockopt() and getsockname() warnings
2567 in Mac OS X.  ckcnet.[ch], 18 Mar 2006.
2568
2569 In response to a complaint from Clarence Dold, tried "make redhat9" (which
2570 is the rather dated target that tried to include all forms of security) on
2571 RH Linux AS4.3, it failed miserably.  I made a new makefile target, removing
2572 Kerberos IV and got a lot farther.  But then in ckcftp.c, the following
2573 struct definition:
2574
2575   struct {
2576       CONST gss_OID_desc * CONST * mech_type;
2577       char *service_name;
2578   } gss_trials[] = {
2579       { &ck_gss_mech_krb5, "ftp" },
2580       { &ck_gss_mech_krb5, "host" },
2581   };
2582
2583 refers to a variable, ck_gss_mech_krb5, that is not defined anywhere.  Up
2584 above, however, is a static definition for gss_mech_krb5, so I changed the
2585 struct definition to match.  Next, in ckuath.c, the compiler could not find
2586 the com_err.h file.  Turns out in Linux this is in a subdirectory, et, so we
2587 have to add a -I clause to the makefile target for this.  Made a target for
2588 Linux+SSL only.  Made a target for Linux+Krb5 only; this required moving an
2589 #ifdef in ckuus7.c to prevent an unguarded reference to SSLEAY_VERSION.
2590 New targets: linux+krb5+ssl, linux+krb5, linux+krb5.  ckcftp.c, ckuus7.c,
2591 makefile, 27 Mar 2006.  
2592
2593 New targets of HP-UX 10/11 with OpenSSL from PeterE.  makefile, 27 Mar 2006.
2594
2595 Added large file/integer support to SHOW FEATURES.  ckuus5.c, 27 Mar 2006.
2596
2597 Built OK on Solaris 9 and 10 with gcc (someone was complaining that this
2598 didn't work, but that was 8.0.211).
2599
2600 Started build on a Sun 3/80 mc68030 with NetBSD 2.0 and gcc 3.3.3.  But it
2601 died with an assembler error in ckcfn2.c (compiler bug).  27 Mar 2006.
2602
2603 --- Dev.17 ---
2604
2605 NebBSD 2.0 build completed by turning off optimization on ckcfn2.c
2606 ("KFLAGS=-O0").  Result supports 64-bit ints and, presumably, large files.
2607 uname -p = "m68k", -m = "sun3". 29 Mar 2006.
2608
2609 Corrected an omission in applying PeterE's updates to the HP-UX targets.
2610 makefile, 28 Mar 2006.
2611
2612 solaris2xg+krb5+krb4+openssl+shadow:
2613
2614 Tried resurrecting the solaris2xg+krb5+krb4+openssl+shadow target.  It asks
2615 to link with libdes but there is no libdes.  Removed -ldes from the target,
2616 now at least it builds and runs wart.  The compilation blows up in ckcftp.c
2617 for missing header files:
2618
2619   ckcftp.c:462: kerberosIV/krb.h: No such file or directory
2620   ckcftp.c:500: gssapi/gssapi_generic.h: No such file or directory
2621   ckcftp.c:501: gssapi/gssapi_krb5.h: No such file or directory
2622
2623 Got a bit farther by adding appropriate -I's and -L's to KFLAGS but it still
2624 dies compiling (or linking?) ckcftp.c, but it doesn't say exactly why.  OK,
2625 deferred.
2626
2627 Added SET SEXPRESSION TRUNCATE-ALL-RESULTS { ON, OFF }.  This can be used
2628 for force integer arithmetic in any kind of calculation that requires it,
2629 such as date calculations.  This is a global setting, not on any kind of
2630 stack.  Also, updated SHOW SEXP and added HELP SET SEXP which wasn't there
2631 before.  ckuus[23].c, 30 Mar 2006.
2632
2633 To make the RENAME command a bit more useful, need to add some switches.
2634 But it shares a switch table, qvswtab[], with some other commands.  Broke
2635 this off into its own switch table.  ckuus6.c, 17 Apr 2006.
2636
2637 Added RENAME switch values that can be used in the same table with the DELETE
2638 switch values, which are shared by many commands.  ckuusr.h, 17 Apr 2006.
2639
2640 Discovered that the RENAME command could be entered without any arguments
2641 and it would still succeed.  Fixed in dorenam(): ckuus6.c, 17 Apr 2006.
2642
2643 Added parsing for RENAME /UPPER:option (to uppercase the file name(s)),
2644 /LOWER:option (to lowercase), and /REPLACE:{{s1}{s2}} (to do string
2645 replacement on the filename(s)), but not the semantics.  When any of these
2646 switches is given, the target ("to") name is not parsed; they act on the
2647 source name.  The /LOWER: switch takes keyword args to specify whether it
2648 should act only only files that have all UPPER case latters, or on ALL files
2649 (i.e., including files with mixed-case names); similarly for the /UPPER:
2650 switch.  There is some creative parsing allowing these to be given with or
2651 without a colon and keyword argument, which works fine except if you include
2652 the colon but no argument, execute the command (which works fine), and then
2653 recall the command.  I haven't yet decided about the interaction among these
2654 switches.  Clearly if /UPPER is given after /LOWER, it overrides.  But if
2655 /UPPER (or /LOWER) is given with /REPLACE, what should happen?  ckuus6.c,
2656 17 Apr 2006.
2657
2658 Filled in actions for RENAME /UPPER: and /LOWER: for the single file case,
2659 and tested all combinations of switch values and filename configurations.
2660 Once that was OK, moved the code out into a separate routine, renameone(),
2661 and then called it from both the single-file case and the multifile case.
2662 ckuus6.c, 19 Apr 2006.
2663
2664 Added RENAME /SIMULATE.  Filled in the code for string replacement, needs
2665 testing.  ckuus6.c, 20 Apr 2006.
2666
2667 Changed /REPLACE options to allow a negative number to specify an occurrence
2668 from the right, so -1 means the last occurrence, -2 means the next-to-last,
2669 etc.  ckuus6.c, 24 Apr 2006.
2670
2671 Added RENAME /COLLISION:{OVERWRITE,PROCEED,FAIL}.  This is implemented but
2672 not tested.  ckuus6.c, 24 Apr 2006.
2673
2674 Worked on RENAME /COLLISION:FAIL.  I decided it was less than useful to ...
2675
2676 Added SET RENAME { COLLISION, LIST } to let user change default collision
2677 and listing actions.  ckuusr.[ch], ckuus[36].c, 25 Apr 2006.
2678
2679 Experimented with parsing for /CONVERT:cset1:cset2.  The problem here is
2680 that there is no straightforward way for a switch to have multiple
2681 arguments.  Or is there...?  If I parse cset1 with cmswi() rather than
2682 cmkey(), it almost works; the only problem is that the character-set
2683 keywords don't have CM_ARG set, so they don't know to stop on, and ignore, a
2684 colon.  If I make a copy of the table and set CM_ARG in the flags field for
2685 each keyword, it works fine: if I Tab in the first name, it fills itself
2686 out, supplies a colon, and waits for the second name.  So in the code, the
2687 first time that RENAME /CONVERT is invoked, I put code to copy fcstab[] and
2688 set CM_ARG in each flags field.  Works fine, and now we know how to make a
2689 switch that takes multiple arguments.  ckuus6.c, 24 Apr 2006.
2690
2691 I thought I had a function to convert the character set of a string but I
2692 don't, so actually implementing /CONVERT: will be difficult.
2693
2694 Actually the parsing wasn't that easy either.  It works OK interactively,
2695 but not in a TAKE file.  To make a long story short, I had to change
2696 gtword() and cmkey2() to not require "/" at the beginning of a switch, and
2697 then to parse arguments-that-are-followed-by-other-arguments as if they were
2698 switches, so that they can end with colon rather than space.  This might
2699 seem dangerous, but switches always have "/" at the beginning, so the check
2700 is superfluous.  ckucmd.c, 26 Apr 2006.
2701
2702 Back to /CONVERT...  Once I was able to get the code to call cvtstring() I
2703 was able to debug it (at first it was skipping every second character).  And
2704 now we have a general-purpose string-translating function we can call from
2705 anywhere.  Requires that C-Kermit be built with Unicode support.
2706 ckuus6.c, 26 Apr 2006.
2707
2708 Added SHOW RENAME.  ckuusr.h, ckuus[r5].c, 26 Apr 2006.
2709
2710 Conditionalized some Unix/Windows assumptions in renameone() so the code
2711 could work in VMS.  ckuus6.c, 2 May 2006.
2712
2713 Added RENAME /FIXSPACES to change all spaces in the filename(s) to
2714 underscore or any other character or string that is given.  This is just a
2715 special case of RENAME /REPLACE:{{ }{x}} with easier syntax.
2716 ckuusr.h, ckuus6.c, 2 May 2006.
2717
2718 Added an "all-but" control to the /REPLACE options:
2719 /REPLACE:{{.}{_}{~1}} means replace all but the first (this one works);
2720 /REPLACE:{{.}{_}{~-1}} means replace all but the last (this one not yet).
2721 ckuus6.c, 2 May 2006.
2722
2723 Filled in the second one ("all but" the given occurrence).  The algorithm is
2724 simply to reverse the three strings and then use the same code as we use in
2725 the left-right-case, and then unreverse the result.  At first I used
2726 yystring() for this but yikes, what a bad design!  So I made a better
2727 string-reversal routine, gnirts(), for this (luckily yystring() is only used
2728 in one place, for which its design is appropriate). ckuus6.c, 3-4 May 2006.
2729
2730 Added code to handle the case where the file being renamed includes a path
2731 specification.  In this case we separate the path, apply the renaming
2732 functions to the filename only, and then at the end rejoin the original
2733 filename with the path, and join the new name with same path or, if a
2734 destination directory was given, with that.  ckuus6.c, 4 May 2006.
2735
2736 Added HELP SET RENAME and updated HELP RENAME.  ckuus2.c, 4 May 2006.
2737
2738 "Tom Violin" (Tom Hansen) noticed that the first time you FOPEN a file,
2739 Kermit's memory consumption goes way up.  In fact there's a warning to that
2740 effect in the code, where, upon first open, a potentially big array of
2741 potentially big structs is allocated.  I rewrote the code to allocate each
2742 array member (struct ckz_file) as needed, i.e. when a file is opened, and to
2743 free it when the file is closed (or the open fails).  This was actually
2744 quite a lot of work, which is why I didn't do it the first time around:
2745 every single "."  had to be changed to "->".  Every check for a valid
2746 channel first had to check if the channel's struct was allocated and every
2747 other reference to z_file[i]->anything had to be prechecked that z_file[i]
2748 was not a NULL pointer.  Also I made some improvements to FILE STATUS, and I
2749 fixed FILE CLOSE to default the channel number if only one channel was open,
2750 as I did for FILE STATUS a while back.  ckuus7.c, Cinco de mayo 2006.
2751
2752 Ran my old BUILDS script that builds C-Kermit with about 100 different
2753 combinations of feature-selection switches.  Fixed a few small glitches so
2754 now they all build OK (except can't do NOANSI builds any more on recent
2755 Linuxes because of varargs()).  ckuus3.c, ckuus5.c, ckuus6.c, ckuus7.c,
2756 ckucmd.c, ckcfns.c, 6 May 2006.
2757
2758 Fixed RENAME /LOWER and /UPPER, when given with no colon or agrument, to
2759 default to ALL.  ckuus6.c, 13 May 2006.
2760
2761 Built on VMS 7.2-1, tested new RENAME command there; seems to be OK.
2762 13 May 2006.
2763
2764 --- Dev.18 ---
2765
2766 I wanted to test large files against RESEND but I don't have access to any
2767 system that can run C-Kermit and that also has enough space for a large
2768 file.  I created a "fake" large file on Linux (3G hole plus 1 byte), and
2769 sent it over a localhost connection, and interrupted it repeatedly and then
2770 initiated a RESEND at the sender.  In each case, it picked up where it left
2771 off.  But before the 2G boundary was crossed the disk filled up.
2772 Inconclusive.  14 May 2006.
2773
2774 PeterE got a warning in the new FILE OPEN code when building in HP-UX 9.
2775 I added a cast, built on HP-UX 11, no more complaint.  However there
2776 are warnings about internal vs external bindings of sendpath and sendfile
2777 in every module.  Too bad, these are not Kermit tokens, it's a conflict in
2778 HP's header files.  Marc Sapiro doesn't see them; probably it's something
2779 on the HP testdrive site.  ckuus7.c, 17 May 2006.
2780
2781 Fixed the tru64-51b+openssl target -- the terminating doublequote of KFLAGS
2782 was missing -- and also the osf target, which failed to import the LIBS
2783 definition from whatever other target invoked it.  Now the SSL build goes OK
2784 on Tru64 5.1B.  Replaced x.tar.z in the download areas without declaring a
2785 new Dev number.  The new one has a makefile with today's date.  Software
2786 engineering at its best!  makefile, 18 May 2006.
2787
2788 Scott Kasten noted that the estimated-time-remaining calculation would go
2789 bonkers on LFS systems when RESENDing a large file.  It looks like the
2790 shocps() and shoetl() functions escaped the CK_OFF_T conversion.  I made
2791 what seemed to be the right adjustments, and then was lucky enough to find a
2792 computer that had enough free disk space for me to send a large file,
2793 interrupt it several times, resend it, all seems to be OK.  28 May 2006.
2794 Later Scott verified these changes independently for Linux, but the problems
2795 in IRIX remain.
2796
2797 Patches from Scott Kasten for large files on IRIX 6.5: ckcdeb.h, makefile,
2798 12 Jun 2006.
2799
2800 --- Dev.19 ---
2801
2802 Added a new function for dealing with JPGs and GIFs:
2803
2804 \fpicture(filename,&a)
2805   returns 0 if file not recognized or can't be opened;
2806   returns 1 if landscape, 2 if portrait or square.
2807   If array given, element 1 is width, element 2 is height.
2808
2809 ckuusr.h, ckuus4.c, 19 Jun 2006.
2810
2811 Scott Kasten reports that the FTP client can transfer large files OK, at
2812 least in Linux, but has trouble with recovery:
2813
2814  . Kermit takes a very long time to start the transfer, sometimes over
2815    30 minutes.  Suspect the ftp server is counting the bytes in a long file?
2816    Or maybe it's a text-mode transfer and it's counting the lines?  Probably
2817    in response to Kermit's SIZE command.
2818
2819  . The size shown in the FT display is wrong by a random amount.  And of
2820    course so are the progress bar, percent done, and time remaining.
2821
2822  . The file, however, is transferred correctly.  REGET works correctly too.
2823
2824 I tried setting up a test scenario locally but our Solaris FTP server does
2825 not support large files:
2826
2827   FTP SENT [SIZE BIGFILE]
2828   FTP RCVD [550 BIGFILE: not a plain file.]
2829   FTP SENT [PASV]
2830   FTP RCVD [227 Entering Passive Mode (128,59,48,24,246,37)]
2831   FTP SENT [RETR BIGFILE]
2832   FTP RCVD [550 BIGFILE: Value too large for defined data type.]
2833
2834 Created the same 3GB on a Tru64 Unix system that allows FTP access.  Made
2835 the connection from C-Kermit on Solaris (32-bit with LFS):
2836
2837   16:46:12.908 FTP SENT [SIZE BIGFILE]
2838   16:46:12.947 FTP RCVD [213 3000000001]
2839
2840 Note that it takes less than half a second to get the reply.  Now I start
2841 the download and then interrupt it at about 2%:
2842
2843   16:46:12.979 FTP SENT [TYPE I]
2844   16:46:13.174 FTP RCVD [200 Type set to I.]
2845   16:46:13.226 FTP SENT [PASV]
2846   16:46:13.262 FTP RCVD [227 Entering Passive Mode (15,170,178,171,11,37)]
2847   16:46:13.299 FTP SENT [RETR BIGFILE]
2848   16:46:13.337 FTP RCVD [150 Opening BINARY mode data connection for BIGFILE..]
2849   16:47:24.895 FTP RCVD [426 Transfer aborted. Data connection closed.]
2850   16:47:24.934 FTP RCVD [226 Abort successful]
2851   16:47:24.991 FTP SENT [MDTM BIGFILE]
2852   16:47:25.028 FTP RCVD [213 20060706204458]
2853
2854 Now I do a REGET:
2855
2856   16:51:55.321 FTP SENT [PASV]
2857   16:51:55.357 FTP RCVD [227 Entering Passive Mode (15,170,178,171,11,43)]
2858   16:51:55.394 FTP SENT [REST 122736640]
2859   16:51:55.430 FTP RCVD [350 Restarting at 122736640. Send STORE or RETRIEVE..]
2860   16:51:55.431 FTP SENT [RETR BIGFILE]
2861   16:51:55.469 FTP RCVD [150 Opening BINARY mode data connection for BIGFILE..]
2862
2863 This worked perfectly, as far as I can tell; the FT display picked up in the
2864 right place; the thermometer, percent done, and estimated time remaining
2865 were the same as when we left off last time.  I did the same thing several
2866 more times, everything was OK.  It would have taken a really long time to
2867 let this run to completion, but I think this demonstrates that Scott's
2868 symptoms are server-dependent.  No changes.  6 July 2006.
2869
2870 Checked current code on VMS 8.2-1 on IA64 / UCX 5.5, builds fine.
2871 No changes.  Updated listing at HP.  6 July 2006.
2872
2873 Checked FTP GET of large file in ASCII mode against Tru64 FTP server.  It
2874 was fine, and there was no delay in the server's response to our SIZE command
2875 (as there would be if it were scanning the entire file to count how many
2876 bytes would be required to send it in text mode).  7 Jul 2006.
2877
2878 Tested FTP PUT big file against Tru64, OK.  Ditto FTP RESEND big file:
2879
2880   C-Kermit>resend BIGFILE
2881    PUT BIGFILE (binary) (3000000001 bytes)---> PASV
2882   227 Entering Passive Mode (15,170,178,171,13,186)
2883   ---> SIZE BIGFILE
2884   213 343211280
2885   ---> MDTM BIGFILE
2886   213 20060707141243
2887   ---> APPE BIGFILE
2888   150 Opening BINARY mode data connection for BIGFILE (128.59.59.56,45470).
2889
2890 Made REPUT a synonym for RESEND.  ckuusr.c, 7 Jul 2006.
2891
2892 Added FTP REPUT and FTP RESEND since previously there was no FTP-prefixed
2893 command for recovering uploads, only the regular RESEND command, which might
2894 not have been obvious to people.  ckcftp.c, 7 Jul 2006.
2895
2896 Added help text for FTP RESEND and REPUT and amended RESEND help text.
2897 ckcftp.c, ckuus2.c, 7 Jul 2006.
2898
2899 Changed name of \fpicture() to \fpictureinfo() and added help text.  By the
2900 way, ImageMagick can do this too: identify -format "%w %h" dscf0520.jpg.
2901 The advantage of having it in Kermit is that not everybody has ImageMagick.
2902 ckuus[24].c, 7 Jul 2006.
2903
2904 Changed the numeric comparisons = < > <= >= != to allow long integers by
2905 changing the data type to CK_OFF_T, etc.  ckuus6.c, 7 Jul 2006.
2906
2907 Noticed that \fkeywordvalue(foo=this is a string) only kept the first word.
2908 Fixed it to keep the whole definition.  Also added \fkwvalue() as a briefer
2909 synomym.  ckuus4.c, 7 Jul 2006
2910
2911 Sometimes we want to check if a file's status before we've FOPEN'd it, in
2912 which case the channel variable is likely to be empty and \f_status(\%c)
2913 would get an error.  Making the obvious change didn't fix this, however.  It
2914 turns out that the function evaluator failed to adjust argn (argument count)
2915 when trailing arguments were empty, and argn was being used in this case,
2916 and probably others, to test whether an argument existed.  I added code to
2917 adjust argn to reflect the number of aruments up to and including the
2918 rightmost non-empty one.  ckuus4.c, 7 Jul 2006.
2919
2920 Fixed \fstripb() to not dump core if second argument is missing.
2921 ckuus4.c, 7 Jul 2006.
2922
2923 Discovered that it was not obvious what pattern to use to match strings
2924 enclosed in square brackets.  "if match [abc] \[*\]" didn't work.  Neither
2925 did various other tricks like NCRs for the brackets.  However, "if match
2926 [abc] \\[*\\]" does work.  Trying to fix this would no doubt break 100 other
2927 things, so let's call it a feature.  7 Jul 2006.
2928
2929 Added \fgetpidinfo(n) to return info about a process ID; for now it simply
2930 returns 1 if the process is alive and 0 if not (or -1 if the argument is
2931 bad or missing or on any kind of error).  ckuusr.h, ckuus[24].c, 7 Jul 2006.
2932
2933 The "where-did-my-file-go" message seemed to be ending with a LF rather
2934 than CRLF, probably because the terminal modes had not yet been restored,
2935 leaving the next prompt hanging below it, rather than on the left margin,
2936 if C-Kermit exited immediately after the transfer.  Fixed by changing
2937 all \n's to \r\n's in wheremsg(): ckcpro.w, 8 Jul 2006.
2938
2939 Added \v(lastkwval) so we can retrieve programmatically the keyword most
2940 recently processed by \fkeywordval().  ckuusr.h, ckuus4.c, 9 Jul 2006.
2941
2942 --- Dev.20 ---
2943
2944 Added #ifdef SV68, #include <unistd.h>, #endif because Unix System V/68 on
2945 Motorola choked on the SEEK_CUR reference without it.  ckuus4.c, 10 Jul 2006.
2946
2947 Make \fkeywordval(xxx) undefine xxx (i.e. when a keyword is given with no
2948 value).  This way command-line keywords will always override preexisting
2949 default definitions, whether they have a value or not, which makes it easier
2950 to parse command lines like "foo=bar blah xx=yy".  ckuus[24].c, 12 Jul 2006.
2951
2952 On 29 Nov 2005 I changed IF KERBANG to solve a problem (see entry for that
2953 date), but introduced a new one; namely that you can't have (e.g.)  a FATAL
2954 macro that uses IF KERBANG to decide whether to EXIT all the way or STOP
2955 back to the prompt.  Changed it again, this time to require not that the
2956 command level be 1, but that the command *file* level be 0 (i.e. that we are
2957 in the top-level command file, irrespective of the command or macro level,
2958 but not in a subfile).  ckuus6.c, 12 Jul 2006.
2959
2960 It is unhelpful when Kermit gets a syntax error in the middle of a big
2961 compound statement block (e.g. FOR or WHILE loop) and dumps out the whole
2962 thing in an error message.  I changed the two places where this can happen
2963 to call a new routine that, instead of dumping out the entire cmdbuf,
2964 checks its length first and if it's more than a line long, truncates it
2965 and adds an ellipsis.  ckuus6.c, 12 Jul 2006.
2966
2967 The new RENAME command didn't give very good error messages, e.g. if the
2968 filespec didn't match any files.  Fixed in dorenam(): ckuus6.c, 12 Jul 2006.
2969
2970 Fixed DIR /TOP to work if the /TOP:n argument was omitted, defaulting
2971 to 10.  domydir(): ckuus6.c, 12 Jul 2006.
2972
2973 Added DIR /COUNT:v to count the number of files that match the given
2974 criteria and store result in the variable v.  ckuusr.h, ckuus[r26].c,
2975 24 Aug 2006.
2976
2977 Added HDIRECTORY as an invisible synonym for DIR /SORT:SIZE /REVERSE.
2978 Can be used with other switches, of course, so (e.g.) HD /TOP shows the
2979 ten biggest files.  ckuusr.h, ckuus[r26].c, 24 Aug 2006.
2980
2981 DIR /FOLLOWLINKS and /NOFOLLOWLINKS always did the same thing; the switch
2982 was ignored, a symlink is always followed.  Fixed in ckuus6.c, 24 Aug 2006.
2983
2984 Added DIR /NOLINKS, which means don't show or count symlinks at all.
2985 ckuusr.h, ckuus[r26].c, 24 Aug 2006.
2986
2987 Build on Solaris 9 and NetBSD 3.0, 24 Aug 2006.
2988
2989 Added a missing definition for LOCK_DIR in the Linux HAVE_BAUDBOY case,
2990 suggested by Gerry Belanger.  ckutio.c, 6 Oct 2006.
2991
2992 Suggested by Jim Crapuchettes: \v(dialmessage) is the text string
2993 corresponding to \v(dialstatus).  ckuusr.h, ckuus4.c, 6 Oct 2006.
2994
2995 Soewono Effendi sent code for exit sequence to leave DTR on; this amounted
2996 to unsetting HPUCL in c_cflag.  I did it a simpler way, hopefully portable
2997 to all Unixes, but who knows at this late date.  The code is inside
2998 #ifndef CK_NOHUPCL..#endif in case it causes trouble.  It is executed if
2999 SET EXIT HANGUP is OFF and a serial port was open at the time Kermit exits
3000 (or closes it explicitly).  ttclos(): ckutio.c, 6 Oct 2006.
3001
3002 Built on Solaris9/Sparc; FreeBSD 6.2/AMD64; NetBSD 3.0/i386; HP-UX 11i v2;
3003 SCO OSR6.00.
3004
3005 --- Dev.21 ---
3006
3007 Added netbsd+openssl target to makefile.  Built OK (NetBSD 3.0, OpenSSL
3008 0.9.7d) except with some warnings in ck_crp.c.  Connects and logs in OK to a
3009 secure site.  10 Oct 2006.
3010
3011 Added a debug statement to ftp_hookup() to record the TCP port that was used.
3012 ckcftp.c, 11 Oct 2006.
3013
3014 Built with OpenSSL 0.9.7l on Solaris 9.  Built with OpenSSL 0.9.8d on
3015 Solaris 9; connects and logs in to a secure site.  11 Oct 2006.
3016
3017 The new RENAME command didn't work if both the source and destination names
3018 included directory segments, e.g. "rename /tmp/foo ~/bar" (see notes of
3019 4 May 2006).  This was fixed in renameone() by a special case in which
3020 the second argument is given but it is a filename, not a directory name.
3021 ckuus6.c, 11 Oct 2006.
3022
3023 Fixed unguarded reference to dialmsg[] for \fdialmessage(), noticed by
3024 Gerry Belanger.  ckuus4.c, 12 Oct 2006.
3025
3026 Added a TOUCH command that does what UNIX touch does: creates the file if it
3027 does not exist, updates the timestamp if it does.  If a wildcard is given,
3028 it operates only on existing files.  It shares the DIRECTORY command parser,
3029 so all the same file selection switches can be given.  ckuusr.[ch],
3030 ckuus[26].c, 12 Oct 2006.
3031
3032 PeterE noticed that if you FOPEN a file, do some seeks or reads, then FCLOSE
3033 it, then FOPEN it again (or open a different one), some of the old
3034 information is still there (e.g. current line number).  This is an artifact
3035 of the changes of May 4th.  Now the file closing and opening routines are a
3036 bit more careful about scrubbing and initializing the file info struct.
3037 ckuus7.c, 12 Oct 2006.
3038
3039 --- Dev.22 ---
3040
3041 Built OK on Red Hat Linux AS4 with both "make linux" and "make linuxnc". 
3042 15 Oct 2006.
3043
3044 DIRECTORY /BRIEF ignored file selection switches and always listed all
3045 files.  This was because of how I cleverly called filhelp() (the routine
3046 that lists matching files when ? is typed in a filename field) and, of
3047 course, filhelp() doesn't know anything about the DIRECTORY command's file
3048 selections.  Changed filhelp() to accept all the args needed for passing
3049 along to fileselect(), renamed it to xfilhelp(), and made a filhelp() stub
3050 that chains to xfilhelp() with null selections.  ckcker.h, ckucmd.[ch],
3051 ckuus6.c, 29 Nov 2006.
3052
3053 SHOW CONNECTION for an SSH connection said the connection type was "NET"
3054 rather than "SSH".  Fixed in dolognet(): ckuus3.c, 29 Nov 2006.
3055
3056 SHOW CONNECTION didn't show the TCP port number.  This command works by
3057 parsing the current connection log entry string, which doesn't have a field
3058 for this, but which sometimes shows the port number as part of the hostname
3059 (but more often not).  Added code to dolognet() to log the TCP port number,
3060 if known.  This involved adding a gettcpport() function to ckcnet.c.
3061 ckcnet.[ch], ckuus3.c, 29 Nov 2006.
3062
3063 This was impossible: def \%1 upper, echo \f\%1(abc) -- i.e. to "compose" a
3064 function name.  Fixed in zzstring().  But note that it's still not possible
3065 to do this: def \%1 \fupper, echo \%1(abc) -- because at the point where
3066 "\fupper" is encountered, which is automatically fed to fneval(), the
3067 argument list hasn't been read yet.  ckuus4.c, 29 Nov 2006.
3068
3069 The meaningless Lisp command (=) would cause Kermit to hang.  Due to some
3070 idiosyncracy in the parser, it would see this as ((=) and would go into
3071 "wait for the closing paren" mode.  There was already a hack in the code to
3072 compensate for this, but it didn't work.  I fixed the hack but I don't
3073 understand the real problem.  Anyway, comparing Kermit with real (Franz)
3074 Lisp I discovered that comparison operators do not require two arguments, as
3075 Kermit has been doing, although they do require at least one.  I changed
3076 Kermit to not require two, so now all the comparison predicates behave
3077 exactly like Franz Lisp, including getting an error if there are no args).
3078 ckuus[r3].c, 29 Nov 2006.
3079
3080 From to-do list: Make a way to inhibit pattern matching in SWITCH labels.
3081 It's already there; just quote the wildcard characters; the only trick is
3082 that for some reason (such as that SWITCH is really an internally defined
3083 macro), a double quote is needed:
3084
3085   switch \%1 {
3086     :a\\*z, echo literally "a*z", break
3087     :abcxyz, echo literally "abcxyz", break
3088     :a*z, echo a...z, break
3089     :default, echo NO MATCH
3090   }
3091
3092 In first case, the asterisk is taken literally; in the third it's a
3093 metacharacter and the label matches any string that starts with 'a' and
3094 ends with 'z'.
3095
3096 Array initializion would quit early if any initializers were undefined,
3097 e.g. "decl \&a[] = \%a \%b \%c" would stop at the first element if \%b
3098 was not defined, even though \%c might be defined.  Fixed in dodcl():
3099 ckuusr.c, 30 Nov 2006.
3100
3101 DIR /ARRAY:a filespec, when the filespec does not match any files,
3102 terminates with the array undeclared.  It would be better to return a
3103 declared but empty array (\&a[0] = 0).  The code is already there to do
3104 that, but isn't working.  And yet "declare \&a[0]" does indeed create a
3105 0-element array ("show array" shows a dimension of 0).  Turns out there were
3106 two problems; one was the careless recycling of a local variable ("array"),
3107 resulting in failure to create \&a[] (but not any other array).  Fixed in
3108 domydir(): ckuus6.c, 30 Nov 2006.
3109
3110 The other problem was that dclarray(), when called with an array name and a
3111 dimension of zero, does two different things depending on whether the array
3112 already existed.  There is still a fair amount of confusion about whether a
3113 dimension of 0 indicates an array with 1 element (as it should) or a
3114 nonexistent array.  We call dclarray() with a size of 0 to undeclare an
3115 array but we also need to able able to declare an array with only element 0.
3116 I changed dclarray() to treat a negative dimension as a command to destroy
3117 the array, and 0 or positive as a command to create the array with the given
3118 dimension.  ckuus[r56].c, 30 Nov 2006.
3119
3120 Next problem: when chkarray() returns 0, this should not be interpreted to
3121 mean the array does not exist.  Looks like the only place this happened was
3122 in \fcontents(); fixed in ckuus4.c, 30 Nov 2006.
3123
3124 If we include file selectors with DIR /ARRAY:&a and some of the files that
3125 match the given filespec but don't fit the selectors, the array's dimension
3126 is bigger than its number of elements.  Added code at the end of domydir()
3127 to resize the array so \fdim() returns the number of filenames in the array,
3128 and also made sure that element 0 contains that number too.  ckuus6.c,
3129 30 Nov 2006.
3130
3131 This would be a nice elegant way to loop over a bunch of files, if it worked:
3132
3133   for \%i 1 \ffiles(*) 1 { rename \fnextfile() xxx_\flpad(\%i,3,0) }
3134
3135 But in this loop, Kermit skips every other file (beginning with the first)
3136 and then runs out of files halfway through the loop.  Why?  Because in
3137 commands like RENAME and DELETE, the filename parser is in a chained FDB
3138 with the switch parser.  First the switch parser, cmswi(), gets its hands on
3139 \fnextfile(), passing it through the evaluator and thus getting the first
3140 filename, which it then sees is not a switch, so now the field is parsed by
3141 the next parser in the chain, cmifi(), which causes \fnextfile() to be 
3142 executed again.  In fact, the FOR loop has nothing to do with; the same
3143 thing happens like this:
3144
3145   void \ffiles(*)
3146   delete \fnextfile()
3147
3148 This deletes not the first file, but the second one.  Obviously users can be
3149 told not to refer to \fnextfile() in chained-fdb fields:
3150
3151   for \%i 1 \ffiles(*) 1 { .f := \fnextfile(), delete \m(f) }
3152
3153 but this is hardly intuitive.  I had some clever ideas of how to make
3154 \fnextfile() work as expected in this context but it's way too much magic.
3155 Better to simply document that \fnextfile() is "deprecated" and the array
3156 format should be used:
3157
3158   for \%i 1 \ffiles(*,&a) 1 { delete \&a[\%i] }
3159
3160 The difference is, an array element doesn't change every time it's referred to!
3161
3162 Added a /PRESERVE switch to the COPY command to preserve the timestamp and
3163 permissions of the file.  I did this using the Kermit APIs so it should work
3164 for any version of C-Kermit or K95.  ckuus[26].c, 30 Nov 2006.
3165
3166 Added COPY /OVERWRITE:{ALWAYS,NEVER,OLDER,NEWER} to control name collisions
3167 when copying across directories.  ckuus[26].c, 1 Dec 2006.
3168
3169 --- Dev.23 ---
3170
3171 Fixed a bug in SET TELNET PROMPT-FOR-USERID, SET AUTH KERBEROS[45] PROMPT,
3172 and SET AUTH SRP PROMPT in which the user's string was compared with a
3173 literal (s == ""), reported by Pavol Rusnak.  Worse, empty strings (if the
3174 test succeeded) were turned into null pointers, and then fed to strlen().
3175 Fixed in ckuus3.c, 5 Dec 2006.
3176
3177 Added an optional 4th argument to \findex(), \frindex(), \fsearch(), and
3178 \frsearch(): the desired occurrence number of the searched-for string.
3179 \frsearch() was a bit tricky.  ckuus[24].c, 7 Dec 2006.
3180
3181 Added \fcount(s1,s2) to tell the number of occurrences of s1 in s2.
3182 ckuus[24].c, 8 Dec 2006.
3183
3184 Added \ffunction(s1) to tell if a given built-in function is available.
3185 ckuus[24].c, 8 Dec 2006.
3186
3187 Changed RENAME /COLLISION:PROCEED to be /COLLISION:SKIP, which is clearer.
3188 ckuus[26].c, 8 Dec 2006.
3189
3190 For communication protocols: INPUT /COUNT:n to read exactly n characters
3191 without any matching.  Can be used, for example, with CONTENT_LENGTH in CGI
3192 scripts; NUL characters are counted but not collected.  ckuusr.[ch],
3193 ckuus4.c, 8 Dec 2006.
3194
3195 There was a bad bug in the date-parsing routines; it's been there for years.
3196 If a date string includes a timezone, e.g. "Sat, 9 Dec 2006 19:26:23 EST",
3197 and converting to GMT changes the date, the variables for day, month, and
3198 year (which are used later) were not updated, and the final result was a day
3199 off.  Fixed in cmcvtdate(): ckucmd.c, 10 Dec 2006.
3200
3201 Built OK with SSL/TLS.  Tested with the POP script, found that I broke INPUT
3202 when adding the /COUNT feature; there was a path through the code that could
3203 leave the "anychar" variable unset and therefore random.  Fixed in
3204 doinput().  The POP script, which does not use /COUNT, works again and so
3205 does a new CGI script, which does use /COUNT.  ckuus4.c, 10 Dec 2006.
3206
3207 Supplied a missing comma in the help-text array for HELP SET TERMINAL, which
3208 resulted in bad formatting in K95 around SET SNI-FIRMWARE-VERSIONS.
3209 ckuus2.c, 10 Dec 2006.
3210
3211 Made "help locus" a synonym for "help set locus".  ckuusr.[ch], ckuus2.c,
3212 11 Dec 2006.
3213
3214 This morning the Columbia FTP server was malfunctioning in a perfect way
3215 for me to implement and test an FTP timeout mechanism.  The server would
3216 close the data connection after sending the file, but the client never saw
3217 the close and was stuck forever in a recv().  I added code to do a select()
3218 on the data connection prior to entering the recv(), with a timeout on the
3219 select() that the user can establish with SET FTP TIMEOUT.  Built and tested
3220 on Solaris 9, clear-text FTP.  Also built cleanly for FTPS and tested
3221 against a server that does not hang; I don't have access to an FTPS server
3222 that would tickle the timeout code.  ckcftp.c, 11 Dec 2006.
3223
3224 --- Dev.24 ---
3225
3226 Fixed a bug in the INPUT /COUNT: parser: the array of search strings was
3227 never initialized, which didn't matter before, but with /COUNT:, if the
3228 first element was not a NULL pointer, we'd treat it as a search string, and
3229 then if it happened to match something in the input stream, the operation
3230 would stop before the count was exhausted.  Fixed by (a) initializing the
3231 array, and (b) ignoring any search strings if /COUNT: was given.  ckuusr.c,
3232 13 Dec 2006.
3233
3234 Removed a debug() statement from zsattr() that suddenly started making some
3235 version of gcc complain, reported by Gerry Belanger.  ckufio.c, 13 Dec 2006.
3236
3237 --- Dev.25 ---
3238
3239 Some casts for the 3 interior args of the new select() call in ckcftp.c
3240 for HP-UX 9.  14 Dec 2006.
3241
3242 Changed \fkeywordvalue() to accept a string rather than a single word
3243 as its second argument, so that more than one separator could be specified,
3244 and to return -1 on error, 0 if it found nothing, 1 if given a kewyord but
3245 no value, and 2 if there was a keyword and a value.  dokwval(): ckuus[24].c,
3246 14 Dec 2006.
3247
3248 Checked FTP timeout on command channel with FTP DIRECTORY of a big directory
3249 using a path into our ftp server that preserves the hanging behavior.  The
3250 timeout was actually working, but the failure condition wasn't propogating
3251 back to the user, and there was no error message.  Fixed in doftprecv2() and
3252 failftprecv2(): ckcftp.c, 15 Dec 2006.
3253
3254 Added the obvious timeout checks for FTP uploads, but I have no way to test
3255 the code since our misbehaving FTP server does not hang when receiving
3256 files, only when sending them.  But uploads work both with and without a
3257 timeout set, so at least no harm is done.  ckcftp.c, 17 Dec 2006.
3258
3259 When downloading with FILE DESTINATION NOWHERE (= /CALIBRATE), Kermit still
3260 checked the size of the incoming file and refused it if there wasn't enough
3261 free disk space, on platforms (such as VMS) where zchkspa()) actually works;
3262 reported by Bob Gezelter.  ckcfn3.c, 18 Dec 2006.
3263
3264 Built on Mac OS X 10.4.8 and NetBSD 3.1_RC3, all OK.  19 Dec 2006.
3265
3266 --- Dev.26 ---
3267
3268 Built on VMS 7.3-2/Alpha.  Had to squelch a couple compiler warnings by
3269 changing some ints in the new \fpictureinfo() code from unsigned to signed,
3270 and fix a typo in the prototype for the new gettcpport() function.
3271 ckcnet.h, ckuus4.c, 22 Dec 2006.
3272
3273 --- Dev.27 ---
3274
3275 Parameterized pty routines and all references to them for file descriptor,
3276 rather than to use global ttyfd, thus allowing ptys to be created for
3277 different purposes.  Tested on Solaris 9 and Mac OS X 10.4.8, with "set host
3278 /connect /pty emacs" (fine in both cases), and (more to the point) "set host
3279 /connect /pty kermit" -- here we make a connection from one Kermit process
3280 to another and transfer a file; works fine and wasn't especially slow either;
3281 a good sign.  ckcdeb.h, ckutio.c, ckupty.c, 22 Dec 2006.
3282
3283 Created a new version of ttruncmd() called ttyptycmd(), which works by
3284 calling do_pty() to get a pty to run the command on, and then in a loop,
3285 reads from the pty and writes to the net and reads from the net and writes
3286 to the pty, using select() to which of those it should do on each pass.
3287 First cut just uses single-byte reads and writes.  Tested using Kermit
3288 itself as an external protocol.  Works but slowly: 6000cps.  Zmodem doesn't
3289 work at all.  ckutio.c, 24 Dec 2006.
3290
3291 Changed single-character read() and write() to buffered reads and writes,
3292 with ttxin() and ttol() used for network i/o.  Using Kermit as the external
3293 protocol, this gives 450Kcps (about 1/3 normal on this connection).  
3294
3295 But now there's a problem: the loop doesn't know when to stop.  How does it
3296 know when the process that is running on the pty has exited?  With single
3297 character read()'s that are executed unconditionally when select() says the
3298 pty has data waiting, as in the first pass, I get EIO if there actually
3299 isn't any, and can exit the loop.  But now, to avoid blocking, I call
3300 in_chk() to see how much data is waiting, and I don't try to read anything
3301 if it says nothing is waiting.  If the process associated with the pty file
3302 descriptor has terminated, in_chk() would presumably get some kind of error,
3303 but it doesn't.  I changed do_pty to return the pid of the fork where it
3304 execs its command so we can check the pid with kill(pid,0) when in_chk() of
3305 the pty says 0, but this doesn't help either; it seems like the process is
3306 not exiting, but of course it is.
3307
3308 I could not find any legitimate way to test when the pty fork terminated.
3309 Select() always says the pty file descriptor was ready, no matter what.
3310 Select() never reports an exception on the pty file descriptor;
3311 in_chk(ptyfd) returns 0 and not an error.  read(ptyfd,...) gets 0 but not an
3312 error.  fcntl(ptyfd,...) doesn't get an error.  Finally I tried
3313 write(ptyfd,c,0) and this indeed gets EIO (i/o error).  With this, using
3314 Kermit as the external protocol works fine in Solaris but I tend to think
3315 this trick will not be very portable (it isn't).  24 Dec 2006.
3316
3317 Made ttptycmd() use a more intelligent buffering scheme, fixed a few things
3318 about how I was setting up the select() call that should address some of
3319 yesterday's problems.  Still doesn't work but it's progress.  A: 25 Dec 2006.
3320
3321 Debugging yesterday's code...  Still, the error conditions are never set,
3322 we never detect when the pty closes.  In Solaris, if select() says ptyfd is
3323 ready to read but in_chk() says there are no characters there, we can treat
3324 this as a loop-exit condition.  But in NetBSD, in_chk() always says 0 when
3325 used on a pty (but works OK on a serial or net connection).
3326
3327 Realized I could not use in_chk() on the pty because there is too much
3328 baggage with the communication path -- myread(), etc etc) -- so I replaced
3329 this with a simple ioctl(ptyfd,FIONREAD,&n).  This works fine in Solaris but
3330 always returns 0 in NetBSD, despite what the man page says (i.e. that this
3331 function can be used on any file descriptor).
3332
3333 OK, let's see.... select() does not return useful results.  It says
3334 characters are waiting on ptyfd when they are not, and it never detects the
3335 closure of the pty.....  Well of course not, because we are the ones who
3336 have to close it.  Just because the process has stopped doesn't mean the pty
3337 is closed.  So we're back to square one, how do we know when to close it?
3338 ckupty.c seems to keep the process ID in a global variable, pty_fork_pid
3339 (which is not the same as the pid now returned by do_pty(), which is
3340 useless, but I don't understand why).  But it doesn't matter because when we
3341 kill(pty_fork_pid,0), we still get no error of any kind, even after we know
3342 the process has exited.  I am completely flummoxed.  select() lies, and even
3343 if it didn't, there is simply no completion criterion.  In the loop,
3344 select() always says that the pty is ready to read.  To be continued.
3345 26 Dec 2006.
3346
3347 Back to Square One, single-byte reads and writes.
3348
3349  . This works for both ripple and Kermit.
3350  . Doesn't work for Zmodem but we'll deal with that later.
3351  . In this case FD_ISSET(ptyfd) is still true after pty closes.
3352
3353 But the ensuing read() gets EIO so we know the pty is gone.  That means the
3354 same thing should happen in the buffered version, no?  Yes; I went back to
3355 the buffered version and replaced all the other nonworking tests by a
3356 blocking read of 1 byte on the pty and this detects the termination.  Now:
3357
3358  . ripple works perfectly (of course it's only one-way).
3359  . Kermit fails
3360
3361 Let's call the remote, forked, redirected, external Kermit A and its
3362 local partner B.  A sends its S-packet, B receives it OK and Acks.
3363 A apparently does not receive the ACK in time, so sends the S again, but OK.
3364 followed immediately by the F.  B Acks the F.  A sends the A, B Acks it.
3365 But now A sends a piece of the previous F packet and the the first piece
3366 of a D packet.
3367
3368 Clearly the buffering is messed up.  Sure enough, there was an extraneous
3369 statement incrementing a read pointer in a write section.  Removing that
3370 cleared up the problems with Kermit, now we can send and receive substantial
3371 files efficiently in remote mode.  Zmodem seems to work too, except that at
3372 the beginning a bunch of "**B0800000000022d"'s are stuffed into Kermit's
3373 command buffer, so after the transfer we get some error messages.
3374
3375 In local mode, over a Telnet connection, Kermit works fine.  Zmodem works
3376 OK too except it doesn't finish right, so at the very end rz on the far end
3377 is still waiting for something; if I cancel out of it with ^X^X^X^X^X, it
3378 deletes the file.  So there still is something wrong with the termination
3379 test.
3380
3381 Also you don't see anything on your screen when running Kermit or Zmodem
3382 this way.  That's to be expected, since they are using stdio for the
3383 transfer, so they can't also be displaying progress or other messages.
3384
3385 Built this on NetBSD again...  Seems to work this time, but has trouble
3386 finishing, like Zmodem.  Hmmm, on closer examination, it turns out that
3387 since in_chk() always returns 0 on the ptyfd, we fall into our new
3388 single-byte read code, so it's really slow, like 10K cps on a connection
3389 where 1M is the norm.  27 Dec 2006.
3390
3391 Switched the pty from buffer peeking (FIONREAD) and blocking reads to to
3392 nonblocking reads (O_NONBLOCK / O_NDELAY).  Works just fine on NetBSD except
3393 now we no longer get EIO at the end when trying to read from the pty process
3394 that has exited.  In fact, we're back to square one again.  not ioctl(), not
3395 fcntl(), not select(), not even read() gets an i/o error after the pty
3396 process exits.  But in NetBSD, we have to use nonblocking reads because ...
3397 Hmmmm, maybe switch the fd between blocking and nonblocking for the test...
3398 Nope, NetBSD seems to be hopeless (later, Ed Ravin confirmed that similar
3399 problems have been observed with other applications that try to do this).
3400
3401 Switching to Linux, I see that yesterday's Solaris code (blocking reads)
3402 works exactly the same way on Linux.
3403
3404 Tried today's O_NDELAY method on Solaris.  It works perfectly.  And then I
3405 moved this one to Linux and it works perfectly there too.  Except in both
3406 cases we have the wierd thing with Zmodem at the end, but I think that's
3407 because rz/sz don't use standard i/o.  On NetBSD, it still hangs at the end.
3408
3409 Turns out that testing the pid works in NetBSD, even though it didn't in
3410 Solaris.  Turns out read() gets an i/o error in Solaris and Linux but not
3411 in NetBSD.  So checking the read result first, and then checking the pid
3412 if read() got zero bytes catches all three.  28 Dec 2006.
3413
3414 Now the question of return code.  In the original ttruncmd() function, we do
3415 a fork() and a wait().  When the external protocol program finishes, wait()
3416 gives us its return code and we can pass it on through \v(pexitstat) as well
3417 ttruncmd's own return code.  But ttptycmd() has to interact with the pty
3418 continuously, so it can't just sit back and wait() for it.  Instead we have
3419 to detect when the process has exited and then call waitpid() on the fork
3420 pid, before shutting down the pty.  Tested on Solaris using Kermit as the
3421 external protocol and then inducing failure, or letting it run to
3422 completion.  FAILURE and SUCCESS set appropriately in each case.  Tested
3423 with Zmodem too, works OK except for the aforementioned cosmetic glitch at
3424 the end.  Tested on NetBSD, all OK.
3425
3426 To make K5 connection to Panix from Spam:
3427
3428  set telnet debug on
3429  authenticate K5 init /realm:PANIX.COM /password:xxxxx
3430  set host shell.panix.com 23 /k5login
3431
3432 Good...  Now I try to send a file from Spam to Panix over the K5 connection
3433 using Kermit itself as the external protocol.  It fails.  Inspection of the
3434 debug log on the far side shows that the S-Packet was received correctly,
3435 good!  This means we are reading the clear-text S-Packet from the external
3436 Kermit program, and that ttol() is encrypting appropriately.
3437
3438 The remote Kermit sends the Ack and goes to read the next packet: ttinl()
3439 calls myfillbuf() and:
3440
3441   SVORPOSIX myfillbuf calling read()
3442   SVORPOSIX myfillbuf=0                <-- read returns 0
3443   SVORPOSIX myfillbuf ttcarr=2
3444   SVORPOSIX myfillbuf errno=0          <-- and reports no error
3445   HEXDUMP: mygetbuf read (-3 bytes)
3446   mygetbuf errno=0
3447   ttinl myread failure, n=-3
3448   ttinl myread errno=0
3449   ttinl non-EINTR -3[closing]
3450
3451 This happens because myfillbuf() deliberately returns -3 when read() gets 0
3452 bytes.  I don't understand why this happens but the real problem is yet to
3453 come.  The local Kermit (the one that has made the secure connection and is
3454 running the external protocol through ttptycmd()) eventually figures out
3455 that the transfer failed and when we reconnect, we get total garbage -- the
3456 encryption either stopped happening, or got out of sync.
3457
3458 Looking at the local debug log, ttol() is doing its job, converting the
3459 initial "kermit -r\13" from plaintext to cyphertext, as shown by the
3460 hexdumps.  Then it enters ttptycmd()...  Hmmmm, wait, how can it send the
3461 "kermit -r" before it starts the external protocol?  Never mind, worry about
3462 that later...  Anyway, ttptycmd() says:
3463
3464   ttptycmd loop top have_pty=1
3465   ttptycmd loop top have_net=1
3466   ttptycmd FD_SET ptyfd in
3467   ttptycmd FD_SET ttyfd in
3468   ttptycmd nfds=5
3469   ttptycmd select=1
3470   ttptycmd FD_ISSET ttyfd in
3471   ...
3472   ttptycmd in_chk(ttyfd) n=11
3473   ttptycmd ttxin n=11
3474
3475 ttxin() asks for 11 bytes, myfillbuf() gets 11 bytes, and hexdump() shows
3476 the cyphertext, there doesn't seem to be any decrypting going on.  Hmmm, it
3477 looks like the regular code calls ttinc() in a loop, rather than ttxin().
3478 Maybe ttxin() doesn't have decryption hooks.  No, that's not it, the code is
3479 there, but the Kermit packet reader does not use ttxin(), it uses ttinl().
3480 But of course we can't use that for external protocols because it's designed
3481 only to read Kermit packets.  Substituting a loop of ttinc()s for the ttxin()
3482 call fixes things (and stangely enough, it seems to be faster).  And now we
3483 have our first external protocol transfer over a secure connection (external
3484 Kermit program, Linux over Kerberos 5 to NetBSD).  Zmodem worked too for a
3485 short file but "something happens" with longer ones.  29 Dec 2006.
3486
3487 New makefile target for Linux with Kerberos 5, linux+krb5, that doesn't
3488 include anything extra from SSL or other security methods (but apparently it
3489 is still necessary to include -DOPENSSL_097 in order to get the right names
3490 for the DES routines?).  Ditto netbsd+krb5 for NetBSD, except in this case
3491 -DOPENSSL_097 is not necessary.  makefile, 30 Dec 2006.
3492
3493 Note to myself: On Panix:
3494
3495   export LD_LIBRARY_PATH=/usr/local/kerblib
3496   make netbsd+krb5 "K5LIB=-L/usr/local/kerblib" "K5INC=-I/usr/local/include"
3497
3498 Can't telnet-k5 from newly built Kermit on NetBSD; partway through the
3499 negotiations, just after "TELNET RCVD SB ENCRYPTION SUPPORT DES_CFB64
3500 DES_OFB64 IAC SE" it dumps core.  The last two lines in debug.log after
3501 this are:
3502
3503   tn_sb[len]=5
3504   encrypt_support[cnt]=2
3505
3506 Rebuilding with -DOPENSSL_097 doesn't change anything.  Ed Ravin said they
3507 have two different Kerberos installations, Heimdahl and MIT; maybe some
3508 mixup between the two explains the problem (Jeff concurs). The core dump
3509 occurs in ck_crp: encrypt_support():
3510
3511    debug(F100,"XXX ep not NULL","",0);
3512    type = ep->start ? (*ep->start)(DIR_ENCRYPT, 0) : 0; <-- Here
3513    debug(F101,"XXX new type","",type);
3514
3515 Anyway, I can log in with Kerberos 5 to Panix OK from Columbia (sesame)
3516 using 8.0.201.  So let's try to resurrect the Solaris version with everything:
3517
3518   solaris9g+krb5+krb4+openssl+shadow+pam+zlib
3519
3520 I hunted around to find where the current library and header file
3521 directories were...  Last time I tried this (March 2006) it bombed, not
3522 finding libdes.  Instead we have /opt/kerberos5125/lib/libdes425.a.  Made a
3523 new cu-specific target that includes this; now we get farther; it blows up
3524 in ckcftp.c with tons of errors and warnings, which we can worry about
3525 later.  Building again with -DNOFTP, it gets to ckuath.c (the first security
3526 module) and:
3527
3528   ckuath.c:151:18: error: krb5.h: No such file or directory
3529   ckuath.c:152:21: error: profile.h: No such file or directory
3530   ckuath.c:153:21: error: com_err.h: No such file or directory
3531   ckuath.c:176:28: error: kerberosIV/krb.h: No such file or directory
3532   In file included from /opt/openssl-0.9.8d/include/openssl/des.h:101,
3533                    from ckuath.c:219:
3534
3535 Found krb5.h in /opt/kerberos5125/include/krb5.h, added a -I for this
3536 directory ...  Now we get lots of warnings in ckuath.c, but it completes OK,
3537 then we wind up bombing out in ck_crp.c; I don't know why -- there are all
3538 the same warnings (related to argument passing to DES functions), but no
3539 errors.  I have no clue.
3540
3541 Tried to resurrect the solaris2x+krb4 target; this required changing -lkrb
3542 to -lkrb4 and -ldes to -ldes425.  Lots of warnings in ckutio.c, ckcnet.c,
3543 ckctel.c, then it bombs out in ckcftp.c because it can't find krb.h.  I
3544 found it, adjusted the -I flags, but now it bombs because krb.h itself
3545 #includes <kerberosIV/des.h>, which of course it can't find because the
3546 brackets mean it's looking in /usr/include/kerberosIV/, which, of course,
3547 the sys folks have removed.  Giving up on Solaris again.  Later, Jeff said
3548 "Solaris does not publicly export the krb5 libraries.  You need to build
3549 the MIT Kerberos libraries separately and link to them."  30 December 2006.
3550
3551 Changed copyright date to 2007.  ckcmai.c, 1 Jan 2007.
3552
3553 With Ed Ravin's help, successfully built C-Kermit with Kerberos 5 and
3554 OpenSSL (netbsd+krb5+openssl+zlib), but it does not make K5 connections; it
3555 gets hung up in the Telnet negotiations.  3 Jan 2007.
3556
3557 Downloaded MIT Kerberos 5 v1.4.4 to Solaris 9, 54MB worth.  This is just so
3558 I can build a Kerberized C-Kermit for testing ttyptycmd().  Ran the
3559 configure program, got a few warnings but it didn't fail (should it?)  Did
3560 "make install", specifying a private directory but it failed immediately
3561 with "cannot stat libkrb5support.so.0.0: No such file or directory".
3562 OK, I tried.  3 Jan 2007.
3563
3564 Made a new makefile target for Mac OS X, macosx10.4+krb5+ssl, ran it on Mac
3565 OS X 10.4.8.  It bombs out in ckcftp.c with: ckcftp.c:551: error: static
3566 declaration of 'gss_mech_krb5' follows non-static declaration
3567 /usr/include/gssapi/gssapi_krb5.h:76: error: previous declaration of
3568 'gss_mech_krb5' was here".  Ditto for gss_mech_krb5_old, gss_nt_krb5_name,
3569 and gss_nt_krb5_principal.  Tried again with -DNOFTP.  We get lots of
3570 warnings in the network modules, but they complete.  But ck_ssl.c bombed
3571 with a conflict between its own declarations of encrypt_output and
3572 decrypt_input and the ones in ckuat2.h; removed the prototypes from the
3573 latter (as Jeff advised) it built OK and it works OK too.  Built with FTP
3574 too, but with link-time warnings about the aformentioned gss_* symbols.
3575 #ifdef'd them out (gss_mech_krb5, gss_mech_krb5_old, gss_mech_name, and
3576 gss_mech_principal) for MACOSX, where these symbols are exported by the
3577 library.  Now it all compiles and links OK, and runs OK too.  3 Jan 2007.
3578
3579 Spent a day hunting around for a version of Zmodem that would build and
3580 execute on Mac OS X, finally found one.  Now at last I could try a Zmodem
3581 external-protocol transfer over a secure connection.  But phooey, C-Kermit's
3582 pty support didn't work on this box.  Kermit finds master /dev/ptypa OK,
3583 then in ptyint_void_association() tries to open /dev/tty but gets ERRNO=6
3584 "device not configured" (which is apparently OK, because the same thing
3585 happens on other platforms where this works), then tries to open slave
3586 /dev/ttypa and gets ERRNO=13 "permission denied" because, indeed, I don't
3587 have r/w permission on the device.  Left a message.  4 Jan 2007.
3588
3589 Changed TRANSMIT /BINARY output buffer size from 252 to 508 to avoid
3590 TCP fragmentation.  Need to add a SET command for this later.
3591 ckuus4.c, 5 Jan 2007.
3592
3593 Found another Mac where the ptys weren't protected against me, make a K5
3594 connection and transferred a largish file with Zmodem with zero glitches,
3595 except it was kind of slow, 84K cps.  Well, we're doing single-character
3596 reads on the net (ttinc()'s instead of ttxin()).  Hmmm, but then I did it
3597 again and got 2.2Mcps.  Success was reported, but it actually didn't work;
3598 it only sent the first quarter of the file....  Oh well, at least now we
3599 have a testbed.  5 Jan 2007.
3600
3601 Tried again, saw that the file is actually transferred instantly but then
3602 we're not picking up the protocol at the end.  Theory: after the transfer
3603 finishes, we come back to the prompt on the remote host, which means we have
3604 something to read from the net and write to the pty, but the pty has already
3605 exited.  AFTER THE PTY IS GONE, WE DO NOT WANT TO READ FROM THE NET ANY
3606 MORE.  Adding this test makes Kermit succeed right away when sending the
3607 same largish file, with a transfer rate of 4M cps, that's better.  But the
3608 rz program on the far end is evidently not receiving the goodbye handshake
3609 from the receiver, because it sits there foreever in its *B09002402009418
3610 mode until I ^X^X^X^X^X out of it, at which point it deletes the file it
3611 already received, not very helpful.  In the code, I read from the pty if the
3612 pty is open and there is room in the buffer.  This means that when we get to
3613 the end, either there is no room in the buffer (unlikely) or the last bit
3614 sent by sz before exiting was cut off when the fork closed.  Why do we get
3615 in this fix only with Zmodem and not with Kermit?
3616
3617 In Mac OS X, after sz exits, we get ERRNO=5 if we try to write to the pty,
3618 but we still get no errors after that if we try to read from it.  Still,
3619 prior to this we did more than 20 unproductive nonblocking reads from the
3620 pty (no error, no bytes) without incident; there did not seem to be anything
3621 waiting.  In fact, the last thing we read from the pty were the text
3622 messages that are issued at the end of the transfer: "rz 3.73 1-30-03
3623 finished."  After which it pauses a second and spits out a message about
3624 UNREGISTERED COPY.
3625
3626 Figured out how to build lrzsz, in hopes that the previous problems were
3627 with rzsz and crzsz's fiddling with file descriptors, but I get the same
3628 behavior.  Which is good, I guess, because if I can fix one, I fix them all.
3629 Or not...  Testing lrz by itself (not under C-Kermit), I see that it doesn't
3630 work at all with Kermit's own Zmodem implementation.
3631
3632 OK, here's one problem: at the end of the transfer, the Omen Zmodems print
3633 stuff like "Please read the license agreement", Kermit dutifully reads this
3634 from the pty and sends it to the host, the host shell says "Please: command
3635 not found", issues its prompt again, which Kermit reads, feeds to the pty,
3636 and apparently the pty echoes it, so we send it back to the host, and there
3637 ensues an infinite loop of getty babble until the pty closes.  Now, there
3638 ought to be a way to make the external protocol shut up, like Kermit's
3639 -q(uiet) flag, but these are unregistered versions so you can't shut up the
3640 messages.  In fact, the transfer works, but the getty babble at the end
3641 ruins the experience.  Now I'm beginning to wonder how any of these programs
3642 ever worked as external protocols.  Hmmm, now that I try it, I see the
3643 same thing happens the old way, when using ttruncmd() rather than ttptycmd().
3644
3645 Reading the crzsz documentation I see it says that messages come out on
3646 stderr.  OK, that's progress.  In ckupty.c I try redirecting 2 to /dev/null.
3647 Well good, this filters out the messages from csz, but we still get getty
3648 babble on the prompt.  In the debug log, we read the last bunch of stuff
3649 from net, 618 bytes of Zmodem stuff...   Now what happens?
3650
3651 Zmodem on the remote exits, the host prints its prompt.  Kermit, of course,
3652 reads the prompt from the net, now come to the bottom of the loop and we
3653 have 7 bytes to write to the pty, and no error condition, so we continue the
3654 loop.  select() says that the pty is ready for writing.  We write the 7
3655 bytes and and get no error.  Loop again, this time select() says the pty has
3656 data waiting.  Sure enough we get the prompt back, and send it to the net,
3657 and thus begins the getty babble.  There are two causes for this:
3658
3659   1. crzsz does not exit immediately; it sleeps for 10 seconds after
3660      printing its nag message.
3661
3662   2. During this interval the pty seems to be echoing what is sent to it.
3663      csz is not echoing; I checked.  Anyway, removing the pause doesn't
3664      seem to make a difference.
3665
3666 ttptycmd() needs to:
3667
3668  . TELL the pty module to redirect stderr to /dev/null
3669  . SET PTY TO NOECHO (master or slave?)
3670
3671 Tried setting the pty to noecho:
3672
3673   termbuf.c_lflag &= ~(ECHO|ECHOE|ECHOK);
3674
3675 and this seemed to stop the getty babble.  After the file transfer, I read
3676 back the prompt from the host shell, I write the prompt bytes to the pty;
3677 there is no error.  And now select() simply hangs forever (or times out if
3678 a timeout is set).  The question here is: why didn't writing to the pty
3679 produce an error?  And, because we never detect the pty has exited, we can't
3680 set a good return code.  5 Jan 2007.
3681
3682 Moved pty fork testing to a separate routine, pty_get_status(), and 
3683 added a call to it from the place where we time out, in case the fork
3684 terminated; then we can get and return its status.  6 Jan 2007.
3685
3686 Added calls to pty_get_status() to every place where we suspect a pty error,
3687 tried again with lrzsz, crzsz, and regular rzsz.  All three work, but in
3688 each case waitpid() indicates that the sz program gave exit code 1 (failure).
3689 ckutio.c, 7 Jan 2007.
3690
3691 Changing the subject...  On my test system, every time I execute ttptycmd(),
3692 I get "permission denied" on /dev/ttyp3.  Then I run it again and get to
3693 ttyp4 which is OK.  I wanted to skip past any pty for which I lack
3694 permission and try the next without raising an error.  Added debugging code:
3695
3696   16:25:23.524 pty_getpty() pty master open error[/dev/ptyp0]=5
3697   16:25:23.524 pty_getpty() pty master open error[/dev/ptyp1]=5
3698   16:25:23.524 pty_getpty() pty master open error[/dev/ptyp2]=5
3699   16:25:23.524 pty_getpty() found pty master[/dev/ptyp3]
3700   16:25:23.524 pty_getpty() slavebuf [2][/dev/ttyp3]
3701
3702 So it already was skipping past open errors; ttyp3 was opened successfully.
3703 The problem is that ptyp3 is rw-rw-rw-, but the corresponding master,
3704 ttyp3, is rw--r----.  It seems the code assumes that if the master can be
3705 opened, then so can the corresponding slave.  Unfortunately, the code is
3706 not structured to allow us to skip ahead to the next master if the slave
3707 can't be opened.  7 Jan 2007.
3708
3709 Spent a couple hours trying to rearrange the code in the pty module to skip
3710 past inaccessible slaves but it was a rabbit hole, not worth it, backed off.
3711 8 Jan 2008.
3712
3713 Tried an upload over a secure connection using lsz.  Unexpectedly, this time
3714 it worked; not only was the file (about 0.5MB) transferred correctly, but
3715 Kermit detected the fork's termination and got the pid's exit status, and,
3716 for the first time, correctly reported a successful transfer.  I have no
3717 idea why this works today and not yesterday.  More tests; it works most of
3718 the time.  It works with csz and with regular sz too.
3719
3720 (days later...)
3721
3722 ckucns.c seems to do the right thing; it recognize the ZSTART string,
3723 activates the Zmodem-Receive APC, and returns.  doconect() sees the APC and
3724 begins to execute it.  The RECEIVE command results in a call to the GET
3725 command parser, doxget() (IS THAT RIGHT?), then comes a ttflui(), which
3726 throws away a bunch of stuff.  Finally we get to ttptycmd(), we get a pty
3727 and run lrz in it, select() says stuff is waiting from the pty, but read
3728 returns 0, errno 0.  Skipping the ttflui() in doxget() if the protocol was
3729 not Kermit didn't seem to make difference.  ckuus6.c, 8 Jan 2007.
3730
3731 The problem is that in this case, reads from the pty never get anything (no
3732 data, no error), write always gets an error.  It's as if the pty was not
3733 being set up right, or we're using the wrong file descriptor.  And if we
3734 skip the autodownload?  Same thing.
3735
3736 OK, putting downloads aside for a moment, let's get uploads working as well
3737 as possible.  At this point we have the odd situation (at least in this
3738 configuration) that the upload succeeds, but now for some reason we are
3739 unable to read the exit status from the process, even though this was
3740 working before, so ttptycmd() returns 0 (failure), yet Kermit reports
3741 success.
3742
3743 Well, it turns out that kill(pty_fork_pid,0) was gumming up the works.
3744 If we use only waitpid() all is well, I think.  waitpid() with WNOHANG
3745 returns -1 with status -1 errno 0 if the pid has not exited, and it returns
3746 the pid and status > -1 if the process has exited.  Fixed pty_get_status()
3747 to do it this way.  ckutio.c, 7 Jan 2007.
3748
3749 Let's move this from Mac OS to NetBSD and see how it works.  Well, the file
3750 transfer was just fine, but then I used some sexps to calculate the elapsed
3751 time and transfer rate, and Kermit hung in dosexp().  Fine, ignoring that...
3752 The debug log shows that ttptycmd() gets the pty OK, master and slave, the
3753 i/o goes smoothly, and waitpid() does its job perfectly.  Solaris, same
3754 deal; ttruncmd() goes smoothly, but then the sexps afterward get "Arithmetic
3755 exception".  Turns out there was a BAD bug in dosexp() that allowed an
3756 integer division by 0 to occur under certain circumstances; it's always been
3757 there.  Fixed in dosexp(): ckuus3.c, 8 Jan 2007.
3758
3759 After noticing a few problems running the pop.ksc script in production over
3760 the past year, rewrote \femailaddress() to be more reliable and a lot
3761 simpler.  ckuus4.c, 9 Jan 2007.
3762
3763 Back to ttptycmd()...  When we left off, we could send but not receive.  Set
3764 up a test case using Kermit as the external protocol for receiving a short
3765 file.  If I SET STREAMING OFF and use short packets, it actually does work,
3766 so it's not a complete failure to function, but apparently a lack of flow
3767 control for the pty.  Began by completing the parameterization of the pty
3768 module, so it can be called for interactive use (fc 0) or for running
3769 protocols (1).  Confirmed that everything works at least as well as before
3770 (e.g. "set host /pty emacs" vs external protocols).  ckcdeb.h, ckutio.c,
3771 ckupty.c, 9 Jan 2007.
3772
3773 Found in HP-UX "man 7 pty" a description of ioctl(fd,TIOCTTY,fc) which is
3774 exactly what we want: fc 0 turns off all termio processing and guarantees an
3775 ininterrupted, unmolested, flow-controlled stream of bytes in both
3776 directions.  This function also exists in Linux, but not in Solaris, NetBSD,
3777 or Mac OS X (TIOCNOTTY is not what we want, it does something else entirely).
3778
3779 Another possibility is TIOCREMOTE, which "causes input to the pseudoterminal
3780 to be flow controlled and not input edited, regardless of the terminal
3781 mode".  This one exists in at least HPUX, NetBSD, Solaris, and Mac OS X.
3782
3783 Solaris: builds OK, but at runtime we get ENOTTY ("Inappropriate ioctl for
3784 device").  By the time this happens, it's hard to tell from the code whether
3785 the fd we're using is for the master or the slave; TIOCREMOTE can be used
3786 only on the master.  Close inspection shows that I am indeed doing that;
3787 ptyfd as seen by ttptycmd() is truly the master, i.e. the /dev/ptyXX device,
3788 not the /dev/ttyXX device (the slave fd can't be seen at all, as it exists
3789 only in a separate fork).  OK, so now we know that TIOCREMOTE can't be used
3790 on Solaris.
3791
3792 NetBSD: Somehow, whether as a result of today's fiddling or the phase of the
3793 moon, the code in pty_open_slave() that tries to open /dev/tty started
3794 failing on NetBSD ("Device not configured").  Changing it to be run only if
3795 fc == 0 (which doesn't seem to hurt anything), once again I get ENOTTY on
3796 the TIOCREMOTE ioctl.  Zmodem works but Kermit totally fails (the fork exits
3797 immediately with an exit code of 0, even though it didn't do anything).
3798
3799 Mac OS X: Exactly the same sequence and results as NetBSD.
3800
3801 Linux:  It did not execute the new ioctl at all; apparently the TIOC symbols
3802 are hidden or not exported or something.
3803
3804 Where we stand:
3805  . Downloads don't work
3806  . Uploads got slow again
3807  . Kermit doesn't work at all as an external protocol
3808
3809 Actually if I take the debugging out it goes fast, but it doesn't finish.
3810
3811 All today's work on ttptycmd() looks like a dead end.  To roll back to
3812 yesterday:
3813
3814   cp ckutio.c-20070108 ckutio.c
3815   cp ckupty.c-20070108 ckupty.c
3816   cp ckupty.h-20070108 ckupty.h
3817
3818 or to continue with today's:
3819
3820   cp ckutio.c-20070109 ckutio.c
3821   cp ckupty.c-20070109 ckupty.c
3822   cp ckupty.h-20070109 ckupty.h
3823
3824 Comparing Monday's and Tuesday's pty-related code, the differences are:
3825  1. Passing of function code to and among pty modules.
3826  2. Skipping the TIOCSCTTY ioctl and the open("/dev/tty") test.
3827  3. Attempting to put pty in TIOCTTY or TIOCREMOTE mode.
3828
3829 Commenting out 2 and 3 should put us back where we were on Monday if the
3830 parameterization was done right.  And with this, on Solaris, downloading
3831 with Kermit external protocol works but slowly, 8K cps, with or without
3832 debugging.  Debug log does not show any obvious bottlenecks; select() takes
3833 anywhere between no time at all and 0.1 seconds to return.  If I increase
3834 the pty-net buffer size from 1K to 4K, the rate goes up to 55K cps.  If I
3835 make it 8K I get 136K cps.  With 16K I get 346K cps.  32K: 395K cps -- this
3836 last one isn't worth the doubling.  But at 24K I get 490K cps, sometimes
3837 twice that.  Let's stick with 24K for now.  Downloading with Zmodem (rzsz)
3838 works at the same rate, but now we're back to seeing the getty babble
3839 (Several "**B0800000000022d") at the end. 10 Jan 2007.
3840
3841 Moving to Mac OS X, everything works the same as on Solaris, except I don't
3842 get the Zmodem getty babble there, not even with Omen rzsz.  Tested sends
3843 in both remote and local mode, the latter over a secure Kerberos 5 Telnet
3844 connection, using C-Kermit, rzsz, lrzsz, and crzsz, all good.  10 Jan 2007.
3845
3846 Now we're back where we were yesterday morning, but with better throughput.
3847 The big issue then was receiving files.  But yikes, now it works!  Not only
3848 that, I got a transfer rate of 2.1M cps.  That's using Kermit protocol,
3849 streaming, and big (4K) packets.  Which didn't work before.  Not a fluke
3850 either, I uploaded bigger and bigger files up to 6MB, they all went
3851 smoothly, at rates between 1 and 2 MBps.  10 Jan 2007.
3852
3853 Not so great in Zmodem land, however.  If I start the external-protocol
3854 receiver on the far end, escape back and start a Zmodem send... nothing.
3855 If I leave the remote C-Kermit at its prompt (where it supposed to recognize
3856 the Zmodem start string), still nothing.  On the other hand, if I do it
3857 with a script instead of by hand:
3858
3859   def xx output take blah\13, send /proto:zmodem \%1
3860   
3861 it works, at least intermittently.  But that's in remote mode.  We won't be
3862 using this in remote mode.  In local mode, where we have a secure connection
3863 to another computer, it seems we can read from the pty and write to the net,
3864 but we time out waiting to read from the net; nothing arrives.  Well, we
3865 know that i/o works both ways, so there is some kind of screwup with the
3866 Zmodem protocol start itself.  Increasing the (still hardwired timeout) from
3867 5 to 22sec and driving the whole process with a script so as to avoid
3868 autodownload as well as manual dexterity effects...  It just sits there
3869 forever, way longer than 22 sec.  ^C'ing out, I see that sz was indeed
3870 started on the far end and the protocol was executing.  But it looks like
3871 the receiver (the one running under ttptycmd()) is getting trashed packets,
3872 because (a) it seems to be sending the same thing over and over again, and
3873 (b) sometimes it waits as long as 10 seconds before anything arrives from
3874 the remote.  Maybe I was too impatient; I interrupted it after 4 minutes but
3875 it seems to have been making some progress.  Whenever there was data
3876 available to read from the net, it was always 65 bytes, and it was not
3877 actually the same data over and over.  This is using lrz as the external
3878 protocol.  crz gets a bit farther.  In this case we read up to 24K at a
3879 gulp, but the amount varies a lot.  It looks like we took in about 1.2MB of
3880 Zmodem protocol data, but were only able to output the first 20K of the
3881 file.  Clearly there were lots of errors.  In the end, the crz exits with
3882 status 1 (failure).
3883
3884 Anyway it looks like we're back at needing to find a way to accomplish
3885 something like TIOCREMOTE on the pty, which is where we came in.  10 Jan 2007.
3886
3887 Without any way to make the pty transparent and flow controlled, it would
3888 seem to make sense to write to the pty in smaller chunks than we do to the
3889 net.  I left the read-from-pty-write-to-net buffer at 24K and changed the
3890 read-from-net-write-to-pty buffer to 48 bytes.
3891
3892 Upload using lsz worked but took about 3 minutes.  Actually it didn't work.
3893 On the local end it seemed to work, but the file did not appear on the
3894 remote end.  Tried this several times, each time with different results,
3895 adding more debugging each time.  The problem this time was that the pty
3896 read could get EWOULDBLOCK.  Changed the code to not treat this as an error,
3897 now Zmodem uploads are solid again except I never got EWOULDBLOCK again
3898 either, even though I repeated the same upload about 1000 times (with
3899 throughput of over 2MBps even with debugging on), so the test for it has
3900 not been exercised.
3901
3902 OK, uploads still work.  Back to downloading...  The very first pty read
3903 gets 0 bytes, followed by the fork test that shows that it exited with
3904 exit status 2. 
3905
3906 Next we try starting sz with some different options on the far end:
3907
3908  -q: quiet (no messages):
3909      for some reason this gets totally stuck.
3910      it looks as if this option is misdocumented;
3911      sz seems to be sending the letter C (as in Xmodem 1K or whatever)
3912
3913  -e: escape (all control chars):
3914      first attempt to read pty finds the process gone with exit status 2.
3915
3916  -k: send 1k blocks:
3917      this one didn't stop immediately.  It reads 48 bytes from net, writes
3918      48 to the pty with no error.  Then reads 21 bytes from the pty, writes
3919      them to the net OK.  Then reads 48 bytes from net, writes them to pty OK,
3920      reads 21 from pty, writes to net OK, etc etc...  It appears to have
3921      worked but (final read from pty returned 0, fork test showed lrz exited
3922      with status 0), but only 754 bytes were received from the net when the
3923      file is 420K...
3924
3925 Well this only goes to show that the faster we shove stuff into the pty, the
3926 worse it gets.  Zmodem downloads won't work unless we can make the pty
3927 transparent and flow-controlled.  So to summarize today's developments:
3928
3929  . separated in/out buffer sizes
3930  . handled EWOULDBLOCK
3931  . found out that sz options don't help much
3932
3933 11 Jan 2007.
3934
3935 Next day.  This has got to be the most delicate code ever, it's like
3936 Whack-A-Mole, fix A and B pops up.  Even without touching it, something that
3937 worked perfectly a 2:00 doesn't work at all an hour later.  Maybe I could
3938 have used pipes instead of ptys, but pipes have problems of their own.
3939 There has to be a way to do this.  The telnet server, the SSH server, etc --
3940 they all run on ptys, and we can upload files to them with Kermit.  Why?
3941 Because Kermit puts its terminal into all the right modes using the
3942 time-honored methods of ttpkt() and ttvt().  Perhaps all we need is a copy
3943 of ttpkt() that operates on the pty.
3944
3945 On that theory, let's go back to Kermit as the external protocol.
3946 It's important to suppress all messages and displays.  With that,
3947 uploads work fine, no hitches.
3948
3949 Downloads:  We fail right away.  The debug log shows the Kermit program that
3950 we are starting in the pty says:
3951
3952   "" - Invalid command-line option, type "kermit -h" for help.
3953
3954 But of course we are not giving it an invalid command-line option.
3955 Switching to gkermit for the external protocol, now we see that no matter
3956 command-line options we use, we read 0d 0d 0a from the pty and then the
3957 next time we go to read from the pty we get 0 bytes and waitpid() says the
3958 program has exited with status 1.
3959
3960 Why should downloading be different from uploading?  ttptycmd has no idea,
3961 it does everything the same.  The only difference would seem to be which
3962 side sends first, but even that tends to get washed out by each program's
3963 startup messages.
3964
3965 Downloading with Kermit worked 2 days ago, what's different now?  The buffer
3966 sizes.  Putting the net-to-pty back up to 24K (from 48 bytes)...  Now it
3967 works again.
3968
3969 Conclusion: Kermit conditions the pty correctly, Zmodem does not.  Therefore
3970 ttruncmd() must duplicate what ttpkt() does.
3971
3972 Or not.  Because rz works fine on ssh/telnet ptys too.  But not on our pty.
3973 lrz exits immediately with status code 2 = 01000 but there are no clues in
3974 the lrz.c source code, I don't even see this exit status set anywhere.
3975 Unredirecting stderr, I see that the error is "lrz: garbage on command line".
3976
3977 Why do both Kermit and Zmodem sometimes think they are receiving an invalid
3978 command line?  If I could capture the garbage...
3979
3980 Side trip #1: ("pty.log",O_WRONLY) gives "no such file or directory".
3981 Changed this to ("pty.log",O_CREAT,0644) and now it doesn't get an error,
3982 and it creates the file, but not with 0644 permissions, and with nothing
3983 written in it.  How come nothing works?
3984
3985 Fine, the debug log shows that ttptycmd() receives the correct string
3986 (e.g. "lrz -v").  It passes it to do_pty() correctly, and do_pty() passes it
3987 to exec_cmd(), which runs cksplit() on it, coming up (in this case) with
3988 "lrz" and "-v", which is right, and then:
3989
3990     args = q->a_head + 1;
3991     execvp(args[0],args);
3992
3993 execvp() wants the args array to have a null element at the end.  cksplit()
3994 does indeed do that, or at least the code is there.  Added code to exec_cmd()
3995 to verify the argument list and that it is null-terminated.  So far it is.
3996
3997 Anyway, we have traffic between the Zmodem partners, but no joy.
3998 Commenting out the bit that redirects stderr, now I can see it on my screen
3999 in real time:
4000
4001   lrz waiting to receive.Retry 0: Bad CRC
4002   Retry 0: Got ERROR
4003   Retry 0: TIMEOUT
4004   Retry 0: TIMEOUT
4005   Retry 0: TIMEOUT
4006   Retry 0: TIMEOUT
4007
4008 etc etc, forever.  Trying sz -e on the far end, I get:
4009
4010   Retry 0: Bad CRC
4011   Retry 0: Garbage count exceeded
4012   Retry 0: Garbage count exceeded
4013   Retry 0: Garbage count exceeded
4014   Retry 0: Garbage count exceeded
4015   Retry 0: Garbage count exceeded
4016   Retry 0: Garbage count exceeded
4017   Retry 0: Garbage count exceeded
4018   ...
4019   Retry 0: Got ERROR
4020   Retry 0: Bad CRC
4021   Retry 0: Got ERROR
4022   Retry 0: Got ERROR
4023   lrz: xxufio.c removed.
4024
4025 So apparently it's not a matter of escaping.  Trying some other stuff, I
4026 caught the command-line problem in the act:
4027
4028   lrz: garbage on commandline
4029   Try `lrz --help' for more information.
4030
4031 Debug log shows:
4032
4033   cksplit result[lrz]=1
4034   cksplit result[-v]=2
4035   exec_cmd arg[lrz]=0
4036   exec_cmd arg[-v]=1
4037   exec_cmd arg[]=2
4038
4039 An empty string at the end instead of a null pointer.  I really do not see
4040 any way that could happen, but rather than dig into cksplit() again after
4041 all these years I added a test for this in exec_cmd(), which, of course
4042 after adding it, never encountered this behavior again.
4043
4044 Fiddled with pty buffer size again.  Made it 512 bytes instead of 24K.
4045 Zmodem downloads are the same (Rety 0: TIMEOUT, over and over).  But I don't
4046 see what the problem is -- every time we receive n bytes from the net, we
4047 write n bytes successfully to the pty and there are no errors.  But it also
4048 looks like the remote sender is sending the file header over and over
4049 because it's not receiving an acknowledgment.  If we're not losing data,
4050 then maybe it's a transparency problem.
4051
4052 Tried uncommenting the TIOCblah stuff I commented out before.  Now instead
4053 of only timeouts I get:
4054
4055   lrz waiting to receive.Retry 0: Bad CRC
4056   Retry 0: Got ERROR
4057   Retry 0: Bad CRC
4058   Retry 0: Got ERROR
4059   Retry 0: Bad CRC
4060   Retry 0: Got ERROR
4061   Retry 0: TIMEOUT
4062
4063 which is odd because the TIOCREMOTE ioctl failed with errno 14, EFAULT,
4064 bad address, which should indicate it had no effect.  We're still receiving
4065 data from the remote in tiny chunks (from 12 to 65 bytes), apparently the
4066 same stuff (file header), and writing them to the pty successfully but
4067 nothing...
4068
4069 Looked at cloning ttpkt() for the pty, but these stupid routines use global
4070 tty mode structs so it's not going to be easy.
4071
4072 Well, we got exactly nowhere today, but I think I'll leave stderr as it is
4073 so users will see some feedback; no reason not to.
4074
4075 WHY DO KERMIT DOWNLOADS WORK AND ZMODEM NOT?
4076
4077 Is it 8-bit transparency?  Up til now I've been testing with text files.
4078 If I try to download a binary what happens?  Fails after 99 seconds.  Packet
4079 log from the far end shows that as soon as the first packet containing 8-bit
4080 data is sent, everything stops.  At least I got one of these:
4081
4082   17:23:56.475 exec_cmd arg[gkermit]=0
4083   17:23:56.475 exec_cmd arg[-qr]=1
4084   17:23:56.475 exec_cmd arg[]=2
4085   17:23:56.475 exec_cmd SUBSTITUTING NULL=2  <-- the code I just added
4086
4087 Doing this again shows the same thing on the near end.  All the 7-bit-only
4088 packets are sent and acknowledged OK.  Three 8-bit data packets arrive and
4089 nothing else happens after that.  This is with G-Kermit.
4090
4091 The same thing happens with C-Kermit receiving.  But if I change C-Kermit's
4092 .kermrc to turn off streaming and use a short packet length:
4093
4094 The transfer works, even though it's sending 8-bit bytes.  So the problem is
4095 not 8-bit data after all, per se.  Facts:
4096
4097  . Kermit can receive streaming transfers of 7-bit files.
4098  . Kermit can not receive streaming transfers of 8-bit files.
4099  . Kermit can receive nonstreaming transfers of 8-bit files with short packets.
4100  . Kermit can receive nonstreaming transfers of 8-bit files with 1K packets.
4101  . Kermit can receive nonstreaming transfers of 8-bit files with 4K packets.
4102
4103 So it's the combination of streaming and 8-bit data?  12 Jan 2007.
4104
4105 As a test I made a new routine pty_make_raw() that does cfmakeraw() (a
4106 nonportable "POSIX-like" function known to be used on ptys in applications
4107 that do approximately what we're attempting).  Results:
4108
4109  Solaris: errno 25 - inappropriate ioctl for device.
4110
4111 This happens even when we try to get the terminal modes with tcgetattr(),
4112 which is completely nuts.  We pass it the file descriptor of the pty master,
4113 which is supposed to work.  But in Mac OS X, there are no errors.  But
4114 downloads still don't work; lots of errors but the pattern is different.
4115 Using a very small buffer:
4116
4117   Retry 0: Bad CRC
4118   Retry 0: Garbage count exceeded
4119   Retry 0: Garbage count exceeded
4120   Retry 0: Got TIMEOUT
4121   Retry 0: TIMEOUT
4122   Retry 0: Bad CRC
4123   Retry 0: Bad CRC
4124   Retry 0: Garbage count exceeded
4125   Retry 0: Garbage count exceeded
4126   Retry 0: TIMEOUT
4127   Retry 0: Got ERROR
4128   Retry 0: TIMEOUT
4129   Retry 0: Garbage count exceeded
4130   Retry 0: Garbage count exceeded
4131   Retry 0: Bad CRC
4132
4133 Using a bigger buffer:
4134
4135   Retry 0: Garbage count exceeded
4136   Retry 0: Garbage count exceeded
4137   Retry 0: Garbage count exceeded
4138   Retry 0: Garbage count exceeded
4139   Retry 0: Garbage count exceeded
4140   Retry 0: Garbage count exceeded
4141   (several screensful)
4142
4143 Various other combinations... Nothing seems to work.
4144
4145 Insight: telnetd does exactly what we want to do, sort of.
4146 But it uses TIOCPKT, so every time it reads from pty, it receives
4147 one control byte and then the data bytes, which would complicate our
4148 buffering scheme considerably.  Anyway the TIOCPKT ioctl() fails on
4149 Mac OS X with 14 "Bad address".
4150
4151 Also see: snoopserver.c (found in Google).  It seems to do things in a
4152 slightly different way -- it sets stdout to raw and then dups it to the
4153 slave side of the pty?
4154
4155 Maybe it's a mistake to use the ckupty.c routines.  They are designed for
4156 creating and accessing an interactive session.  Maybe just copy one of the
4157 other programs.
4158
4159 18 Jan 2007.  Tried going back to blocking rather than nonblocking reads
4160 to see if it would make a difference, after all the other changes.  Nope.
4161 OK, let's look at some of these other programs...
4162
4163 snoopserver.c.  I don't know exactly what this is or where it's from or what
4164 platform it runs on and there are no comments to speak of, but it does
4165 approximately what ttptycmd() does.  To get a pty it uses openpty():
4166
4167   if (openpty(&pty, &tty, NULL, NULL, NULL) == -1)
4168
4169 then creates a fork.  In the fork, it closes the pty (master) and
4170 manipulates the modes of the tty (slave), dups tty to be stdio, and then
4171 doex execv() on the command.  Meanwhile the upper fork closes the tty
4172 (slave), gets the attributes of stdin, using atexit() to have them
4173 automatically restored on exit.  Then it sets stdin to raw mode and enters
4174 the select() loop on stdin, the pty master, and the net.  It uses regular
4175 blocking reads.  It does not use TIOCPKT or anything like it.
4176
4177 openpty() is supported on: Linux, Mac OS X, NetBSD, FreeBSD, ...
4178 openpty() is NOT supported on: Solaris, HP-UX, ...
4179
4180  1. Try copying the pty code, but keep everything else the same.
4181
4182 I did this; it compiles and starts OK, upper fork (ttptycmd) debug log shows
4183 no errors, but nothing happens.  Logs show that the Kermit program that is
4184 started in the subfork seems to die as soon as it reaches eof on its init
4185 file.  The good news, at least, is that select() doesn't report report that
4186 the pty is ready to be read.  Clearly the file descriptors aren't being
4187 assigned as expected, or as before.
4188   
4189 In ckupty.c getptyslave() dup2's the slave fd to 0 and 1.  The new code
4190 does exactly the same thing.  Debug log makes it look like the forked kermit
4191 is not receiving its command line.  But now I'm not even sure that the
4192 forked kermit started at all.  ps from another terminal doesn't show it.
4193
4194 19 Jan 2007: Noticed that in snoopserver, the select() calls use standard
4195 input and output file descriptors, rather than the pty master.  Made that
4196 change...  In doing that I had to look at every file descriptor in every
4197 line of code and discovered a couple mistakes, fixed them, put back the
4198 original code but with the fixes, tried it, but no change; can upload OK but
4199 still can't download with Zmodem without lots of errors and ultimate
4200 failure.  Going back to the alternative version and trying to get the the
4201 file descriptors sorted out, now it appears that the external Kermit program
4202 never even starts in the lower fork.  After a bit more fiddling I sort that
4203 out, but now when the lower Kermit program goes to open "/dev/tty" it gets
4204 errno 6 "Device not configured".  Forcing it to use stdio with "-l 0", it
4205 gets past this and actually sends its first packet.  But the Kermit on top
4206 reads nothing from the pty.
4207
4208 Next, I change the pty fd from STDIN_FILENO and STDOUT_FILENO to slavefd.
4209 No difference.  Next I comment out the dup2() calls.  This time I get some
4210 action.  The transfer starts, but only one packet comes.  Log shows that
4211 the lower Kermit sends its S packet.  The upper Kermit receives the ACK
4212 but the lower Kermit never gets it.  The write to the pty succeeds, no
4213 error.  Different combinations give different results.  If write to master
4214 and read from the slave, I get packets in both directions but tons of
4215 errors....  This happens only if I comment out the dup2()'s.
4216
4217 25 Jan 2007: After leaving it sit for a while, and realizing that what I'm
4218 trying to do has to be possible because so much other software does the same
4219 thing (e.g. Telnet servers), I put things back to how they were originally
4220 -- the upper fork (Kermit) uses the master and the lower fork the slave.
4221 The upper fork puts the master in raw mode, the lower fork puts the slave in
4222 raw mode.  The lower fork dup2's the slave fd to stdin/out.  Send file in
4223 remote mode using external Kermit: works OK but select() times out at the
4224 end.  This means that the self-contained pty code in ttptycmd() is sorted
4225 out -- all the file descriptors go to the right place, etc, and now we can
4226 use this routine as a testbed, rather than the original ckupty.c-based one.
4227
4228 But send with lsz, csz, and regular rz: Nothing happens, times out after 0
4229 bytes of i/o.  Once again, Kermit works, Zmodem doesn't.  The reason for
4230 running Zmodem in a pty is so its i/o will work as it does on a terminal,
4231 no matter how it may fiddle the file descriptors.  So why don't we see a
4232 single byte come out?
4233
4234 Commenting out pty_make_raw(), I get a successful Zmodem send using lsz.
4235 csz manages to get the filename across, but then gets stuck.  regular sz, on
4236 the other hand, works perfectly.  Testing csz by itself (not under Kermit),
4237 I see it fails in exactly the same way ("Got phony ZEOF", etc).  OK, forget
4238 crzsz.
4239
4240 OK, let's move to local mode over a Kerberized Telnet connection...
4241 Uploading (sending) with external Kermit protocol... works.
4242 Downloading (receiving) with external Kermit protocol... works.
4243 Uploading with sz... works.
4244 Downloading with lrz...  Gets tons of errors and fails.
4245
4246 Running pty_make_raw() on the slave but not on the master: no difference.
4247 Running pty_make_raw() on the master but not on the slave: no difference.
4248
4249 Back where we started...  Either:
4250
4251  . Zmodem is overdriving the pty, no matter what modes we put it in.  
4252  . It's a transparency problem.
4253
4254 Theoretically we should be able to test these by using different sz switches:
4255   -q:    quiet (should always use this)
4256   -e:    escape all control characters
4257   -B n:  Buffer n bytes (rather than whole file)
4258   -L n:  Packet length
4259   -l n:  Frame length (>= packet length)
4260   -w n:  Window size
4261   -4:    4K blocksize (doesn't help)
4262
4263 -q by itself doesn't help.
4264 -q -e, this one worked but still got about 100 errors and was very slow.
4265 -q -e -l 200 -L 100, failed fast and bad.
4266 -q -e -w 1.  Failed quickly.
4267 -q -e -w 1 -B 100.  Eventually failed.
4268 -q -w 1, Eventually failed.
4269 -q -l 1024, this gets much more errors, definitely need -e.
4270 -q -e -l 1024, got pretty far before failing.
4271 -q -e -w 1 -l 1024, also got pretty far before failing.
4272 -q -e, this one got farthest of all, about 48K, before getting errors.
4273
4274 In the latter combinations that work somewhat better, we always get up to
4275 16K, or 32K, or 48K, before the errors start coming out and piling up.
4276 Sometimes the errors are recoverable and we receive as much as 300K
4277 successfully before giving up.
4278
4279 Now that we have data flowing pretty well (but not well enough), tried
4280 reinstating pty_make_raw(), but it hurt more than helped.
4281
4282 As a sanity check, I tried transferring from the same host over the same
4283 kind of connection (Kerberized Telnet) directly to K95's built-in Zmodem
4284 protocol, and that worked fine.  So the problem is definitely in the pty.
4285 Or more precisely, where Kermit writes incoming net data to the pty master.
4286
4287 26 Jan 2007: Tried changing the size of the net-to-pty buffer from 24K to
4288 1K.  Result: total failure.  Set both buffers to 1K.  Still total failure.
4289 Set both to 4K: now we get about 45K of data, then failure.  Put them both
4290 back to 24K, still fails totally -- the same code that worked pretty well
4291 yesterday.  Actually, no downloads work, not even Kermit, not even of
4292 text files.
4293
4294 27 Jan 2007: Since I have not been able to find a way to make ptys work for
4295 this, I made a third copy of this routine, this time using pipes instead of
4296 ptys.  The disadvantage here is that if the external protocol does not use
4297 stdio, the pipes won't work, but one thing a time...
4298
4299 Inferior Kermit starts in lower fork, but when it tries to send its first
4300 packet it gets errno=9 EBADF, Bad File Descriptor.  Substituting G-Kermit as
4301 the external protocol, which is simpler, reveals that the problem is that
4302 the external protocol gets errors when it tries to manipulate the its stdio
4303 file descriptors with ioctls, etc; these are not valid for a pipe.  The pipe
4304 mechanism itself works.  If I take out the test for ttpkt() failing in
4305 gkermit, the file transfer works OK.  Trying Zmodem... Sending works OK;
4306 receiving works a lot better than with ptys (it got 360K into the file
4307 before failing).  Making the buffers smaller, doesn't help.
4308
4309 I'm starting to wonder if the problem might be in my buffering code, rather
4310 than in the pty or pipe interface...  Try making a version that does
4311 single-character reads and writes.
4312
4313 This one reads the first packet from the lower Kermit and sends it.  It is
4314 recognized by the other Kermit, which sends an ACK.  We see the ^A of the
4315 ACK, but then select() times out on the next character -- OF COURSE: because
4316 at a lower level, it has already been read.  We have to check the myread
4317 buffer, and then call select() only if it's empty.  Making this change:
4318
4319  . SEND with G-Kermit works (but very slowly).
4320  . SEND with lsz works but gets a lot of errors, eventually succeeds.
4321
4322 Let's work our way back...  With the same changes to the buffered pipe version:
4323
4324  . SEND with G-Kermit/streaming works (fast).
4325  . SEND with lsz works too (fast), but we get gubbish at the end.
4326  . RECEIVE with Kermit fails because "/dev/tty is not a terminal device".
4327  . RECEIVE with rsz... lots of errors ("garbage count exceeded") but succeeded.
4328
4329 But maybe now we're seeing pipe artifacts, so going back one more step to
4330 the version that gets its own pty and starts its own fork:
4331
4332  . SEND with G-Kermit/Streaming works (fast) but select() times out at the end.
4333
4334 Another breakthrough: Moved the write pieces to below the read pieces.  This
4335 is what was preventing the buffer reset code from working -- with the writes
4336 done before the reads, we never catch up and can never reset the buffers.
4337
4338  . SEND with G-Kermit/streaming works (fast) (but there's a pause at the end)
4339  . SEND with lsz works (fast) (but there's a pause at the end)
4340  . RECEIVE with rsz... lots of errors ("garbage count exceeded") and fails.
4341  . RECEIVE with Kermit -- nothing happens (it thinks it succeeded), then we
4342      reconnect, terminal sees S packet and goes into autodownload
4343
4344 From the log it looks like ttpkt() fails in the lower Kermit.  Switching
4345 this with the hacked G-Kermit...  it gets "transmission error on reliable
4346 link".  Tried again with real Kermit below, this time with "-l 0" and not
4347 streaming.  This was actually working, but slowly, I don't see any NAKs in
4348 the packet log, but then select() timed out.
4349
4350 28 Jan 2007: Restored both the calls to pty_make_raw():
4351
4352  . SEND with C-Kermit streaming works, but slow (54Kcps)
4353  . Ditto, but with debugging off -- hangs forever.
4354  . Ditto, but using G-Kermit instead of C-Kermit -- also hangs forever.
4355
4356 Backed off on calling pty_make_raw().  Same thing.
4357 Reduced size of net-to-pty buffer.  Same thing.
4358
4359 15 Feb 2007...  Decided to give up on this and publish it as is, in hopes
4360 that somebody with more experience with ptys can make it work, because I'm
4361 just going in circles.  So today I just have to get the code into shape so
4362 people could choose among the three alternative routines.  The second one,
4363 yttyptycmd(), is the one that uses openpty(), which is not portable, so it
4364 can be enabled only for Mac OS X, NetBSD, FreeBSD, and Linux, or by also
4365 defining HAVE_OPENTPY at compile time.  Anyway, if you build Kermit in the
4366 normal way, you get the regular behavior -- ttruncmd() is used to execute
4367 external protocols.  If you build it with -DXTTPTYCMD, you get the first
4368 version of ttptycmd(); with -DYTTPTYCMD the second, and with -DZTTPTYCMD the
4369 third.
4370
4371 (Then some interruptions, then...)
4372
4373 From Jeff, fix hostname comparison in X.509 certificate checking to work
4374 right in the case of names that contain no periods.  dNSName_cmp(): cl_ssl.c,
4375 21 Feb 2007.
4376
4377 John Dunlap noticed some strange behavior when transferring files between
4378 home base and the EM-APEX oceanographic floats via satellite... long story,
4379 but every so often the transfer would get stuck for a long time, and it
4380 happened only when C-Kermit was sending a file and received two or more
4381 packets (Ack or Nak) back to back from the float.  Years ago I added some
4382 lookahead code to ttinl() to clear the input buffer of any interpacket junk
4383 so that, in the windowing case, we wouldn't be tricked next time around into
4384 thinking a packet was waiting to be read when there wasn't.  The code, which
4385 has been there for a while, was a bit fractured; luckily, it would be
4386 executed only when the debug log was active so it didn't have much effect.
4387 The problem was that if the SOP came immediately after the EOP, it could be
4388 missed because the loop read the next character before checking the current
4389 one.  Fixed by rearranging the loop.  Also I changed it so it would execute
4390 in all cases, not only when the debug log was active.  Also, cleaned up a
4391 bunch of confusing #ifdefs and removed some chunks that had been commented
4392 out for years, decades maybe.  ttinl(): ckutio.c, 21-22 Feb 2007.
4393
4394 Added NOW keyword info to HELP DATE, plus a tip about how to convert to UTC;
4395 suggested by Arthur Marsh.  ckuus2.c, 22 Feb 2007.
4396
4397 When an FTP client sends NLST to the server and no matching files are found,
4398 the server is supposed to respond with an error message on the control
4399 channel and nothing on the data channel.  However it seems that at least one
4400 server sends the error message back on the data channel, as if it were a
4401 filename ("/bin/ls: blah: No such file or directory"), and on the control
4402 channel there is no error indication ("226 ASCII Transfer complete").  At
4403 this point remote_files() has a listfile and, if a match pattern was given,
4404 it looks through list to see if any of the lines match the given filename,
4405 e.g. "blah".  This makes FTP CHECK give false positives.  The problem
4406 (diagnosed by Jeff) is that the match pattern was not given in this case, so
4407 it takes some random default action, resulting in the spurious success
4408 return.  Fixed by using the user's string as the pattern.  Not tested,
4409 however, since I don't have access to a server that behaves this way.
4410 ckcftp.c, 22 Feb 2007.
4411
4412 If an external-protocol file transfer fails, don't print Kermit-specific
4413 hints.  ckuus5.c, 22 Feb 2007.
4414
4415 One more time with ttinl().  Got rid of the "csave" junk, which never could
4416 have worked (which is no doubt why it was in a debugging section).  The
4417 problem was that saving the beginning of the next packet locally did not
4418 synchronize with the buffer clearing (ttflui()) done at a higher level,
4419 between calls to ttinl().  So now, the lookahead code, if it finds the
4420 beginning an as-yet unread packet, puts it back at the head of the input
4421 queue.  This way, if the protocol engine clears the input buffer, it will
4422 get the whole packet, not just the part after the SOH.  ckutio.c, 24 Feb 2007.
4423
4424 From Steven M Schweda, Saint Paul, MN: adaptation of large file support to
4425 VMS (it was already possible to transfer large files in VMS C-Kermit but the
4426 file-transfer display and statistics were wrong).  And a minimal adaptation
4427 of the FTP client to VMS -- no RMS, no special VMS file stuff, Stream_LF and
4428 binary files only, developed and tested only with UCX.  SSL/TLS is
4429 supported.  The source-code changes are minimal; most have nothing to do
4430 with VMS, but with header files, prototypes, and data types (e.g. ftp_port
4431 int rather than short, various signed/unsigned conflicts) to shut up
4432 compiler warnings.  Some of these could be dangerous in terms of
4433 portability; I've marked them with /* SMS 2007/02/15 */.  ckcfns.c,
4434 ckcnet.h, ck_ssl.h, ckuus3.c, ckuus4.c, ckvfio.c, ckcftp.c, ckvker.mms
4435 (which was rewritten to actually reflect the source module dependencies),
4436 ckvker.com (also heavily modified).  ckvker.com (the "makefile" for VMS
4437 C-Kermit) now indludes "F" and "I" option flags for the large File and
4438 Internal ftp features, plus better handling of Vax/Alpha/IA64 distinction.
4439 26 Feb 2007.
4440
4441 Changed NetBSD targets to include -DHAVE_OPENPTY and -lutil, so they
4442 can use openpty().  makefile, 26 Feb 2007.
4443
4444 Built on Solaris without and with SSL OK.
4445 Built on NetBSD with Kerberos 5, OK.
4446 Built on Mac OS X 10.4, regular version, OK.
4447 Built on Mac OS X 10.4 with SSL and Kerberos 5, OK.
4448
4449 On VMS 7.2-1/Alpha with MultiNet 4.4A-X...
4450
4451 'CC' 'CCOPT' KSP:ckuus3
4452 %DCL-W-TKNOVF, command element is too long - shorten
4453  \CKUUS4.OBJ "'CC' 'CCOPT' KSP:ckuus4" "KSP:ckuus4.c KSP:ckcsym.h KSP:ckcdeb.h
4454  KSP:ckclib.h" "KSP:ckcasc.h KSP:ckcker.h KSP:ckcnet.h KSP:ckvioc.h"
4455 "KSP:ckctel.h KSP:ckuusr.h KSP:ckucmd.h KSP:ckuver.h" "KSP:ckcxla.h
4456  KSP:ckuxla.h KSP:ckcuni.h KSP:ckuath.h"
4457
4458 The new rule for ckuus4.c was too long.  I removed one file from the
4459 dependency list (ckcxla.h, which will probably never change again) and that
4460 made it OK.  Built Nonet and Net versions OK, but this is without the new
4461 stuff.
4462
4463 "make f" (large-file support) on VMS 7.2-1...
4464 'CC' 'CCOPT' KSP:ckuus4
4465                     if (CKFSEEK(fp,(CK_OFF_T)j,SEEK_CUR) != 0) {
4466 ........................^
4467 %CC-I-IMPLICITFUNC, In this statement, the identifier "fseeko" is implicitly
4468 declared as a function.
4469
4470 Ditto for ftello and fseeko in various other places, and then fseeko and
4471 ftello come up up undefined at link time.
4472
4473 The rule for ckcftp in "make i" (Internal FTP support) had the same problem.
4474 I removed ckcxla.h from its dependency list too, but "utime" comes up
4475 undeclared at compile time and undefined at link time.
4476
4477 Verdict: neither one of the two new features can be used in VMS 7.2 or
4478 earlier, but the code still builds OK if you don't ask for them.
4479
4480 VMS 8.3 on IA64...  Can't build anything:
4481 %MMS-F-BADTARG, Specified target (WERMIT) does not exist in description file
4482
4483 27 Feb 2007: Changed CKVKER.COM to keep all its dependencies but use a
4484 shorter logical name (Steven M Schweda).  The problem on VMS 8.3 is that MMS
4485 now supports case-sensitive file systems, and so it can't find anything.
4486 Workaround: bypass MMS (include "m" in P1).  With this, "@ckvker.com ifm"
4487 builds OK on HP Testdrive, but I can't test the new features since outbound
4488 connections are not allowed there.  As for fseeko(), ftello(), and utime(),
4489 they simply are not availble prior to VMS 7.3.  It would probably be a good
4490 idea to test for this in CKVKER.COM, but actually it is possible to install
4491 newer C's and CRTLs on older VMS versions, so don't stand in their way.
4492
4493 28 Feb 2007: With additional chages from SMS, and then some further
4494 adjustments, I was able to build the FTP version on VMS 7.2-1.  First I
4495 tested it with GET of a binary file, but it transferred it in text mode.
4496 After a few more attempts with PUT and GET, it crashed with "floating/decimal
4497 divide by zero" in ckscreen, ckuusx.c line 27859.  Of course, that's the
4498 listing line, not the source line, and I don't have a listing.
4499
4500 To get a listing, I deleted CKUUSX.OBJ and then did:
4501
4502   $ make i "" "" "/LIST"
4503
4504 Surprisingly, it recompiled everything.
4505
4506 Anyway, the divide by zero happened in a section of code where the divisor
4507 was not checked, but it was a section of code we should not have been
4508 executing at all, since the file-transfer display was fullscreen, and this
4509 was in the "brief" section.  Anyway, I added the needed check.  Again, it
4510 recompiles everything.  Maybe there's no MMS on grumpy -- right, there isn't.
4511
4512 ANYWAY... Try to GET a binary file like this:
4513
4514   binary
4515   ---> TYPE I
4516   200 Type set to I.
4517   get gkermit
4518   ---> TYPE A
4519   200 Type set to A.
4520   ---> SIZE gkermit
4521   550 gkermit: file too large for SIZE.
4522   GET gkermit (text) (-1 bytes)---> TYPE A
4523
4524 Anyway... "get /binary gkermit" downloads it, seemingly correctly (the byte
4525 count is right).
4526
4527 But "put /binary gkermit.;1" results in a 0-length GKERMIT file being sent.
4528 Here's the debug log:
4529
4530 FTP PUT gnfile[DISK$MSA4:[C.FDC.NET]gkermit.;1]=1
4531 ftp putfile flg[DISK$MSA4:[C.FDC.NET]gkermit.;1]=0
4532 zltor fncnv[DISK$MSA4:[C.FDC.NET]gkermit.;1]=-1
4533 FTP PUT nzltor[GKERMIT]
4534 zfnqfp 1[DISK$MSA4:[C.FDC.NET]gkermit.;1]=675
4535 zfnqfp 2[DISK$MSA4:[C.FDC.NET]GKERMIT.;1]=31
4536 zfnqfp 3[DISK$MSA4:[C.FDC.NET]GKERMIT.;1]=31
4537 zrelnam result 2[gkermit.;1]
4538 ftp sendrequest restart[DISK$MSA4:[C.FDC.NET]gkermit.;1]=0
4539 openi name[DISK$MSA4:[C.FDC.NET]gkermit.;1]
4540 openi sndsrc=-1
4541 openi file number=2
4542 zopeni[DISK$MSA4:[C.FDC.NET]gkermit.;1]=2
4543 zopeni fp=0
4544 chkfn=2
4545 chkfn return=0
4546 zopeni fixed file format - using blk I/O
4547 zopeni binary flag at open=1
4548 zopeni ifile_bmode=1
4549 zopeni binary=1
4550 zopeni RMS operations completed ok
4551 openi zopeni 1[DISK$MSA4:[C.FDC.NET]gkermit.;1]=1
4552 ftpcmd cmd[PASV]
4553 FTP SENT [PASV]
4554 FTP RCVD [227 Entering Passive Mode (166,84,1,2,233,216)]
4555 initconn connect ok
4556 FTP SENT [STOR GKERMIT]
4557 FTP RCVD [150 Opening BINARY mode data connection for 'GKERMIT'.]
4558 doftpsend2 ftpcode[STOR]=150
4559
4560   Here is where the file is supposed to be read and sent but there is nothing
4561   in the log between the "doftpsend2 ftpcode" line and the following line.
4562
4563 rftimer status=1
4564 gftimer status 1=1
4565 gftimer status 2=1409025
4566 gftimer status 3=1409025
4567 gftimer s[0.000000]
4568 zclose n=2
4569 chkfn=2
4570 chkfn return=1
4571 zclose ZIFILE RMS operations completed ok
4572 ftp getreply lcs=0
4573 ftp getreply rcs=-1
4574 ftp getreply fc=0
4575 FTP RCVD [226 Transfer complete.]
4576 ftp getreply[226 Transfer complete.]=2
4577 doftpsend2 ok=0
4578
4579 Everything is OK up until we go to send the file, then it behaves as if we
4580 got EOF immediately and so closes the data connection, and reports success;
4581 an empty copy of the file is left on the far end.
4582
4583 Starting over with a text file....  PUT LOGIN.COM gets another divide by
4584 zero.  But it happened in the code I just fixed, which is impossible.  Swell.
4585 I recompiled everything and this time the upload worked, and downloading it
4586 again worked too.
4587
4588 But a binary file still can't be uploaded.  Trying to upload a text file
4589 after doing this seems to succeed (reports the right number of bytes sent)
4590 but nothing appears on the far side.
4591
4592 SUMMARY:
4593
4594   To download a text file: GET /ASCII blah.txt    (/ASCII is optional)
4595   To download a binary file: GET /BINARY blah.bin (/BINARY is required)
4596   To upload a text file: PUT blah.txt             (/ASCII switch not needed)
4597   To upload a binary file: PUT /BINARY blah.bin   (doesn't work)
4598
4599 Problems:
4600   . Why doesn't BINARY "stick"?
4601   . Why don't binary uploads work?
4602
4603 The culprit seems to be the VMS version of zxin().  In the FTP module,
4604 zxin() is called only when sending binary files.  In VMS, zxin() is just
4605 a front end for C-Library fread().  It probably needs to do just do
4606 zminchar() in a loop, like binary mode does, but calling zzout instead
4607 of xxout.  Or something like that.  FINISH THIS TOMORROW (debug on grumpy).
4608
4609 2 Mar 2007: New logs from John Dunlap.
4610
4611 ema-1636-log-0175.dbg: C-Kermit uploads a short file. It receives an Ack for
4612 the Z packet it just sent, tailgated by the beginning of a Nak for the next
4613 packet.  When the second SOH is encountered, it is put back in the myread
4614 queue.  Then the protocol engine, to which we return the Ack, says, "I have
4615 the packet I wanted so I'm clearing the buffer", and away go the first two
4616 bytes of the Nak from the myread buffer.  Then, having just received the Ack
4617 of our Z packet, we send our B, and go to read the reply.  in_chk finds 0 in
4618 the myread buffer (which we just cleared) and 6 waiting to be read from the
4619 comms channel, which it does, obtaining the remaining 6 bytes of the Nak,
4620 which it properly discards.  (The reason this is proper is that, having
4621 already received the Ack for the last packet it sent, no Ack or Nak that
4622 arrives subsequently -- in the non-windowing case -- could possibly affect
4623 what it does next.)  Since it hasn't yet found a good packet, it keeps
4624 reading, and now it finds the Ack to the B, as soon as it showed up.  This
4625 is how it's supposed to work.  No time was lost because of anything that
4626 C-Kermit did.
4627
4628 ema-1636-log-0174.dbg: C-Kermit uploads a short file. It sends Data packet
4629 #3 and receives the Ack followed immediately by the first 3 bytes of a Nak
4630 for packet 4.  When it gets to the SOH of the second packet, it pushes it
4631 back in the queue.  Again, input() flushes the input buffer (myread queue
4632 and device buffer).  C-Kermit detects EOF on the file it is sending, and
4633 sends the Z packet.  Then it reads the remaining bytes of the Nak,
4634 which it discards, and then it finds the Ack for Z which comes in 23 seconds
4635 later, sends the B, gets a Nak for the B, sends the B again, gets the Ack
4636 for the B 4 seconds later, and done.  Again, it's working right and losing
4637 no time.
4638
4639 The question remains: what would happen if the protocol engine did not clear
4640 the buffer?  Would ttinl() retrieve all packets in sequence even when they
4641 come back to back?  To test this, I had C-Kermit send a file using 30 window
4642 slots and observed the stream of Acks in the reverse direction:
4643
4644   HEXDUMP: mygetbuf read (16 bytes)
4645   01 25 23 59 2f 52 39 0d | 01 25 24 59 2b 26 31 0d  .%#Y/R9. .%$Y+&1.
4646   ttinl lookahead my_count=9
4647   ttinl lookahead removed=^M
4648   ttinl lookahead pushback SOP=^A
4649   HEXDUMP: ttinl got (7 bytes)
4650   01 25 23 59 2f 52 39    |                          .%#Y/R9
4651   RECEIVE BUFFERS:
4652   buffer inuse address length data type seq flag retries
4653      0     1     29212 9667     0   Y    3     0
4654   [\ 1%#Y]
4655   ...
4656   in_chk my_count=8
4657   ...
4658   ttinl lookahead my_count=1
4659   ttinl lookahead removed=^M
4660   HEXDUMP: ttinl got (7 bytes)
4661   01 25 24 59 2b 26 31    |                          .%$Y+&1
4662   RECEIVE BUFFERS:
4663   buffer inuse address length data type seq flag retries
4664      0     1     29212 9667     0   Y    4     0
4665   [\ 1%$Y]
4666
4667 Here we can see that the pushed-back SOH was properly retrieved next time
4668 around, and the tailgating Ack was not lost.  This scenario repeats itself
4669 212 times in the log, and there are no screwups.
4670
4671 Back to VMS FTP...  The problem with sending binary files is that zxin()
4672 uses C-Library fopen()/fread() instead of RMS, so it can't access the input
4673 file, which was opened by zopeni(), which is totally RMS-ified in VMS
4674 C-Kermit.  For VMS only, I replaced the zxin() loop by a zminchar() loop
4675 like the one used in text mode, except without the character set or
4676 record-format conversion.  Tested by PUT /BINARY of some binary files, which
4677 worked fine.  ckcftp.c, 2 Mar 2007.
4678
4679 Next problem...  VMS C-Kermit ftp client sending binary files in text mode.
4680 Variation 1: We just send the file.  zopeni() is supposed to detect that
4681 it's a binary file and automatically set the mode.  And it does:
4682
4683   zopeni fixed file format - using blk I/O
4684   zopeni binary flag at open=0
4685   zopeni ifile_bmode=1
4686   zopeni binary=0
4687   zopeni autoswitch from TEXT to BINARY
4688   zopeni RMS operations completed ok
4689
4690 but then in gnfile():
4691
4692   if (!server || (server && ((whatru & WMI_FLAG) == 0)))
4693     binary = gnf_binary;        /* Restore prevailing transfer mode */
4694
4695 Well, since VMS sets text/binary mode automatically when sending files,
4696 this code can (and should) be skipped in VMS.  gnfile(): ckcfns.c, 2 Mar 2007.
4697
4698 Variation 2: BINARY or SET FILE TYPE BINARY doesn't force binary mode.  But
4699 SET FTP TYPE BINARY does.  But BINARY does indeed call doftptyp() so what's
4700 the problem?  We do indeed set ftp_typ to 1 but it gets reset somewhere
4701 before we call zopeni().  But then zopeni() puts it back to 1.  Tracing
4702 through a transfer, it looks like all of this works right, it's only that
4703 the file transfer display says TEXT when the transfer is really in binary
4704 mode.  This is because screen() is called before openi().  I wonder if we
4705 can call scrft() from the ftp module...  No, that would be too easy.  OK,
4706 sendrequest calls openi() and sets the file mode; putfile() calls
4707 screen(SCR_FN), which prints the transfer mode.  But putfile calls
4708 sendrequest() after it puts up the screen that says the file type.  So it
4709 looks like sendrequest() has to call screen(SCR_FN) again if it changes the
4710 file type.  OK, that did it.  ckuusx.c, ckcftp.c, 2 Mar 2007.
4711
4712 The BINARY and TEXT (ASCII) commands do not inhibit automatic type switching
4713 in VMS.  They don't in Unix either.  They never have.  Should they?  I think
4714 so, otherwise what good are they?  Plus we want the Kermit FTP client to
4715 behave like the others.  I added code for this but it doesn't work, due to
4716 the layers and layers of text/binary detection and switching and
4717 if-this-but-then-if-that...  Anyway, no harm done.  The normal rule is:
4718 when you PUT a file, Kermit figures out on a per-file basis whether to use
4719 text or binary mode unless you include a /TEXT (/ASCII) or /BINARY switch
4720 in the PUT (or MPUT) command.  ckuus[r3].c, ckcftp.c, 2 Mar 2007.
4721
4722 Wed Mar 7 16:21:13 2007 WROTE SHORT TEST PROGRAM for ttruncmd (the openpty
4723 version) on Mac OS X.  On dulce: ~/kermit/ttpty.c / ttpty.sh.  It starts the
4724 external protocol in the lower fork.  The command to run is a command-line
4725 argument.  Sending and receiving files with Kermit works OK.  But again, the
4726 standalone program totally fails when I use sz or lsz as the external
4727 protocol.  So it looks like we can rule out any environmental effects of
4728 running the code inside C-Kermit.
4729
4730 Mon Mar 12 16:52:20 2007: Put some effort into making ttpty.c more useful;
4731 added a debug log.  Found that for some reason, at least on Mac OS X,
4732 select() always timed out at the the end.  I added a SIGCHLD alarm and that
4733 seems to handle the fork exit condition very nicely.  Now we can send (say)
4734 a 3MB file at good speed on Ethernet (1Mcps) considering the debugging, etc,
4735 and it terminates instantly.  But when sending a file into ttptycmd (with
4736 "gkermit -r"), things go wrong at the end -- the Z packet is never
4737 acknowledged.  This is reproducible.  Maybe this is a good lead....  The log
4738 shows that select() timed out, even though the gkermit fork had not yet
4739 exited (or finished).  It looks like gkermit sent the Ack, ttpty.c read it
4740 from the pty and sent it out the net:
4741
4742   0003: read pty=8                <-- read Ack from pty
4743   0003: loop top have_pty=1
4744   0003: loop top have_net=1
4745   0003: FD_SET pty_in
4746   0003: FD_SET ttyfd in
4747   0003: FD_SET ttyfd out=8
4748   0003: nfds=5
4749   0003: select=1
4750   0003: FD_ISSET ttyfd out
4751   0003: write net=8               <-- send ack to net
4752   0003: loop top have_pty=1
4753   0003: loop top have_net=1
4754   0003: FD_SET pty_in
4755   0003: FD_SET ttyfd in
4756   0003: nfds=5
4757   0009: select=0
4758   0009: select timeout - have_pty=1
4759
4760 But Ack never arrived.  This is a streaming transfer.  But nope, streaming
4761 is not the problem.  If I disable streaming ("gkermit -Sr"), we hang in in
4762 the middle of sending the data.  If I use small packets, we don't hang:
4763 1000 is OK, 2000 is not.  In fact, the cutoff is 1024.  OK, TBC...
4764
4765 Wed 14 Mar 2007: Receiving a file thru ttpty "gkermit -e 1200 -Srd"
4766 produces a debug log that shows that gkermit gets a lot of EAGAIN errors
4767 when it tries to read from its stdin.  In fact, it takes 6 tries (read()
4768 calls) to read the S packet (27 bytes).  Then when the first data packet
4769 arrives (1200 bytes), read() never returns even one single byte.  The
4770 timeout interval is 15 seconds and it times out repeatedly.  Added a
4771 primitive hex dump to the ttpty debug log for each read/write (showing only
4772 the first 24 characters and the last character, so it fits on one line).
4773 Tried uploading a file.  The S, F, and A packets (short) are received and
4774 Ack'd OK, but then ttpty select() times out, never receiving even one byte
4775 from the D packet.  Clearly, when the pty driver receives a burst of > 1K
4776 bytes, stops working.  As before, if I limit the packets to < 1K, it works
4777 fine.
4778
4779 Can I send an 8-bit binary file?  Nope.  ttpty reads the binary data just
4780 fine from the net and writes it exactly as it was received to the pty, but
4781 the first time we write an 8-bit byte, we never hear back from the PTY
4782 again.  But the log shows that when the initial 7-bit packets from the pty,
4783 it looks like the PTY is not in rawmode, because these packets end with ^J
4784 rather than ^M.  Calling pty_make_raw() on the masterfd and slavefd
4785 explicitly, however, doesn't change anything.  It doesn't matter if I do
4786 this in the lower fork or the upper fork.  So maybe it's the actual
4787 semantics of pty_make_raw() that are wrong.
4788
4789 Thu 15 Mar 2007: Went thru all the terminal mode flags in Mac OS X; didn't
4790 help.  Changed hex dump to show whole packet.  Put hex dump routine in a
4791 private copy of G-Kermit.  Tried to transfer an 8-bit file, logging both
4792 ttpty and gkermit.  Compared what ttpty received on stdin with what it sent
4793 to the pty (same) and what was received by G-Kermit (same).  Then I realized
4794 that my little test program was not putting its controlling terminal into
4795 raw mode; when I did that, I could upload binary files (streaming, 2MB/sec).
4796 And with Zmodem too (with rz; lrz doesn't work for some reason).  Looking
4797 back at the original in ckutio.c, I see that ttptycmd() never called
4798 ttpkt().  Maybe that was the trouble all along.  (Yup, but maybe not the
4799 whole trouble.)
4800
4801 Moving back to C-Kermit and the original ttptycmd() routine, adding the call
4802 to ttpkt(), and stripping out a lot of cruft, and moving the pty_make_raw()
4803 code to ckupty.c, Kermit uploads and downloads (streaming) work fine in
4804 Solaris.  Zmodem sends a file, but then the transfer hangs at the very end,
4805 as if the signoff protocol were lost.  This happens on Solaris.  If I move
4806 back to Mac OS X, everything works just fine.  Then, making a Kerberized
4807 connection from the Mac to NetBSD, I can send files from the Mac with both
4808 Zmodem and Kermit.  Receiving...  Kermit OK.  Zmodem...  Nope.  "rz:
4809 Persistent CRC or other ERROR" (and created a 265MB debug.log!)
4810
4811 Fri 16 Mar 2007: ttptycmd() was for sending files with Zmodem across
4812 encrypted connections.  But it occurred to me that it's necessary for
4813 clear-text connections too; e.g. Telnet, where 0xff has to be doubled.  Of
4814 course Zmodem doesn't do that itself, so there's no way Zmodem external
4815 protocol could work when executed over a Telnet connection, and in fact
4816 it doesn't.  I wonder why I ever thought it did.
4817
4818 Wed 21 Mar 2007: Back to where we left off a week ago.  Trying C-Kermit's
4819 ttptycmd() on the Mac again, in remote mode:
4820
4821  . G-Kermit send txt (kst): OK  832Kcps  
4822  . G-Kermit recv txt (kr):  OK  425Kcps  
4823  . G-Kermit send bin (ksb): OK 1000Kcps  
4824  . G-Kermit recv bin (kr):  OK  188Kcps  
4825
4826 And Zmodem:
4827
4828  . sz txt (zst): OK  563Kcps  
4829  . sz bin (zsb): OK  714Kcps  
4830  . rz txt (zr):  OK  863Kcps  
4831  . rz bin (zr):  OK  198Kcps  
4832
4833 So in remote mode, everything works.  Now let's try a clear-text Telnet
4834 connection...
4835
4836  . G-Kermit send txt (kst): OK  841Kcps
4837  . G-Kermit recv txt (krt): OK  391Kcps
4838  . G-Kermit send bin (ksb): OK  811Kcps
4839  . G-Kermit recv bin (krb): OK  171Kcps
4840
4841 And Zmodem over the same clear-text telnet connection:
4842
4843  . sz txt (zst): OK  91Kcps (*)
4844
4845 Kermit is sending sz messages like "sz 3.73 1-30-03 finished." to the
4846 host, which tries to execute them, after the transfer is finished.
4847 Of course "sz" is a command, but:
4848
4849   sz: cannot open 3.73: No such file or directory
4850   sz: cannot open 1-30-03: No such file or directory
4851   sz: cannot open finished.: No such file or directory
4852
4853 Did I lose that code that dis-redirects stderr when I went back to using the
4854 pty code from the ckupty module?  No, it's there and it's being executed.
4855 Apparently the copy of sz I have is writing its "finished" message to stdout
4856 because "sz blah 2> /dev/null" does not suppress it.  Starting again with
4857 lsz instead of sz:
4858
4859  . sz txt (lzst): OK  413Kcps
4860  . sz bin (lzsb): OK  FAILED (*)
4861  . rz txt (lzrt): OK  
4862  . rz bin (lzrb): OK
4863
4864 (*) Sigh.  Using lsz, we get "garbage count exceeded" errors and eventual
4865 failure.  But using regular sz, we get the extraneous message that starts
4866 sz on the far tend, and the resulting getty babble.
4867
4868 But even without changing the code, it will work one minute, and then fail
4869 consistently the next.  For example, I was able to send files with sz
4870 successfully over and over, but with the getty babble at the end.  Then,
4871 after trying lsz and then going back to sz, every attempt at sending a file
4872 quits with "Got ZCAN".  The difference has to be that Kermit always does at
4873 least some minimal encoding of C0/C1 control characters such NUL and DEL and
4874 IAC, and I doubt that Zmodem does.
4875
4876 http://zssh.sourceforge.net/ says:
4877
4878   If file transfer is initiated but never completes (ie a line like :
4879
4880      Bytes Sent:      0/    513   BPS:0        ETA 00:00  Retry 0: Got ZCAN
4881
4882    can be seen, but transfer never completes), chances are the pty/tty on one
4883    of the systems are not 8-bit clean.  (Linux is 8-bit clean, NetBSD is not).
4884    Using the -e (escape) option of rz should solve this problem.
4885
4886 It doesn't, at least not with lrz.  And yes, the receiving end happens to be
4887 NetBSD.  But it looks like the zssh people have been down this road too.
4888
4889 But with rz and sz, it worked.  Once.  Twice.  Three times.  But of course,
4890 with the getty babble at the end.  This can be taken care of by doing:
4891
4892   rz -eq ; cat > foo
4893
4894 which puts "sz 3.73 1-30-03 finished" and any other messages in foo (but you
4895 have to type ^D to finish the cat).  Using this method I was also able to
4896 send an 8K binary file that contained a test pattern of all 256 possible byte
4897 values.  Then I tried a 3MB binary executable.  All OK.  So here we go again:
4898
4899  . sz txt (zst): OK
4900  . sz bin (zsb): OK
4901  . rz txt (zrt): 
4902  . rz bin (zrb): 
4903
4904 Downloading fails about halfway through a fairly large file.  I tried an
4905 even bigger file, guaranteed to be 100% ASCII; same thing -- halfway
4906 through: "rz: Persistent CRC or other ERROR".  But it worked with a smaller
4907 version of the same file (82K versus 2MB).  Tried again with the bigger
4908 version, it failed in exactly the same way at exactly the same spot: byte
4909 number 1048320.  But this is just ASCII text so it can't be a transparency
4910 problem.  Substituting another plain ASCII file of the same size but totally
4911 different contents, it doesn't fail (2.36MB).  Back to the previous file, it
4912 fails again, but in a different spot (832960).  So it's not totally
4913 deterministic.
4914
4915 To round things out, I tried downloading the binary test-pattern file; it's
4916 only 8K.  This failed.
4917
4918   -4, --try-4k                go up to 4K blocksize
4919   -B, --bufsize N             buffer N bytes (N==auto: buffer whole file)
4920   -e, --escape                escape all control characters (Z)
4921   -E, --rename                force receiver to rename files it already has
4922   -L, --packetlen N           limit subpacket length to N bytes (Z)
4923   -l, --framelen N            limit frame length to N bytes (l>=L) (Z)
4924
4925 Tried again with "sz -L 256 -B 256 -4aeq".  Doesn't change anything.
4926
4927 NOTE: Mac OS X rz 3.73 1-30-03 does not support -e.
4928 NetBSD rz 0.12.20 does support -e.
4929
4930 Thu 22 Mar 2007: It occurs to me that ttpkt() might still be a problem;
4931 maybe it's the network connection and not the pty that is not transparent
4932 enough.  To test this theory I did "stty raw ; stty -a" and then copied all
4933 of the flag values into ttpkt in the BSD44ORPOSIX section:
4934
4935  . rz txt (zrt): OK (2.36MB file, worked 2 out of 3 times)
4936  . rz bin (zrb): "rz: Persistent CRC or other ERROR"
4937
4938 A little more fiddling with the flags and I got the 8K binary test pattern
4939 to SEEM to download OK (in the sense that rz gave a 0 return code) but the
4940 file itself was truncated, always at 224.  If I changed the test pattern
4941 file to not include any bytes with value 224 (0xe0) or 255 (0xff), the
4942 download worked.  So we have a transparency problem somewhere.  The debug
4943 log shows that all byte values are being received from the network correctly
4944 so the problem has to occur when we try to feed them to the pty.
4945
4946 But no amount of twiddling with the termios flags seems to let these
4947 characters pass through.  Of course, since they are not in the C0 or C1
4948 control range, "sz -e" doesn't quote them (which it does by prefixing with
4949 Ctrl-X and then adding 0x40 to the byte value so (e.g.) NUL becomes ^X@.
4950 Note that 255 does not cause problems because it coincides with the IAC
4951 character; the remote Telnet server doubles outbound IACs, and Kermit's
4952 ttinc() undoubles them automatically (as the log shows).
4953
4954 Trying to send a different file (a C-Kermit binary) shows that 255 is the
4955 real killer; the file is truncated where the first one appears (at about
4956 6K), even though some 224's precede it.  Going back to the remote-mode test,
4957 I see the same thing happens with the binary test-pattern file, if I send it
4958 from K95 direct to rz-under-C-Kermit-in-remote-mode.  So it has nothing to
4959 do with C-Kermit having a network connection.  Yet if I send the same file
4960 direct from K95 to rz, it goes OK and the result is not truncated, so it's
4961 not Zmodem either.  The data arrives to C-Kermit intact, so the failure is
4962 definitely in writing it to the rz process through the slave and master ptys.
4963
4964 BUT if I send the same file from K95 to rz-under-ttpty, that works.  What's
4965 the difference?  Suppose I just transplant ttpty literally into C-Kermit...
4966 It makes no difference.  When receiving the test-pattern, it truncates it
4967 in exactly the same place.
4968
4969 Well, all this is on Mac OS X.  What if I move it to a different platform?
4970 OK, building on Solaris and following the exact same procedure, ttptycmd()
4971 doesn't even use the network connection.  I think that's because rzsz on
4972 Solaris is hardwired to use the controlling terminal and can't be
4973 redirected, even in a pty?
4974
4975 Moved to NetBSD.
4976
4977  . sz txt (zst): Failed ("Got ZCAN")
4978  . sz bin (zsb): 
4979  . rz txt (zrt): OK
4980  . rz bin (zrb): 
4981
4982 Well, this is a big mess.  Sending doesn't work (or sometimes it does but
4983 reports that it didn't).  Receiving...  well, actually it's the same thing;
4984 the file is completely transferred but then the final protocol handshake is
4985 lost.  The local C-Kermit returns to its prompt, but rz is still running:
4986
4987   Retry 0: Got TIMEOUT
4988   Retry 0: TIMEOUT
4989   Retry 0: Got TIMEOUT
4990   Retry 0: TIMEOUT
4991   Retry 0: Got TIMEOUT
4992   Retry 0: TIMEOUT
4993   Retry 0: Got TIMEOUT
4994   Retry 0: TIMEOUT
4995   Retry 0: Got TIMEOUT
4996   Retry 0: TIMEOUT
4997   Retry 0: Got TIMEOUT
4998
4999 I don't see how that is even possible.  Even after I exit from Kermit the
5000 messages keep coming, even though ps doesn't show the rz process anywhere.
5001 Looking at the code, I see a place where end_pty() was still commented out
5002 from the ttpty.c episode, I uncommented it.  But still:
5003
5004  . sz txt (zst): Fails ("Got ZCAN")
5005  . sz bin (zsb): Fails instantly (but with no diagnostic)
5006  . rz txt (zrt): OK
5007  . rz bin (zrb): Fails with tons of "Bad CRC", "Gargage Count exceeded"
5008
5009 Conclusion for the day: I think this is hopeless.  Even if I can get it to
5010 work somewhere, the results depend on the exact Zmodem software, how it uses
5011 stdin/out vs stderr versus getting its own nonredirectable file descriptor,
5012 versus the Zmodem version on the other end and which options are available
5013 on each, versus the pty and select() quirks on each platform, and on and on.
5014 It will be so hard to explain and to set up that nobody would ever use it.
5015 It would be better to just implement Zmodem internally.
5016
5017 Fri 23 Mar 2007: Went back to the small test program, ttpty.c.  Tried
5018 setting both the master and the slave pty to rawmode, even though I have
5019 never seen any other software that did this.  I had it receive the binary
5020 test pattern file; it worked.  I made a bigger test-pattern file, 3MB,
5021 containing single, double, and triple copies of each byte in byte order and
5022 in random order, this one was accepted too.
5023
5024 So it would seem that the ckupty.c module is something to avoid after all.
5025 It's full of stuff I don't understand and probably should not undo.  So
5026 changing C-Kermit's ttptycmd() to manage its own pty again, using openpty()
5027 (which is not portable), I got it all to work in remote mode: Kermit
5028 text/binary up/down and Zmodem text/binary up/down.  But in local mode on
5029 the client side of a Telnet connection...
5030
5031   zst: OK, but we still get the getty babble at the end that starts sz.
5032   zsb: OK, ditto.  This is with the 3MB test-pattern file.
5033   zrt: Not OK -- "Persistent CRC or other ERROR"
5034   zrb: Not OK -- got the cutoff at 224 again "Persistent CRC or other ERROR"
5035
5036 It's close.  But actually this was still with USE_CKUPTY_C defined.  When I
5037 undefined it, it was back to being totally broken.  Start over.  (Check the
5038 new cfmakeraw() code.)
5039
5040 Tue 27 Mar 2007: Starting over.  Back to ttpty.c.  Let's verify, VERY
5041 CAREFULLY, that it really does work, using the most stressful of the four
5042 tests: sending the big (3.2768MB) binary test pattern from K95 into rz
5043 through ttpty, logging everything.  ttpty definitely receives the big file
5044 smoothly with no errors or hiccups when I have it set to use the master side
5045 of the pty for i/o.  The application program (Zmodem in this case) runs on
5046 the slave, and the network and/or control program communicates with the
5047 master.  This implies that Zmodem controls the terminal modes of the slave,
5048 and ttpty should be concerned with those of the master.  Doing it this way
5049 in ttpty confirms this.
5050
5051 Fine.  But if I tell ttpty to SEND a file with sz, nothing happens.  Ditto
5052 with lsz.  Select times out waiting for input from the pty.  But if I
5053 manually tell K95 to RECEIVE /PROTOCOL:ZMODEM it works OK.  Somehow sz's
5054 initial B000000 string is being swallowed somewhere, and it's waiting for
5055 a reply from the receiver.  sigh...  But "ttpty gkermit -s filename" works
5056 fine.  What's the difference?  It has nothing to do with stdout vs stderr;
5057 sz is not writing to stderr at all.  Is it some timing thing between the
5058 forks?  Aha.  It's that I change the modes of the pty master in one fork
5059 while sz is already starting in the other fork.
5060
5061 OK, good, now for the first time we have Kermit and Zmodem both able to
5062 upload and download a large worst-case binary test-pattern file... in
5063 remote mode.  Now taking today's lessons and fitting them back into
5064 C-Kermit so I can try it local mode...
5065
5066 Using G-Kermit as the external protocol, first in remote mode...  All good:
5067 text/binary up/down.  The "halting problem" is solved by SIGCHLD, which
5068 catches fork termination instantly and lets ttptycmd() know there is no more
5069 pty.  Zmodem:
5070
5071   zst: OK
5072   zsb: OK
5073   zrt: OK
5074   zrb: OK
5075
5076 That's a first.  Next, repeat in local mode, in which C-Kermit is the client
5077 and has made a Telnet connection to another host over a secure (Kerberos V)
5078 connection:
5079
5080   kst: OK     zst: ...
5081   ksb: OK
5082   krt: OK  
5083   krb: OK
5084   
5085 It seems we can never end a day on a high note.  Somehow I seem to have
5086 broken regular internal Kermit protocol transfers over encrypted connections
5087 -- the en/decryption engine loses sync.  But they still work OK over a
5088 clear-text Telnet connection.
5089
5090 Today's code in ~/80/dulce.tar (27 Mar 2007).
5091
5092 Added makefile target solaris10g+openssl.  Gathered all the standard CFLAGS
5093 for Solaris into cdcdeb.h so they don't have to be included in every single
5094 makefile target for Solaris.  On local Solaris 10 host OpenSSL is in
5095 /opt/openssl-0.9.8e/.  Tried the new makefile target, works OK.  Also made
5096 solaris10+openssl for Sun CC, but couldn't test it because I can't find any
5097 Solaris 10 host that has Sun CC.  Built with gcc at another site that has
5098 OpenSSL 0.9.8f-dev, all OK.  ckcdeb.h, makefile, 24 Jun 2007.
5099
5100 It occurs to me that Kermit transfers on secure connections might have been
5101 broken by the changes I made back in February to ttinl() for John Dunlap.
5102 Here, for the first time, we invoke myunrd() to push a byte back into the
5103 input queue, and there is also some funny business with "csave", which
5104 changed, and which an old comment notes that it has to be treated specially
5105 when encrypting.  So it could be that the broken Kermit transfer has nothing
5106 to do with the work on external protocols, and that putting back the
5107 previous ttinl() will fix it.  But now I can't seem to make a Kerberized
5108 connection from Panix to Panix, even though I can make one from Columbia to
5109 Panix.  This means I have to build a Kerberized binary from the current
5110 source code on either Solaris or Mac OS X.  Trying Solaris
5111 first... [~/solaris9k5/mk5.sh] This didn't work the first time due to
5112 undefined krb5_init_ets, which is referenced if MIT_CURRENT is not defined
5113 (it should be for Kerberos 5 1.05 and later and we have 1.42 here), tried
5114 again with -DMIT_CURRENT=1...  Nope, that one totally blew up in ck_crp.c.
5115 Later, Jeff says krb5_init_ets is a no-op in Kerberos 1.4.x and later,
5116 so I added an #ifdef (NO_KRB5_INIT_ETS) for skipping it; now it builds and
5117 runs OK.  ckuath.c, makefile, 9 Jul 2007.
5118
5119 Meanwhile, using C-Kermit on Mac OS X, which makes the Kerberized connection
5120 just fine, but still has the problem transferring files over it.  Packet log
5121 shows:
5122
5123   s-00-01-^A9 Sz/ @-#Y3~Z! z0___F"U1@A^M 
5124   r-00-01-^A9 Y~/ @-#Y3~^>J)0___J"U1@I
5125   s-01-01-^A(!Fx.x)(V^M
5126   r-xx-08-<timeout>
5127   S-01-08-^A(!Fx.x)(V^M
5128   r-xx-08-<timeout>
5129   S-01-08-^A(!Fx.x)(V^M
5130   r-xx-16-<timeout>
5131
5132 Note that S packet is sent, received, and Ack'd OK.  The F packet is sent but
5133 is never Ack'd.  Tried this several times and noticed that it's just
5134 receiving that is screwed up, not sending.  After ^C'ing out of the
5135 transfer, I can still type commands, and they are executed on the far end,
5136 but the results coming back are gibberish.  Mon Jul 9 16:08:22 2007 (come
5137 back to this later... substitute Dev.27 ttinl for current one and see if
5138 the problem goes away, and if so, conditionalize the new code for clear-text
5139 connections).
5140
5141 Built C-Kermit with Kerberos 5 on Solaris with a version of ckutio.c that
5142 uses the old ttinl() and transferred a file OK over a Kerberized connection.
5143 So now it's just a matter of reconciling the old and new ttinl.  The easiest
5144 way to do this is to have new ttinl() chain to old ttinl() if the connection
5145 is encrypted, which is what I did and it works fine.  At some point the two
5146 versions of ttinl() should be reconciled.  ckutio.c, 12 Aug 2007.
5147
5148 There was a function, islink(), used in only one place (ckuus6.c) that had
5149 the same name as a commonly used scalar variable, and it was missing a
5150 prototype.  Changed its name to isalink() and added the prototype (Unix
5151 only), ckuus6.c, ckufio.c, ckcdeb.h. 12 Aug 2007.
5152
5153 Revisiting the ASCII and BINARY top-level commands, which are supposed to
5154 be like in other FTP clients, but don't seem to have any effect.  I added a
5155 new routine to the FTP module, doftpglobaltype(), that sets the global,
5156 sticky, permanent transfer mode (ASCII or BINARY) (TENEX could be added to
5157 if anybody asks).  These commands (now that they work) are different from
5158 SET FTP TYPE { ASCII, BINARY }, which set the *default* transfer mode when
5159 automatic switching fails for a given file.  ckuusr.c, ckcftp.c, 12 Aug 2007.
5160  (notify: Matt <mlist@cmcflex.com>)
5161
5162 Even though the code hasn't changed, suddenly we're getting:
5163
5164   "ckuusx.c", line 5682: warning: implicit function declaration: tgetent
5165   "ckuusx.c", line 6183: warning: implicit function declaration: tgetstr
5166   "ckuusx.c", line 6262: warning: implicit function declaration: tputs
5167   "ckuusx.c", line 6266: warning: implicit function declaration: tgoto
5168
5169 in ckuusx.c on Solaris 9.  <curses.h> is still in /usr/include, dated 2002.
5170 A quick search shows the missing functions are hiding in <term.h>, which
5171 until now was included only in Linux.  Added a USE_TERM_H clause.  No, that
5172 doesn't help, the prototypes are not selected at compile time; there are
5173 #ifdefs in that file that skip over these prototypes.  I had to put them in
5174 the code under #ifdef BUG999..#endif (I could have used a longer name like
5175 #ifdef ADD_PROTOTYPES_FOR_CURSES_FUNCTIONS, but that would not be portable).
5176 ckuusx.c, 12 Aug 2007.
5177
5178 Also:
5179
5180   "ckuusx.c", line 9232: warning: implicit function declaration: creat
5181
5182 This is called in the IKSD dababase code, used for getting a lockfile.
5183 creat() is a Unixism in code that is supposed to be portable.  But IKSD only
5184 runs on Unix and Windows, so I assume the Windows C library has a creat()
5185 function.  Anyway, suddenly the Solaris header files seem to have blocked
5186 whatever path previously existed to the creat() prototype (which is in
5187 <fcntl.h>), so I added an #include in the appropriate spot.  ckuusx.c,
5188 12 Aug 2007.
5189
5190 Kermit functions for converting the number base -- \fradix(), \fhexify(),
5191 \unfhexify() -- did not work with big numbers; ckradix() was missed in the
5192 CK_OFF_T conversion.  Fixed in ckclib.c, 12 Aug 2007.
5193
5194 Updated the help text for ASCII, BINARY, and SET FTP TYPE to clarify the
5195 semantics.  ckuus2.c, ckcftp.c, 12 Aug 2007.
5196
5197 Error messages were printed upon failure to open any of the four log file,
5198 even with SET QUIET ON.  Fixed in ckuus4.c, 12 Aug 2007.
5199
5200 Built OK on NetBSD 1.3_RC3.  Tried to build secure version but the libraries
5201 had disappeared.  13 Aug 2007.
5202
5203 Built OK on Mac OS X 10.4.9.  Tried the secure version, macosx10.4+krb5+ssl.
5204 Here we get the usual pile of "pointer targets in passing argument 1 of
5205 (function name) differ in signedness", regarding security functions, but it
5206 built OK.  13 Aug 2007.
5207
5208 Reconciling the two ttinl's...  On encrypted connections myread() returns
5209 encrypted bytes; ttinl() has to decrypt them; it wasn't doing this in the
5210 lookahead section so I fixed it.  The new code works on both encrypted and
5211 clear-text connections.  I removed the chaining to oldttinl(), and
5212 oldttinl() itself.  ckutio.c, 13 Aug 2007.
5213
5214   (Wouldn't it make more sense and be more efficient and less confusing
5215   for myfillbuf() to do the decrypting?)
5216
5217 When C-Kermit uses Zmodem as an external protocol, it doesn't seem to scan
5218 files before sending them to set text or binary mode appropriately.  It's
5219 that external protocols bypass Kermit's whole "get next file" mechanism; the
5220 (possibly wild) filespec is simply passed to the external protocol program.
5221 Changing this would be a very big deal.  But if only one file is being sent
5222 (the filespec is not wild) it's easy enough to check.  I added this to the
5223 external protocols section of the protocol module.  It can be overridden in
5224 any of the regular ways (/TEXT or /BINARY switch on SEND command, SET
5225 PATTERNS OFF, SET TRANSFER MODE MANUAL, etc).  ckcpro.w, 13 Aug 2007.
5226
5227 [FTP SEND /RECURSIVE]
5228 Peter Crowley reported a problem with FTP recursive uploads getting the
5229 directory tree wrong when the previous pathname was a left substring of the
5230 new pathname (e.g. foo/bar/ and foo/bar2/).  The logic did not handle this
5231 case and created the bar2 directory as a subdirectory of bar, rather than as
5232 a parallel directory.  Fixed in syncdir() and tested with various edge cases.
5233 ckcftp.c 14 Aug 2007.
5234
5235   notify <peter.crowley@alumni.utexas.net>
5236
5237 Added CD messages to FTP BRIEF display to track the ups and downs of
5238 recursive uploads.  ckcftp.c, 14 Aug 2007.
5239
5240 The OUTPUT command gave a misleading error message ("Connection to xxx not
5241 open") when used on a serial port that was, indeed, open but was not
5242 presenting the Carrier signal, when CARRIER-WATCH was not OFF.  Added a new
5243 message for this, and some others.  ckuus5.c, 14 Aug 2007.
5244
5245 Sending from the command line, e.g. kermit -s foo, did not give an
5246 informative error message if the file could not be found or opened.  Fixed
5247 in ckuusy.c, 14 Aug 2007.
5248
5249 OK, back to ttptycmd....  It seems that back on March 27th, I got everything
5250 working but I thought that there was still something wrong with it because
5251 an unrelated problem so I put it aside.  The version of ttpty.c from that
5252 date worked OK, and it looks like I updated ckutio.c from it, but that
5253 version of ckutio.c was put aside.  Since then I have been working on the
5254 ckutio.c version that was NOT put aside and so now I have to reconcile the
5255 two:
5256
5257   ~/80/ttypty/20070327/ckutio.c
5258   ~/80/ckutio.c
5259
5260 As a first cut I did this simply by replacing the contents of the #ifdef
5261 CK_REDIR section of the latter with that of the former.  Of course in
5262 Solaris this comes up with openty() implicitly declared at compile time and
5263 unresolved at link time.  So the first task is to get HAVE_OPENPTY defined
5264 for platforms that have it and have the others use the ttruncmd().  For
5265 starters I put an #ifdef block in ckcdeb.h that defines HAVE_OPENPTY for
5266 Linux, FreeBSD, NetBSD, OpenBSD, and Mac OS X.  Ones that don't have
5267 openpty() include AIX, HP-UX, and Solaris.  Others like SCO I don't know but
5268 I doubt it.  The real solution is to get the ckupty.c module to work but one
5269 thing at a time...  This version is supposed work with secure builds on the
5270 openpty() platforms, and on the others like Solaris, if an external protocol
5271 is attempted on a secure (encrypted) connection, an error message is
5272 printed and the command fails.  ckutio.c, 14 Aug 2007.
5273
5274 How to test?  Apparently I did all my testing on Panix before, and that's
5275 where all my Zmodem builds are, but now when I build a Kerberized version
5276 (which works if I do it on the right pool host), it won't make a local
5277 connection, and there is no other place I can connect to that has a
5278 Kerberized Telnet server.  I can, however, connect to Panix from here, using
5279 the same code, but on Mac OS X...
5280
5281 Slight detour: Got access to AIX again (5.3.0.0).  Picky compiler, some
5282 things needed fixing....  Also it says "1506-507 (W) No licenses available.
5283 Contact your program supplier to add additional users. Compilation will
5284 proceed shortly" and of course it goes kind of slow.  For some reason, I
5285 can't do streaming transfers into AIX over a local network (to its SSH
5286 server), but windowed transfers are OK.  Anyway, noting that we've been
5287 using the same basic makefile target since AIX 4.2, changing nothing but the
5288 version herald, I made a new target, simply "aix", that picks up the AIX
5289 version automatically and sets the herald from it.  Ditto for aix+openssl,
5290 but on this host requires setting SSLINC and SSLLIB to /opt/ssl/include and
5291 /opt/ssl/lib.  Also the make program here was extremely sensitive to spacing
5292 so I had to make some minor edits to get the link step to work for the SSL
5293 version.  ckuusy.c, makefile, 14-15 Aug 2007.
5294
5295 Got rid of the special Panix secure NetBSD target, replaced it with a
5296 regular one, which is invoked in the normal way by defining K5INC and K5LIB
5297 to point to to where the stuff is hidden.  Cleaned up and modernized the
5298 comments in the makefile a bit.  makefile 15 Aug 2007.
5299
5300 Changed some data types and added some casts to ckctel.c to do away with
5301 tons of "pointer targets in passing argument 1 of 'xxx' differ in signedness"
5302 warnings.  15 Aug 2007.
5303
5304 Set up Mac OS X as the testbed for ttptycmd(), with Panix as the remote
5305 partner over a Kerberos 5 connection.  The first test is to send a 300K
5306 text file with gkermit as the external protocol.  It worked fine, and the
5307 debug log showed all the right components were active (namely encryption and
5308 ttptycmd) [kermit/zmodem send/receive text/binary]:
5309
5310   Kermit    Zmodem
5311   kst OK    zst OK
5312   ksb OK    zsb OK
5313   krt OK    zrt OK
5314   krb OK    zrb Failed "rz: Persistent CRC or other ERROR"
5315
5316 We've seen this before.  The problem is 0xff, Telnet IAC, as I proved to
5317 myself by constructing a 3MB file that contained every byte but 0xff in every
5318 mixture and order and transferring it successfully over the same connection.
5319 Presumably the Telnet server is doubling IACs, whereas of course rz is not
5320 undoubling, thus the CRC error.  This is progress.  15 Aug 2007.
5321
5322 Log shows that indeed every IAC in the source file arrives doubled.  Adding
5323 code to remove the first IAC of every adjacent pair, a small test file with
5324 different-length runs of IACs transfers OK.  The 3MB all.bin file does not.
5325
5326 Starting over...  I can receive a big text file with Zmodem OK.  The 3.2MB
5327 binary test pattern that contains no IACs failed after 1.8MB, but the part
5328 that it transferred was OK.  A second try, almost the whole thing arrived,
5329 it stopped just 584 bytes short of the end.  Could be that file size is a
5330 separate problem.  Making a new copy exactly 1MB long...  Well, that's
5331 interesting, this one too stopped just short of the end.  And again, the
5332 same thing.  When connecting back to the host, the last Zmodem packet can
5333 be seen on the screen; it's as if the local Zmodem exited before reading
5334 the last packet...  But OK, if I change the options on the remote sz
5335 sender to use small blocks, etc, then it works.
5336
5337 Now, changing from the 1MB no-IAC-binary test pattern, to the 1MB all-values
5338 test pattern, we fail after 81K.  But the part that was transferred is
5339 correct.  Second try, same thing, but 57K.  Third: 40K.  Each time, upon
5340 connecting back, the session is completely dead.
5341
5342 IF I HAVE TO undouble IACs for incoming files, don't I have to double them
5343 going out?  To send a block to net we just call ttol(), but ttol() doesn't
5344 do any doubling (because Kermit protocol always quotes 0xff).  To see what
5345 happens, I changed the ttol() call to ttoc() in a loop that doubles IACs.  I
5346 tested this by sending the full 3.2MB test pattern, which worked fine.
5347
5348 For receiving, it's slow but it works OK with files that don't contain IACs
5349 (my concern was that IACs might appear in outbound files or in Zmodem
5350 protocol messages).  It receives the 1MB no-IAC test pattern, so there are
5351 no problems with protocol or timing.  But the full test pattern always gets
5352 cut off, but at different points, as before, with the remote session dead.
5353 Changing the Zmodem receiver from rz to lrz on the local end (since the
5354 sender on the remote end is lsz) does not change the behavior.
5355
5356 Anyway, I went back and replaced the byte loop with something more
5357 efficient, and it goes about 20 times faster.  But this doesn't help either,
5358 it only makes it fail faster.  But aha, what if a doubled IAC is broken
5359 across successive pty reads -- we have to make the "previous character"
5360 memory persistent.  Well, that was a good insight, but it still didn't fix
5361 it.  The log shows the IAC handling code is working fine.
5362
5363 What does sz say?  Capturing its stderr to a file... "Retry 1: Got ZCAN".
5364 Next time: "Retry 1: Got TIMEOUT".  Next time: Got ZCAN.
5365
5366 Trying different Zmodem options...  apparently I don't need to use short
5367 blocks.  But I do need to use -e, probably because of Telnet NVT treatment
5368 of carriage return; without -e, there is a "persistent CRC error".  -O
5369 disables timeouts, but this makes no difference.
5370
5371 OK, we still have two Big Problems:
5372
5373  1. When a long file has no IACs, the final < 1K of the file is not received.
5374  2. When a long file has IACs, the transfer generally stops very early.
5375
5376 Problem 1: the transfer consistently fails less than 1K from the end of the
5377 file.  Upon CONNECT back to the host, a big Zmodem packet is sitting there
5378 waiting to be read, which means ttptycmd()'s copy of rz is terminating
5379 early.  Can we catch it in the debug log?  Doing this takes forever and
5380 writes a GB to the disk...  And then the problem doesn't happen.  Also, I
5381 can receive a HUGE text file almost instantly with no errors at all.
5382
5383 Switching to lrz on the receiving end, now I see the error messages, about
5384 300 lines like this:
5385
5386   Retry 0: Garbage count exceeded
5387   Bytes received:  872352/1000000   BPS:85464  ETA 00:01  Retry 0: Bad CRC
5388   Bytes received:  892448/1000000   BPS:86690  ETA 00:01  Retry 0: Bad CRC
5389   Retry 0: Garbage count exceeded
5390   Retry 0: Garbage count exceeded
5391   Retry 0: Garbage count exceeded
5392   Retry 0: Garbage count exceeded
5393   Retry 0: Garbage count exceeded
5394   Retry 0: Garbage count exceeded
5395   Retry 0: Got ERROR
5396   Bytes received:  898336/1000000   BPS:84293  ETA 00:01  Retry 0: Bad CRC
5397   Retry 0: Garbage count exceeded
5398   Retry 0: Garbage count exceeded
5399   Bytes received:  900384/1000000   BPS:83751  ETA 00:01  Bad escape sequence
5400   2fRe
5401   try 0: Bad data subpacket
5402   Bytes received:  941472/1000000   BPS:86191  ETA 00:00  Retry 0: Bad CRC
5403   Retry 0: Garbage count exceeded
5404
5405 Even when it succeeds, it gets these.  But if I receive a text file, no
5406 matter how big, no errors or retries or timeouts at all.  So it appears that
5407 there is only one problem: a big-time lack of transparency regarding 8-bit
5408 and/or control characters.  The odd thing is, it's not that the characters
5409 can't get through -- they all can -- but they seem to cause transitory
5410 blockages.  16 Aug 2007.
5411
5412 Cleaned up the remaining pointer signedness warnings in ckutio.c, but this
5413 was a mistake, it broke Kerberos connections completely.  Undid the changes.
5414 ckutio.c, 17 Aug 2007.
5415
5416 Changed all return() in the fork()==0 section of ttptycmd() to exit().
5417 ckutio.c, 17 Aug 2007.
5418
5419 Tried explicitly setting the slave pty to rawmode.  Makes no difference.
5420 Tried using the Mac OS X (curses) raw() function, and also system("stty
5421 raw"); still no difference.  Tried doing all of these in different
5422 combinations and orders.  I found one combination that cuts the errors about
5423 in half, and the transfer of the no-IAC test pattern almost always succeeds
5424 (but it's slow).  Anyway, it doesn't help much with the test pattern that
5425 contains IACs.  Well, the code is more solid than it was before but
5426 functionally we have not advanced much if we can't download a binary file
5427 with Zmodem!  On the other hand, we can upload them, and we can transfer
5428 text files in both directions, which is an improvement over the previous
5429 situation, in which the entire session would hang due to loss of
5430 synchronization of the encryption stream.
5431
5432 Tried adding -funsigned-char to CFLAGS of Mac OS X target.  It does not
5433 make the "signedness" warnings go away and it doesn't change the runtime
5434 symptoms.
5435
5436 I tried a simpler version of pty_make_raw(), the one from Serg Iakovlev, but
5437 it was a total failure.  That's encouraging though, because it indicates
5438 that pty_make_raw() is the right place to be working.
5439
5440 Then I made pty_make_raw() set or unset every single terminal flag
5441 explicitly.  This made no difference, but didn't hurt anything either.
5442
5443 Then I made pty_make_raw() explicitly set all the c_cc[] characters to 0
5444 (but left c_cc[VMIN] as 1).  This made no difference either.
5445
5446 I checked pty_make_raw() against ttpkt() and the only difference I found in
5447 the terminal flags is that ttpkt() sets IGNPAR thinking it means "ignore
5448 parity errors" when really it means "discard any character that has a parity
5449 error" (at least according to Iakovlev) -- exactly the opposite.  But I
5450 tried it both ways, no difference.  17 Aug 2007.
5451
5452 I noticed that even Zmodem text receives can fail.  They don't get any
5453 errors, they just get cut off shortly before the end.  (But usually they
5454 succeed, and fast too, like 500K cps).
5455
5456 What if I don't call pty_make_raw() at all on the slave pty?
5457
5458 zrt: EESSSSSSSS: 80% good (E = stopped just before end but no other errors)
5459
5460 zrb no-IAC test pattern, short blocks:
5461  1. S/5 (success with 5 screens of errors.
5462  2. S/7
5463  3. S/7
5464  4. S/6
5465  5. E/7 (failed just before end)
5466  6. S/7
5467  7. S/6
5468  8. S/6
5469  9. S/6
5470 10. S/4
5471
5472 So, lots of errors, but it recovered 90% of the time.
5473 Next, same thing, but without requesting short blocks:
5474
5475  1. E/5
5476  2. S/5
5477  3. E/4
5478  4. S/5
5479  5. S/5
5480  6. S/5
5481  7. X/0 (hard failure right away: "Got ZCAN"
5482  8. S/5
5483  9. S/5
5484 10. S/5
5485
5486 So it doesn't look like short blocks make that much difference.  Now what if
5487 I turn off prefixing?  Bad CRC, fails immediately every time.  Putting back
5488 pty_make_raw(slave), it still fails hard.
5489
5490 Tried a new strategy with pty_make_raw(): rather than modify existing flags,
5491 I set all flags to 0, and then turn on only those few that we need like CS8.
5492 Now we get only 2.5 screens of errors instead 4-7 and the transfer rate is
5493 higher for binary files (all of the previous ones were under 100K CPS, while
5494 for text files it was 400-500K CPS):
5495
5496  1. S/2 195669 CPS
5497  2. S/2 194720
5498  3. E/3
5499  4. S/2 192550
5500  5. S/3 192325
5501  6. S/3 145066
5502  7. S/2 200689
5503  8. S/3 188948
5504  9. S/2 209461
5505 10. S/3 181991
5506
5507 I noticed that there was no TIOCSTTY ioctl in the pty/fork setup sequence,
5508 which is recommended somewhere, so I tried that and it was a disaster; the
5509 entire session hung.  I took it back out.  18 Aug 2007.
5510
5511 Tried some transfers over a clear-text (not encrypted) connection with the
5512 same results: smooth, fast transfer of a big text file (400K cps); rocky but
5513 successful transfer of the no-IAC binary pattern file (135K cps).  Switching
5514 back to ttruncmd(), the same binary file is received at 1.5M cps, and the
5515 no-IAC binary file totally fails after too many "Bad CRC"s; and we already
5516 know that any file that contains IACs will fail.  One might say that
5517 ttptycmd() is better in every respect than ttruncmd() except in speed
5518 (when it works).
5519
5520 Let's see if ttyptycmd still works in remote mode (to local K95):
5521  . sz / text works, but slowly.
5522  . lsz / text works but some wierd errors are reported.
5523  . lsz / binary / no IAC doesn't work at all (CRC-32 mismatch for a header;
5524         Unexpected control character ignored: 13, etc).
5525  . sz / binary / no IAC works OK but slow.
5526  . sz / binary / full test pattern with IAC works OK but slow.
5527  . Sending text into rz fails completely.
5528
5529 What about ttruncmd() in remote mode?
5530  . send /text works, fast.
5531  . send /binary works, fast. 
5532  . receive /text works, not so fast but not bad.
5533  . receive /binary works, not so fast but not bad.
5534
5535 So we use ttruncmd() for remote mode, and we use it for local mode
5536 serial-port and modem connections, and we use ttptycmd() on network
5537 connections because (a) they might be encrypted, and (b) even if they are
5538 not, they use some protocol that we have to handle, e.g. Telnet, Rlogin.
5539 19 Aug 2007.
5540
5541 Discovered that Sending binary files no longer works.  Text is OK, binary
5542 transfers don't even start.  This happens on both encrypted and clear-text
5543 connections.  ttptycmd() is being used in both cases.  But oddly enough,
5544 receiving binary still works as before.  What did I break, and when?
5545 Oh, it was just the script, when I changed it from using sz to lsz.  Putting
5546 it back to sz makes it work, even with the full 3.2MB binary pattern with
5547 IACs.
5548
5549 I backed off the changes I made to ckctel.c to suppress some warnings, in
5550 view of the fact that similar changes to ckutio.c broke things so badly.
5551 19 Aug 2007.
5552
5553 If sz is not given the -e flag, it sends control characters bare, except ^P,
5554 ^Q, ^S, and ^X.  ^X is the control prefix, so ^A is sent ^X followed by A.
5555 With -e, all C0 control chars are prefixed, but with ^X, which is, of
5556 course, a control character.  Interestingly, the C1 analogs of ^P, ^Q, ^S
5557 (but not ^X and, unfortunately, not IAC) are also prefixed.  -e makes no
5558 difference for 8-bit characters.
5559
5560 If we have a Telnet connection and the server is in ASCII (NVT) mode, CR is
5561 always followed by LF or NUL.  Well, it seems the server is putting us
5562 (Kermit) in binary mode in this case, but staying in ASCII mode itself.
5563 Added code to handle NVT byte stuffing and unstuffing in each direction
5564 independently, according to the TRANSMIT_BINARY state in that direction.  I
5565 made a file containing just the bytes 0-31 and 127 and 128-159 and 255 (66
5566 bytes all together) and sending it from the host to C-Kermit, the local log
5567 shows that every control character was received correctly and all TELNET
5568 conversions were done right -- NUL removed after CR (and only after CR); IAC
5569 removed after IAC (and only after an IAC meant as a quote).  For the first
5570 time, I can receive the 1MB all-values test pattern, but there are still
5571 tons of (correctable) CRC errors, so the transfer rate is really awful, like
5572 about 5% of what we get with a text file (25Kcps instead of 500).
5573
5574 Further experimentation shows that the fundamental transparency problem is
5575 fixed; we can receive short files (say, 1K or less) containing absolutely
5576 any byte values in any combination with no errors at all.  But once the file
5577 size reaches (say) 10K, we get CRC errors, like one every 2 or 3K of data.
5578 These are not deterministic.  In successive transfers of the same file, they
5579 come in different spots.  It's tempting to blame pty buffer overruns, but
5580 then text files would show the same behavior.  When a binary file size
5581 exceeds, say, 1MB, the chances of successful completion go way down,
5582 independent of whether my external protocol is rz or lrz.  I like lrz better
5583 because the error reports come out on the screen as the transfer is going
5584 on.  Trying to download a real-world binary file -- a 2.2MB C-Kermit
5585 executable -- I get 4500 error messages but the transfer evenually succeeds,
5586 with an effective throughput of 21Kcps.
5587
5588 Actually it turns out that "sz -a somebigtextfile" (2.2MB) also gets a lot
5589 of CRC errors.  The -e flag (escape all control characters) makes the same
5590 big text file transfer with few or no errors.  It's not sure-fire.
5591 Sometimes no errors, sometimes one or two, and sometimes a fatal error that
5592 kills the transfer.
5593
5594 With binary files... a 32K binary file seems to make it every time.  40K
5595 fails about 50% of the time.  48K fails 60% and every time it fails, it has
5596 created a partial file of exactly 32K (32768 bytes).  96K fails 9 out of 10
5597 times, when it fails, the partial file is always 0 bytes, or 32768, or
5598 65536, but that just means that rz's file output buffer is 32K.
5599
5600 Why, then, do binary files cause trouble if it is not a solid transparency
5601 problem?  If a certain file can get through once, why can't it get through
5602 every time?  When a character arrives at the pty, the pty driver probably
5603 takes a different path through its code, checking the terminal flags that
5604 would affect that character.  I tried making Kermit's network read buffers
5605 very small but, surprisingly, this made things worse.  I also tried making
5606 them very much bigger, which didn't help either.  24K still seems to be the
5607 right size.
5608
5609 So, is it that some characters take longer to process than others?  So long
5610 that data is lost due to lack of flow control between TCP and the pty?  One
5611 way to test this theory is to slow Zmodem down.  I tried "-l 32" which,
5612 according to the man page, tells sz to "wait for the receiver to acknowledge
5613 correct data every N (32 <= N <= 1024) characters.  This may be used to
5614 avoid network over-run when XOFF flow control is lacking."  Makes no
5615 difference.  I also tried the -w (Window) switch, ditto.  In fact there are
5616 all sorts of options to set the "window size", "packet length", "block
5617 size", and "frame length", but with no explanation of what these mean or how
5618 they are related.  If I crank everything down to minimum value:
5619
5620   lsz q -L 32 -l 32 -w 1
5621
5622 I get 50% success with the 96K file instead of 10%.  Adding -e, oddly
5623 enough, made it worse.  I also tried setting the environment variable
5624 ZNULLS to different numbers like 512, no help there either.
5625
5626 I tried making the read-from-net-write-to-pty buffer small (1K) but leaving
5627 the pty-to-net one big.  This improves chances of success, but it's
5628 intolerably slow (3Kcps when the connection is capable of 500K).
5629
5630 I also changed the write-to-pty operation from a single write() call of
5631 possibly many K characters to a byte loop, one write() per byte.  Same
5632 result: success (but still about 300 recoverable errors), throughput 3Kcps.
5633 20 Aug 2007.
5634
5635 With ttptycmd() configured to write to the pty in a byte loop, it is
5636 possible to delay each write.  Adding a 10msec delay per character results
5637 in a transfer that runs at about 20 cps and (for the 96K test file) would
5638 take about 80 minutes to complete.  And yet it still gets just as many
5639 errors.  So it's not a matter of timing either.  The errors come, on
5640 average, every file 388 bytes, but not at regular intervals.
5641
5642 I tried the TIOCREMOTE ioctl on the pty master, as discussed somewhat
5643 obliquely in the Mac OS X "man pty" page; "This mode causes input to the
5644 pseudo terminal to be flow controlled and not input edited (regardless of
5645 the terminal mode)" -- sounds like just the ticket but it made no
5646 difference.  Actually, looking at a man page on another OS (Solaris), it
5647 says this is only for lines of text, EOLs are supplied, so that would mess
5648 up the protocol.  So remember: don't use this.
5649
5650 Tried without O_NDELAY; the behavior was the same but the speed was much
5651 slower.
5652
5653 Tried switching back to the ckupty.c routines on Mac OS X and found that it
5654 works now the same as with openpty(), except that I seem to get more getty
5655 babble at the end.  But this means I can run some tests on Solaris.  I moved
5656 the entire test environment from Mac OS X 10.4.9 to Solaris 9.  But it
5657 doesn't work at all.
5658
5659 Trying to figure out the ckupty.c modules again.
5660  . do_pty() calls pty_getpty() which returns in arg1 the fd of the pty master.
5661  . Then it creates a pipe as a way to tell when the child dies
5662  . Then it creates a fork:
5663     - The parent does a blocking read from the pipe
5664     - The child calls getptyslave() to get the pty slave
5665       and writes one byte to the pipe
5666       and then execs the command it's supposed to run
5667 Note that the file descriptor of the slave is known only to the lower fork.
5668 Therefore the lower fork is the one that has to set all the tty modes, etc.
5669 I took care of all that but the ckupty.c method doesn't work at all on
5670 Solaris.  But it works "fine" on Mac OS X (the 32K all-bytes test file
5671 transfers instantly with no errors, but the 96K one errors out).
5672
5673 The problem on Solaris is that pty_make_raw() fails on the masterfd (but not
5674 on the slavefd) with errno 25 "ioctl inappropriate for device".  It doesn't
5675 matter whether I do it in ckupty.c or ckutio.c.  I found a web page on
5676 kde.org that says Solaris does not allow tcget/setattr() on a pty master.
5677 But the Sun "knowledge base" is not open to the public.  Well, presumably
5678 changes made to the slave are reflected in the master (comments in Solaris
5679 telnetd seem to confirm this...)  Let's come back to Solaris later.
5680
5681 Moving to a Linux with lrzsz installed...  Built a Kerberos 5 version with
5682 USE_CKUPTY_C.  Like on Mac OS X, it transfers short files OK and chokes on
5683 longer ones.  Switched to openpty(), it behaves the same.  So the problems
5684 on Mac OS X are evidently not OS-specific, which is good I guess, since that
5685 means finding the way around them will apply to more than one platform.
5686 21 Aug 2007.
5687
5688 Look into TIOCSCTTY again.  On System V based OS's, opening a pty acquires a
5689 controlling terminal automatically.  On BSD-based OS's, no; you have to use
5690 the TIOCSCTTY on the slave file descriptor to give it one.  I'm not sure why
5691 a controlling terminal would be needed, except that without one, the virtual
5692 device "/dev/tty" does not exist for the process that runs on the pty, and
5693 maybe the application that runs there (e.g. rzsz) checks for it.  On the
5694 downside, having a controlling terminal opens the process up to terminal
5695 interrupts like SIGINT and SIGQUIT.  Until now I have not been using this
5696 ioctl().  Results (in Linux):
5697
5698   With TIOCSCTTY: 96K all-bytes test: 11 screens of errors, then success
5699   Without TIOCSCTTY: exactly the same.
5700
5701 Tried the same thing with TIOCNOTTY instead of TIOCSCTTY, with exactly the
5702 same results (no effect whatsoever).
5703
5704 There has to be a way to make this work, because Zmodem works through
5705 telnetd, which basically the same thing as ttptycmd(): a relay between the
5706 network and a pty.  ttptycmd() is like telnetd backwards.  Modern telnetds
5707 are not much help; they don't access ptys or the network directly, they go
5708 through "mux" devices so I can't see what they're doing to get transparency
5709 and flow control.  An old BSD telnetd uses packet mode but that would be a
5710 big deal...
5711
5712 I tried ignoring various signals like SIGTTOU and SITSTP, since some Telnet
5713 clients do this.  No effect, no difference.  Anyway, in Linux the transfers
5714 almost always finish OK despite the many errors.  There is just some trick
5715 I'm missing to make the pty accept a stream of arbitrary bytes without
5716 hiccuping.
5717
5718 What about Solaris, which uses ckupty.c?  In streams-based OS's, where line
5719 disciplines and whatnot are pushed on top of the pty, it looks like the pty
5720 module saves the file descriptor of the "bare" slave pty (as 'spty') before
5721 pushing things onto it, and then later uses spty rather than the regular
5722 slave pty file descriptor when getting/setting terminal modes.  I'm not sure
5723 what this is all about but it's definitely SysVish...  It happens if
5724 STREAMSPTY is defined, but I noticed that STREAMSPTY is never defined
5725 anywhere.  I tried defining it so we take an entirely different path through
5726 the code.  It made absolutely no difference.
5727
5728 Then I noticed that HAVE_STREAMS is not defined for Solaris either.  Tried
5729 defining it, but the session didn't work at all, no i/o.  Removing the
5730 HAVE_STREAMS definition but keeping the STREAMSPTY defined, I rebuilt and
5731 tried "set host /connect /pty emacs".  I got an EMACS screen but could not
5732 type anything into it, which means that STREAMSPTY should not be defined
5733 either.  Removed the definition and "set host /pty" works again.  So what's
5734 the problem with ttptycmd()?
5735
5736 In fact, ttptycmd() works on Solaris with Kermit as the external protocol,
5737 but not with Zmodem, not even with text files.  So again, there is no
5738 fundamental problem with the code or the logic, it's Just A Matter Of
5739 Transparency to control and/or 8-bit characters -- some trick I don't know
5740 about.
5741
5742 Looking at the Solaris debug log...  I see that ckupty.c is calling
5743 init_termbuf() to set the tty modes of the master, not the slave, and
5744 set_termbuf() to set them, but you can't do that in Solaris, error 25.  This
5745 is in getptyslave().  Shouldn't getptyslave() be setting the tty modes of
5746 the slave, not the master?  I changed it to do this, but like all other
5747 changes, it made no difference.  I checked to make sure that after the change,
5748 "set host /pty /connect emacs" still worked and it did.
5749
5750 And then what...  I had some code to redirect stderr in ckupty.c that was
5751 not being executing due to a typo.  When I fixed the typo, poof, Zmodem
5752 binary transfers started working, or working as well as they work in Linux
5753 and Mac OS X.  It turns out that if I don't redirect stderr, sz and rz
5754 just don't work.  But lsz and lrz do.  But if I do redirect it, I don't see
5755 the progress messages from lsz/lrz.  22 Aug 2007.
5756
5757 Built on HP-UX 11i v3 (B.11.31 U ia64) with optimizing compiler, got tons of
5758 picky warnings, but it finished and linked and runs OK.  Many of the
5759 warnings were like this:
5760
5761   "ckucns.c", line 1606: warning #2068-D: integer conversion resulted in a
5762   change of sign:   tnopt[0] = (CHAR) IAC;
5763
5764 IAC is defined as 255 in ckctel.h.  If I define it as 0xff, I don't get the
5765 warnings.  I changed the definitions of all the Telnet commands to be in hex
5766 notation rather than decimal.  If cuts way down on the HP-UX warnings and
5767 doesn't seem to cause problems elsewhere.  ckctel.h, 23 Aug 2007.
5768
5769 Now it looks like Solaris is working but then it hangs at the end.  It
5770 appears as if the ckupty.c module is blocking SIGCHLD.  Debug log shows that
5771 when the transfer is complete, we received IAC DM (Telnet Data Mark) after
5772 sz's last gasp and before the shell prompt is printed.  But calling
5773 tn_doop() in this case is a mistake because we are reading the number of
5774 bytes that we know are available in a counted loop, but tn_doop() would
5775 consume an unknown number of bytes and we would never know when to exit the
5776 loop.  Anyway, C-Kermit doesn't do anything with DM.  Skipping over
5777 tn_doop() (and not writing out the Telnet command bytes) fixes the hanging
5778 condition at the end, even though SIGCHLD is never raised.  ckutio.c,
5779 23 Aug 2007.
5780
5781 Some tests, Solaris to NetBSD over K5.
5782 zst sends ascii.txt, a 2.36MB ascii text file (Kcps / Errors).
5783 zrt receives the same file:
5784
5785   zst 587/0 526/0 542/0 434/0 423/0
5786   zrt 827/0 800/0 847/0 FAIL  610/0
5787
5788 So text is good.  Binary not so good.  Here we transfer the 1MB all-bytes
5789 pattern file.  zrb receives it successfully, but with 1248 errors, at only
5790 15Kcps.  Sending the same file out always fails:
5791
5792   Begin 20070823 16:32:07: SEND BINARY all2.bin [sz]
5793   Sending: all2.bin
5794   Bytes Sent:   5600/1000000   BPS:12446    ETA 01:19   FAILURE
5795   End 20070823 16:32:13
5796   Elapsed time: 6.617992999999842
5797   cps = 151103.2121067556
5798   lsz: caught signal 1; exiting
5799
5800 Decided to move to Linux but found that something is screwed up in Linux
5801 C-Kermit with tilde expansion:
5802
5803   send ~/testfiles/all.bin
5804
5805 doesn't expand at all (but it did yesterday!).  The problem was in the
5806 ancient, ancient realuid/setuid handling code; real_uid() no longer works in
5807 Linux.  I worked around this in whoami() by setting ruid to getuid() if
5808 real_uid() returned a negative number.  Maybe dangerous, worry about it
5809 later.  ckufio.c, 23 Aug 2007.
5810
5811 ANYWAY... after fixing that, I tested zsb on Linux, and it's broken there
5812 too, using openpty(), so it's nothing to do with ckupty.c.  After sending
5813 the first Zmodem data packet, it just hangs, nothing comes back.  In text
5814 mode it gets farther, but then the same thing happens.  Captured stderr from
5815 rz on the far end:
5816
5817   Bytes received:     608/1000000   BPS:21137  ETA 00:47  Retry 0: Bad CRC
5818   Bytes received:     864/1000000   BPS:23540  ETA 00:42  Retry 0: Bad CRC
5819   Bytes received:    1120/1000000   BPS:25003  ETA 00:39  Retry 0: Bad CRC
5820   Bytes received:    5696/1000000   BPS:56988  ETA 00:17  Retry 0: Bad CRC
5821   Bytes received:    9120/1000000   BPS:62227  ETA 00:15  Retry 0: Bad CRC
5822   Bytes received:    9376/1000000   BPS:60766  ETA 00:16  Retry 0: Bad CRC
5823   Bytes received:    9632/1000000   BPS:60361  ETA 00:16  Retry 0: Got TIMEOUT
5824   Retry 0: Sender Canceled
5825   Retry 0: Got ZCAN
5826
5827 The local sz, however, doesn't give any error message.  ZCAN means: "other
5828 end canceled session by sending 5 ^X's" (or user typed them).  What actually
5829 happens is that ttptycmd()'s select() times out waiting for something from
5830 the Zmodem partner and ttptycmd() itself kills the sz fork with SIGHUP.
5831 When lsz receives SIGHUP it sends the ZCAN.  So the real problem is that
5832 after some point we're not receiving anything.
5833
5834 I changed the timeout from 4 seconds to 30 seconds and now I see it just
5835 stops for long periods of time and then resumes.  The lrz log on the
5836 receiving end shows tons of timouts, CRC errors, and other errors.  The
5837 local log shows that lsz wound up sending ZCAN (2 x (10 x ^H, 10 x ^X)).
5838
5839 Moving on to another problem...  Turns out Ctrl-C (SIGINT) is working right
5840 after all.  Since I'm using my test scripts like kerbang scripts, Ctrl-C
5841 exits through trap(), as it should, closing the connection and cleaning up.
5842 If I start Kermit and tell it to TAKE the script, then Ctrl-C brings me back
5843 to the prompt with the connection still open (as it should).  However, until
5844 now I haven't done anything about the fork or the ptys.  Added code to
5845 trap() to kill the fork and close the master pty.  ckuusx.c, 24 Aug 2007.
5846
5847 Added code to try to break the deadlock.  If select() times out, but we have
5848 stuff to write either to the pty or the net, try to do it anyway, even
5849 though select() did not say we could.  But this doesn't help because when
5850 select() times out we don't have anything to write.  The problem is that
5851 after receiving that last packet from the remote rz, the local lsz doesn't
5852 seem to do anything, as if the lower fork wasn't running (and to confirm
5853 this hypothesis, sometimes I noticed that when I Ctrl-C'd out of this, the
5854 transfer would take off again).
5855
5856 Backing up and testing with gkermit rather than zmodem:
5857
5858  kst ripple.txt [824K] OK
5859  kst ascii.txt [1359K] OK
5860  krt ripple.txt -- FAILED
5861
5862 It seems that we can't handle streaming.  If I set up krt to disable
5863 streaming on receipt, it works OK.
5864
5865  krt ripple.txt [824K] OK
5866  krb all2.bin  [1000K] OK
5867
5868 So here we have no trouble sending but big trouble receiving unless we
5869 disable streaming.  Whereas with Zmodem we have trouble receiving.
5870
5871 But this wasn't happening before, what changed?  Using C-Kermit on the far
5872 end to receive the file with debug log on, I see that it is sending 4K data
5873 packet after 4K data packet, with the local gkermit silent, as expected.
5874 About midway through the transfer, the local Kermit sends an error packet
5875 "Transmission error on reliable link".  Looking at G-Kermit's debug log...
5876 It receives the first five 4K data packets OK, but gets a CRC error on the
5877 fifth one, and sends the Error packet.  So it has received a stream of
5878 20-some thousand bytes OK and then messes up.  That number sounds a lot like
5879 ttptycmd()'s buffer size.  I changed the buffer sizes to be different:
5880
5881   Read from pty and write to net: 4K  
5882   Read from net and write to pty: 1K
5883
5884 This time it received the first 4K packet and failed on the second one.
5885 Then I increased the buffers to 98K each, expecting to receive lots more
5886 packets successfully but it bombed out on the 5th one.  But that's good, it
5887 confirms there's no logic error in the buffer management.  Just to make
5888 sure, though, let's set the buffer size smaller than the packet size and
5889 disable streaming.  In this case we get 4 good data packets and a CRC error
5890 on the 5th one and so we request retransmission, and the next 8 times it
5891 arrives it gets a different CRC error, but the 9th copy is OK.  Then the
5892 next packet comes and it gets a CRC error every time.  And this is nothing
5893 but plain ASCII text.
5894
5895 Switching to remote mode:
5896
5897   REMOTE=1 kk kst
5898
5899 (after tricking myself because it was using ttruncmd() for this...) I see
5900 that nothing works at all.  What did I break?  24 Aug 2007.
5901
5902 Fixed ttptycmd() to restore console modes after a remote-mode transfer.
5903 ckutio.c, 25 Aug 2007.
5904
5905 Noticed that error codes like ESRCH are not available in all modules.
5906 That's because of some complicated in #ifdefs in ckcdeb.h that wind up not
5907 always #including <errno.h>.  But I notice that ckutio.c includes it
5908 unconditionally with no ill effects, and so does ckvfio.c.  Does any version
5909 of Unix at all not have <errno.h>?  Added a catch-all clause to ckcdeb.h to
5910 #include <errno.h> (in UNIX only) if, after the other clauses, ESRCH was
5911 still not defined.  ckcdeb.h, 25 Aug 2007.
5912
5913 Now back to debugging ttptycmd()...  Remote-mode transfers with ttptycmd()
5914 were broken in two places, maybe as long as 2 weeks ago (this would have
5915 affected non-network transfers too, which I can't test any more).
5916 The logic was missing in a couple places for the non-network and/or
5917 non-Telnet and/or non-encrypting connections (if statements with no else
5918 parts).  Fixed in ckutio.c, 25 Aug 2007.
5919
5920 Testing remote mode:
5921
5922  kst OK   zst OK
5923  ksb OK   zsb OK
5924  krt OK   zrt OK
5925  krb OK   zrb OK
5926
5927 Functionally it all works but there are hitches with Zmodem as always.
5928 When sending to K95:
5929
5930  . If I send with lsz, there are hundreds of "Subpacket too long" errors,
5931    and the transfer is very slow, but it succeeds.
5932
5933  . If I send with the 1994 Omen version of sz, transmission is instantaneous
5934    and without errors, but then it hangs at the end.
5935
5936  . If I bypass C-Kermit and send direct from lsz or sz, both work fine.
5937
5938 So clearly the ptys are getting in the way.  The hanging at the end would be
5939 caused by the sz process closing before its last output reached the master
5940 pty.  It would need to do some form of flushing and/or pausing at the end
5941 but there's nothing I can do about that; these programs were not designed to
5942 be used in this way.  Anyway, it only seems to happen with files longer than
5943 100K.
5944
5945 For local mode, testing in Solaris over our Kerberos 5 connection again:
5946
5947  gkermit  lrzsz
5948  kst OK   zst FAIL
5949  ksb OK   zsb FAIL
5950  krt OK   zrt OK but with errors
5951  krb OK   zrb FAIL
5952
5953 If I use Omen rzsz as the external protocol (e.g. with zst), it blocks
5954 redirection and it sends the file to my terminal, rather than over the
5955 connection.  This would probably be because it finds out the device name of
5956 the job's controlling terminal and opens it, to prevent redirection.  This
5957 is hard to prevent in Solaris because there is no TIOCSTTY ioctl().
5958 Supposedly the same thing is accomplished by closing and reopening the slave
5959 pty after doing setsid().  I added code to do this, but it made no
5960 difference.  (If I use lsz instead of sz, it is indeed redirected, but jams
5961 up after about 15K.)  ckupty.c, 27 Aug 2007.
5962
5963 On Mac OS X with sz 3.73 1-30-03, however, the redirection works, so I
5964 assume it would also work in Linux, FreeBSD, NetBSD, etc, too.  Doing the
5965 full test suite on Mac OS X:
5966
5967  gkermit   lrzsz          rzsz
5968   kst OK   zst FAIL (1)    OK
5969   ksb OK   zsb FAIL (2)    OK
5970   krt OK   zrt OK   (3)    OK for 100K file, fails for longer.
5971   krb OK   zrb FAIL (4)    OK (1MB all-bytes test pattern)
5972
5973 (1) 64K file OK every time; 100K file fails every time.
5974 (2) 10K file fails every time.
5975 (3) Succeeds with 800K file but gets a few recoverable errors.
5976 (4) Succeeds with 48K binary file with some errors, fails with longer ones.
5977
5978 So actually it looks pretty good, it's just that lrzsz messes up.  When
5979 sending with lsz if I include -L 512 it sends the 100K test file with no
5980 errors, but still chokes on longer ones.
5981
5982 Testing on Mac OS X again, but this time over a clear-text Telnet connection:
5983
5984  gkermit        lrzsz    rzsz
5985   kst OK   zst  FAIL(1)   OK
5986   ksb OK   zsb  FAIL(2)   OK
5987   krt OK   zrt  OK(3)     OK
5988   krb OK   zrb  FAIL(4)   OK 
5989
5990 (1) Almost worked, finished 777K out of 824K without errors.
5991 (2) Got tons of errors, failed in first 30K out of 1000K.
5992 (3) OK for 100K file but fails for larger.
5993 (4) OK for 48K binary fail but fails for larger.
5994
5995 Maybe see if we can do without the OPENPTY part.
5996
5997 TOMORROW -- just clean up the code, add some SET / SHOW / HELP commands,
5998 document it, and move on.
5999
6000 Note: In K95, SET WINDOW sets the Zmodem packet length, 32 - 1024, multiple
6001 of 64.
6002
6003 SEE ~/80/external.txt
6004
6005 Changed ftp port from int to unsigned int.  ckcftp.c, 30 Aug 2007.
6006
6007 Tried again to build KRB4/KRB5/SSL/TLS version for Solaris 9.  Had to update
6008 the build procedure again, of course, because of new file and directory
6009 names, but ran into problems anyway because the
6010 cu-solaris9g+krb5+krb4+openssl+shadow+pam+zlib target was calling another
6011 target that did not know about the hardwired pathnames.  Integrated the two
6012 targets and tried building again.  It actually compiled ok (but with lots of
6013 warnings from the security modules), but failed at link time with
6014 krb5_init_ets not found; fixed that with an #ifdef NO_KRB5_INIT_ETS, now it
6015 builds OK but without the ftp client.  Tried building it WITH the FTP and
6016 that was OK too, no changes needed except to the build procedure.  12 Feb
6017 2008, that is: C-Kermit 8.0.212 : 20080212.
6018
6019 Tried to build with -DCK_SRP and -lsrp but:
6020
6021   hash_supported                      ckcftp.o
6022   hash_getdescbyname                  ckcftp.o
6023   hash_getdescbyid                    ckcftp.o
6024   cipher_getdescbyname                ckcftp.o
6025   krypto_delete                       ckcftp.o
6026   krypto_new                          ckcftp.o
6027   cipher_supported                    ckcftp.o
6028   krypto_msg_priv                     ckcftp.o
6029   krypto_msg_safe                     ckcftp.o
6030   hash_getlist                        ckcftp.o
6031   cipher_getlist                      ckcftp.o
6032   cipher_getdescbyid                  ckcftp.o
6033
6034 Sent mail to Tom Wu and backed off for now.  makefile, 14 Feb 2008.
6035 (Tom Wu never answered; seems like SRP is defunct.)
6036
6037 The ".blah = xxx" form of variable assignment only worked for variables
6038 names of length 22 or less, noticed and fixed by Wolfram Sang.  ckucmd.c,
6039 5 Mar 2008.
6040
6041 In "set host /pty ssh ..." connections, the INPUT command suddenly stopped
6042 working.  This is in Solaris 9.  It happens with all 8.0.* versions of
6043 C-Kermit, so it's nothing to do with ttptycmd().  Added some debug()
6044 statements but they don't show anything.  Turns out there wasn't a problem
6045 after all.  Wed Mar 26 16:04:53 2008
6046
6047 Changed cmifi() to not print "?No files match" (or whatever) if SET QUIET ON.
6048 ckucmd.c, 26 Mar 2008.
6049
6050 Added \v(remoteip) for the IP address of the host we're connected to,
6051 and \v(inmessage) for INPUT status messages corresponding to \v(instatus).
6052 ckuusr.h, ckcmai.c, ckuus[24].c, 26 Mar 2008.
6053
6054 Made \fkeywordval() strip braces/quotes from the right-hand side so we can
6055 handle things like:
6056
6057   password="stringwithspaceatend "
6058
6059 ckuus4.c, 6 Aug 2008.
6060
6061 Added invisible PUTENV command for UNIX only.  Value should not be enclosed
6062 in doublequotes.  Requires lge \v(buildid) 20080826.  ckuusr.[ch], 26 Aug 2008.
6063
6064 Added SET VARIABLE-EVALUATION { RECURSIVE, SIMPLE }.  This is highly
6065 experimental, but also highly desirable if it works out.  SIMPLE inhibits
6066 the default recursive method of evaluating \%x and \&x[] variables, which
6067 is, quite frankly, nuts and makes programming in Kermit at best
6068 counterintuitive.  I made an exception in the case of array subscripts,
6069 because changing how they are evaluated could break a lot of scripts, and
6070 anyway there should never be any harm in evaluating them recursively because
6071 their final value is always (or should be) numeric, not some string that
6072 might contain backslashes.  The SET VAR setting is on the stack, just like
6073 SET QUIET (it follows the quiet/xquiet code in ckuus[356].c), so macros or
6074 command files that change it can't break the script that invokes them.
6075 Added \frecurse() to force recursive evaluation of a \%x or \&x[] variable
6076 regardless of the VARIABLE-EVALUATION setting.  Added \v(vareval) to allow
6077 programmatic setting to current setting.  Tested on Solaris 9 but should be
6078 totally portable.  ckuusr.[ch], ckuus[356].c, 11 Sep 2008.
6079
6080 From Günter Knauf: 64-bit builds were failing on SuSE Linux because
6081 libresolv and libcrypt were in lib64 rather than lib; updated the tests in
6082 the linux makefile target to find them.  makefile, 12 Jan 2009.
6083
6084 Tried building on Red Hat Enterprise Linux Server release 5.3 64-bit.
6085 There is no curses or ncurses.  "make linuxnc" compiled OK but collapsed at
6086 link time looking for crypt(), res_search(), and dn_expand().  Turned out
6087 the linuxnc (and linuxc) targets needed the same treatment as the Linux one
6088 for 64-bit Linuxes.  makefile, 3 Mar 2009.
6089
6090 Consolidated the linux targets so we no longer need three separate ones for
6091 curses, ncurses, and no curses.  "make linux" works ok on computers with and
6092 without (n)curses.  "make linux+ssl", ditto.  "linux+krb5+ssl builds OK but
6093 needs -DNO_KRB5_INIT_ETS".  Makefile, 3 Mar 2009.
6094
6095 Fixed copyright date announced in herald, ckuus5.c, 3 Mar 2009.
6096
6097 Patch from Seth Therault to avoid deprecation warning for utmp references
6098 in ckufio.c in Mac OS X 10.5 (later, this became a consolidated makefile
6099 target that works automatically for at least Mac OS X 10.3.9 through
6100 10.5.6).  makefile, ckufio.c, 28 April 2009.
6101
6102 zshcmd() (the function used by RUN and ! to run external commands) was not
6103 falling back as expected in Linux RHEL4/5 if SHELL was not defined in the
6104 environment.  Also in all Unix versions, there was no indication if a RUN/!
6105 command failed (other than the return code) because the specified shell
6106 didn't exist or was not executable (e.g. the SHELL environment variable was
6107 misdefined).  Now it prints the name of the offending shell and the reason
6108 it couldn't be executed (Not found, Permission denied, etc).  ckufio.c,
6109 28 April 2009.
6110
6111 There is no easy way to get the last field of string; for example, the
6112 extension from a filename, which might have any number of fields.  In
6113 general we want to be able to get "word number n" counting from the right;
6114 \fword() lacks this ability.  Now if you give it a negative word number,
6115 that says to count from the right; for example \fword(one two three four
6116 five, -2) returns "four".  ckclib.c, ckuusr.c, 14 May 2009.
6117
6118 Fixed a typo in the aix51+openssl (SSLLIBS should have been SSLLIB).
6119 From Jason Lehr.  makefile, 27 May 2009.
6120
6121 Updated the linux+openssl+zlib+shadow+pam target to chain to the new main
6122 Linux target.  A bunch of other ones remain un-updated. makefile, 12 Jun 2009.
6123
6124 Updates to the new Mac OS X 10.5 target from Seth Therault (which is
6125 supposed to work on all Mac OS 10-point-anything) to avoid warnings
6126 that came up on on Mac OS 10.4.11/Intel.  Once this one is proven we should
6127 be able to remove/consolidate lots of other ones.  makefile, 12 Jun 2009.
6128
6129 C-Kermit disables SSL with the message "?OpenSSL libraries do not match
6130 required version." if the version of OpenSSL that Kermit was built with is
6131 not exactly the same as the version that is loaded dynamically at runtime.
6132 This is actually the proper behavior, since APIs are not guaranteed not to
6133 change between OpenSSL versions prior to 1.0.0.  Made the error message more
6134 informative.  ck_ssl.c, 26 Aug 2009, and again 28 Aug 2009.
6135
6136 AIX 6.1 is out, it is really just a new name for AIX 5.4.  Added makefile
6137 targets, plus for the first I made AIX 4.2 and later figure out its version
6138 number in the makefile target so we don't have to keep adding new -DAIXnn
6139 sections to the code, and also get its hardware name (e.g. "powerpc") from
6140 uname at make time, rather than hardwiring "rs6000" as I did before.
6141 Consolidated all AIX 4.2 and later targets so now just "make aix" or "make
6142 aix+ssl" can be used.  Except not the gcc ones as they have some quirks so
6143 I'd rather not disturb them.  Tested this on AIX 5.3.
6144 makefile, 28 Aug 2009.
6145
6146 From Kinjal Shah, a correction to the Linux makefile entry that allows it
6147 find the 64-bit curses or ncurses library.  makefile, 29 Aug 2009.
6148
6149 Renamed aix4[23]: to oldaix4[23]: in makefile to fix the warning messages
6150 I didn't notice before.  I didn't want to remove them because they have
6151 some special things that might still be needed, if anybody still has these 
6152 AIX versions.  makefile, 29 Aug 2009.
6153
6154 Built on RHEL 5.3 64-bit, regular and with OpenSSL 0.9.8e.  31 Aug 2009.
6155
6156 Built on NetBSD 5.0.1/i386, regular and with OpenSSL 0.9.9-dev, 1 Sep 2009.
6157
6158 Changed SSL message to mention LD_LIBRARY_PATH (Solaris), SHLIB_PATH (HP-UX),
6159 LIBPATH (AIX), or LD_LIBRARY_PATH (Linux).  ck_ssl.c, 3 Sep 2009
6160
6161 Noticed that "make linux+openssl" fails to include -lutil a link time, which
6162 it needs for openpty().  That's because this target is obsolete.  I renamed
6163 it to be oldlinux+openssl and added linux+openssl as a synonym for
6164 linux+ssl.  makefile, 3 Sep 2009.
6165
6166 Tested linux+openssl+zlib+shadow+pam, it's OK.  Also linux+krb5.  Also
6167 linux+krb5+ssl.  makefile, 3 Sep 2009.
6168
6169 Tried building on Solaris 9 with OpenSSL 0.9.8k with
6170 solaris9g+openssl+shadow+pam+zlib, it failed like so:
6171
6172   ck_ssl.c:2875: error: conflicting types for 'inet_aton'
6173   /usr/include/arpa/inet.h:52: previous declaration of 'inet_aton' was here
6174   make[2]: [ck_ssl.o] Error 1
6175   make[2]: Leaving directory hmt/sirius1/prv0/kd/fdc/solaris9ssl'
6176   make[1]: [solaris2xg+openssl+zlib+pam+shadow] Error 2
6177   make[1]: Leaving directory hmt/sirius1/prv0/kd/fdc/solaris9ssl'
6178   make: [solaris9g+openssl+shadow+pam+zlib] Error 2
6179
6180 The problem was caused by including an inet_aton() function ck_ssl.c for
6181 the benefit of platforms that don't have one in their libraries.  This is
6182 defeated by including NO_DCL_INET_ATON in KFLAGS.  I added this, but then
6183 I thought it would be a good idea to automatically sense the OpenSSL
6184 version so we can automatically set OPENSSL_097 or OPENSSL_098 rather than
6185 bombing out, so I added code to do that too, and also to set the Solaris
6186 version number: 9, 10, or 11.  The new entry is solaris9g+openssl.
6187 ckcdeb.h, makefile, 3 Sep 2009.
6188
6189 Fixed a complaint in ckufio.c about implicit declaration of initgroups.
6190 ckufio.c, 4 Sep 2009.
6191
6192 Built on Solaris 10 with gcc and Sun CC using new solaris{9,10,11} target
6193 that is like the new solaris{9,10,11}g one but without the gccisms.
6194 makefile, 4 Sep 2009.
6195
6196 Changed solaris{9,10,11}g+ssl target to set only the SSL-specific things and
6197 then chain to the main solaris{9,10,11}g target.  Tested OK on Solaris 9 and
6198 10.  makefile, 4 Sep 2009.
6199
6200 Created solaris{9,10,11}+ssl target that is exactly like the
6201 solaris{9,10,11}g+ssl except it chains to the solaris{9,10,11} target
6202 instead of the solaris{9,10,11}g one.  That is, it builds an SSL version of
6203 C-Kermit using Sun CC rather than gcc.  makefile, 4 Sep 2009.
6204
6205 Tried building on HP-UX 10.20, bundled (non-ANSI) compiler ("make
6206 hpux1000").  This failed until I:
6207
6208  . Moved a struct inititialization out of setextern(), ckuus3.c.
6209  . Removed an ANSIism from the declaration of sigchld_handler() in ckutio.c
6210  . Added a cast to strcmp() in zvuser(), ckufio.c.
6211
6212 Builds OK now.  Built OK with "hpux1000o" (the ANSI compiler) too.
6213 And with "hpux1000gcc".  Couldn't test "hpux1000o+openssl".  21 Sep 2009.
6214
6215 The Sony Playstation 2 and 3 are 64-bit PowerPC platforms that can run Linux
6216 if it is installed as an "other OS" on its hard disk; and the Linux kernel
6217 since 2.6.21 supports the PS3 without any patching required.  Pawel Rogocz
6218 reported that "make linuxppc" (one of the old targets that has not yet been
6219 integrated into the main "linux" target) compiles OK on 2.6.29-ydl61.3
6220 (Yellow Dog Linux release 6.2 'Pyxis'), but fails at link time because
6221 'openpty' isn't found, because -lutil was not included, because that part
6222 was added only to the main linux target.  I asked him to try "make linux"
6223 and he sent back a transcript in which there were thousands of errors from
6224 the curses code ckuusx.c.  Later I tried it myself and it built without a
6225 hitch.  My theory is that between then and now, a missing piece of the
6226 ncurses library (/usr/include/ncursesw) was installed.  21 Sep 2009.
6227
6228 HP-UX 9.05 on PA-RISC 9000/712 building with hpux0900 (bundled compiler):
6229  . ckutio.c compilation failed with PENDIN and FLUSHO not defined in
6230    pty_make_raw().  I dummied definitions for them to handle this situation
6231    on this or any other platform where it might crop up.
6232    ckutio.c, 24 Sep 2009.
6233  . Ditto for the PTY module, + IMAXBEL.  ckupty.c, 24 Sep 2009.
6234  . References to endusershell() were fatal in the bundled compiler.  Changed
6235    the hpux0900 target to define NODCLENDUSERSHELL, and put a special case
6236    in ckufio.c to not put a cast in front of the call if NODCLENDUSERSHELL
6237    is defined.  Now it builds and links OK.  makefile, ckufio.c, 24 Sep 2009.
6238
6239 HP-UX 9.05 on PA-RISC 9000/712 building with hpux0900o (optimizing compiler):
6240  . Warnings in ckutio.c at line 14860 about arguments to select (pointers
6241    are not assignment-compatible).  "man select" says arguments are ints.
6242    Defining INTSELECT fixes these warnings but results in fatal errors later
6243    around line 14881 and others in the area involving FD_SET.  This was too
6244    involved so I put it back as it was.  24 Sep 2009.
6245
6246 Built OK on Solaris 10 with Sun CC.  A couple warnings about implicit
6247 function declarations for curses routines because apparently they aren't
6248 declared in curses.h.  Tuff.  25 Sep 2009.
6249
6250 Tried building on Solaris 10 with Sun CC and OpenSSL 0.9.8k, and this
6251 uncovered various loose ends in the solaris9+openssl target, which I fixed.
6252 makefile, 25 Sep 2005.
6253
6254 Fixed four typos in printfs in ck_ssl.c, \% instead of just %.  25 Sep 2009.
6255
6256 Squelched 20-some complaints about a character array being referred to
6257 directly instead of by a pointer, plus several other similar nits to get rid
6258 of all the compilation warnings on Solaris 10 with Sun C 5.8 Patch 121015-06
6259 2007/10/03.  ckctel.c, ckctel.h, 25 Sep 2009.
6260
6261 Built the result on the same Solaris 10 system with gcc 4.2.4 using the
6262 new solari10g+openssl target, working out a few kinks here too.
6263 makefile, 25 Sep 2009.
6264
6265 Made consolidated Solaris 9/10/11 64-bit targets for gcc, solaris9g64,
6266 solaris10g64, solaris11g64, tested on Solaris 10 Sparc. makefile, 25 Sep 2009.
6267
6268 Made consolidated Solaris 9/10/11 64-bit targets for Sun cc: solaris9_64,
6269 solaris10_64, solaris11_64.  These simply set a couple flags and chain to
6270 the main solaris9 target.  makefile, 25 Sep 2009.
6271
6272 Removed a bunch of old superfluous Solaris 9 and 10 targets: oldsolaris9,
6273 oldsolaris9lfs, solaris9g64 solaris9g_64, oldsolaris10 old solaris10lfs,
6274 oldsolaris10+openssl, oldsolaris10g+openssl, solaris10_64, oldsolaris10g,
6275 solaris10g_64, solaris10g64.  There are still plenty more to prune but it's
6276 a start.  makefile, 25 Sep 2009.
6277
6278 Added or fixed some missing prototypes in ckctel.h:
6279 fwdx_send_xauth_to_xserver(), fwdx_parse_displayname.  25 Sep 2009.
6280
6281 Improved the instructions for building secure versions in the makefile,
6282 using this example:
6283
6284   make solaris9+openssl "SSLINC=-I/opt/openssl-0.9.8k/include" \
6285    "SSLLIB=-L/opt/openssl-0.9.8k/lib"
6286
6287 makefile, http://kermit.columbia.edu/security.html, 25 Sep 2009.
6288
6289 Built on HP-UX 11.11, 26 Sep 2009:
6290  . make hpux1100 (ok)
6291  . make hpux1100gcc (ok)
6292  . make hpux1100o (gets a lot of warnings about sendpath and sendfile,
6293     because they are also declared in <sys/socket.h>, but builds OK)
6294  . make hpux1000gcc+openssl \
6295     SSLINC=-I/opt/openssl/include SSLLIB=-L/opt/openssl/lib
6296
6297 Note: sendpath and sendfile are not Kermit symbols.  The warnings are coming
6298 from socket.h: 'Redeclaration of "sendfile" with a different storage class
6299 specifier'.  This is nothing new; see notes of 2-4 Jan 2005.
6300
6301 From Peter Eichhorn:
6302  . Update to makefile to make current code build OK on HP-UX 8.00.
6303  . Changes to format of some hints to make them more copy-and-pastable.
6304 makefile, ckuu5.c, 28 Sep 2009.
6305
6306 From Peter Eichhorn: Changes to HP-UX 7.0 target to increase the switch table
6307 stack size, which was overflowing.  makefile, 30 Sep 2009
6308
6309 HP-UX 6.5 (1989), "make hpux0650tcpc"... (8:19...)  Needed to not include
6310 arpa/inet.h (which doesn't exist) and not use host address lists (add
6311 -DNOHADDRLIST), which gets us past ckcnet.c, but in ckcftp.c we bomb out on
6312 FD_SETSIZE undefined.  Somehow we worked around this in ckcnet.c.  Patched
6313 in a definition in ckcftp.c, and also added -DINTSELECT to compiler flags.
6314 Compiles ok, bombs at link time on bcopy, bzero, FD_ZERO, FD_SET, FD_ISSET.
6315 Now it compiles and links OK but dumps core when started.  Added
6316 -DNOCKGETFQHOST, rebuilt from scratch (takes 35 minutes).  It starts OK, but
6317 it dumps core when given a "telnet xxx" command, where xxx is a hostname.
6318 However, it works OK if an IP address is used: "telnet 123.45.6.78".  It
6319 took all day to track this down, but now it's fixed (see the #ifdef HPUX6
6320 sections of ckcnet.c).  So now (for the first time, I think) we have both
6321 telnet and ftp in HP-UX 6.x, if anyone cares.  ckcnet.[ch], ckcftp.c,
6322 makefile, 2 Oct 2009.
6323
6324 Changed default SET TERMINAL TYPE type for K95 from vt320 to vt220.  This is
6325 because Unix OS's such as Solaris have dropped vt320 as a terminal type.
6326 settrmtyp(), ckuus7.c, 5 Oct 2009.
6327
6328 I moved the PUTENV command code, which was inline, to a function, doputenv().
6329 ckuus[r7].c, ckuusr.h, 5 Oct 2009.
6330
6331 Changed the UNIX version of SET TERMINAL TYPE to take a value and then do
6332 the equivalent of "export TERM=value" by calling doputenv().  This sets
6333 \$(TERM) correctly and passes its value along to inferior processes.
6334 However, to make this take effect within Kermit itself (for the fullscreen
6335 file transfer display and for the SCREEN command, Ctrl-L, etc) I also had to
6336 reinitialize the curses database, which is tricky because normally if you
6337 feed it an unknown terminal name, it just exits.  ckuus7.c, 5 Oct 2009.
6338
6339 Changed the little-known and little-used RESET command (which closes all
6340 open files) to also put command echoing back to normal in case it got
6341 messed up somehow (as in HP-UX 6.5, upon returning from PUSH).
6342 ckuusx.c, 5 Oct 2009.
6343
6344 For Unix, increased string buffer sizes for wildcard expansion for all
6345 platforms that have BIGBUFOK defined from 500000 (0.5M) to 10000000 (10M)
6346 bytes, and for 64-bit builds to 2000000000 (2G) bytes.  No point making
6347 it bigger than that because malloc's argument is a size_t, which is an int.
6348 ckufio.c, 5 Oct 2009.
6349
6350 Built on Mac OS X 10.4.11, required one minor adjustment to the makefile
6351 (-DNODCLINITGROUPS).  This was using the macosx10.5 target, which is
6352 supposed to be universal like the linux and netbsd targets, but not yet
6353 proven.  Also built a 64-bit version (-mpowerpc64 -mcpu=G5 -mtune=G5
6354 -arch ppc64); it compiles and links OK but won't start: "Bad CPU Type
6355 in executable".  Fix later...  makefile, 5 Oct 2009.
6356
6357 Changes from Seth Theriault to suppress signed vs unsigned char warnings in
6358 Mac OS 10.5.8 from gcc4, and a new makefile target for Mac OS X (presumably
6359 10.3.9 or later) + Kerberos 5 and OpenSSL.  ckutio.c, ckuath.c, ckctel.c,
6360 ckcnet.c, ckcftp.c, ck_crp.c, makefile, 6 Oct 2009.
6361
6362   Later I had to back out of these, because although it made for a
6363   clean build, in the resulting executable SSL connections didn't work.
6364
6365 Tue Oct  6 17:23:27 2009
6366 FTP address resolution is broken, but ftp_hookup() hasn't changed.
6367 So... (see the #ifdef HPUX6 sections of ckcnet.c)  (I did, and I rolled
6368 back some of the changes from the other day, but it made no difference.)
6369 Putting back the ckcftp.c from a few weeks ago makes no difference.
6370 Putting back the ckcnet.c from a few weeks ago makes no difference.
6371
6372 Added patches from Seth Theriault so macosx10.5+krb5+openssl would build
6373 on Mac OS X 10.3.9.  makefile, ckcftp.c, 7 Oct 2009.
6374
6375 Built today's code on Linux RHEL4, NetBSD 5.0.1, Solaris 9, and Mac OS X
6376 10.4.11, both with and without SSL.  The NetBSD system has OpenSSL 0.9.9-dev.
6377 7 Oct 2009.
6378
6379 In Mac OS X 10.6, the following symbols are unresolved at link time:
6380 _des_key_sched, _des_new_random_key, _des_ecb_encrypt,
6381 _des_init_random_number_generator, _des_fixup_key_parity.  This is
6382 with OpenSSL 0.9.8k.  But it doesn't happen on other platforms that
6383 have 0.9.8k.
6384
6385 Added SET SESSION-LOG NULL-TERMINATED-TEXT.  This is for the benefit of a
6386 speech synthesizer that will speak a line of text only after receiving a
6387 NUL character.  A more general solution would be to define a filter or
6388 whatever, but who has time.  ckuus[23x].c, 7 Oct 2009.
6389
6390 Consolidated Mac OS X targets, and removed experimental 64-bit ones, because
6391 they never could work in 10.5 and earlier because 64-bit libs are missing,
6392 and 10.6 and later are 64-bit automatically.  makefile, 8 Oct 2009.
6393
6394 Built on Mac OS X 10.6.1.  It came out automatically as a 64-bit build
6395 because __LP64__ is defined somewhere that I can't find.  But this explains
6396 why the 0.9.8k on 10.6 comes up with missing symbols when the 0.9.8k lib
6397 10.5 (or on Solaris or on Linux) does not: it's a different library: "Mach-O
6398 64-bit dynamically linked shared library x86_64", rather than "Mach-O
6399 dynamically linked shared library ppc".  Probably the 64-bit version has
6400 some things #ifdef'd out.  Added -m32 to the CFLAGS and LNKFLAGS for the
6401 macosx+krb5+openssl targets, and it built OK one time.  But then the errors
6402 came back.  makefile, 8 Oct 2009.
6403
6404 Updated C-Kermit installation for Mac OS X in ckuwr.html on the website.
6405 8 Oct 2009.
6406
6407 Tried some things to get around the problem with OpenSSL in Mac OS X 10.6,
6408 to no avail.  Asked Jeff.  He said, "MacOS X no longer includes DES anywhere
6409 on the system.  Not for SSL, not for Kerberos, not for anything.  This will
6410 increasingly become the situation on new operating systems.  Windows 7 and
6411 2008 R2 will also ship with no DES."  Sure enough, the Mac OS X Server
6412 Upgrading and Migrating document for 10.6 says, "Mac OS X Server v10.6 does
6413 not support single DES encryption. It supports AES 128 and 256 encryption
6414 types. However, during a migration or upgrade from v10.4 to v10.6, servers
6415 that were Kerberized by the v10.5 Open Directory server will not use the AES
6416 128 or 256 encryption types. To use the AES 128 or 256 encryption types you
6417 must re-Kerberize all servers."  12 Oct 2009.
6418
6419 DES and 3DES encryption can be excluding removing the -DCK_DES flag.  I
6420 removed this one and -DLIBDES (and -m32) and this makes a working 64-bit
6421 version.  Then I added code to the macosx+krb5+openssl target to use these
6422 flags if the Mac OS X version was 10.5 or less and leave them out for 10.6
6423 or later.  Tested on 10.4.11 and 10.6.1.  A better way to do it might have
6424 been "nm -gj libssl.dylib | grep des_", but that gives the same results on
6425 10.4 and 10.6.  Also, 10.6 still has /usr/include/ssl/des.h.
6426 makefile, 13 Oct 2009.
6427
6428 Next issue:
6429   In file included from ckutio.c:15674:
6430   /usr/lib/gcc/i386-redhat-linux/3.4.6/include/varargs.h:4:2: #error "GCC no
6431   longer implements <varargs.h>."
6432   /usr/lib/gcc/i386-redhat-linux/3.4.6/include/varargs.h:5:2: #error "Revise
6433   your code to use <stdarg.h>."
6434
6435 The problem occurs when trying to force a non-ANSIC build with GCC.
6436 Changing the source file to include <stdarg.h> instead of <varargs.h>
6437 doesn't help because evidently <stdarg.h> requires an ANSI C compiler.
6438 Nothing can be done about this.  13 Oct 2009.
6439
6440 Next issue: Can't compile ckcftp.c with -DNOCSETS or -DNOSPL; some
6441 #ifdef/#endif doesn't match up.  Sigh, this is the hardest kind of thing to
6442 debug.  There's 17,622 lines of code in this module and no tool that I know
6443 of.... Wait, I wrote one.  But it shows all the #if/#ifdef/#ifndef's and
6444 #endifs matching up just fine.  Backing off to ckcftp.c of a few days ago
6445 (before char / unsigned char casts were added), I see that it builds OK, so
6446 I backed off to that one, but put back the special case #ifdef for MACOSX103
6447 declaring CONST gss_OID_desc, and it builds OK (the other stuff was purely
6448 cosmetic, when will I learn?).  ckcftp.c, 13 Oct 2009.
6449
6450 Protected cvtstring() and related functions with #ifdef NOCSETS..#endif,
6451 and ditto for the character-set conversion code in dorename().
6452 ckuus6.c, 13 Oct 2009.
6453
6454 Fixed an #endif /* TNCODE */ that was a line too low in ttptycmd(),
6455 causing -DNONET builds to fail.  ckutio.c, 13 Oct 2009.
6456
6457 There was a reference to doputenv() that wasn't guarded by #ifndef NOPUTENV,
6458 fixed in ckuus7.c, 13 Oct 2009.
6459
6460 Moved doputenv() and settermtyp() out of an #ifdef NOLOCAL section because
6461 these are useful even when not making connections.  ckuus7.c, 13 Oct 2009.
6462
6463 Moved havelfs declaration outside of #ifdef NOXFER because it was also used
6464 for other things.  ckcmai.c, 13 Oct 2009.
6465
6466 COPY /PRESERVE depended on code from the Kermit protocol module, which
6467 is omitted in -DNOXFER builds.  Disabled COPY /PRESERVE in -DNOXFER
6468 builds.  ckuus6.c, 14 Oct 2009.
6469
6470 SHOW PROTOCOL code for external protocols had to be #ifdef'd out for
6471 -DNOPUSH builds.  ckuus4.c, 14 Oct 2009.
6472
6473 There was some confusion between "No XYZMODEM" and "No extermal protocols";
6474 cleared up in ckuus3.c, 14 Oct 2009.
6475
6476 After all that, 86 different combinations of feature selections built OK on
6477 Linux.  And the Kerberized version (K5) works OK on Linux for Telnet and FTP.
6478 14 Oct 2009.
6479
6480 Changed version number to 9.0.  All modules, 16 Oct 2009.
6481
6482 Need to make LOG SESSION log to a tty.  Right now "log session
6483 /dev/ttyKeySerial1" says "Write permission denied" even though the device is
6484 crw-rw-rw-.  This happens in zchko(), which is called by cmofi().  The
6485 problem is that /dev/ is not writeable.  I added a Unix-only clause that
6486 attempts to open the file for write access using open(), in order to get a
6487 file descriptor, which then can be passed to isatty() to check if it's a
6488 tty, and if so, to allow access.  And then close it.  I tested this on Mac
6489 OS X as follows:
6490
6491   log session /dev/ttyKeySerial1
6492   telnet somehost
6493
6494 The Mac's serial port was connected to the serial port of another computer
6495 where Kermit displayed the incoming characters in CONNECT mode.  Glitches:
6496
6497  1. The port has to be set up as desired in advance, outside of Kermit.
6498  2. log session /dev/ttyKeySerial1 will hang if any required modem signals
6499     are not present when the port is opened.
6500  3. Bypasses lockfile mechanism - so we do this only if -DNOUUCP.
6501
6502 For (2), I tried setting O_NDELAY / O_NONBLOCK, and this allowed zchko() to
6503 continue, but then it freezes in the subsequent fopen().  So I changed
6504 zopeno() to also check if the device is a serial port, and if so, to open()
6505 it with O_NDELAY / O_NONBLOCK, and then convert the file descriptor into a
6506 file pointer with fdopen().
6507
6508 Now for the speaking device that needs lines to be terminated by NUL...
6509
6510   set session-log binary       <-- need to put these in SHOW LOG
6511   set session-log null-padded      (and in HELP SET LOG)
6512   set line /dev/ttyKeySerial1
6513
6514 This part works.
6515
6516 This feature is enabled only for -DNOUUCP builds because serial ports aren't
6517 like other Unix files; we would have to create a lockfile, but we can't do
6518 that...  actually, ttlock() takes a name as an argument, but ttunlck() does
6519 not, so there would be no way to remove the lock.  Anyway, there is only one
6520 API for configuring the port (speed, flow control, etc) and it only works
6521 with the SET LINE device, not any random file.  To fix this would require
6522 massive redesign and changes.  ckuus[23].c, ckufio.c, 19-20 Oct 2009.
6523
6524 I made -DNOUUCP the default for Mac OS X, since everybody winds up building
6525 it that way anyhow.  To undo this, do "make macosx KFLAGS=-UNOUUCP".
6526 makefile, 21 Oct 2009.
6527
6528 Changed SET SESSION-LOG TEXT to strip out ANSI escape sequences; 
6529 previously there wasn't that much difference between TEXT and BINARY logs.
6530 It's still not perfect; for example it doesn't delete characters that the
6531 user erased.  (Made sure this still builds with -DNOESCSEQ.)
6532 ckucns.c, 22 Oct 2009.
6533
6534 Changed SHOW LOG to show the SET SESSION-LOG settings, as well as
6535 SET DEBUG, which was not shown before.  ckuus5.c, 22 Oct 2009.
6536
6537 If a series of PUTENV commands is given, each new one undoes the previous
6538 one, so only the last definition is seen by the new fork (or by Kermit
6539 itself).  Turns out you can't feed automatic variables to putenv(); they
6540 have to be static, so to allow for multiple PUTENV commands Kermit has to
6541 maintain an array of static strings.  ckuus7.c, 6 Nov 2009.
6542
6543 From Seth Theriault, a better way for the makefile to determine the
6544 Mac OS X version number; there's a program for this, sw_ver.  makefile,
6545 6 Nov 2009.
6546
6547 Peter Eichhorn reported that file-transfer failure hints were not coming
6548 out since Dev.27.  The only change I made since then was to skip them if
6549 the file-transfer protocol was not Kermit.  I was using the wrong variable
6550 in the tests, 'proto' instead of 'protocol'.  ckuus5.c, 6 Nov 2009.
6551
6552 Changed Mac OS X targets to correctly extract the Mac OS major version
6553 from uname -r in order to choose correctly between utmp and utmpx; this
6554 wasn't working in 10.6.1.  makefile, 6 Nov 2009.
6555
6556 Fix from Seth T. for an oversight in the previous edit.  Also add
6557 MACOSX103 to "show features" display.  makefile, ckuus5.c, 10 Nov 2009.
6558
6559 Added REJECT as a synonym for DISCARD in SET FILE COLLISION; it's more
6560 intuitive and more accurate.  ckuus[27].c, 15 Nov 2009.
6561
6562 \fsplit() and \fword() always break on 8-bit characters unless you explicitly
6563 put every single 8-bit value into the include set, e.g. (for a TSV file):
6564
6565   undef include
6566   for \%i 128 255 1 {
6567       if == \%i 9 continue
6568       .include := \m(include)\fchar(\%i)
6569   }
6570   .\%n := \fsplit(\m(line),&a,\9,\m(include))
6571
6572 I changed cksplit() to treat all 8-bit bytes 128-255 as non-break characters
6573 by default.  It might have made more sense to do this for 160-255 (since
6574 128-159 are traditionaly C1 control characters) but thanks to Microsoft
6575 tradition is out the window.  To treat one or more 8-bit characters as break
6576 characters, put them in the break set.  This might break some scripts, but I
6577 doubt it because this flaw was so awful that if anyone had come up against
6578 they would have let me know.  ckclib.c, 16 Nov 2009.
6579
6580 Changed the netbsd target to set -funsigned-char, since cc on NetBSD is
6581 actually gcc.  makefile, 16 Nov 2009.
6582
6583 Changed macosx targets to get the CPU type from the HOSTTYPE environment
6584 variable.  Also added getenv("HOSTTYPE") as a last-resort method to set the
6585 \v(cpu) variable at runtime (maybe it should be the first resort?)...
6586 ckuus4.c, makefile, 16 Nov 2009.
6587
6588 Made sure the solaris9_64 and solaris10 targets still work.  16 Nov 2009.
6589
6590 Made sure the current source package builds OK on HP-UX 10.20...  Got a lot
6591 of "warning 6062: Optdriver: Exceeding compiler resource limits in xxx; some
6592 optimizations skipped. Use +Onolimit if override desired" but it builds OK.
6593 Tested long file transfer; works OK.  17 Nov 2009.
6594
6595 Built on FreeBSD 7.2 with and without OpenSSL, all OK.  17 Nov 2009.
6596
6597 Built on NetBSD 5.0.1 with and without OpenSSL, all OK, but netbsd+krb5
6598 fails with "can't find -lgssapi_krb5"; worked around this with
6599 "K5LIB=-L/usr/local/kerblib" (where the lib actually is on this host) but
6600 then it failed with "ckcftp.c:13868: error: 'gss_nt_service_name' undeclared".
6601 17 Nov 2009.
6602
6603 I found a VMS 6.2 system... Takes a loooong time to build there.  In
6604 ckuusy.c, DEC C didn't like the prototypes and declarations of dorlgarg()
6605 and dotnarg() as static so I made them not static.  But that didn't help,
6606 now it fails at the very end, saying the final #ifdef is an invalid
6607 statement.  It looks like an #ifdef mismatch that affects only VMS.  I ran
6608 my #ifdef matcher, it turned up nothing.  I substituted a copy of ckuusy.c
6609 from 2007, it comes up with the same errors.  Then I substituted the copy
6610 from 8.0.211 from 2004, and this one compiled OK and, miraculously, the
6611 whole mess even linked OK and runs OK.  The Alpha binary is 2.84MB.  Now I
6612 have 4500 lines of code to compare....  I went through the two files line by
6613 line and I can't see a single thing wrong.  I gave up and tried building the
6614 TCP/IP version.  It builds fine except for ckuusy.c, with the utterly
6615 useless error message:
6616
6617   #endif /* NOCMDL */
6618   ...................^
6619   %CC-E-BADSTMT, Invalid statement.
6620
6621 Indicating the last line in the file.  Just for the heck of it, I put
6622 another line after that one:
6623
6624   /* This is a test */
6625
6626 and got:
6627
6628   /* This is a test */
6629   ....................^
6630   %CC-E-BADSTMT, Invalid statement.
6631
6632 So it is not objecting to anything in the file.  Trying the old LISP trick,
6633 I put an extraneous closing bracket after that.  Success!  Honestly, I don't
6634 see anything wrong with file.  It's DEC C V5.3-006.  I suspect a C bug.
6635 I'll leave it like this for now until I get access to some other VMS
6636 versions.  Another clue is that when building the network version I get a
6637 horrible warning I never saw before from a module that hasn't been touched
6638 in a very long time (ckvrtl.c).  Also, in the network version, I note that
6639 the FTP code is not compiled in.  We have to try this again with some
6640 command-line switches, but it'll do for now.  ckuusy.c, 18 Nov 2009.
6641
6642 ---C-Kermit 9.0 Alpha.01---
6643
6644 From Steven Schweda (SMS), the real solution for the VMS closing brace
6645 problem, it wasn't a DECC bug, it was a me bug.  ckuusy.c, 20 Nov 2009.
6646
6647 Rediscovered the new VMS build options: f for Long Files, i for Internal
6648 FTP.  "make mnf" doesn't work on VMS 6.2, it looks like the VMS definition
6649 for CK_OFF_T got lost.  Same thing with "make mfi".  Come back to this later.
6650
6651 From Gerry Belanger, a fix to INPUT /COUNT:n.  ckuus4.c, 26 Nov 2009.
6652
6653 Added \fsqueeze(s), returns string s with leading and trailing whitespace
6654 removed, Tabs converted to Spaces, and multiple spaces converted to single
6655 spaces.  For now, ASCII only, no options.  ckuusr.h, ckuus[24].c, 27 Nov 2009.
6656
6657 I wrote a Kermit script to read a big file of addresses on Solaris 9,
6658 \fsqueeze()ing each line.  After about 14000 lines, there was a malloc
6659 failure in getnct() (the command-file reader).  There's nothing wrong with
6660 \fsqueeze(), the failure is on a deeper level, because the same thing
6661 happens if I use \fupper() (which is structurally identical to \fsqueeze())
6662 in the same script.  The problem is not in getnct() either, because every
6663 malloc() is freed (I checked).  On the other hand, the same script (with
6664 \fupper() instead of \fsqueeze() completes OK in C-Kermit 8.0.201.  If I
6665 remove the function call (\fsqueeze() or \fupper()) from the script, it also
6666 runs OK in 9.0.  This seems to point the finger at fnevel(), which contains
6667 countless malloc's and free's.  But comparing fneval() between 8.0.211 and
6668 9.0, I don't see any difference that would explain this behavior -- nothing
6669 at all that involves malloc(), makstr(), or free().  Nor any pertinent
6670 change in the caller (zzstring) of fneval().  27 Nov 3009.
6671
6672 Another problem is that when this happens, the error is not caught (e.g. by
6673 the IF FAIL statement after the command that contains the function call);
6674 instead, C-Kermit returns immediately to its prompt.  27 Nov 2009.
6675
6676 It could simply be that some of the buffers we allocate are much bigger now.
6677 But again, I don't see much difference between 8.0.211 and 9.0; we were
6678 already allocating 32K command-related buffers (malloc() takes a size_t, and
6679 size_t is an int almost everywere).  I built the same source on NetBSD and
6680 ran the same script (with \fqueeze()), and it worked fine.  Let's worry
6681 about this later, if it comes up.  27 Nov 2009.
6682
6683 Built OK on Silicon Graphics IRIX 6.5 R10000; regular build OK, SSL and
6684 Kerberos builds failed.  30 Nov 3009.
6685
6686 Tried to build on Digital Unix 4.0F but it blew up in ckutio.c, apparently
6687 not recognizing any of the terminal struct symbols from termios.h.  Tried
6688 again with gcc, same thing.  Tried explicitly #including <sys/termios.h>
6689 within #ifdef TRU64, same thing.  What could have changed?  30 Nov 2009.
6690
6691 Built OK on Linux RHEL5.4/Itanium-2, make linux.  The secure build
6692 required "FLAGS=-DNO_KRB5_INIT_ETS" and built OK.  30 Nov 2009.
6693
6694 Built OK on Digital Unix 4.0F using "make osf" instead of "make tru64-40f".
6695 I don't know why the specific target doesn't work, but it's not worth
6696 chasing down.  2 Dec 2009.
6697
6698 Built OK on MirBSD 10, despite a lot of gratuitous compiler warnings.  Built
6699 OK on MirBSD 10, OpenBSD 4.5, and Fedora 10.  3 Dec 2009.
6700
6701 (Various other successful Unix builds in these weeks...)
6702
6703 Built on VMS 7.2 and 8.3 with and without TCP/IP, no problems.  11 Jan 2010.
6704
6705 Built on VMS 8.3 with "make fi" to include the FTP client and long-file
6706 support (mid Jan 2010).
6707
6708 Built on VMS 8.3 with UXC 5.6 and HP SSL 1.3, which is OpenSSL 0.9.7e.
6709 It compiled and linked OK but when I tried to make an FTP SSL connection
6710 it crashed in SSL$LIBSSL_SHR, which is called from ssl_auth(), after having
6711 had TLS accepted as an authentication type, but before actually
6712 authenticating.  In Unix:
6713
6714  19. ftp open ftp.somecompany.com /user:pge.com/test_quota /password:xxxxxx
6715 Connected to ftp.somecompany.com.
6716 220-Somecompany FTP v6.0 for WinSock ready...
6717 220 Welcome to the online storage FTP server.  Please check the main web
6718 site for system announcements and AUP. (O)
6719 ---> AUTH TLS
6720 234 AUTH command OK. Initializing SSL connection.
6721 TLS accepted as authentication type
6722 SSL DEBUG ACTIVE
6723 =>START SSL/TLS connect on COMMAND
6724
6725 In VMS:
6726
6727  19. ftp open ftp.somecompany.com /user:pge.com/test_quota /password:xxxxxx
6728 Connected to ftp.somecompany.com.
6729 220 Somecompany FTP v6.0 for WinSock ready...
6730 ---> AUTH TLS
6731 234 AUTH command OK. Initializing SSL connection.
6732 TLS accepted as authentication type
6733 SSL DEBUG ACTIVE
6734 %SYSTEM-F-ACCVIO, access violation, reason mask=04, virtual
6735 address=FFFFFFFF8001A120, PC=000000000068B118, PS=0000001B
6736
6737 Note: The Unix version received the second 220 response, the VMS version did
6738 not.  That's odd, it's the same code...  25 Jan 2010.
6739
6740 Added some essential details to the HELP FSEEK text.  ckuus2.c, 25 Jan 2010.
6741
6742 Discovered that the result returned by \fsearch() is totally unreliable.
6743 This is probably too hard to fix.
6744
6745 FSEEK did not pay attention to SET CASE, searches were always case sensitive.
6746 Fixed in ckuus7.c, 26 Jan 2010.
6747
6748 FSEEK failed to find anything if the search pattern was matched in the first
6749 line of the file.  Fixed in ckuus7.c, 26 Jan 2010.
6750
6751 \fword() and \fsplit()....  Another change, but not backwards-incompatible.
6752 One may now put the word ALL (just like that, all uppercase) as the include
6753 set (4th argument) to indicate that there will be no break characters other
6754 than those explicitly given in the break set, e.g. \fsplit(\m(xx),&a,:,ALL)
6755 breaks a line only on a colon (:), nothing else.  The original rules for
6756 cksplit() were more than a little counterintuitive: the default break set is
6757 all non alphanums, and the default include set is all alphanums, so if you
6758 wanted to parse (say) a CSV file, breaking only on comma, you had to think
6759 of all the characters you wanted to keep.  This way you just say ALL.
6760 ckclib.c, 26 Jan 2010.
6761
6762 Speaking of CSV files... How can you put comma as a function argument when
6763 comma is the function-argument separator?  Use one of these forms:
6764
6765  \fsplit(\m(xx),&a,",",ALL)
6766  \fsplit(\m(xx),&a,{,},ALL)
6767  \fsplit(\m(xx),&a,\44,ALL)
6768  \fsplit(\m(xx),&a,\fchar(44),ALL)
6769
6770 From John Dunlap, U. of Washington Applied Physics Lab: 'When "stty -a <
6771 /dev/ttyS0 | grep crtscts" shows "crtscts" (not "-crtscts") and when using a
6772 three wire serial interface and when asking kermit to not use flow control
6773 (set flow none) then "ckutio.c1" (see attachments) fails while "ckutio.c"
6774 works.  The result of "diff -u ckutio.c1 ckutio.c" is attached as "diffs"'.
6775 ckutio.c, 26 Jan 2010.
6776
6777 Changed the year from 2009 to 2010 in the modules I worked on today and in
6778 the heralds, etc.  ckckmai.c, ckuus5.c, ckutio.c, ckclib.c, ckuus7.c,
6779 26 Jan 2010.
6780
6781 Built on Linux Fedora Core 3, regular and with OpenSSL 0.9.7a.  Built on
6782 Ubuntu 9.4 OK, but SSL and Kerberos builds failed due to not finding libs
6783 and/or header files.  I'm sure this could be fixed...  27 Jan 2010.
6784
6785 Added SSL, KRB4, and KRB5 to the startup herald for versions that were
6786 built with SSL, Kerberos 4, or Kerberos 5.  Built OK on Fedora 3 with
6787 linux+krb5+ssl and new banner shows correctly.  ckuus5.c, 27 Jan 2010.
6788
6789 Set NO_KRB5_INIT_ETS by default in ckuath.h since krb5_init_ets() is a no-op
6790 in Kerberos 1.4.x and later and in some installations it can't be found,
6791 which clobbers the build.  ckuath.h, 27 Jan 2010.
6792
6793 Adapted to MINIX 3 1.5, the first version that has virtual memory according
6794 to Andy T, who should know.  On earlier versions (e.g. MINIX 3 1.2) any
6795 attempt to build C-Kermit causes the compiler to crash.  Now the compiler
6796 doesn't crash but it spews out countless warnings about old-fashioned
6797 function declarations that I don't get anywhere else.  The real problems
6798 came in ckutio.c where numerous symbols were undefined at compile time and
6799 the POSIX function tcgetpgrp() was not found at link time, even though there
6800 is a prototype for it in the MINIX header files, and there is no alternative
6801 (since POSIX doesn't let us use ioctl()).  Also note that there is some
6802 confusion over the compile-time symbols MINIX, MINIX2, MINIX3, and MINIX315.
6803 You would expect MINIX to mean "any version of MINIX" but in some parts of
6804 ckutio.c it means MINIX 1.0.  I sincerely doubt that C-Kermit 9.0 can be
6805 built on any version of Minix before 3.1.5 so I removed the confusion and
6806 made MINIX mean "any Minix".  It builds on 3.1.5 OK now, except for the FTP
6807 client.  This can probably be fixed but...  Modules changed: ckcdeb.h,
6808 ckuver.h, ckcmai.c, ckuus5.c, ckutio.c, 1 Feb 2010.
6809
6810 Later.. Andy says MINIX does not support job control, so no program is ever
6811 in the background.  That settles that!  1 Feb 2010.
6812
6813 Built OK on Minix, Linux, Mac OS X, Solaris 9, NetBSD 5.0.1...  1 Feb 2010.
6814
6815 ---C-Kermit 9.0 Alpha.02---
6816
6817 From Christian Corti at Uni-Stuttgart.de: fixes to allow building on SunOS
6818 4.1, which once was my main development platform but which is long-gone from
6819 here.  ckupty.c, ckutio.c, 9 Feb 2010.  (He says it is also necessary to
6820 comment out the "struct winsize" and "struct ttysize" in sys/ioctl.h;
6821 otherwise there will be a conflict with sys/ttycom.h (included by termios.h)
6822 which also declares these structs. But you need both includes.')
6823
6824 From John Dunlap, a fix for Kermit protocol fixed packet-timeout interval
6825 going to a unexpected value (missing else clause in two places).
6826 ckcfn2.c, 9 Feb 2010.
6827
6828 Added an aixg target to build on AIX with gcc when gcc is not installed as
6829 cc, and also added CC=$(CC) CC2=$(CC) clauses to the aix and aix+ssl
6830 targets.  Wow, AIX really loses bigtime when receiving files through its ssh
6831 server.  Streaming can't be used, sliding windows recover from errors but
6832 there are tons of them using the default 4K packets; 500 works much better.
6833 Built with IBM cc and gcc, and also tested (successfully) the new aix+ibmssl
6834 target, in which the OpenSSL headers and libs are in a standard place.
6835 makefile, 9 Feb 2010.
6836
6837 In ckupty.h, make the #include <sys/ioctl.h> be #ifndef SUNOS41.
6838 From Christian Corti.  10 Feb 2010.
6839
6840 Built on VMS E8.4.  12 Feb 2010.
6841
6842 Tried to build on a real VAX-11/785 but the machine seems to be seriously
6843 wedged.  12-15 Feb 2010.
6844
6845 Added note to CKVKER.COM to the effect the the 'f' option has no effect
6846 on VAX architecture.  15 Feb 2010.
6847
6848 Moved the #include "ckvrtl.h" in the FTP module to below the include for
6849 utime.h, because building the VMS version with the 'i' option (meaning
6850 "include internal ftp client") results in "struct utimbuf tp" erroring out
6851 because struct utimbuf is not defined yet (at least in some version of VMS
6852 with some version of C).  From Rob Brown, ckcftp.c, 20 Feb 2010.
6853
6854 From Martin Vorlaender: new code in VMS C-Kermit build procedure to detect
6855 OpenSSL version automatically.  ckvker.com, 22 Feb 2010.
6856
6857 Added code to INPUT command to strip ANSI escape sequences.  It's activated
6858 by SET SESSION-LOG TEXT.  ckuusr.h: added prototype for chkaes();
6859 ckucon.c, ckucns.c: made inesc[] and oldesc[] global instead of static; 
6860 ckuus4.c: doinput() code for skipping escape sequences.  1 Mar 2010.
6861
6862 Peter Eichhorn complained that if you make an ssh connection with Kermit,
6863 then log out from the ssh host, and then use a "connect" command to
6864 make a new connection to the same host (which you can do with Telnet),
6865 Kermit says (e.g.):
6866
6867  DNS Lookup... Can't get address for ssh -e none somehostname
6868  Sorry, can't open ssh -e none somehostname: Error 0
6869
6870 I added code to detect and handle this case and it seems to work OK, even
6871 though it's kind of a hack.  ckuusr.[ch], ckuus7.c, 1 Mar 2010.
6872
6873 There has never been a clean way to put debugging messages (ECHO commands)
6874 in a script which are executed only if debugging is desired and ignored
6875 otherwise.  You'd have to set a random variable and test it, or define a
6876 macro or whatever.  To make this more straightforward, I added SET DEBUG
6877 MESSAGE ON/OFF/STDERR, and added a new MESSAGE (syn: MSG) command for printing
6878 debugging messages to stdout if SET DEBUG MESSAGE is ON or to stderr if SET
6879 DEBUG MESSAGE is STDERR.  ckcmai.c, ckuus[r23].c, 12 Mar 2010.
6880
6881 Also for debugging and error messages, I added \v(lastcommmand) so that
6882 the command that failed can be included in an IF FAIL or DEBUG error message.
6883 This works even for commands that have syntax errors.
6884 ckuusr.h, ckuus5.c, ckucmd.c, 12 Mar 2010.
6885
6886 From SMS for VMS: 'Added/documented P3 options INTSELECT, OLDFIB, OLDIP.
6887 Disabled (commented out) automatic definition of NOSETTIME for VMS before
6888 V7.2 (vms_ver .lts. "VMS_V72").'  ckcdeb.h, ckcftp.c, ckcnet.c, ckuus[2567].c,
6889 ckvfio.c, ckvker.com, ckvrtl.[ch], 15 Mar 2010.
6890
6891 Exposed inesc[] and oldesc[] for VMS, so new INPUT command escape-sequence
6892 stripping can work (really, chkaes() and related global variables should be
6893 moved out of ck[uvd]con.c/ckucns.c and into a common module; do that later).
6894 ckuusr.h, ckvcon.c, 15 Mar 2010.
6895
6896 Built OK on Solaris9, Mac OS X 10.4.11, RHEL4 (32-bit), RHEL5 (64-bit),
6897 AIX 5.3, SCO OpenServr 6.0.0...  15 Mar 2010.
6898
6899 Not so good on VMS, turns out I made a typo in one of the VMS updates
6900 (#ifndef OLDIP instead of #ifdef...).  ckcnet.c, 16 Mar 2010.
6901
6902 More from SMS for VMS, 16 Mar 2010:
6903  . Set MAXPATH correctly for VMS, ckcdeb.h.
6904  . NAM -> NAML, QIO replaces system( "SET PROTECTION"), bugfixes in
6905    cvtdir() and nzltor(), ...  (See comments): ckvfio.c, new ckvrms.h.
6906    (The RMS code in ckvfio.c was almost totally rewritten)
6907  . Moved "NAMX$*" (and related) macros to ckvrms.h, and renamed to
6908    "NAMX_*" (and similar "$" -> "_"), moved "FIB_*" macros from ckvrtl.c.
6909
6910 These changes are mainly to accommodate the ODS5 file system, which has
6911 longer and mixed-case filenames, and also to execute certain commands
6912 (e.g. for setting file protection, deleting directories) directly instead
6913 of using a system() command.
6914
6915 Built OK on VMS 8.3 (with and without network support).  16 Mar 2010.
6916
6917 Failed to build on VMS 6.2.  16 Mar 2010.
6918
6919 FreeBSD 8.0 <libutil.h> has a hexdump() prototype that conflicts with the
6920 hexdump macro defined in ckcdeb.h.  Since the same thing is likely to happen
6921 elsewhere, I changed the Kermit macro to ckhexdump as well all references to
6922 it: ckcdeb.h, ckcftp.c, ckcnet.c, ckctel.c, ckuath.c, ckutio.c, 16 Mar 2010.
6923
6924 Built OK on Digital Unix Tru-64 4.0E using "make osf", 16 Mar 2010.
6925
6926 Tried again to build Digital Unix Tru64 4.0E using "make tru64-40e", but
6927 something prevents it from picking up the termios symbols and it blows up in
6928 ckutio.c, whereas this used to work in earlier C-Kermit versions.  This is
6929 the only Tru64 system I still have access to, so I can't tell if it's a
6930 local peculiarity or what.  Note that POSIX is not defined for this build.
6931 But if I define it, I get into trouble with "struct timeval".  Tried again
6932 with "KFLAGS=-DPOSIX -DNOTIMEVAL" but that doesn't help.  Tried "make
6933 dec-osf" and that worked OK but oddly enough it makes a Kermit with less
6934 features than "make osf".  16 Mar 2010.
6935
6936 To go with MESSAGE and SET DEBUG MESSAGE, I added IF DEBUG, which is true
6937 if SET DEBUG MESSAGE is not OFF and false otherwise.  ckuusr.h, ckuus6.c,
6938 16 Mar 2010.
6939
6940 From SMS: Corrections to my merging of SMS's changes, ckcftp.c, ckvrtl.h.
6941 Builds OK on VMS 6.2 now.  Also did an SSL build on VMS 8.3 with OpenSSL
6942 m0.9.7e and "OPENSSL_DISABLE_OLD_DES_SUPPORT" was included in P3
6943 automatically by Martin V's addition to ckvker.com.  17 Mar 2010.
6944
6945 From SMS: #include <types.h> earlier for VMS in ckcdeb.h to pick up off_t
6946 before it is referenced.  This allows C-Kermit to compile on VMS/Alpha 6.2
6947 but linking fails on fseeko() and ftello() (and yet, a functional executable
6948 is created, and FSEEK works right).  Builds the same way with no problems at
6949 all on VMS 8.3 / Alpha.  In this case we get the full 64-bit arithmetic...
6950 Well, 62 bits:
6951
6952   ATLAS::C-Kermit>( ^ 2 63)
6953    9223372036854775000.0
6954   ATLAS::C-Kermit>( ^ 2 62)
6955    4611686018427387904
6956
6957 whereas on VMS 6.2 we get integers only up to (^ 2 30).  17 Mar 2010.
6958
6959 Changed the VMS build procedure to enable large file support automatically
6960 for non-VAX and VMS 7.3 or greater.  No reason not to include this feature.
6961 Changed the sense of the F option to DISABLE large file support in the
6962 unlikely case that C-Kermit is being built on a suitable platform but the
6963 C library is older than VMS73_ACRTL-V0200, in which case fseeko() and
6964 ftello() will come up missing at link time.  ckvker.com, 18 Mar 2010.
6965
6966 Changed VMS build procedure to include the FTP client in any network build
6967 by default.  Changed the sense of the I option to exclude the FTP client,
6968 in case anybody would want to do that.  ckvker.com, 18 Mar 2010.
6969
6970 From SMS: updated dependencies in CKVKER.COM, fix the "don't reinclude me"
6971 clause in CKVRTL.H.  19 Mar 2010.
6972
6973 Built OK on VMS 6.2 and 8.3 with and without networking.  Large file support
6974 included automatically in VMS 8.3  FTP client included automatically in both
6975 network builds.  19 Mar 2010.
6976
6977 Changed hexdump() to ckhexdump() in ck_crp.c, which I missed before.
6978 19 Mar 2010.
6979
6980 ---C-Kermit 9.0 Alpha.03---
6981
6982 In HP-UX with the bundled-non ANSI compiler, we get warnings about functions
6983 such as endusershell(), which are declared void in the header files.  But in
6984 non-ANSI builds we defind VOID to be int rather than void, so our prototypes
6985 are wrong.  I checked that HP-UX 9, 10, and 11 all have void datatype and
6986 changed the definition of VOID to void in those cases.  ckcdeb.h, 29 Mar 2010.
6987
6988 Fixed a typo in a debug() statement in cksplit() that was causing some
6989 warnings.  ckclib.c, 29 Mar 2010.
6990
6991 Ditto in tls_load_certs().  ck_ssl.c, 29 Mar 2010.
6992
6993 "make hpux1000o+ssl" files with:
6994 /usr/ccs/bin/ld: Unsatisfied symbols:
6995    __umoddi3 (code)
6996    __udivdi3 (code)
6997    __eprintf (code)
6998
6999 It appears that OpenSSL (0.9.7c in this case) requires -lgcc.
7000 And indeed hpux1000gcc+ssl builds fine.  29 Mar 2010.
7001
7002 There are various warnings in the SSL code in ckutio.c, ckcftp.c, and
7003 ckcnet.c about pointers not being assignment compatible, but I have learned
7004 from experience not to try to fix these (see notes from 6 Oct 2009).
7005 29 Mar 2010.
7006
7007 connect(s, (struct sockaddr *)&hisctladdr, sizeof (hisctladdr)): In FTP,
7008 this doesn't work on RHEL5 / Mac OX X 6.1/2 64-bit.  But the connect() in
7009 Telnet works.  On Mac OS X 6.2 I tried changing the socket() call to be like
7010 the one in ckcnet.c for Telnet, but it made no difference.  On a RHEL5.4
7011 system on i386, FTP works fine, so it's not the Red Hat version.  On Digital
7012 Unix 4.0E 64-bit, same thing:
7013
7014   11:23:10.722 ftp_hookup[kermit.columbia.edu]=21
7015   11:23:10.722 ftp hookup A[kermit.columbia.edu]
7016   11:23:10.722 ftp hookup C[kermit.columbia.edu]
7017   11:23:10.722 ftp hookup socket=4
7018   11:23:10.722 ftp hookup HADDRLIST
7019   11:23:10.723 ftp hookup connect failed=13
7020   11:23:10.723 ftp hookup bad
7021
7022 13 = Permission denied:
7023
7024   [EACCESS] Search permission is denied for a component of the path prefix;
7025     or write access to the named socket is denied.
7026
7027 On Gentoo Linux, also on Alpha, the errno is 51: Network is unreachable.
7028 Clearly some data type in the sockets structs is out of whack.
7029
7030 The third connect() argument is "address length".  The address is a
7031 struct sockaddr.  About the third argument, RHEL5 "man connect" says:
7032
7033   The third argument of connect() is in reality an int (and this is what 
7034   4.x BSD and libc4 and libc5 have).  Some POSIX confusion resulted in 
7035   the present socklen_t, also used by glibc.  See also accept(2).
7036
7037 Building on RHEL5 on x86_64, where size_t is 8 and socklen_t is 4, I get a
7038 warning:
7039
7040   ckcftp.c: In function 'ftp_hookup':
7041   ckcftp.c:14667: warning:
7042    comparison is always true due to limited range of data
7043
7044 Referring to:
7045
7046   if (hisctladdr.sin_addr.s_addr != (unsigned long) -1)
7047
7048 This seems to be the problem; if I remove the (unsigned long) cast (in two
7049 places), the problem goes away.  Actually what I should be comparing it with
7050 is INADDR_NONE, which is defined appropriately in some header file, e.g. as
7051 0xffffffff.  Also I define it explicitly as -1 if it is not defined in any
7052 header file (as is the case in Solaris 9).  Tested OK on 64-bit RHEL5,
7053 32-bit RHEL5, Digital Unix 4.0E 64-bit, Solaris 9 32-bit, Mac OS X 10.4.11
7054 32-bit, Mac OS X 10.6.3 64-bit, AIX 5.3, Gentoo Linux 2.6.31 on Alpha
7055 64-bit, NetBSD 5.0.1 32-bit....  ckcftp.c, 29 Mar 2010.
7056
7057 ---C-Kermit 9.0 Alpha.04---
7058
7059 Yesterday's VOID redefinition caused problems for HP-UX in ckuusx.c, in the
7060 curses section where VOID is undef'd and not used to avoid a conflict with
7061 curses.h.  As a workaround I defined a new macro CKVOID with the same
7062 definition as VOID and used it in the offending section of ckuusx.  The real
7063 solution is to replace all references to VOID with CKVOID (since VOID is
7064 increasingly likely to cause conflicts), but a mass search and replace is
7065 not without risks.  ckcdeb.h, ckuusx.c, 30 Mar 2010.
7066
7067 Changed VOID and CKVOID definition to be 'void' for all HP-UX (verified by
7068 PeterE back to HP-UX 6.5, 1989).  Still need to check this on HP-UX 5.21;
7069 if that's an exception it can be done in the makefile.  ckcdeb.h, 30 Mar 2010.
7070
7071 The change I made to allow CONNECT to reestablish a previous SSH connection
7072 prevented a new SSH connection to a different host to be made.  Fixed in
7073 ckuus7.c, 30 Mar 2010.
7074
7075 Fixed mistaken extern declarations of krb4_errno and krb5_errno as strings
7076 in nvlook(); they are ints. Built OK on Mac OS X 10.6.3. ckuus4.c, 30 Mar 2010.
7077
7078 A fix to Trusted HP-UX makefile target from PeterE, to account for the
7079 equivalence of +openssl and +ssl as target suffixes.  30 Mar 2010.
7080
7081 Added a new function \fcvtcsets(string,cset1,cset1) that converts a string
7082 from one character set to another.  The csets are File Character-Set names.
7083 ckuus4.c, 31 Mar 2010.
7084
7085 Added a new function \fdecodehex(string,prefix) that decodes a string
7086 containing prefixed hex bytes.  Default prefix is %%, but any prefix of
7087 one of two chars (such as % or 0x) can be specified.  ckuusr.h, ckclib.h,
7088 ckclib.c, ckuusr.c, 31 Mar 2010.
7089
7090 Richard Nolde reports that Kermit can't find -lpam on Fedora 12 because it's
7091 in /lib rather than /usr/lib.  RHEL5 has symlinks, FC12 should too.  Added a
7092 note to the makefile.  1 Apr 2010.
7093
7094 Build on Solaris 11 for the first time.  Had to adjust ckuver.h to get the
7095 version herald right.  This was on a box that reported its architecture as
7096 i86pc.  1 Apr 2010.
7097
7098 Added MIME character-set names as invisible synonyms in the file and
7099 terminal character-set tables, fcstab[] and tcstab[].  Note that not all the
7100 character sets known to Kermit are registered in MIME.  But at least now
7101 MIME-registered character sets can be referred to by their MIME names, e.g.
7102 ISO-8859-1, ISO646-ES, IBM437, WINDOWS-1252.  These are not listed if you
7103 type ? in a field that is parsing them, unless you type a letter first,
7104 e.g. "i?" lists ISO- and IBM set names.  Later maybe I'll make parallel
7105 tables, or keyword attribute bit that says whether a name is MIME or not.
7106 The real benefit of this change is that now Kermit can take its
7107 character-set names from external sources like email headers or web logs.
7108 ckuxla.c, 1 Apr 2010.
7109
7110 Changed the IF command to accept a bare macro name its condition.  This will
7111 parse and execute correctly if the macro is defined and if it has a numeric
7112 value, or if it is not defined, in which case it evaluates to 0 (FALSE).  If
7113 it is defined but has a non-numeric value, a parse error occurs.  ckuus6.c,
7114 2 Apr 2010.
7115
7116 Added \fstringtype() function.  Given a string argument, it tells whether
7117 the string is 7bit, 8bit, utf8, binary, etc.  ckuusr.h, ckuus[4x].c,
7118 2 Apr 2010.
7119
7120 Did a few builds to make sure there were no booboos.  Solaris 9, NetBSD
7121 5.01, Linux RHEL4, HP-UX 10.20 (non-ANSI compiler and ANSI optimizing
7122 compiler), Mac OS X 10.4.11, SCO OSR 6.00.  5 Apr 2010.
7123
7124 ---C-Kermit 9.0 Alpha.05---
7125
7126 Increased maximum variable name length from 4K to 16K. Verified that
7127 too-long names are caught and recovered from correctly.  ckuusr.h, 6 Apr 2010.
7128
7129 Implemented a new \fsplit() option for parsing CSV files, which turns out to
7130 be a little complicated, because the separator is not just a comma, but a
7131 comma and all its surrounding spaces.  Also there are special quoting rules
7132 for fields with embedded commas and fields with embedded quotes.  ckclib.c,
7133 7 Apr 2010.
7134
7135 ---C-Kermit 9.0 Alpha.06---
7136
7137 VMS changes from SMS.  They build OK, Kermit file transfers are still OK,
7138 but FTP text-mode GETs always hang on the 10th 8K network read.  Couldn't
7139 get a debug log this time.  ckcmai.c, ckvfio.c, ckvrms.h, ckvker.com.
7140 8 Apr 2010.
7141
7142 Changing VNAML from 4K to 16K broke the build on HP-UX 9.  Put it back to
7143 4K.  9 Apr 2010.
7144
7145 John Dunlap, running days-long stress tests between E-Kermit and C-Kermit,
7146 found a bug in the packet-reading and -decoding code: If a NAK packet
7147 arrives with its length field corrupted to indicate a bigger size, and there
7148 are enough bytes following in the pipeline, ttinl() will return a too-long
7149 packet (if there are not enough bytes waiting to be read, then ttinl() will
7150 properly time out).  In the bad case rpack() trusts the packet length, uses
7151 it as the basis for computation of the block-check length, which is then
7152 used to access memory that might not be there, causing (at least on John's
7153 Linux system) a segmentation fault.  John added the normal clause to check
7154 the result of the block-check calculation, and I changed ttinl() to always
7155 break on the eol character (normally carriage return), since this can never
7156 appear in a packet, even if we "set control unprefix all".  Also added a
7157 check to ttinl() to protect against length fields corrupted into illegal
7158 values.  ckcfn2.c, ckutio.c, 13 Apr 2010.
7159
7160 From Lewis McCarthy:
7161   Based on code inspection, C-Kermit appears to have an SSL-related security
7162   vulnerability analogous to that identified as CVE-2009-3767 (see e.g.
7163   http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3767).
7164
7165   I'm attaching a patch for this issue relative to the revision of ck_ssl.c
7166   obtained from a copy of http://www.columbia.edu/kermit/ftp/test/tar/x.zip
7167   downloaded on 2010/07/30, which I believe is the latest.
7168
7169   When this flaw was first widely publicized at last year's Black Hat
7170   conference, it was claimed that some public certificate authorities had
7171   indeed issued certificates that could be used to exploit this class of
7172   vulnerability. As far as I know they have not revealed specifically which
7173   public CA(s) had been found issuing such certificates.
7174   Some references: http://www.mseclab.com/?p=180
7175   http://www.theregister.co.uk/2009/07/30/universal_ssl_certificate/
7176
7177 Patches added to ck_ssl.c, 4 Aug 2010.
7178
7179 Peter Eichhorn reported that "RENAME ../x ." didn't work.  This is a side
7180 effect of the changes of 2006 to the RENAME command, there was a little
7181 confusion in the renameone() routine; fixed in ckuus6.c, 4 Aug 2010.
7182
7183 If only one file is FOPEN'd, FCLOSE given with no arguments would close it.
7184 Turns out to be a bad idea. Example: program with an input and output file,
7185 try to close the output file before it is opened by just typing FCLOSE; this
7186 can mess up the input file.   For safety FCLOSE has to require a channel
7187 number or ALL.  ckuus7.c, 4 Aug 2010.
7188
7189 Added \fstrcmp(s1,s2,case,start,length), which has the advantage over IF
7190 EQU,LGT,LLT that case senstivity can be specified as a function arg, and
7191 also substrings can be specified.  ckuusr.h, ckuus[24].c, 5 Aug 2010.
7192
7193 The CSV feature of Alpha.06 had a subtle flaw, namely that if the last item
7194 in a comma separated list was enclosed within doublequotes with a trailing
7195 space after the closing doublequote, a spurious empty final element would be
7196 created in the result array.  Fixed in cksplit(), ckclib.c, 5 Aug 2010.
7197
7198 ---Alpha.07---
7199
7200 The CSV feature of \fsplit() splits a comma-separated list into an array.
7201 To turn the array back into a comma separated list, \fjoin(&a,\44,1) almost
7202 works, except for elements contain literal doublequotes, such as:
7203
7204   Mohammad "The Greatest" Ali
7205
7206 This calls for making a symbolic CSV argument for \fjoin() like the one that
7207 was made for \fsplit(): \fjoin(&a,CSV).  Also \fjoin(&a,TSV) for
7208 Tab-separated list.  Thus if Kermit reads a record in CSV format, splits it
7209 into an array, and then joins the array back into a CSV record, the result
7210 will be equivalent to the original, according to the CSV definition.  It
7211 might not be identical, because if the result had extraneous spaces before
7212 or after the separating commas, these are discarded, but that does not
7213 affect the elements themselves.  Furthermore it is now possible to convert
7214 a comma-separated list into a tab-separated list, and vice versa (which is
7215 not a simple matter of changing commas to tabs or vice versa).  ckuus4.c,
7216 12 Aug 2010.
7217
7218 From Joop Boonen 26 Juli 2010: "Added HAVE_LOCKDEV as openSuSE >= 11.3 uses
7219 lockdev but not baudboy.  They use ttylock directly.  The program code has
7220 been added so the the program works without a problem."  makefile, ckcdeb.h,
7221 ckutio.c, ckuus5.c, 23 Aug 2010.
7222
7223 ---Alpha.08---
7224
7225 From Gary Mills at the U of Manitoba: convert Solaris version from BSD ptys
7226 to streams ptys because there are only 48 BSD-style ptys and he was running
7227 out.  No code changes needed, the only change necessary was to add the
7228 following flags to the makefile target:
7229
7230   -DHAVE_STREAMS -DHAVE_GRANTPT -DHAVE_PTSNAME
7231   -DPUSH_PTEM -DPUSH_LDTERM -DPUSH_TTCOMPAT
7232
7233 makefile, ckcmai.c, 21 Sep 2010.
7234
7235 Testing this in Solaris 9 I see that the DES library disappeared.  Added
7236 code to the solaris9 targets (also used by Solaris 10 and 11) to check for
7237 this.  makefile, 21 Sep 2010.
7238
7239 The Solaris target checked the OpenSSL version automatically to set the
7240 right flag, the Linux target didn't.  Put the OpenSSL-version testing code
7241 in the Linux target too.  makefile, 21 Sep 2010.
7242
7243 A couple minor changes to the tru64-51b makefile targets from Steven Schweda
7244 but there still are some problems with the Tru64 Unix builds.
7245 makefile, 21 Sep 2010.
7246
7247 ---Alpha.09---
7248
7249 \fcontents(\&a[3]) got an error if the array was declared but its dimension
7250 was less than 3, which is bad when dealing with (say) an array created
7251 dynamically by \fsplit(), which might or might not have a third element.
7252 In case it doesn't -- i.e. in case we are referring to an out of range
7253 element of any array that is declared -- we should just return a null
7254 string, as we do with other types of variables that are not defined.
7255 For that matter, ditto even if the array is not declared; what useful
7256 purpose is served by throwing an error in this case?
7257 ckuus4.c, 30 Dec 2010.
7258
7259 cksplit() treats \ as a quoting character.  If the source string contains
7260 backslashes, they are swallowed (or, if doubled, one is kept).  That's not
7261 good for parsing external data, such as lines read from files, where there
7262 are no quoting rules.  This came up when parsing CSV files; as a workaround,
7263 I made \fsplit() treat backslash as an ordinary character for CSV and TSV
7264 splitting (a better solution might be yet another argument that specifies
7265 a quote character).  ckclib.c, 30 Dec 2010.
7266
7267 Began converting C-Kermit to Open Source with the Simplified 3-Clause BSD
7268 license.  Updated the text for the INTRO, LICENSE, NEWS, and SUPPORT
7269 commands.  Fixed things so the copyright year to be displayed is defined in
7270 one place (ck_cryear in ckcmai.c), rather than hardwired into text strings
7271 all over the place.  COPYING.TXT, ckcmai.c, ckuus[256].c, 2 Jun 2011.
7272
7273 When I added MIME synonyms for Kermit character-set names, I left a bogus
7274 entry in the tables ("windows-1251") that was in the wrong place
7275 alphabetically, thus preventing most references to file character-set names
7276 from working right.  Removed the bogus entry.  ckuxla.c, 2 Jun 2011.
7277
7278 Most combinations work OK, but not translating Cyrillic text from UTF-8
7279 to Latin/Cyrillic, and probably the same would be true for any case of
7280 converting from UTF-8 or UCS-2 to anything else.  The problem was in
7281 xgnbyte(), which converts the input stream from the specified character to
7282 UCS2; it needed to make a special case for when the input file was already
7283 Unicode.  Believe it or not, this problem occurred at least as far back as
7284 8.0.201 (9.5 years ago) and nobody noticed.  So if the fix isn't perfect
7285 probably nobody will notice that either.  ckcfns.c, 3 Jun 2011.
7286
7287 The SET BLOCK CHECK command did not parse all the items in its keyword
7288 list.  Fixed in ckuus3.c, 3 Jun 2011.
7289
7290 For EM-APEX ocean floats project, where buoys in stormy waters have to
7291 transmit data through an earth satellite using non-error-correcting modems,
7292 John Dunlap ran exhaustive stress tests of Kermit protocol transfers through
7293 a simulated connection that injected errors and delays and identified a
7294 weakness in Kermit protocol when it is used under extremely bad conditions:
7295 If a data byte of the S packet (or its Ack) is corrupted and the 1-byte
7296 checksum is also corrupted in such a way that that the checksum matches the
7297 corrupted data, the two Kermit programs will disagree as to the negotiated
7298 parameters.  For example, if file Sender's RPT field is changed from '~' to
7299 '^', the receiver will decode the packet incorrectly.  Ditto for most of the
7300 other parameters.  The result is that a corrupted file is received but
7301 reported correct.  John suggested a new mode of operation in which the Type
7302 3 block check is used for all packets.  Such a mode can not be negotiated
7303 because the negotiation packet itself is assumed by all Kermit programs to
7304 have a 1-byte checksum.  Added SET BLOCK-CHECK 5 to the parser (with
7305 invisible synonym FORCE-3".  ckuus3.c, 3 Jun 2011.
7306
7307 Added supporting code for SET BLOCK 5: ckcfn[23].c, ckcpro.w, ckcmai.c,
7308 ckuus3.c, 3 Jun 2011.
7309
7310 Added code to skip the heuristic that S and I packets always have block
7311 check type 1.  File transfer OK between two C-Kermits with SET BLOCK 5.
7312 rpack(): ckcfn2.c, 5 Jun 2011.
7313
7314 Made the file receiver put "5" in the block-check-type in its ACK to the
7315 S-Packet.  spar(): ckcfns.c, 5 Jun 2011.
7316
7317 Now the question is: Can we make the file receiver automatically and safely
7318 recognize a three-byte block check on an incoming S or I packet?  It's
7319 tricky because the block check field is not self-identified, it's just the
7320 last "n" characters of string indicated by the length field, so correct
7321 decoding of the packet depends on stateful knowledge of "n".  How about this:
7322 rpack() already knows what type of packet it is, so if it's an S or I packet
7323 and the 8th byte of the data field is "5" and last 3 bytes, when interpreted
7324 as the CRC, match the packet contents, then we accept the packet and switch
7325 to BLOCK 5 mode.  
7326
7327 On the other hand, if the "5" was put there by corruption, the CRC should
7328 catch the error.  In that case we NAK the packet and presumabely get a
7329 different version back.  There would be no reason to try to re-read the same
7330 packet with a different block check, because the "5" could not possibly be
7331 there legitimately unless it had a 3-byte CRC.  To be clear, this is
7332 cheating.  We read the packet contents before we know the packet is correct,
7333 then we check that it *is* correct.  I made the 4-line change to rpack()
7334 and it works OK in the absense of transmission errors.  ckcfn2.c, 3 Jun 2011.
7335
7336 So the various combinations should work as desired:
7337
7338  . Sender and receiver both support and are told to SET BLOCK 5 ("SB5").
7339  . Sender SB5, but receiver doesn't support it (errors out).
7340  . Sender SB5, receiver supports it but wasn't told (auto-recognizes it).
7341  . Receiver SB5 but sender no (errors out).
7342
7343 Note in the last case, the receiver should NOT automatically fall back to
7344 standard behavior because if the user said SET BLOCK 5 that means every
7345 packet MUST be protected by CRC to prevent the I/S packets from being
7346 corrupted.
7347
7348 Installed new HELP SET BLOCK-CHECK text.  ckuus2.c, 5 Jun 2011.
7349
7350 Autodownload didn't work when the S or I packet had a 3-byte block check
7351 because kstart() checked it for a 1-byte checksum.  Fixed in kstart(),
7352 ckcfn2.c, 6 Jun 2011.  However, older Kermit versions and programs that
7353 claim to do "autodownload" will never recognize this type of packet.  No
7354 big deal since even if they did, the transfer would fail anyway.
7355
7356 Added 'FORCE 3' to E-Kermit, called it EK 1.7.  The option is "-b 5".  Works
7357 OK for sending and receiving, both with and without the new option.  Also
7358 works with "-b 5" if you send an S packet to it with '5' in the BCT field.
7359 Changes were minimal, I have them all in ek17.diff.
7360
7361 I could probably also make a new G-Kermit in about 10 minutes, but who cares
7362 about G-Kermit...  We already have two useful Kermit programs that
7363 interoperate with the new protocol.  6 Jun 2011.
7364
7365 Replaced the very inadequate help texts for functions \fword() and
7366 \fsplit() with new ones.  ckuus2.c, 6 Jun 2011.
7367
7368 There were a couple reports of file corruption that I was saving for later.
7369 Now that now is later I dug up the messages, files, and logs and it turns
7370 out that nobody had reported a reproducible case of Kermit corrupting a
7371 file.  There have been non-reproducible cases though, almost certainly due
7372 to corruption of the S or I packet or its ACK, which is why we now have SET
7373 BLOCK 5.  Even with BLOCK CHECK 5, there is no guarantee that the same thing
7374 won't happen, it is just far less likely.  Even if we added a 32-bit CRC or
7375 even 64-bit one, there would still be a small chance it could happen.
7376
7377 7 Jun 2011:
7378
7379 Corrected various #ifdefs (or lack of them) when building C-Kermit with
7380 different combinations of feature-selection options such as NOCSETS, NOICP,
7381 NOLOCAL, NOSPL, NOUNICODE, etc.  ckcfns.c ckcmai.c ckcxla.h ckuus2.c
7382 ckuus4.c ckuus5.c ckuus6.c ckuusr.c, 7 Jun 2011.  After running the script
7383 that does all these builds (84 of them) I ran it again to make sure that
7384 none of the changes broke builds that succeeded before the changes were made.
7385
7386 Built OK on Solaris9 ("make solaris9")
7387 Ditto with Krb5 and OpenSSL 0.9.8q  ("make solaris9g+openssl+shadow+pam+zlib")
7388
7389 Built OK on Mac OS X 10.4.11 ("make macosx").
7390 Also "make macosx+krb5+openssl.
7391
7392 Built OK on Linux RHEL4 ("make linux").
7393 Built OK on Linux RHEL4 with OpenSSL 0.9.7a ("make linux+ssl").
7394 Built OK on Linux RHEL5 ("make linux").
7395
7396 "make linux+ssl" fails on RHEL5 because of DES, even though the target
7397 tests for the presence or absence of the DES libraries.  In this case the
7398 libraries are there but they lack the functions des_ecb3_encrypt,
7399 des_random_seed, and des_set_odd_parity.  The build succeeds as:
7400
7401   make linux+ssl KFLAGS=-UCK_SSL
7402
7403 Since DES is now considered harmful, Jeff Altman suggests that all OpenSSL
7404 builds, even for old versions, should omit it ("If you are building with
7405 openssl and no kerberos or srp, just disable DES.  Disabling DES will impact
7406 telnet and rlogin but it won't matter if you have no ability to negotiate a
7407 session key").
7408
7409 From Ian Beckwith, patches for Debian Linux:
7410  . Change all '-' to '\(hy' in man page (new pedantry): ckuker.nr.
7411  . Make IKSD authentication (using PAM) ask for a password when an invalid
7412    username has been given, to avoid disclosing which account names are valid:
7413    ckufio.c, ckuus7.c.
7414  . Fix spelling errors: ckcftp.c, ckuus2.c, ckuker.nr, ckcpro.w, ckuusr.h.
7415  . Patch makefile to support install to a staging area with DESTDIR.
7416  . Some other patches (mainly for typos) were for plain-text documentation
7417    files that were generated from Web pages; I updated the web pages.
7418
7419 A big corporate C-Kermit user has an application where a local C-Kermit
7420 makes a connection to a remote one, uploads some files, and then if the
7421 server has any new patch files for the local, it sends the patches and
7422 does a REMOTE HOST command to run the patch program.  This stopped working
7423 in C-Kermit 6.0 or 7.0 when I put a check to prevent it, because "it makes
7424 no sense to send REMOTE commands to the local end, because the results are
7425 sent back to the remote to be displayed on its screen but it has no screen".
7426 That may be true, but if the user needs to control the local from the
7427 remote, they should be able to.  I removed the checks.  This doesn't solve
7428 the problem of where the output goes; ideally it would go to the local
7429 screen but I don't see any elegant and simple way to make that change.
7430 However the output redirectors can still be used with the REMOTE command
7431 so the results can be captured to a remote file, which could then be sent.
7432 ckuus7.c, 7 Jun 2011.
7433
7434 Changed SET VARIABLE-EVALUATION to SET COMMAND VARIABLE-EVALUATION, but left
7435 the former version available.  ckuusr.c, 9 Jun 2011.
7436
7437 Documented the SET COMMAND VARIABLE-EVALUATION command, which I added in
7438 2008.  ck90.html, 9 Jun 2011.
7439
7440 Renamed all old Mac OS X makefile targets to have the prefix "old" to avoid
7441 confusing them with the current targets, and made macosx10 a synonym for
7442 macosx, so those who used previous makefiles will get a current target
7443 without having to know the new name.  makefile, 9 Jun 2011.
7444
7445 Added XMESSAGE, which is to MESSAGE as XECHO is ECHO: prints the text
7446 without a line terminator, so it can be continued by subsequent [X]MESSAGE
7447 commands.  ckuusr.[ch], 9 Jun 2011.
7448
7449 Back to "make linux+ssl" on RHEL5...  I took the coward's way out and added
7450 code to the makefile target to check whether the build worked (somebody let
7451 me know if there is a better way to check), and if not to give a message
7452 suggesting they "make clean ; make linux+ssl KFLAGS=-UCK_DES".  makefile,
7453 9 Jun 2011.
7454
7455 Noticed that \frecurse() would dump core if called with no arguments.
7456 Fixed in ckuus4.c, 9 Jun 2011.
7457
7458 Added \q() as an alternative to the more verbose \fliteral() for quoting
7459 strings that contain characters (like \) that would otherwise be significant
7460 to Kermit.  It's more efficient because it isn't a function call, and 'q'
7461 is an intuitive letter to mean 'quote'.  It also works better than
7462 \fliteral() because functions treat commas and braces specially.  ckuus4.c,
7463 10 Jun 2011.
7464
7465 Built OK on VMS 8.3 on Alpha, no net.  DEC C caught a couple glitches in the
7466 new code that gcc didn't catch, which I fixed.  ckuus[25].c, 10 Jun 2011.
7467
7468 Built OK on VMS 8.3 on Alpha with Multinet 5.3.  The SSL build failed but
7469 I'm not going to worry about it.  10 Jun 2011.
7470
7471 Built OK on NetBSD 5.1.  10 Jun 2011.
7472
7473 Tried to resurrect my old "build-all" machine, an IBM Netfinity 3500 from
7474 1997 with 20-some mountable bootable hard disks with lots of 1990s OS's on
7475 them.  No dice.  I can see the BIOS but not the hard disks.  The
7476 configuration is still correct because it tries to boot from the mountable
7477 hard disk, but it fails (I tried six different ones).
7478
7479 Tried to resurrect my old Siemens Nixdorf RM 200 MIPS machine.  Booted OK,
7480 headless even, but makes a hellish high-pitched whine, like a dentist drill.
7481 It's pretty slow too.  "make sinix542" (for SINIX 5.4.2) bombed at link
7482 time on no rdchk().  Fixed by #including <sys/filio.h>.  ckutio.c, 10 Jun 2011.
7483
7484 Tried to resurrect my old SCO Xenix 2.3.4 machine, also headless.  Amazingly
7485 it still works; it can't use a monitor but I can Telnet to it.  Had to tweak
7486 some #ifdefs but I got a no-net version built successfully.  According to my
7487 notes, it hasn't been possible to build with TCP/IP since C-Kermit 8.0,
7488 but how many people ever had SCO Xenix 2.3.4 with TCP/IP anyway?  Anyway we
7489 still have the binaries for C-Kermit 7.0.  ckuus4.c, 10 Jun 2011.
7490
7491 Built OK on AIX 5.3.  Built OK on Solaris 10.  11 Jun 2011.
7492
7493 Tried harder to revive the build-all machine, now it sort of works, but not
7494 all of the bootable OS's work.  Built C-Kermit 9.0 OK on OpenBSD 3.0.  Built
7495 OK on QNX 4.25 but had to #ifdef references to IXANY in ckutio.c and ckupty.
7496 Built OK on NetBSD 1.5.1 (2000).  Tried "make netbsd+ssl" on this one, it's
7497 OpenSSL 0.9.5a 1 Apr 2000, but it bombs out in ckuath.c, no big deal.
7498 Another problem in NetBSD 1.5.2 is that even though off_t is 8, CK_OFF_T
7499 is 4.  Worth noting but not worth fixing unless someone else notices.
7500 13 Jun 2011.
7501
7502 SuSE 7.0... boots OK but telnet server doesn't work.  Can telnet out but
7503 it's too flaky, connection drops if I try to transfer a file.
7504
7505 OpenBSD 2.5 [1999] OK.  Red Hat 7.1 OK.  Red Hat 7.1 with OpenSSL 0.9.6
7506 not OK, same error as with 0.9.5a:
7507
7508 ckuath.c
7509 In file included from ck_ssl.h:48,
7510                  from ckuath.c:225:
7511 /usr/include/openssl/des.h:77: warning: redefinition of `Block'
7512 ckuat2.h:86: warning: `Block' previously declared here
7513 /usr/include/openssl/des.h:83: redefinition of `struct des_ks_struct'
7514 /usr/include/openssl/des.h:91: warning: redefinition of `Schedule'
7515 ckuat2.h:90: warning: `Schedule' previously declared here
7516
7517 So it appears that OpenSSL support is broken for pre-0.9.7.  Tried
7518 building it again with -UCK_SSL (since the errors are originating from
7519 from des.h)...  But it still failed exactly the same way.  I found
7520 #includes for des.h in ckuath.c and and ck_ssl.h and #ifdef'd them out,
7521 but it still fails:
7522
7523 In file included from /usr/include/openssl/evp.h:89,
7524                  from /usr/include/openssl/x509.h:67,
7525                  from /usr/include/openssl/ssl.h:69,
7526                  from ck_ssl.h:51,
7527                  from ckuath.c:227:
7528 /usr/include/openssl/des.h:77: warning: redefinition of `Block'
7529 ckuat2.h:86: warning: `Block' previously declared here
7530 /usr/include/openssl/des.h:83: redefinition of `struct des_ks_struct'
7531 /usr/include/openssl/des.h:91: warning: redefinition of `Schedule'
7532 ckuat2.h:90: warning: `Schedule' previously declared here
7533
7534 Built OK on Debian 2.1.  13 Jun 2011.
7535
7536 On FreeBSD 4.4, it blows up with:
7537 ckufio.c: In function vpass':
7538 ckufio.c:8201: conflicting types for 'initgroups'
7539 /usr/include/unistd.h:154: previous declaration of 'initgroups'
7540 ckufio.c:8201: warning: extern declaration of 'initgroups' doesn't match global
7541 one.  Fixed by defining NODCLINITGROUPS for FreeBSD in ckufio.c. It might not 
7542 be the right fix, but I don't have a lot of other FreeBSD versions to
7543 compare with.  Anyway now it builds OK on 4.4, and also on FreeBSD 3.3.
7544 ckufio.c, 13 Jun 2011.
7545
7546 Tried to build on SCO Open Server 5.0.7 but it fails at link time because
7547 it can't find rdchk().  But it's supposed to be there!  Come back to this
7548 later...
7549
7550 Red Hat 6.1             i386   32/64   linux          2332545
7551 Red Hat 7.1             i386   32/64   linux          2368528
7552 Red Hat EL4             i386   32/74   linux          2363067
7553 Red Hat EL5.6           i386    64     linux          2371279
7554 Solaris9                sparc  32/64   solaris9       2849896
7555 Solaris9+ssl            sparc  32/64   solaris9       5021764
7556 Solaris10               sparc  32/64   solaris10      2855776
7557 QNX                     i386    32     qnx32          2012323 
7558 NetBSD 1.5.1            i386   32/64   netbsd         2198055
7559 NetBSD 5.1              i386   32/64   netbsd         2159863
7560 OpenBSD 2.5             i386   32/64   openbsd        2236036
7561 Mac OS X 10.6.7         x86_64  64     macosx         2.7M
7562 Mac OS X 10.4.11        ppc    32/64   macosx         2496304
7563 Debian 2.1              i386   32/64   linux          2213221
7564 FreeBSD 4.4             i386   32/64   freebsd        2291333
7565 FreeBSD 3.3             i386   32/64   freebsd        2147370
7566 SINIX 5.42              mips    32     sinix542       3319325 (1995)
7567 SCO Unixware 2.1.3      i386    32     uw213          2242176
7568 SCO OSR6.0.0            i386   32/64   sco_osr600     2368300
7569
7570 More builds, 14 June 2011:
7571
7572 VMS 6.2                 alpha   32     make mn        2556928 No TCP/IP
7573 VMS 6.2                 alpha   32     make m         3112960 UCX 4.0
7574 Solaris 11              i386   32/64   solaris11      2823860
7575 Solaris 11              i386   32/64   solaris11+ssl  2993660 OpenSSL 0.9.8l
7576 NetBSD 5.1              i386   32/64   netbsd+krb5    2307855 Kerberos 5
7577 Linux Slackware 12.1.0  i386   32/65   linux          2175754
7578 Linux Fedora 14         i386   32/64   linux          2256514
7579 Linux Fedora 14         i386   32/64   linux+ssl      ....... OpenSSL 1.0.0d
7580 Linux Fedora 14         i386   32/64   linux+krb      2449614 (*)
7581
7582 (*) make linux+krb5 "LIBS=$LIBS /lib/libk5crypto.so.3 /lib/libcom_err.so.2"
7583
7584 Noticed that netbsd+ssl build on NetBSD 5.1 said "NetBSD 1.5" in its banner.
7585 Fixed by replacing the old hardwired target with the new "subroutinized"
7586 target a'la linux+ssl and adapting it to NetBSD.  makefile, 15 Jun 2011.
7587
7588 Same deal for Kerberos 5, make a new netbsd+krb5 target and it builds ok,
7589 at least once one figures out where the Kerberos headers and libs are.
7590 makefile, 15 Jun 2011.
7591
7592 Same deal for the netbsdnc target, now it simply defined NOCURSES and
7593 chains to the main netbsd target.  makefile, 15 Jun 2011.
7594
7595 Tried to build with Kerberos 5 on Solaris, fails because the DES library
7596 no longer exists.  This one is beyond me, sorry.
7597
7598 Made new targets for MirBSD, mirbsd and mirbsd+ssl, makefile 15 Jun 2011.
7599
7600 In OpenSUSE 11.2 with OpenSSL 0.9.8r we bomb on undefined references from
7601 various DES library routines.  Builds OK without DES.
7602
7603 Various linux+krb5 builds fail because can't find -lgssapi_krb5
7604
7605 SSL builds with OpenSSL < 0.9.7 fail even though there is code to support
7606 the older SSL.
7607
7608 Fixed some printf %ld vs int instances in the sizeofs section of SHOW FEATURES.
7609 ckuus5.c, 15 Jun 2011.
7610
7611 Fixed the new linux+ssl target to actually use the SSLINC and SSLLIBS
7612 definitions, oops.  makefile, 15 Jun 2011.
7613
7614 15 June 2011 builds (Beta.01):
7615
7616 AIX 5.3                 ppc    32/64   aix+ssl        3283846 OpenSSL 0.9.8m
7617 NetBSD 5.1              i386   32/64   netbsd         2159863
7618 NetBSD 5.1              i386   32/64   netbsd+ssl     2350274 OpenSSL 0.9.9-dev
7619 NetBSD 5.1              i386   32/64   netbsd+krb5    2349627 MIT Krb5 1.6.3
7620 FreeBSD 8.2             i386   32/64   freebsd        2298414
7621 FreeBSD 8.2             i386   32/64   freebsd+ssl    2448961 OpenSSL 0.9.8q
7622 OpenBSD 4.7             i386   32/64   openbsd        2266132
7623 OpenBSD 4.7             i386   32/64   openbsd+ssl    2409263 OpenSSL 0.9.8k
7624 MirBSD 10               i386   32/64   mirbsd         2216601
7625 MirBSD 10               i386   32/64   mirbsd+ssl     2358318 OpenSSL 0.9.8r
7626 OpenSuse 11.2           x86_64  64     linux          2348468
7627 OpenSuse 11.2           x86_64  64     linux+ssl (*)  2546540 OpenSSL 0.9.8r
7628 RHEL 5.6                ia64    64     linux          4390687
7629 RHEL 5.6                ia64    64     linux+ssl (*)  4775007 OpenSSL 0.9.8e
7630 Ubuntu 9.10             i386   32/64   linux          2275523
7631 Ubuntu 9.10             i386   32/64   linux+ssl      2466708 OpenSSL 0.9.8r
7632 Gentoo 1.12.13          ppc    32/64   linux          2386597
7633 Gentoo 1.12.13          ppc64   64     linux          2749015
7634 Gentoo 1.12.13          ppc64   64     linux+ssl      3002150 OpenSSL 0.9.8r
7635 Gentoo 1.12.13          sparc  32/64   linux          2478382
7636 Gentoo 1.12.13          sparc  32/64   linux+ssl      2690499 OpenSSL 0.9.8r
7637 Solaris 9               sparc  32/64   solaris9       2849896
7638 Solaris 10              i386   32/64   solaris10      2837620
7639 IRIX 6.5                R10000 32/64   irix65         2869704
7640
7641 * and KFLAGS=-UCK_DES
7642
7643 Tried building on NetBSD 5.1 with Heimdal Kerberos using:
7644
7645 make netbsd+krb5 \
7646  "KFLAGS=-DHEIMDAL" \
7647  "K5INC=-I/usr/include" \
7648  "K5LIB=-L/usr/lib"
7649
7650 It found all its headers OK, but it blew up in ckuath.c.  Small wonder,
7651 ckccfg.html says:
7652
7653 HEIMDAL
7654     Should be defined if Kerberos V support is provided by HEIMDAL. Support
7655     for this option is not complete in C-Kermit 8.0. Anyone interested in
7656     working on this should contact kermit-support. 
7657
7658 'krb5-config --version' gives the MIT Kerberos 5 version number.
7659
7660 Make a new netbsd+krb5+ssl target based on the combination of the new
7661 netbsd+ssl and netbsd+krb5 targets.  There were lots of warnings in the
7662 compilation but no errors, but it produced an executable that starts and
7663 does normal things but I have no idea if the SSL or Kerberos functions work.
7664 makefile, 16 Jun 2011.
7665
7666 Changed the cu-solaris9-krb5 target to test for the presence of DES because
7667 DES isn't there, to see if this would allow a Kerberos build to proceed.
7668 And it worked, amazing.  At least the build completed, I have no way to test
7669 the Kerberos part.  makefile, 16 Jun 2011.
7670
7671 Updated the solaris9+ssl target to do the DES testing.  makefile, 16 Jun 2011.
7672
7673 Updated cu-solaris+krb5 target to test whether the GSSAPI library is called
7674 libgassapi or libgassapi_krb5.  makefile, 16 Jun 2011.
7675
7676 Added lots of tests to the Linux Kerberos 5 entries, linux+krb5 and
7677 linux+krb5+ssl, because some have libk5crypto and some don't; some have
7678 libcom_err and some don't; and some have libgssapi_krb5 (e.g. RHEL5,
7679 OpenSuse 11.2) whereas others have libgssapi (Gentoo).
7680
7681 16 June 2011 builds (Beta.01):
7682
7683 NetBSD 5.1 i386   32/64  netbsd+krb5+ssl   2451757 OpenSSL 0.9.9 MIT Krb5 1.6.3
7684 Solaris 9  sparc  32/64  solaris9+krb5     2543036 MIT Kerberos 5 1.7.1
7685 Solaris 9  sparc  32/64  solaris9+ssl      5021544 OpenSSL 0.9.8q (gcc)
7686 Gentoo...  ppc    32/64  linux             2386597
7687 Gentoo...  ppc    32/64  linux+ssl         2593561 OpenSSL 0.9.8r 
7688 Gentoo...  ppc64   64    linux             2749015
7689 Gentoo...  ppc64   64    linux+ssl         3002150 OpenSSL 0.9.8r 
7690 RHEL5      x86_64  64    linux+krb5 (*)    2563878 MIT Kerberos 5 1.6.1
7691 RHEL5      x86_64  64    linux+krb5+ssl(*) 2563878 MIT Kerberos 5 1.6.1
7692 Fedora 14  i386   32/64  linux+krb5+ssl    2539891 MIT Krb5 + OpenSSL 0.9.8r
7693
7694 * KFLAGS=-UCK_DES
7695
7696 --- C-Kermit 9.0.299 Beta.01 ---
7697
7698 sizeof() can return a long or an int, so neither printf("%d",sizeof(blah));
7699 or printf("%ld",sizeof(blah)); can be used everywhere.  Changed the
7700 "sizeofs" section of SHOW FEATURES in the dumbest (and therefore most
7701 portable) way to squelch the warnings.  ckuus5.c, 17 Jun 2011.
7702
7703 From John Dunlap: "Watching the server screen led me to offer a cosmetic
7704 patch for ckuusx.c.  I noticed that the server screen said it was
7705 "RESENDING" when it really wasn't.  The attached patch emits blanks to
7706 insure that old labels are completely erased."  ckuusx.c, 17 Jun 2011.
7707
7708 Nelson Beebe found two places where I had SSLLIBS in the makefile instead of
7709 SSLLIB.  makefile, 18 Jun 2011.
7710
7711 More important he knew how to force gcc to load the right header files for
7712 OpenSSL 1.0.0d (by using '-isystem' rather than '-I').  Previously it was
7713 using the 0.9.8r header files but linking with the 1.0.0d libraries.  This
7714 is not in the sources or makefile; it's done when giving the 'make' command:
7715
7716   export PATH=/usr/bin:$PATH
7717   export SSLINC=-isystem/usr/include
7718   export "SSLLIB=-L/usr/lib -Wl,-rpath,/usr/lib"
7719   make linux+ssl
7720
7721 Folded the previous linux+openssl+zlib+shadow+pam and linux+openssl+shadow
7722 targets into linux+ssl.  Checked the linuxso (scripting only) target, builds
7723 OK, 600K.  Made new subroutinized linux+krb5+krb4 target but can't find
7724 anyplace to test it.   Made new subroutinized linux+shadow+pam target, works
7725 fine on RHEL4.  Revised comments and lists again.  makefile, 18 Jun 2011.
7726
7727 For the pluggable-disk OS's that boot OK but lack a working network, I
7728 rigged up a serial connection using a DB9-FF null modem cable, and then a
7729 DB9-MF modem cable to make it reach.  I don't see any modem signals on
7730 either end, but the data goes through OK.  COM1 on the desktop PC,
7731 /dev/ttyS1 or whatever on Lab.  Since there are no modem signals, can't use
7732 RTS/CTS.  At 57600bps with Xon/Xoff, 500-byte packets and sliding windows,
7733 transfers work OK at about 5000cps using 5 window slots; takes 8 minutes to
7734 transfer the gzipped C-Kermit tarball.  Kermit to the rescue.  19 Jun 2011.
7735
7736 Transferred the tarball over serial ports to SCO OSR5.0.5 at 38.4Kbps, the
7737 highest speed supported, 12 minutes, no errors, 3300cps.  Unpack, make
7738 sco32v505udk, OK.  Also built the TCP/IP version and it almost made an
7739 outbound connection, but only once (not a Kermit program but something with
7740 the TCP/IP stack).  19 Jun 2011.
7741
7742 Ditto for Solaris 2.6/i386, except 57.6Kbps, 4K-byte packets, no problem.
7743 Solaris 8/i386, ditto.  19 Jun 2011.
7744
7745 SCO OpenServer 5.0.5  i386   32   sco32v505udk     1940964  No TCP/IP
7746 SCO OpenServer 5.0.5  i386   32   sco32v505udknet  2314668  With TCP/IP
7747 Sun Solaris 2.6       i386   32   solaris26g       4661368
7748 Sun Solaris 8         i386   32   solaris8g        4675432
7749
7750 When using compact substring notation, \s(xx[4]) returns the whole string
7751 xx starting at position 4, but \s(xx[4:]) returns an empty string.  Fixed
7752 the latter to be like the former.  ckuus5.c, 20 Jun 2010.
7753
7754 Really it would have been nicer if \s(xx[4]) returned a single character,
7755 the 4th character of xx, but it's too late now.  Added another "separator"
7756 character '.' (period) for that: \s(xx[4.]) is the 4th character of xx.
7757 ckuus4.c, 20 Jun 2010.
7758
7759 Back to SCO OSR5.0.7... This failed before because 'rdchk' came up unknown
7760 at link time, unlike all previous OSR5's, that used rdchk() in place of the
7761 FIONREAD ioctl.  Added #ifdefs to make a special case for 5.0.7.  I'm not
7762 sure this is the best way, but this is the minimal change to get it to work.
7763 If anybody cares, maybe the same can be done for previous OSR5 releases.
7764 ckutio.c, 20 Jun 2010 (search for SCO_OSR507).
7765
7766 SCO OpenServer 5.0.7  i386   32   sco32v507        1895724  No TCP/IP
7767 SCO OpenServer 5.0.7  i386   32   sco32v507net     2246792  With TCP/IP
7768
7769 Checked current code on RHEL4, found that my GSSAPI-lib finding makefile
7770 target didn't look in enough places; added some more.  makefile, 21 Jun 2011.
7771
7772 Got reports back on HPUX from Peter Eichhorn, almost all good on HP-UX 7, 8,
7773 9, 10, and 11.  21-22 Jun 2011.
7774
7775 Got access to Debian 5.0 and 7-to-be ("Wheezy/Sid").  Regular 'make linux' is
7776 OK in Debian 5, but in 7 can't find crypt, res_search, or dn_expand; had
7777 to add more library search clauses to 'make linux'.  makefile, 21 Jun 2011.
7778
7779 In Debian 7.0, libk5crypto could not be found without adding another clause
7780 to 'make linux+krb5'.  That done, the SSL build (1.0.0d) was OK, as well as
7781 the krb5+ssl one.  makefile, 21 Jun 2011.
7782
7783 I found a Linux box that had both Kerberos 4 and 5 installed and tried 'make
7784 linux+krb5+krb4', which failed because of missing DES functions.  Tried
7785 'make linux+krb5+krb4 KFLAGS=-UCK_DES', but that fails too, even though it
7786 doesn't fail for Kerberos 5 alone, so probably some Krb4 code is making
7787 unguarded calls to the DES routines.  What is really needed is a way to
7788 completely strip all DES references from any given build, code and makefile,
7789 a big deal.  21 Jun 2011.
7790
7791 Fixed some typos in COPYING.TXT (noticed by Ian Beckwith).  24 Jun 2011.
7792
7793 Got access to perhaps the last living 4.3BSD VAX system.  It doesn't have
7794 SEEK_CUR so I had to #ifdef out the \fpicture() function.  Aside from that,
7795 no problems.  ckuus4.c, 24 Jun 2011.
7796
7797 I had been wanting the S-Expression (ROUND x) to allow a second argument n,
7798 which, if given, tells where the rounding should occur.  If n is positive,
7799 the number is rounded to n decimal places.  If zero, it is rounded to the
7800 nearest integet.  If positive, the number is rounded to the nearest power of
7801 10; e.g. -2 means "to the nearest hundred".  If ROUND is used as before,
7802 with one argument, it works as before.  ckclib.c, ckuus3.c, 25 Jun 2011.
7803
7804 From Arthur Marsh, a few more directories to test for libresolv in Linux.
7805 makefile, 26 Jun 2011.
7806
7807 From Martin Vorlaender, a fix for the VMS file-transfer display and
7808 statistics, a place where a file length wasn't being cast to CK_OFF_T
7809 in zchki().  ckvfio.c, 28 Jun 2011.
7810
7811 Updated version to 9.0.300 and removed the Beta designation.
7812 ckcmai.c, makefile, 28 Jun 2011.
7813
7814 Removed solaris9_64 target from makefile.  It builds but it doesn't work
7815 at all.  30 Jun 2011.
7816
7817 --- C-Kermit 9.0.300 ---
7818
7819 On Solaris 10 and 11, DNS lookups don't work.  It seems these Solaris
7820 versions have INADDRX and INADDRX_NONE defined, thus triggering the code in
7821 ckcnet.c, ckucns.c, and ckcftp.c #ifdef'd on these symbols, but that code
7822 doesn't work in this case.  This happens building with gcc as well as with
7823 Sun cc.  Put #ifdefs in ckcnet.h to undefine these symbols (if they are
7824 defined after including all the header files) for Solaris.  I didn't bother
7825 trying to differentiate the Solaris versions because the symbols are not
7826 defined in Solaris 9 or earlier, and they should not be used in Solaris 10
7827 or 11.  ckcnet.h, 6 July 2011.
7828
7829 From SMS:  To avoid the %CC-W-PTRMISMATCH1 complaints from ck_ssl.c, add
7830 two (harmless) type casts at lines 2460 and 2773, 6 July 2011.
7831
7832 Built and tested on Solaris 9, Solaris 10, and RHEL5.  6 July 2011.
7833
7834 --- C-Kermit 9.0.301 Beta.01 ---
7835
7836 Updated version text and date.  ckcmai.c, makefile, 11 July 2011.
7837
7838 --- C-Kermit 9.0.301 ---
7839
7840 ---------------------------------
7841 ***************************