f7239f20af14b2e1f66b9b954da3b959ec653005
[ckermit.git] / ckc299.txt
1 C-KERMIT 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
8 FTP USER, FTP ACCOUNT, plus the various prompts and switches for FTP username,
9 password, and account all neglected to strip quotes, and in most cases quotes
10 are necessary to specify a username that contains spaces.  ckcftp.c,
11 15 Jan 2003.
12
13 FTP MPUT f1 f2 f3... gets a parse error if any of the fn's do not match an
14 existing file.  This is bad for scripts.  In doftpput(), cmfdb() looks for
15 keywords (switches) or CMIFI.  When it hits CMIFI, it exits from the initial
16 parse loop and then does additional cmifi()s in a loop until done.  The most
17 obvious fix is to parse each field with cmfdb(CMIFI,CMFLD), i.e. fall back to
18 CMFLD if CMIFI doesn't match anything.  Then if CMFLD was used, we don't add
19 the filespec to the list.  This is a rather big change but it seems to work.
20 No error messages or failures happen for non-matching fields, but an error
21 message is printed (and the MPUT command fails) if none of the fields match
22 any files.  This fix got in too late for 2.1.3; workaround: use C-Shell
23 like wildcard list (ftp mput "{*.abc,foo.*}").  ckcftp.c, 16 Jan 2003.
24
25 GREP did not pass its pattern through the expander, thus variables could
26 not be used for patterns.  This must have been an oversight -- I can't find
27 anything in my notes about it.  Fixed in dogrep(): ckuus6.c, 24 Jan 2003.
28
29 New makefile target for HP-UX 11.xx with OpenSSL from Tapani Tarvainen.
30 makefile, 31 Jan 2003.
31
32 From Jeff:
33  . Avoid core dump when dereferencing tnc_get_signature(): ckuus4.c.
34  . Bump version numbers to 8.0.208, 2.1.4: ckcmai.c.
35
36 Added /NOLOGIN to FTP [OPEN].  ckcftp.c, 10 Feb 2003.
37
38 Don't dump core if FTP DEBUG is ON and FTP OPEN does not include a service.
39 openftp(): ckcftp.c, 10 Feb 2003.
40
41 HELP PATTERN text incorrectly identified commands and functions with
42 floating and anchored patterns.  The corrected lists are:
43 Floating: GREP, TYPE /MATCH:, /EXCEPT: patterns, \farraylook(),
44 Anchored: IF MATCH, file-matching wildcards, \fsearch(), \frsearch()
45 ckuus2.c, 10 Feb 2003.     
46
47 INPUT n \fpattern(xxx) did not work for case-independent comparisons.
48 Fixed in doinput(): ckuus4.c, 10 Feb 2003.
49
50 It seems \fpattern() didn't work with MINPUT at all.  There was no code to
51 handle \fpattern() in the MINPUT parse loop, so it never worked.  The code
52 had to be totally rewritten to use cmfld() in a loop, rather than cmtxt()
53 and then cksplit().  Furthermore, whenever any of the fields was an
54 \fjoin(), this had to be split.  ckuusr.c, 10 Feb 2003.
55
56 Macro replacement via \m() and \fdefinition() does not work as advertised
57 (i.e. case sensitively) for associative array elements; e.g. \m(xxx<abc>) is
58 treated the same as \m(xxx<ABC>), contrary to section 7.10.10 of the C-Kermit
59 7.0 update notes, and to the fact that the two really do exist separately.
60 Fixed by adding a static function isaarray(s) which succeeds if s is an
61 associative array reference and fails otherwise, and then having \m()
62 and \fdef() call mxxlook() (case-sensitive lookup) if isaarray(), otherwise
63 (as before) mxlook()).  ckuus4.c, 11 Feb 2003.
64
65 Fixed FTP OPEN to allow the /USER switch to override SET FTP AUTOLOGIN OFF,
66 just as /NOLOGIN overrides SET FTP AUTOLOGIN ON.  ckcftp.c, 11 Feb 2003.
67
68 In K95, "set key \1234 \27H" (any SET KEY command in which the first char of
69 the definition was backslash, and the ONLY character after the backslash
70 quantity was an uppercase letter, that letter would be lowercased).  Diagnosis:
71 xlookup() poking its argument (see notes from July 2000).  Jeff sent a fix.
72 ckucmd.c, 15 Feb 2003.
73
74 Ran my S-Expression torture test to make sure Sexps still worked.  They do,
75 except the bitwise & and | operators were broken, e.g. (& 7 2) and (| 1 2 4)
76 get "Invalid operand" errors.  Jeff's code had added an early failure return
77 from the lookup loop when when a single-byte keyword matched a keyword that
78 started with the same byte but was more than one byte long.  So "&" would hit
79 "&&" and fail instead of continuing its search (xlookup tables aren't sorted
80 so there can be no early return).  Fixed in xlookup(): ckucmd.c, 16 Feb 2003.
81
82 Got rid of "krbmit" target from makefile.  It's still there, but we don't
83 use it any more.  All secure targets now use "xermit", and produce a binary
84 called wermit, just like the regular ones do (except the old ckucon.c ones).
85 Non-secure targets, since they don't define any of the security symbols,
86 wind up compiling and linking to (mostly) empty security modules.  makefile,
87 15 Feb 2003.
88
89 Added \fcvtdate(xxx,3) to format its result in MDTM format (yyyymmddhhmmss,
90 all numeric, no spaces or punctuation).  Of course these numeric strings
91 are too big to be 32-bit numbers and are useless for arithmetic, but they're
92 useful for lexical comparison, etc.  ckuus[24].c, 16 Feb 2003.
93
94 The following FTP commands did not set FAILURE when they failed: RMDIR,
95 CD, CDUP, Fixed in the corresponding doftpblah() routines.  ckcftp.c,
96 16 Feb 2003.
97
98 RENAME would sometimes not print an error message when it failed, e.g. in K95
99 when the destination file already existed.  ckuus6.c, 17 Feb 2003.
100
101 Fixed COPY error messages, which did not come out in standard format when
102 /LIST was not included.  ckuus6.c, 17 Feb 2003.
103
104 Fixed #ifdefs in ck_crp.c to allow nonsecure builds on old platforms like
105 System V/68 R3.  19 Feb 2003.
106
107 Similar treatment for ck_ssl.c.  20 Feb 2003.
108
109 From Jeff, 21 Feb 2003:
110  . AIX53 and AIX52 symbols for ckcdeb.h, makefile.
111  . New gcc targets for various AIX 4.x/5.x versions: makefile.
112  . Copyright date updates: ck_crp.c, ck_ssl.c.
113  . ENABLE/DISABLE QUERY broken because keyword table out of order: ckuusr.c.
114  . Fixed the use of HTTP proxies for HTTP [RE]OPEN for Unix: ckcnet.c.
115
116 Also for K95 only: Allow file transfer when K95 is invoked on the remote end
117 of a connection to a Pragma Systems Terminal Server connection; automatically
118 SET EXIT HANGUP OFF when invoked with open port handle ("k95 -l nnnn").
119
120 "cd a*" failed even when "a*" matched only one directory.  Fixed in cmifi():
121 ckucmd.c, 21 Feb 2003.
122
123 In the Unix version, replace "extern int errno;" with "#include <errno.h>"
124 if __GLIBC__ is defined, since glibc now defines a thread-specific errno.
125 ckcdeb.h, 26 Feb 2003.
126
127 Added #ifdefs to skip compilation of ckuath.c in nonsecure builds.  Tested
128 by building both secure and regular versions in Linux.  ckuath.c, 26 Feb 2003.
129
130 Ran the build-in-84-different-configurations script on Linux to make sure it
131 still builds with all different combinations of feature selection options.
132 All OK.  26 Feb 2003.
133
134 Built on VMS.  Needed to add a prototype for mxxlook*() to ckuusr.h; built
135 OK otherwise.  26 Feb 2003.
136
137 From Jeff: More #ifdef shuffling for nonsecure builds: ckuath.c, ck_ssl.c,
138 27 Feb 2003.
139
140 Added code to ensure \v(download) ends in a directory separator in Unix,
141 Windows, and OS/2.  ckuus7.c, 27 Feb 2003.
142
143 Added code to K95 zfnqfp() to tack on directory separator when returning
144 a directory name.  ckofio.c, 27 Feb 2003.
145
146 Somehow an old copy of ckuath.c popped to replace the new one.  Put the new
147 one back.  28 Feb 2003.
148
149 From Jeff: Fix typo in my K95 zfnqfp() code from yesterday; fixes for handling
150 UNCs uniformly, no matter which way their slashes are leaning.  ckofio.c,
151 28 Feb 2003.
152
153 At Jeff Mezei's suggestion, separate text and binary mode open sequences
154 for VMS session log.  ckvfio.c, 28 Feb 2003.
155
156 Added freebsd48 target for FreeBSD 4.8.  makefile, 1 Mar 2003.
157
158 Changed Mac OS X entries to include -DUSE_STRERROR.  makefile, 2 Mar 2003.
159
160 Fixed GETOK /GUI to evaluate its text argument.  ckuus6.c, 3 Mar 2003.
161
162 Jeff fixed the K95 Dialer QUICK dialog to (a) allow templates, and (b) have
163 a Save-As option.  3 Mar 2003.
164
165 Jeff fixed a problem with the Xmodem-CRC checksum being crunched whenever
166 there was a retransmission.  7 Mar 2003.
167
168 Added target/banner for Tru64 5.1B.  makefile, ckuver.h, 5 Mar 2003.
169
170 In Unix, the zcopy() routine (used by the COPY command) reset the user's umask
171 to 0 for the remainder of the Kermit process lifetime.  The bug was in
172 ckufio.c 8.0.194, 24 Oct 2002, and is fixed in ckufio.c 8.0.195, 6 Mar 2003.
173 Of course this happened after building 155 C-Kermit 8.0.208 binaries.  (But
174 before officially releasing 8.0.208.)
175
176 In the VMS version, changed:
177
178         while ((n--) && xx_inc(2) > -1) ;
179 to:
180         while ((n--) && xx_inc(2) >= 0) ;
181
182 to suppress the "...is being compared with a relational operator to a constant
183 whose value is not greater than zero" warning.  ckvtio.c, 7 Mar 2002.
184
185 Added a debug call to dologend in hopes of catching overzealous Locus
186 switching, which seems to happen only in K95.  ckuus3.c, 7 Mar 2002.
187
188 Rebuilt binaries for some of the more current Unix releases: AIX 4.3.3-5.1,
189 Solaris 7-9 , Red Hat 7.0-8.0, Slackware 8.1, Freebsd 4.7-4.8, NetBSD 1.6,
190 OpenBSD 3.2, Unixware 7.1.3, Open Unix 8, OSR5.0.6a, etc.  A Unix binary with
191 COPY umask fix shows a 6 Mar 2003 date for "UNIX File support" in SHOW
192 VERSIONS; a binary without the fix shows 24 Oct 2002.
193
194 C-Kermit 8.0.208 dated 14 March 2003 released on 10 March 2003.
195
196 ---8.0.208---
197
198 From Jeff 13 Mar 2003:
199  . Updated SSL module allows importation of tickets from host.
200  . freebsd50+openssl target: makefile.
201  . FTP PUT /PERMISSIONS error message for K95: ckcftp.c.
202  
203 Fixed MINPUT to strip quotes or braces from around targets (this was broken
204 on Feb 10th).  Thanks to Jason Heskett for discovering and reporting this
205 (killer) bug.  ckuusr.c, 14 Mar 2003.
206
207 Changed version number to 209 Dev.00.  ckcmai.c, 14 Mar 2003.
208
209 While debugging the alphapage script, I found that the command "minput 8 \6\13
210 \21\13 \13\27\4\13 \30\13" gets "?Not confirmed" in 8.0.208 and 8.0.209, but
211 not in 206 and earlier.  This problem too was introduced on Feb 10th by
212 changing MINPUT parsing from cmtxt() followed by cksplit() to cmfld() in a
213 loop.  cmfld() uses setatm() to return its result and of course setatm()
214 breaks on \13.  Changing setatm() not to do this would break everything else.
215 But cmfld() has no arguments that let us tell it to do anything different in
216 this case.  Changing the API would be a disaster.  The only solution is to add
217 an "MINPUT ACTIVE" (minputactive) global variable that tells cmfld() to tell
218 setatm() not to break on CR.  Now MINPUT with braced targets containing CR
219 and/or LF works in 209, 206, and 201 (but not 208).  ckucmd.c, ckuusr.c,
220 ckuus5.c, 15 Mar 2003.
221
222 MINPUT n \fjoin(&a) works OK if all the members of \&a[] are text strings, but
223 if they are strings of control chars (as above), they don't get separated by
224 the spaces.  For example in:
225
226   dcl \&a[] = "\4\5" "\6\7" xxx
227   minput 10 \fjoin(&a)
228
229 MINPUT gets two targets: "aaa" and "\4\5 \6\7 xxx".  The bug was in the
230 cksplit() call in the \fjoin() case of MINPUT: it needed to specify an
231 include set consisting of all the control characters except NUL.  ckuusr.c,
232 16 Mar 2003.
233
234 But there's still a problem:
235
236   dcl \&a[] = "\4\5\13\10" "\6\7" "xxx"
237
238 creates an array whose first member is "^D^E (one doublequote included).  But
239 if braces are used instead, there's no problem.  Same deal as MINPUT: cmfld()
240 breaks on CR or LF, thus the end quote is lost.  If I set minputactive for
241 DECLARE initializers too, that fixes it.  Is there any reason not to do this?
242 Can't think of any (famous last words)...  ckuusr.c, 16 Mar 2003.
243
244 Since it has multiple applications, changed the flag's name from minputactive
245 to keepallchars.  ckucmd.c, ckuus[r5].c, 16 Mar 2003.
246
247 \v(exedir) wasn't being set correctly (it included the program name as well
248 as the directory).  Fixed in getexedir(): ckuus4.c, 16 Mar 2003.
249
250 SET CARRIER-WATCH <Esc> "auto matic" (spurious space in supplied keyword).
251 Cosmetic only; it still worked.  Fixed in setdcd(): ckuus3.c, 16 Mar 2003.
252
253 "directory a b c" listed too many files -- all files whose names END WITH a,
254 b, or c, rather than the files whose names WERE a, b, or c.  Diagnosis: The
255 filespec is changed into a pattern: {a,b,c}, which is the correct form.  It is
256 passed to nzxpand(), which goes through the directory getting filenames and
257 sending each one to ckmatch() with the given pattern.  ckmatch() receives the
258 correct pattern but then prepends a "*" -- that's not right.  It's not just
259 in filename matching either.  The following succeeds when it shouldn't:
260
261   if match xxxxc {{a,b,c}} <command>
262
263 Changing ckmatch() to not prepend the "*" to each segment fixes the command
264 above but breaks lots of others.  Running through the "match" torture-test
265 script shows the problem occurs only when the {a,b,c} list is the entire
266 pattern, and not embedded within a larger pattern.  Testing for this case
267 fixed the problem.  ckmatch(): ckclib.c, 16 Mar 2003.
268
269 Fixed FTP MODTIME to not print anything if QUIET ON.  ckcftp.c, 16 Mar 2003.
270
271 Picked up a new ckuath.c from Jeff, not sure what the changes are. 16 Mar 2003.
272
273 Did a few regular and secure builds to make sure I didn't wreck anything.
274
275 Changed version number to 209 (final).  ckcmai.c, 16 Mar 2003.
276
277 Jason Heskett found another bug: if you define a macro FOO inside the
278 definition of another macro BAR, and FOO's definition includes an odd number
279 of doublequotes (such as 1), FOO's definition absorbs the rest of BAR's
280 definition.  Example:
281
282   def TEST {
283     .foo = {X"}
284     sho mac foo
285   }
286   do test
287   sho mac foo
288
289 Results in:
290
291   foo = {X"}, sho mac foo
292
293 Diagnosis: the TEST definition becomes:
294
295   def TEST .foo = {X"}, sho mac foo
296
297 and the macro reader is erroneously treating the doublequote as an open
298 quote, and then automatically closes the quote at the end of the definition.
299 The error is that a doublequote should be significant only at the beginning of
300 a field.  But the macro reader isn't a command parser; it doesn't know what
301 a field is -- it's just looking for commas and skipping over quoted ones.
302 First we have to fix an oversight: SET COMMAND DOUBLEQUOTING OFF should have
303 worked here, but it wasn't tested in this case.  Fixed in getncm(): ckuus5.c,
304 17 Mar 2003.
305
306 There are only certain cases where it makes sense to treat doublequotes as
307 signicant:
308
309  . An open quote must be at the beginning or preceded by a space.
310  . A close quote is only at the end or else followed by a space.
311
312 This too was fixed in getncm(): ckuus5.c, 17 Mar 2003.
313
314 A fix from Jeff SSL/TLS FTP data decoding.  ckcftp.c, 18 Mar 2003.
315
316 Tried building C-Kermit on a Cray Y-MP with UNICOS 9.0.  "int suspend",
317 declared in ckcmai.c and used in many modules, conflicts with:
318
319   unistd.h:extern int suspend __((int _Category, int _Id));
320
321 The "=Dsuspend=xsuspend" trick doesn't work for this; there is no way around
322 the conflict other than to rename the variable: ckcmai.c, ckutio.c,
323 ckuus[35xy].c.  26 Mar 2003.  VMS and K95 not affected.
324
325 OK that gets us past ckcmai.c...  Then in ckutio.c I had to add a new #ifdef
326 around the LFDEVNO setting, because the Cray didn't have mkdev.h.  Could not
327 find a Cray-specific manifest symbol, so I made a new makefile target (cray9)
328 that sets this symbol.  Having done this I have no idea what kind of lockfile
329 would be created, but I also doubt if anybody dials out from a Cray.  The
330 binary should run a C90, J90, or Y-MP.  makefile, 26 Mar 2003.
331
332 Added a target for SCO OSR5.0.7.  makefile, ckuver.h, 30 Mar 2003.
333
334 Changed since 208:
335 makefile ckuver.h ckcmai.c ckclib.c ckcftp.c ckucmd.c ckuus*.c ckutio.c.
336
337 ---8.0.209---
338
339 From Mark Sapiro, a fix for the March 17th doubleqote fix, getncm(): ckuus5.c,
340 4 Apr 2003.
341
342 From Jeff, 29 Apr 2003:
343  . Corrected target for HP-UX 11.00 + OpenSSL: makefile, 
344  . Do not allow WILL AUTH before WONT START_TLS: ckctel.h ckctel.c
345  . Add hooks for SFTP and SET/SHOW SFTP: ckcdeb.h ckuusr.h ckuusr.c ckuus3.c
346  . Add SKERMIT ckuusr.h ckuusr.c
347  . Add ADM-5 terminal emulation: ckuus7.c, ckuus5.c
348  . Uncomment and update HELP SET SSH V2 AUTO-REKEY: ckuus2.c
349  . Enable IF TERMINAL-MACRO and IF STARTED-FROM-DIALER for C-Kermit: ckuus6.c
350  . Fix conflicting NOSCROLL keyword definition: ckuusr.h
351  . Set ttname when I_AM_SSH: ckuusy.c
352  . Add extended arg parsing for SSH, Rlogin, Telnet: ckuusy.c, ckuus4.c
353  . Security updates: ckuath.c, ck_ssl.c
354  . Change K95 version number to 2.2.0: ckcmai.c
355  . Save K95 term i/o state before executing keyboard macro: ckuus4.c
356  . Add tests for SSH Subsystem active during INPUT/OUTPUT/CONNECT: ckuus[45].c
357  . Enable K95 SET SSH V2 AUTO-REKEY: ckuus3.c
358
359 SFTP and SET SFTP subcommands are implemented up to the case statements.
360
361 Files of mine that Jeff hadn't picked up:
362   ckuver.h ckcftp.c ckutio.c ckuusx.c (just minor changes for last build-all)
363
364 On 4 Jan 2003, SET RECEIVE MOVE-TO was changed to convert is argument to an
365 absolute path, which made it impossible to specify a relative path, then
366 move to different directories and have it apply relatively to each directory.
367 Changed this as follows:
368
369  . Parser uses cmtxt() rather than cmdir() so it won't fail at parse time.
370  . If path is absolute, we fail at parse time if directory doesn't exist.
371  . In reof() we run the the path through xxstring (again, in case deferred
372    evaluation of variables is desired) and then, if not null, use it.
373  . If the directory doesn't exist, rename() fails and reof() returns -4,
374    resulting in a protocol error (this is not a change).  We do NOT create
375    the directory on the fly. 
376
377 I also fixed SET SEND/RECEIVE RENAME-TO to parse with cmtxt() rather than
378 cmdir(), since it's parsing a text template, not a directory name, e.g.
379 "set receive rename-to file-\v(time)-v(date)-\v(pid)".  This was totally
380 broken, since when I don't know.  We don't call xxstring() in this parse, so
381 evaluation is always deferred -- I'd better not change this.  ckuus7.c,
382 ckcfns.c, 1 May 2003.
383
384 From Jeff, Sat May  3 14:15:23 2003:
385  . Pick up the right isascii definition for K95: ckctel.c
386  . malloc...  ckuath.c (new safe malloc routines for K95)
387  . Add author listing: ckuus5.c
388  . SSH Heartbeat support (K95 only): ckuus[23].c
389  . Prescan --height and --width to avoid window resizing at startup: ckuusy.c
390  . Add checks for fatal() or doexit() called from sysinit(): ckuusx.c
391  . Move some K95-specific definitions to ckoker.h: ckcdeb.h
392  . Add support for ON_CD macro in zchdir(): ckufio.c
393  . Add a command to let FTP client authenticate with SSLv2: ckcftp.c
394  . Fix parsing of FTP file facts like "UNIX.mode": ckcftp.c
395
396 ON_CD will need some explaining (to be done).  It's implemented for Unix,
397 VMS, WIndows, and OS/2.
398
399 The FTP file facts fix came from first exposure to the new OpenBSD FTP
400 server: ftp://ftp7.usa.openbsd.org/pub/os/OpenBSD/3.3/i386/
401 The period in "UNIX.mode" caused an erroneous word break, adding junk to
402 the filename.
403
404 About the malloc changes, Jeff says "K95 is not behaving well in low memory
405 environments.  I'm not sure that C-Kermit does much better.  The program does
406 not crash but it certainly does not behave the way the user expects it to.
407 I'm beginning to think that any malloc() error should be treated as fatal."
408
409 Not visible in these changes because it's in K95-specific modules: Jeff made
410 SET ATTRIBUTES OFF and SET ATTRIBUTES DATE OFF apply to XYZMODEM transfers.
411
412 From Jeff, 11 May 2003:
413  . Add support for SSH Keepalive to relevant SET command (K95): ckuus3.c
414  . Reduce max overlapped i/o requests from 30 to 7 (K95): ckuus7.c
415  . Don't call sysinit() in fatal(): ckuusx.c.
416  . Some new conditionalizations for SSL module: ck_ssl.c
417
418 The doublequote-parsing fixes from March and April broke the SWITCH statement,
419 which is implemented by internally defining, then executing, a macro.  If I
420 drop back to the old dumb handling of doublequotes, everything is fixed except
421 the problem of March 17th.  But can we really expect getncm() to pre-guess
422 what the parser is going to do?  getncm()'s only job is to find command
423 boundaries, which are represented by commas.  Commas, however, is needed IN
424 commands too.  We take a comma literally if it is quoted with \, or is inside
425 a matched pair of braces, parens, or doublequotes.  It is not unreasonable to
426 require a doublequote in a macro definition to be prefixed by \ when it is to
427 be taken literally.  The proper response to Jason Heskett's complaint of March
428 17th should have been to leave the code alone and recommand an appropriate
429 form of quoting:
430
431   def TEST {
432       .foo = {X\"}
433       sho mac foo
434   }
435
436 And this is what I have done.  Another reason for sticking with the old method
437 is that it's explainable.  The "improved" method, even if it worked, would be
438 be impossible to explain.  Btw, in testing this I noticed that the switch-test
439 script made 8.0.201 dump core.  Today's version is fine.  The problem with
440 quoted strings inside of IF {...} clauses and FOR and WHILE loops is fixed
441 too.  Perhaps "unbroken" would be a better word.  ckuus5.c, 11 May 2003.
442
443 Vace discovered that FTP MGET /EXCEPT:{... (with an unterminated /EXCEPT list)
444 could crash Kermit.  Fixed in ckcftp.c, 11 May 2003.
445
446 CONTINUE should not affect SUCCESS/FAILURE status.  ckuusr.c, 11 May 2003.
447
448 Fixed an oversight that goes back 15 years.  While \{123} is allowed for
449 decimal codes, \x{12} and \o{123} were never handled.  ckucmd.c, 11 May 2003.
450
451 Added support for Red Hat <baudboy.h> and /usr/sbin/lockdev.  Supposedly this
452 allows Kermit to be installed without setuid or setgid bits and still be able
453 to lock and use the serial device.  Compiles and starts, but not tested.
454 ckcdeb.h, makefile, ckutio.c, ckuus5.c, 16 May 2003.
455
456 From Jeff: FTP ASCII send data to host when FTP /SSL was in use was broken.
457 ftp_dpl is set to Clear when FTP /SSL is in use.  This was causing the data to
458 be written to the socket with send() instead of the OpenSSL routines.
459 ckcftp.c, ckuath.c, 21 May 2003.
460
461 From Jeff: Stuff for Kerberos 524: ckcdeb.h.  Fixes for FTP; "FTP ASCII send
462 data did not properly compute the end of line translations.  On Unix (and
463 similar platforms) the end of line was correct for no character sets but
464 incorrect when character sets were specified.  On Windows/OS2, the end of line
465 was correct when character sets were specified and incorrect when they were
466 not.  On MAC, both were broken.  Also, FTP Send Byte counts were incorrect
467 when character sets were specified."  ckcftp.c.  17 Jun 2003.
468
469 From Jeff: fixes to HTTP /AGENT: and /USER: switch action: ckcnet.c ckuus3.c
470 ck_crp.c ckcftp.c ckuus2.c ckuusy.c ckuusr.c ckcnet.h, 21 Jun 2003.
471
472 From Jeff: Fix SET DIALER BACKSPACE so it can override a previous SET KEY
473 (e.g. from INI file): ckuus7.c.  Some SSL/TLS updates: ck_ssl.c.  HTTP support
474 for VMS and other VMS improvements (e.g. a way to not have to hardwire the
475 C-Kermit version number into the build script) from Martin Vorlaender:
476 ckcnet.h, ckuus[r3].c, ckcdeb.h, ckvtio.c, ckcnet.c, ckvker.com.  Built on
477 Solaris (gcc/ansi) and SunOS (cc/k&r).  The new VMS script tests the VMS
478 version and includes HTTP support only for VMS 6.2 or later.  2 Jul 2003.
479
480 Tried to build on our last VMS system but it seems to be dead.  Looks like a
481 head crash (makes really loud noises, boot says DKA0 not recognized) (fooey, I
482 just paid good money to renew the VMS license).  Tried building at another
483 site with:
484
485   Process Software MultiNet V4.3 Rev A-X,
486   Compaq AlphaServer ES40, OpenVMS AXP V7.3
487   Compaq C V6.4-008 on OpenVMS Alpha V7.3
488
489 Had to make a few corrections to ckvker.com.  But still, compilation of
490 ckcnet.c bombs, indicating that the SELECT definition somehow got lost
491 somewhere since the 209 release (i.e. no SELECT type is defined so it falls
492 thru to "SELECT is required for this code").  But I don't see anything in
493 ckcdeb.h or ckcnet.[ch] that would explain this.  Not ckvker.com either
494 (putting the old one back gives the same result).  OK, I give up, maybe it's
495 just that I haven't tried building it on MultiNet recently.  What about UCX?
496 Aha, builds fine there except for warnings about mlook, dodo, and parser in
497 ckvfio.c (because of ON_CD) -- I suppose I have #include <ckucmd.h>... (done)
498 Anyhow it builds OK and the HTTP code is active and almost works (HTTP OPEN
499 works; HTTP GET seems to succeed but creates an empty file every time).  Tried
500 building under MultiNet at another installation; same bad result.
501
502 OK so why won't it build for MultiNet?  Comparing ckcnet.c with the 209
503 version, not a single #ifdef or #include is changed.  Tried building with
504 p3="NOHTTP" -- builds OK, aha.  Where's the problem?  Not ckcnet.h...
505 Not ckcdeb.h...  OK I give up, will revisit this next time I get time to
506 do anything with the code.
507
508 Later Jeff said "Martin did not implement VMS networking for the HTTP code.
509 All he did was activate the #define HTTP which happens to work because his
510 connections are using SSL/TLS connections.  http_inc(), http_tol(), etc have
511 no support for VMS networking regardless of whether it is UCX or MULTINET.
512 The vast majority of HTTP connections are not secured by SSL/TLS.  It makes no
513 sense to support HTTP on VMS until someone is willing to either do the work or
514 pay have the work done to implement VMS networking in that code base."  So the
515 fix is to not enable HTTP for VMS after all.  Removed the CKHTTP definition
516 for VMS from ckcdeb.h, 6 Jul 2003.
517
518 Fixed ckvfio.c to #include <ckuusr.h> (instead of <ckucmd.h>) to pick up 
519 missing prototypes.  6 Jul 2003.
520
521 From Arthur Marsh: solaris2xg+openssl+zlib+srp+pam+shadow and the corresponding
522 Solaris 7 target.  makefile, 6 Jul 2003.
523
524 Remove duplicate #includes for <sys/stat.h>, <errno.h>, and <ctype.h> from
525 ckcftp.c.  6 Jul 2003.
526
527 Add -DUSE_MEMCPY to Motorola SV/68 targets because of shuffled #includes in 
528 ckcftp.c.  8 Jul 2003.
529
530 From Jeff: Fix problems mixing SSL and SRP without Kerberos.  Plus a few minor
531 #define comment changes and a reshuffling of #defines in ckcdeb.h to allow me
532 to build on X86 Windows without Kerberos.  ckcdeb.h, ck_crp.c, ckuath.c,
533 10 Jul 2003.
534
535 From Jeff: updated ckuat2.h and ckuath.c, 29 Jul 2003.
536
537 Mats Peterson noticed that a very small Latin-1 file would be incorrectly
538 identified as UCS-2 by scanfile().  Fixed in ckuusx.c, 29 Jul 2003.
539
540 Fixed ACCESS macro definition to account for the fact that FIND is now a
541 built-in command.  ckermit.ini, 30 Jul 2003.
542
543 From Jeff: Fix for typo in urlparse() (svc/hos): ckuusy.c, 18 Aug 2003.
544
545 From Jeff: Redhat9 makefile targets (needed for for OpenSSL 0.9.7):
546 makefile, 19 Aug 2003.
547
548 GREP /NOLIST and /COUNT did too much magic, with some undesirable fallout:
549 "GREP /NOLIST /COUNT:x args" printed "file:count" for each file.  "GREP
550 /COUNT:x /NOLIST args" did not print "file:count", but neither did it set the
551 count variable.  Removed the magic.  Also one of the GREP switches,
552 /LINENUMBERS, was out of order.  Fixed in ckuus6.c, 20 Aug 2003.
553
554 From Jeff: "Reorganizing code to enable building with different subsets of
555 options; a few typos corrected as well."  ckcdeb.h, ckuver.h (for RH9),
556 ckcnet.c, ckuus7.c, ckuus3.c: 24 Aug 2003.
557
558 Scanfile misidentified a big PDF file as text because the first 800K of it
559 *was* text (most other PDF files were correctly tagged as binary).  Fixed
560 by adding a check for the PDF signature at the beginning of the file.
561 scanfile(): ckuusx.c, 25 Aug 2003.
562
563 Ditto for PostScript files, but conservatively.  Signature at beginning of
564 file must begin with "%!PS-Ado".  If it's just "%!" (or something nonstandard
565 like "%%Creator: Windows PSCRIPT") we do a regular scan.  Also added "*.ps"
566 to all binary filename patterns.  ckuusx.c, 4 Sep 2003.
567
568 Ditto (but within #ifndef NOPCLSCAN) for PCL (<ESC>E) and PJL (<ESC>%) files,
569 but no binpatterns (note: ".PCL" is the extension for TOPS-20 EXEC scripts).
570 ckuusx.c, 4 Sep 2003.
571
572 Added comments about OpenSSL 0.9.7 to all linux+openssl targets.
573 makefile, 4 Sep 2003.
574
575 From Jeff: Added - #define ALLOW_KRB_3DES_ENCRYPT.  When this symbol is defined
576 at compilation Kermit will allow non-DES session keys to be used during Telnet
577 Auth.  These session keys can then be used for Telnet Encrypt.  The reason
578 this is not compiled on by default is that the MIT Kerberos Telnet does not
579 follow the RFC for constructing keys for ENCRYPT DES when the keys are longer
580 than 8 bytes in length.  ckuath.c, ckuus5.c, 4 Sep 2003.
581
582 "ftp mget a b c" succeeded if one or more of the files did not exist, even
583 with "set ftp error-action proceed".  This is because the server's NLST file
584 list does not include any files that don't exist, so the client never even
585 tries to get them.  Fortunately, the way the code is structured, this one was
586 easy to fix.  ckcftp.c, 14 Sep 2003.
587
588 From Jeff: Corrected code in ckcnet.c to ensure that Reverse DNS Lookups are
589 not performed if tcp_rdns is OFF.  Fixed ck_krb5_getrealm() to actually return
590 the realm of the credentials cache and not the default realm specified in the
591 krb5.conf file.  Previously krb5_cc_get_principal() was not being called.
592 Fixed ck_krb5_is_tgt_valid() to test the TGT in the current ccache and not the
593 TGT constructed from the default realm.  ckcnet.c, ckuath.c, 14 Sep 2003.
594
595 Marco Bernardi noticed that IF DIRECTORY could produce a false positive if
596 the argument directory had previously been referenced but then removed.  This
597 is because of the clever isdir() cache that was added to speed up recursion
598 through big directory trees.  Changed IF DIRECTORY to make a second check
599 (definitive but more expensive) if isdir() succeeds, and changed the
600 directory-deleting routine, ckmkdir(), to flush the directory cache (UNIX
601 only -- this also should be done in K95 but it's not critical).  This was
602 done by adding a routine, clrdircache() to ckufio.c, which sets prevstat
603 to -1 and prevpath[0] to NUL.  ckcfn3.c, ckuus6.c, ckufio.c, 18 Sep 2003.
604
605 Marco reported the second fix still didn't work for him (even though it did
606 for me).  Rather than try to figure out why, I concluded that the directory
607 cache is just not safe: a directory found a second ago might have been deleted
608 or renamed not only by Kermit but by some other process.  Why did I add this
609 in the first place?  The log says:
610
611   Some debug logs showed that isdir() is often called twice in a row on the
612   same file.  Rather than try to sort out clients, I added a 1-element cache
613   to Unix isdir().  ckufio.c, 24 Apr 2000.
614
615 Experimentation with DIR and DIR /RECURSIVE does not show this happening at
616 all.  So I #ifdef'd out the directory cache (see #ifdef ISDIRCACHE in ckufio.c;
617 ISDIRCACHE is not defined) and backed off the previous changes: ckufio.c,
618 ckcfn3.c, ckuus6.c, 28 Sep 2003.
619
620 From Jeff: Replace the compile time ALLOW_KRB_3DES_ENCRYPT with a run-time
621 command SET TELNET BUG AUTH-KRB5-DES which defaults to ON: ckctel.[ch],
622 ckuus[234].c, ck_crp.c, ckuath.c.  4 Oct 2003.
623
624 Allow DIAL RETRIES to be any positive number, and catch negative ones.
625 Also added code to check for atoi() errors (e.g. truncation).  At least on
626 some platforms (e.g. Solaris) atoi() is supposed to set errno, but it
627 doesn't.  ckuus3.c, ckucmd.c, 4 Oct 2003.
628
629 Added /DEFAULT: to ASK-class commands (ASK, ASKQ, GETOK):
630
631  . For popups: no way to send defaults to popup_readtext() or popup_readpass().
632  . For GUI ASK[Q], pass default to gui_txt_dialog().
633  . For GUI GETOK, convert "yes" "ok" or "no" default to number for uq_ok().
634  . For Text GETOK, add default to cmkey().
635  . For Text ASK[Q], add default to cmtxt().
636  . For GETC, GETKEY, and READ: no changes.
637
638 GETOK, ASK, and ASKQ with /TIMEOUT: no longer fail when the timer goes off
639 if a /DEFAULT was supplied.  The GUI functions (uq_blah) don't seem to
640 support timeouts.  Only the text version has been tested.  ckuus[26].c,
641 4 Oct 2003.
642
643 From Jeff: add /DEFAULT: for popups.  ckuus6.c. 6 Oct 2003.
644
645 Change SET DIAL INTERVAL to be like SET DIAL RETRIES.  ckuus[34].c, 6 Oct 2003.
646
647 Added target for HP-UX 10/11 + OpenSSL built with gcc, from Chris Cheney.
648 Makefile, 12 Oct 2003.
649
650 From Jeff, 6 Nov 2003:
651  . #ifdef adjustments: ckcftp.c, ckcdeb.h
652  . Fix spurious consumption of first byte(s) on Telnet connection: ckctel.c
653  . Another HP PJL test for scanfile: ckuusx.c.
654  . K95: Recognize DG4xx protected fields in DG2xx emulation: ckuus7.c.
655  . Add SSLeay version display to SHOW AUTH command: ckuus7.c
656  . Improved SET MOUSE CLEAR help text: ckuus2.c.
657  . Improved Kverbs help text: ckuus2.c (+ new IBM-3151 Kverbs).
658  . Some changes to ck_ssl.c, ckuath.c.
659
660 From PeterE, 10 Nov 2003:
661  . Improved HP-UX 10/11 makefile targets for OpenSSL.
662  . #ifdef fix for OpenSSL on HP-UX: ck_ssl.c.
663
664 Another new makefile from PeterE with improved and integrated HP-UX targets.
665 12 Nov 2003.
666
667 A couple fixes to the solaris9g+krb5+krb4+openssl+shadow+pam+zlib target
668 from Jeff.  Added a solaris9g+openssl+shadow+pam+zlib target.  makefile,
669 21 Nov 2003.
670
671 From Jeff, 30 Nov 2003:
672  . Fix SEND /MOVE-TO: ckuusr.c.
673  . Fix K95 SET TITLE to allow quotes/braces around text: ckuus7.c.
674  . Improved "set term autodownload ?" response: ckuus5.c.
675  . Fix SHOW FEATURES to specify the protocol for encryption: ckuus5.c
676  . Make {SEND, RECEIVE} {MOVE-TO, RENAME-TO} work for XYZMODEM (K95 only).
677
678 From Jeff: 7 Jan 2004:
679  . At one point Frank started to add a timer parameter to the
680    uq_txt() function but he only did it for the non-ANSI
681    compilers.  I added it for the ANSI compilers, fixed the
682    prototypes and provided a default value easily changed
683    DEFAULT_UQ_TIMEOUT: ckcker.h, ckuus[36].c, ck_ssl.c, ckcftp.c, ckuath.c.
684  . Fixed SET TERMINAL DEBUG ON (typo in variable name): ckuus7.c.
685  . Fixed BEEP INFORMATION; previously it made no sound, now uses
686    MB_ICONQUESTION.  ckuusx.c.
687
688 From Ian Beckwith <ian@nessie.mcc.ac.uk> (Debianization), 7 Jan 2004:
689  . Search dir/ckermit for docs, as well as dir/kermit in cmdini(): ckuus5.c.
690  . New linux+krb5+krb4+openssl+shadow+pam target (kitchen sink minus SRP,
691    which Debian does not distribute): makefile.
692  ? Mangles the DESTDIR support in makefile to install into a staging area:
693    makefile (I didn't take this one yet).
694
695 Updated copyright notices for 2004, all modules.  7 Jan 2004.
696
697 Added INPUT /NOMATCH, allowing INPUT to be used for a fixed amount of time
698 without attempting to match any text or patterns, so it's no longer
699 necessary to "input 600 STRING_THAT_WILL_NEVER_COME".  If /NOMATCH is
700 included, INPUT succeeds if the timeout expires, with \v(instatus) = 1
701 (meaning "timed out"); fails upon interruption or i/o error.  ckuusr.h,
702 ckuus[r24].c, 7 Jan 2004.
703
704 Added SET INPUT SCALE-FACTOR <float>.  This scales all INPUT timeouts by the
705 given factor, allowing time-sensitive scripts to be adjusted to changing
706 conditions such as congested networks or different-speed modems without
707 having to change each INPUT-class command.  This affects only those timeouts
708 that are given in seconds, not as wall-clock times.  Although the scale
709 factor can have a fractional part, the INPUT timeout is still an integer.
710 Added this to SHOW INPUT, and added a \v(inscale) variable for it.
711 ckuusr.h, ckuus[r257].c, 7 Jan 2004.
712
713 undef \%a, \fverify(abc,\%a) returns 0, which makes it look as if \%a is a
714 string composed of a's, b's, and/or c's, when in fact it contains nothing.
715 Changed \fverify() to return -1 in this case.  ckuus4.c, 12 Jan 2004.
716
717 \fcode(xxx) returned an empty string if its argument string was empty.  This
718 makes it unsafe to use in arithmetic or boolean expressions.  Changed it to
719 return 0 if its argument was missing, null, or empty.  ckuus4.c, 12 Jan 2004.
720
721 Updated \verify() and \fcode() help text.  ckuus2.c, 12 Jan 2004.
722
723 While setting up IKSD, Ian Beckwith noticed that including the --initfile:
724 option caused Kermit to start parsing its own Copyright string as if it were
725 the command line, and eventually crash.  I couldn't reproduce on Solaris /
726 Sparc but I could in Linux / i386 (what Ian is using) -- a change from Jeff
727 on 28 Apr 2003 set the command-line arg pointer to a literal empty string in
728 prescan() about line 1740 of of ckuus4.c; the pointer is incremented next
729 time thru the loop, resulting in random memory being referenced.  Fixed by
730 setting the pointer to NULL instead of "".  ckuus4.c, 12 Jan 2004.
731
732 declare \&a[999999999999999] would dump core on some platforms.  atoi()
733 or whatever would truncate the dimension to maxint.  When we add 1 to the
734 result, we get a negative number, which is used as an index, loop test, etc.
735 Fixed both dodcl() and dclarray() to check for (n+1 < 0).  ckuus[r5].c,
736 12 Jan 2004.
737
738 Unix zchki() would fail on /dev/tty, which is unreasonable.  This prevented
739 FOPEN /READ from reading from the terminal.  zchki() already allowed for
740 /dev/null, so I added /dev/tty to the list of specials.  Ditto for FOPEN
741 /WRITE and zchko().  ckufio.c 13 Jan 2004.
742
743 Added untabify() routine to ckclib.[ch], 13 Jan 2004.
744 Added FREAD /TRIM and /UNTABIFY.  ckuus[27].c, 13 Jan 2004.
745 Added \funtabify().  ckuusr.h, ckuus[24].c, 13 Jan 2004.
746
747 Dat Nguyen noticed that (setq u 'p') followed by (u) dumped core.  This was
748 caused by an over-clever optimization that skipped mallocs for short
749 literals, but then went on later to try to free one that hadn't been
750 malloc'd.  Fixed in dosexp(): ckuus3.c, 14 Jan 2004.
751
752 Catch another copyright date.  ckuus5.c, 14 Jan 2004.
753
754 Fixed SWITCH to work even when SET COMMAND DOUBLEQUOTE OFF (from Mark
755 Sapiro).  ckuus5.c, 15 Jan 2004.
756
757 Changed version to 8.0.211 so scripts can test for recently added features.
758 ckcmai.c, 15 Jan 2004.
759
760 Fixed a glitch in K95 "help set port".  ckuus2.c, 20 Jan 2004.
761
762 Fix from Jeff: Connections to a TLS-aware protocol which require a reconnect
763 upon certificate verification failure could not reconnect if the connection
764 was initiated from the command line or via a URL.  ckctel.c ckcmai.c
765 ckuusr.c ckuus7.c ckuusy.c, 20 Jan 2004.
766
767 From Alex Lewin: makefile target and #ifdef for Mac OS X 10.3 (Panther):
768 makefile, ckcnet.c, 7 Feb 2004.
769
770 Added KFLAGS to sco32v507 targets to make PTY and SSH commands work.  The
771 same flags could probably also be added to earlier OSR5 targets but they
772 have not been tested there.  makefile, 7 Feb 2004.
773
774 Checked a complaint that "LOCAL &a" did not make array \&a[] local.  Indeed
775 it did not, and can not.  You have to use the full syntax in the LOCAL
776 command, "LOCAL \&a[]", or else it doesn't know it's not a macro named &a.
777 7 Feb 2004.
778
779 Fixed some confusion in creating IKSD database file and temp-file names.
780 I was calling zfnqfp() without remembering that the path member of the
781 returned struct included the filename, so to get just the directory name,
782 I needed to strip the filename from the right.  ckuusy.c, 2 Mar 2004.
783
784 New ckuath.c, ck_ssl.c from Jeff.  2 Mar 2004.
785
786 Updated Jeff's affiliation in VERSION command text.  ckuusr.c, 2 Mar 2004.
787
788 Designation changed from Dev.00 to Beta.01.  ckcmai.c, 2 Mar 2004.
789
790 Fixed zrename() syslogging -- it had success and failure reversed.
791 Beta.02: ckufio.c, 4 Mar 2004.
792
793 Problem: when accessing IKSD via a kermit:// or iksd:// URL, and a user ID
794 is given but no password, doxarg() set the password to "" instead of leaving
795 it NULL, but all the tests in dourl() are for NULL.  Fixed in doxarg():
796 ckuusy.c, 5 Mar 2004.
797
798 The logic in dourl() about which macro to construct (login and connect,
799 login and get directory listing, or login and fetch a file) was a bit off,
800 so all three cases were not handled.  ckcmai.c, 5 Mar 2004.
801
802 Trial Beta builds:
803  . HP-UX B.11.11 PA-RISC
804  . HP-UX B.11.23 IA64
805  . Tru64 4.0G Alpha
806  . Tru64 5.1B Alpha
807  . Debian 3.0 i386
808  . Red Hat ES 2.1 i386
809  . Slackware 9.1 i386
810  . VMS 7.3-1 Alpha + UCX 5.3
811  . VMS 7.3-1 Alpha no TCP/IP
812  . VMS 7.3 Alpha MultiNet 4.3 A-X
813  . SCO UnixWare 7.1.4 i386
814  . SCO OSR5.0.7 i386
815  . Solaris 9 Sparc
816
817 Fixed compiler warning in doxarg() caused by typo (NULL instead of NUL) in
818 the 5 March doxarg() edit.  ckuusy.c, 9 Mar 2004.
819
820 IKSD (kermit://) command-line URLs did not work right if the client had
821 already preauthenticated with Kerberos or somesuch because they tried to log
822 in again with REMOTE LOGIN.  The macros constructed in doxarg() needed to
823 check \v(authstate) before attempting REMOTE LOGIN.  ckcmai.c, 10 Mar 2004.
824
825 Added ckuker.nr to x.sh (ckdaily upload) and updated ckuker.nr with current
826 version number and dates.  10 Mar 2004.
827
828 Replaced hardwired references to /usr/local in makefile with $(prefix)
829 (which defaults to /usr/local, but can be overridden on the command line),
830 suggested by Nelson Beebe for use with Configure.  10 Mar 2004.
831
832 From Nelson Beebe: In the Kermit makefile in the install target commands,
833 line 981 reads:
834
835         cp $(BINARY) $(DESTDIR)$(BINDIR)/kermit || exit 1;\
836
837 Could you please add this line before it:
838
839         rm -f $(DESTDIR)$(BINDIR)/kermit;\
840
841 Some sites (mine included) keep multiple versions of software around,
842 with hard links between $(prefix)/progname and $(prefix)/progname-x.y.z.
843 Failure to remove the $(prefix)/progname at "make install" time then
844 replaces the old $(prefix)/progname-x.y.z with the new one, destroying
845 an old version that the site wanted to be preserved.  makefile, 10 Mar 2004.
846
847 Minor syntax and typo fixes (mostly prototypes): ckcdeb.h, ckcfns.c,
848 ckclib.c, ckufio.c, ckuusr.h, ckuusx.c, 10 Mar 2004.  (I still have a few
849 more to do.)
850
851 Added CC=$(CC) CC2=$(CC2) to many (but not all) makefile targets that
852 reference other makefile targets.  On some platforms (notably AIX, Solaris,
853 SunOS) there are specific targets for different compilers, so I skipped
854 those.  makefile, 10 Mar 2004.
855
856 Added error checking to kermit:// URL macros, so they don't plow ahead
857 after the connection is closed.  ckcmai.c, 11 Mar 2004.
858
859 Added FreeBSD 4.9 and 5.1 targets (only the herald is affected).
860 makefile, ckuver.h, 11 Mar 2004.
861
862 Added "LIBS=-lcrypt" to bsd44 targets since nowadays crypt is almost always
863 unbundled from libc.  Also added explanatory notes.  makefile, 11 Mar 2004.
864
865 Changed MANDIR to default to $(manroot)/man/man1, and manroot to default
866 to $(prefix).  More adding of CC=$(CC) clauses: {Free,Net,Open}BSD, 4.4BSD.
867 makefile, 11 Mar 2004.
868
869 Miscellaneous cleanups: ckuusx.c, ckcnet.c, ckufio.c, 11 Mar 2004.
870
871 Corrected the check in the linux target to see if /usr/include/crypt.h
872 exists, and if so to define HAVE_CRYPT_H, which is used in ckcdeb.h to
873 #include <crypt.h> to get the prototype for crypt() and prevent bogus
874 conversions on its return type on 64-bit platforms (the previous test wasn't
875 quite right and the resulting symbol wasn't spelled right).  makefile,
876 12 Mar 2004.
877
878 From Jeff, 14 Mar 2004:
879  . Initialize localuidbuf[] in tn_snenv(): ckctel.c.
880  . Remove remote-mode checks in hupok() for K95G only (why?): ckuus3.c.
881  . Add help text for new K95-only TYPE /GUI switches: ckuus2.c.
882  . TYPE /GUI parsing, ...: ckuusr.c.
883  . TYPE /GUI action, dotype(): ckuus6.c
884  . Change Jeff's affiliation: most modules.
885
886 20 Mar 2004: Looked into adding long file support, i.e. handling files more
887 than 2GB (or 4GB) long.  Discovered very quickly this would be a major
888 project.  Each platform has a different API, or environment, or transition
889 plan, or whatever -- a nightmare to handle in portable code.  At the very
890 least we'll need to convert a lot of Kermit variables from long or unsigned
891 long to some new Kermit type, which in turn is #defined or typedef'd
892 appropriately for each platform (to off_t or size_t or whatever).  Then we
893 have to worry about the details of open() vs fopen(); printf() formats (%lld
894 vs %Ld vs %"PRId64"...), platforms like HP-UX where you might have to use
895 different APIs for different file systems on the same computer, etc.  We'll
896 need to confront this soon, but let's get a good stable 8.0.211 release out
897 first!  Meanwhile, for future reference, here are a few articles:
898
899 General: http://freshmeat.net/articles/view/709/
900 Linux:   http://www.ece.utexas.edu/~luo/linux_lfs.html
901 HP-UX:   http://devrsrc1.external.hp.com/STK/partner/lg_files.pdf
902 Solaris: http://wwws.sun.com/software/whitepapers/wp-largefiles/largefiles.pdf
903
904 Looked into FTP timeouts.  It appears I can just call empty() (which is
905 nothing more than a front end for select()) with the desired timeout before
906 any kind of network read.  If it returns <= 0, we have a timeout.  This is
907 not quite the same as using alarm() / signal() around a recv() (which could
908 get stuck) but alarm() / signal() are not not used in the FTP module and are
909 not naturally portable to Windows, but select() is already in use in the FTP
910 module for both Unix and Windows.  This form of timeout could be used
911 portably for both command response and data reads.  What about writes to the
912 command or data socket?  They can get stuck for hours and hours without
913 returning too, but the select() approach won't help here -- we need the
914 actual send() or recv() to time out, or be wrapped in an alarm()/signal()
915 kind of mechanism.  But if we can do that for sends, we can also do it for
916 receives.  Better check with Jeff before I start programming anything.
917 20 Mar 2004.
918
919 Later: Decided to postpone the above two projects (ditto IPv6) until after
920 8.0.211 is released because both will have major impacts on portability.
921 Grumble: all i/o APIs should have been designed from the beginning with a
922 timeout parameter.  To this day, hardly any have this feature.
923
924 3-4 Apr 2004: More 8.0.211 Beta.02+ test builds:
925
926  . FreeBSD 3.3
927  . FreeBSD 4.4
928  . Linux Debian 2.1
929  . Linux RH 6.1
930  . Linux RH 7.1
931  . Linux RH 7.2
932  . Linux RH 9 (with 84 different combinations of feature selection)
933  . Linux SuSE 6.4
934  . Linux SuSE 7.0
935  . NetBSD 1.4.1
936  . NetBSD 1.5.2
937  . OpenBSD 2.5
938  . OpenBSD 3.0
939  . QNX 4.25
940  . SCO UnixWare 2.1.3
941  . SCO UnixWare 7.1.4
942  . SCO OpenServer 5.0.7
943  . SCO XENIX 2.3.4 (no TCP)
944
945 Changes needed: None.
946
947 Problem: SCO XENIX 2.3.4 network build failed in the FTP module with
948 header-file syntax and conflicting-definitions trouble.  I'm not going to
949 try to fix it; 8.0.209 built OK with FTP, so we'll just keep that one
950 available.
951
952 Got access to VMS 8.1 on IA64.  Building the nonet version of C-Kermit
953 required minor modifications to ckvvms.h, ckv[ft]io.c, and ckvcon.c, to
954 account for a third architecture.  Also to SHOW FEATURES in ckuus5.c.  Once
955 that was done, the UCX 5.5 version built OK too.  Starts OK, makes Telnet
956 connection OK, sends files.  Has some obvious glitches though -- "stat"
957 after a file transfer reports 0 elapsed time (in fact it was 00:09:48) and
958 1219174400 cps (when in fact it was 10364).  This doesn't happen on the
959 Alpha.  Btw, the IA64 binary is twice as big as the Alpha one.  Changed
960 to Beta.03.  5 Apr 2004.
961
962 Fixed the ckdaily script to include the makefile and man page in the Zip
963 file (they were not included because the Zip file was intended mainly for
964 VMS users, but some Unix users prefer Zip to tar.gz).  6 Apr 2004.
965
966 Traced problems in VMS/IA64 statistics report to rftimer()/gftimer() in
967 ckvtio.c, which use sys$ and lib$ calls to figure elapsed time.  These work
968 on VAX and Alpha but not IA64.  Sent a report to the chief engineer of the
969 IA64 VMS port; he says it's probably a bug in VMS 8.1 (which is not a real
970 release); he'll make sure it's fixed in 8.2.  As an experiment, tried
971 swapping in the Unix versions of these routines (which call gettimeofday()
972 etc).  They seem work just fine (it hung a couple times but I think that's
973 because the underlying system hung too; trying it later on a new connection,
974 it was fine; however I noticed a BIG discrepancy in throughput between
975 sending and receiving).  Moved definitions for VMS64BIT and VMSI64 to
976 ckcdeb.h so all modules can use them and added them to the SHOW FEATURES
977 display.  Added VMSV80 definition to build procedure.  Beta.03+.  ckcdeb.h,
978 ckcuus5.c, ckcvvms.h, ckvtio.c, ckvker.com, 6 Apr 2004.
979
980 While doing the build-all, I noticed the VMS version did not build with
981 Multinet or older UCX versions, always with the same errors -- undeclared
982 variables, undefined symbols, all TCP/IP related.  This didn't happen a
983 couple weeks ago...  Somehow the order of #includes was messed up --
984 ckuusr.h depended on symbols that are defined in ckcnet.h, but ckcnet.h
985 was being included after ckuusr.h...  this was compounded by two missing
986 commas in ckvker.com.  11 Apr 2004.
987
988 Removed Beta designation, released as 8.0.211, 10 Apr 2004.
989
990 I had somehow lost the edit to ckutio.c that changed the UUCP lockfile for
991 Mac OS X from /var/spool/uucp to /var/spool/lock.  So I slipped it in and
992 re-uploaded version 8.0.211.  You can tell the difference because SHOW
993 VERSIONS has 17 Apr 2004 for the Communications I/O module.  Also the 10.3
994 executable now has a designer banner: "Mac OS X 10.3".  makefile, ckuver.h,
995 ckutio.c, ckuus[45].c, 17 Apr 2004.
996
997 ---8.0.211---
998
999 Removed "wermit" from "make clean" (how did it get there?).  makefile.
1000
1001 From Jeff, applied 10 May 2004.
1002  . Rearrange #ifdefs that define OS/2-only features. ckcdeb.h.
1003  . Fix two strncat()s that should have been ckstrncat()s.  ckuus7.c.
1004  . Fix two strncat()s that should have been ckstrncat()s.  ckuus4.c.
1005  . Fix one strncat(). ckcfns.c.
1006  . SET FTP CHAR ON used backwards byte order when output to screen.  ckcfns.c.
1007  . Fix two strncat()s.  ckuus3.c.
1008  . Add SET NETWORK TYPE NAMED-PIPE for K95.  ckuus3.c.
1009  . Add "No active connections" message to hupok().  ckuus3.c.
1010  . Fix many strncat()s.  ckcnet.c.
1011  . Fix some strncat()s.  ckcftp.c
1012  . Make FTP port unsigned short for 16383 < port < 65536.  ckcftp.c.
1013  . Improvements to FTP USER command.  ckcftp.c.
1014  . Fix FEAT parsing to allow for various forms of whitespace.  ckcftp.c.
1015
1016 S-Expression (AND FOO BAR) would not short-circuit if FOO's value was 0,
1017 even though short-circuiting code has been there since Day 1.  Similarly for
1018 (OR BAR FOO).  Turns out the first operand was a special case that bypassed
1019 the short-circuit check.  Fixed in dosexp(): ckuus3.c, 10 May 2004.
1020
1021 Red Hat 7.3 (and maybe others) <baudboy.h> referenced open() without first
1022 ensuring it was declared.  The declaration is in <fcntl.h>, which is after
1023 <baudboy.h> in ckutio.c series of #includes.  Made a special case for this.
1024 ckutio.c (see comments), 10 May 2004.
1025
1026 If the local Kermit's parity is set to SPACE and then a file arrives via
1027 autodownload, automatic parity detection improperly switches it to NONE.
1028 Fixed in rpack() by switching parity automatically only if parchk() returns
1029 > 0 (rather than > -1), since NONE and SPACE are indistinguishable.  A
1030 bigger problem still remains: autodownload does not work at all if the
1031 sender is using actual parity bits (even, odd, or mark) and the receiver's
1032 parity is NONE.  ckcfn2.c, 10 May 2004.
1033
1034 When a DIAL MACRO is defined and the phone number is comprised of more than
1035 one "word" (i.e. contains spaces), the dial macro loses the second and
1036 subsequent words after the first call. Fixed in xdial() by inserting quotes
1037 around phone number before passing it to xdial(). ckuus6.c, 10 May 2004.
1038
1039 DIAL MACRO fix was not right; the quotes were kept as part of the phone
1040 number and sent to the modem.  dodo() pokes its argument to separate the
1041 macro argument string into its component arguments.  xdial() is called
1042 repeatedly on the same string, so after the first time, a NUL has been
1043 deposited after the first word of the telephone number.  The fix is to have
1044 xdial() create a pokeable copy of its argument string before calling
1045 dodo(dial-macro,args...).  It might seem odd that dodo pokes its argument,
1046 but making copies would be would be prohibitive in space and time.
1047 ckuus6.c, 23 May 2004.
1048
1049 FTP CD did not strip braces or quotes from around its argument.  Fixed in
1050 doftprmt(): ckcftp.c, 23 May 2004.
1051
1052 Added client side of REMOTE MESSAGE/RMESSAGE/RMSG: ckuus[r27].c, 23 May 2004.
1053
1054 Server side of REMOTE MESSAGE: ckcpro.w, 23 May 2004.
1055
1056 From Dave Sneddon: an updated CKVKER.COM containing a fix where the
1057 COMPAQ_SSL symbol was not defined but later referenced which generated an
1058 undefined symbol error.  ckvker.com, 5 Jan 2005.
1059
1060 From Andy Tanenbaum (28 May 2005):
1061  . Fix an errant prototype in ckcker.h and ckucmd.h - () instead of (void).
1062  . Add support for MINIX 3.0.  makefile, ckutio.c, ckufio.c, ckuver.h.
1063
1064 Fixed messed-up sndhlp() call which apparently had been jiggered to
1065 compensate for the bad prototype which has now been fixed, ckcpro.w,
1066 12 Jun 2005.
1067
1068 From Jeff (12 June 2005):
1069  . Security updates.  ck_ssl.c, ck_crp.c, ckuath.c.
1070  . Fix bug in K95 SET PRINTER CHARACTER-SET. ckuus3.c.
1071  . Add printer character-set to K95 SHOW PRINTER display. ckuus5,c
1072  . Add SET MSKERMIT FILE-RENAMING to K95. ckuus7.c, ckuusr.h.
1073  . Add help for K95 SET MSKERMIT.  ckuus2.c.
1074  . Add SET GUI CLOSE to K95.  ckuusr.h, ckuus2.c, ckuus3.c
1075  . Add help text for K95 SET GUI MENUBAR and TOOLBAR.  ckuus2.c.
1076  . Add --noclose command-line option for K95.  ckuusy.c
1077  . Add PAM support for Mac OS X.  ckufio.c.
1078  . Add GSSAPI support for Mac OS X.  ckcftp.c.
1079  . Pick up more URL options.  ckcker.h, ckuusy.c.
1080  . Fix bug in delta-time calculation across year boundary.  ckucmd.c.
1081  . Add Secure Endpoints to copyright notices.  ckcmai.c.
1082  . Fix FTP HELP to override unverbose setting.  ckcftp.c.
1083  . Fix assorted minor typos.
1084
1085 From Matthias Kurz: automatic herald generation for NetBSD 2.0 and later,
1086 "make netbsd2".  ckuver.h, makefile, 12 Jun 2005.
1087
1088 Added SET TERMINAL LF-DISPLAY, like CR-DISPLAY but for linefeed rather than
1089 carriage return.  ckuusr.h, ckuus[257x].c, 12 Jun 2005.
1090
1091 Made a command-line option --unbuffered to do what the -DNONOSETBUF
1092 compile-time option does, i.e. force unbuffered console i/o.  Unix only.
1093 ckuusr.h, ckuusy.c, ckutio.c, 12 Jun 2005.
1094
1095 Fixed getiact() (which displays TERM IDLE-ACTION setting) to display
1096 space as \{32}.  ckuus7.c, 12 Jun 2005.
1097
1098 Added LMV as a synonym for LRENAME, which is itself a synonym for LOCAL
1099 RENAME.  ckuusr.c, 12 Jun 2005.
1100
1101 Put HELP SET TERMINAL DG-UNIX-MODE text where it belonged.  ckuus2.c,
1102 12 Jun 2005.
1103
1104 Added IF LINK (Unix only) to test if a filename is a symlink.  Uses the most
1105 simpleminded possible method, calls readlink() to see if it succeeds or fails.
1106 No other method is dependable across different Unixes.  This code should be
1107 portable because I already use readlink() elsewhere within exactly the same
1108 #ifdefs.  ckufio.c, ckuus2.c, ckuus6.c, 12 Jun 2005.
1109
1110 Fixed a bug in which \fdir() wouldn't work when its argument was the nonwild
1111 name of a directory file.  zxpand(): ckufio.c, 12 Jun 2005.
1112
1113 Made \fdirectory() a synonym for \fdirectories().  Made \fdir() an
1114 acceptable abbreviation for these, even though it clashes with \fdirname(),
1115 which still works as before.  ckuus4.c, 12 Jun 2005.
1116
1117 Added the long-needed \flopx() function, to return rightmost pieces of
1118 strings, such as file extensions.  \fstripx() and \flopx() are the
1119 orthogonal functions we need to pick filenames apart from the right:
1120 \stripx(foo.tar.gz) = foo.tar; flopx(foo.tar.gz) = gz.  ckuusr.h, ckuusr.c,
1121 ckuus2.c, 12 Jun 2005.
1122
1123 Removed reference to defunct fax number, ckcmai.c, 12 Jun 2005.
1124
1125 Added -DHAVE_PTMX to linux+krb5+openssl+zlib+shadow+pam.  From Timothy Folks.
1126 makefile, 12 Jun 2005.
1127
1128 Built on Solaris 9 and NetBSD 2.0.
1129
1130 From Jeff: New build target for Mac OS X 10.3 with Kerberos 5 and SSL.
1131 makefile, 14 Jun 2005.
1132
1133 Fixed error in ckuver.h NetBSD #ifdefs.  15 Jun 2005.
1134
1135 Fixed SET TERMINAL IDLE-ACTION OUTPUT to work as documented, namely if the
1136 output string is empty, to send a NUL.  Previously there was no way to make
1137 it send a NUL.  ckuus7.c, 15 Jun 2005.
1138
1139 Suppose (in Unix, for example) a filename contains wildcard characters, such
1140 as {abc}.txt.  When referring to such a file (e.g. in a SEND command), these
1141 characters can be quoted, e.g. \{abc\}.txt.  But if the file list has been
1142 obtained programmatically, e.g. stored in an array, there is no way, short
1143 of tedious, complicated, and error-prone string processing, to reference the
1144 file.  For this we need a way to disable wildcard processing.  I added { ON,
1145 OFF } choices for the SET WILD and SHOW FILE commands: ckuusr.h, ckuus[234].c.
1146 { ON, OFF } turns wildcarding off and on without affecting the { KERMIT,
1147 SHELL } agent choice; it does this by setting a new and separate global
1148 variable, wildena.  Added semantics to ckufio.c.  Crude but effective.  It
1149 might have been more Unixlike to add Yet Another form of quoting but we
1150 have enough of that already (later maybe I'll add a \function() for this).
1151 Needs to be propogated to Windows and VMS.  15 Jun 2005.
1152
1153 Improved and fixed typos in HELP WILDCARD and HELP PATTERN.  ckuus2.c,
1154 15 Jun 2005.
1155
1156 The GREP command, and probably anything else that uses ckmatch() for pattern
1157 matching, failed on patterns like */[0-3]*.html.  The [a-b] handler, when
1158 failing to match at the current position, neglected to back up the pattern
1159 and try again on the remainder of the string.  I also fixed another case, in
1160 which matching a literal string a*b?c against the pattern a[*?]*[?*]c caused
1161 ckmatch() to recurse until it blew up.  ckclib.c, 16 Jun 2005.
1162
1163 Added builds and designer banner for Solaris 10.  makefile, ckuver.h,
1164 27 Jun 2005.
1165
1166 Defined CKHTTP for NetBSD, the HTTP code builds and works fine there.
1167 ckcdeb.h, 2 Jul 2005.
1168
1169 Added #ifndef OSF40..#endif around definition of inet_aton() in ck_ssl()
1170 to allow building in Tru64.  Added tru64-51b+openssl to makefile.
1171 15 Jul 2005.
1172
1173 HTTP GET would fail if the URL contained any metacharacters, no matter how
1174 much you quoted them.  Although it uses cmfld() to parse the (partial) URL,
1175 it then uses cmofi() to get the output filename, which by default is the
1176 "filename" from the URL, which might be something like "rankem.asp?id=1639".
1177 cmofi() refuses to accept unquoted metacharacters in "filenames" and that's
1178 what happens in this case if the output filename is not specified.  Worked
1179 around this by disabling wildcard processing around HTTP GET using the new
1180 "wildena" variable from June 15th.  ckuusr.c, 18 Jul 2005.
1181
1182 Fixed the June 16th fix to the pattern matcher.  I fixed a real problem, but
1183 I made an unrelated optimization that introduced new ones.  ckclib.c,
1184 18 Jul 2005.
1185
1186 Added missing help text for \fb64encode() and \fb64decode().  ckuus2.c,
1187 18 Jul 2005.
1188
1189 Changed SET WILD OFF help text to warn that this setting prevents the
1190 creation of backup files (later I'll have to see if something more useful
1191 can be done about this).  ckuus2.c, 18 Jul 2005.
1192
1193 Built OK on Mac OS X 10.4.2 using macosx103 target (but with some
1194 "signedness" warnings in ckcnet.c and ckcftp.c).  Built on Unixware 7.1.4
1195 with uw7 target.  27-28 Jul 2005. 
1196
1197 Added -DCKHTTP to Mac OS X 10.3-.4 KFLAGS.  Makefile, 4 Aug 2005.
1198
1199 Built on BSDI 4.3.1.  Added -DCKHTTP.  
1200
1201 Compact substring notation extended to accept not only start:length but also
1202 start-end notation.  Thus \s(foo[12:18]) means the substring of foo starting
1203 at position 12 of length 18, and tne new \s(foo[12-18]) means the substring
1204 of foo starting at position 12 and ending with position 18.  Ditto for
1205 \:(\%a), etc.  ckuus4.c, 9 Aug 2005.
1206
1207 See correspondence with Mark Sapiro, Nov 2003 and Sep 2004, about certain
1208 variations on IF syntax having been broken by the introduction of "immediate
1209 macros" circa 1999.  It seems the problem -- variables not being expanded --
1210 always occurs in the ELSE part when (a) the IF condition is false; (b) the
1211 ELSE command is "standalone", i.e. expressed as a separate command after the
1212 IF command (original C-Kermit 5A syntax), and (c) its command list is a block.
1213 This would suggest the problem is in the XXELS parser.
1214
1215 Going back to 1999, I find this:
1216   Fixed a problem Jim Whitby noticed with quoting in ELSE statements.  This
1217   problem was introduced when I unified IF and XIF, and occurs only when
1218   ELSE begins on a line, followed by a { command list } rather than a single
1219   command.  The solution (gross) was to make a special version of pushcmd()
1220   (called pushqcmd()) for this situation, which doubles backslashes while
1221   copying, BUT ONLY IF it's a command list (i.e. starts with "{"); otherwise
1222   we break lots of other stuff.  Result passes Jim's test and still passes
1223   ckedemo.ksc and iftest.ksc.  ckucmd.c, ckuus6.c, 27 Sep 99.
1224
1225 I undid this change and it made no difference to all the other IF
1226 constructions (in fact, it fixed an urelated one that was broken, so now
1227 iftest scores 54 out of 54, instead of 53).  However, it does not fix the
1228 ELSE problem; in fact it pushes it all the way in the other direction:
1229
1230   The opposite occurs any time you try to execute an immediate macro inside a
1231   macro or any other { block }: not only is the variable evaluated, it is
1232   evaluated into nothing.  It looks like this happens only in immediate
1233   macros, i.e. *commands* that start with '{'.  So maybe we really have two
1234   isolated problems, that can each be fixed.
1235
1236 The situation is illustrated by this simple script:
1237
1238   def xx {
1239       if false { echo \%1, echo \%2 }
1240       else { echo \%3, echo \%4 }
1241   }
1242   xx one two three four
1243
1244 With pushqcmd() it echoes the variable names literally; with pushcmd() it 
1245 echoes empty lines.  Since ELSE, when its argument is a block, dispatches
1246 to the immediate-macro handler, it seems we have unified the two problems,
1247 so fixing one should fix the other.
1248
1249 The problem is that we define a new temporary macro and then call dodo() to
1250 execute it.  But if the definition contains macro arguments, we have added a
1251 new level of macro invocation, thus wiping out the current level of args.
1252 The cure is to expand the variables in the immediate macro in the current
1253 context, before executing it.  This means simply changing the cmtxt() call
1254 that reads the immediate macro to specify xxsting as its processing
1255 function, rather than NULL, which is used for real macros to defer their
1256 argument evaluation until after the macro entered.  ckuusr.c, 11 Aug 2005.
1257
1258 Added a new makefile target, macosx10.4, for Mac OS X 10.4.  This one uses
1259 an undocumented trick to get the otherwise unavailable-except-by-clicking
1260 Mac OS X version number (in this case 10.4.2) and stuff it into the HERALD
1261 string.  makefile, 11 Aug 2005.
1262
1263 Built OK on Solaris 9, Solaris 10 (with a few implicit declaration warnings
1264 in ckuusx.c), Mac OS X 10.4.2 (with some warnings in ckcnet.c and ckcftp.c),
1265 Mac OS X 10.3.9 (also using the macos10.4 entry, which gets the right
1266 version number, and gets no warnings at all), RH Enterprise Linux AS4 on AMD
1267 x86_64, Tru64 Unix 4.0F, SCO UnixWare 7.1.4
1268
1269 For docs and/or scriptlib:  Unix C-Kermit can be a stdin/out filter.  The
1270 trick is to use the ASK, ASKQ, or GETC command for input, specifying no
1271 prompt, and ECHO or XECHO for output, e.g.:
1272
1273 while true {
1274     ask line
1275     if fail exit 0
1276     echo \freverse(\m(line))
1277 }
1278 exit 0
1279
1280 FOPEN didn't do anything with the channel number if the open failed, so any
1281 subsequent command that tried to reference it would get a parse error it was
1282 undefined or non-numeric, not very helpful.  Changed FOPEN to set the
1283 channel number to -1 if the file can't be opened.  Now subsequent operations
1284 on the channel fail with "Channel -1: File not open".  I also added two
1285 magic channel numbers: -8 means that any FILE command (besides OPEN and
1286 STATUS) on that channel is a noop that succeeds silently; -9 is a noop that
1287 fails silently.  So now it's possible to simply set a channel number to one
1288 of these values to disable i/o to certain file without getting lots of error
1289 messages.  dofile(): ckuus7.c, 12 Aug 2005.
1290
1291 Added automatic herald construction for UnixWare 7.  makefile, 12 Aug 2005.
1292
1293 Unix isdir() never allowed for arguments that started with tilde, so gave
1294 incorrect results for ~/tmp/ or ~fdc.  The problem was mainly invisible
1295 since most commands that parsed file or directory names used cmifi(), cmdir(),
1296 etc, which did the conversions themselves.  But IF DIRECTORY was an exception,
1297 since its operand had to be treated as just text, and then tested after it
1298 was parsed.  ckufio.c, 13 Aug 2005.
1299
1300 Fixed the following:
1301 "ckuusx.c", line 8959: warning: implicit function declaration: ckgetpeer
1302 "ckufio.c", line 1869: warning: implicit function declaration: ttwait
1303 "ckufio.c", line 2941: warning: implicit function declaration: mlook
1304 "ckufio.c", line 2943: warning: implicit function declaration: dodo
1305 "ckufio.c", line 2944: warning: implicit function declaration: parser
1306 "ckcftp.c", line 2625: warning: implicit function declaration: delta2sec
1307 "ckcftp.c", line 4071: warning: no explicit type given for parameter: prm
1308 "ckcftp.c", line 8389: warning: no explicit type given for parameter: brief
1309 ckuusx.c, ckufio.c, ckcftp.c, ckucmd.h.  13 Aug 2005.
1310
1311 Unbuffered stdout code has never worked because the setbuf(stdout,NULL) call
1312 has to occur before the stdout has been used.  The reason it's needed is
1313 that some Kermit code writes to stderr (which is unbuffered) and other code
1314 writes to stdout, and therefore typescripts can come out jumbled.  Robert
1315 Simmons <robertls@nortel.com> provided the needed clue when he insisted it
1316 worked only when executed at the very beginning of main().  So I moved the
1317 code to that spot.  But since now we also want to make unbuffered a runtime
1318 (command-line) option, I had to do a clunky by-hand pre-prescan inline in
1319 main() to look thru argv[], even before prescan() was called.  ckcmai.c,
1320 ckutio.c, ckuusy.c, 13 Aug 2005.  (Now that this works, it might be a good
1321 idea to remove all use of stderr from Kermit.)
1322
1323 Managed, after some finagling, to build a 64-bit version on Solaris 10 at
1324 Utah Math with Sun cc.  (Can't make any gcc builds at all, 32- or 64-bit,
1325 they all blow up in <sys/siginfo.h>.)  New target: solaris10_64.  makefile,
1326 15 Aug 2005.
1327
1328 The 64-bit Solaris 10 version compiles and links OK and transfers files in
1329 remote mode.  It can make FTP connections and use them, but Telnet connections
1330 always fail with "network unreachable".  This is with all default libs and
1331 include files.  Nelson has a separate set in /usr/local, which he references
1332 explicitly in all his 64-bit builds, but using these makes no difference.
1333 Some data type is wrong in ckcnet.c.  But telnet works fine in 64-bit Linux
1334 and Tru64 builds.  Debug logs trace the difference to netopen() (of course),
1335 the spot where we test the results of inet_addr(), which is already marked
1336 suspicious for 64-bit builds.  It seems that inet_addr() is of type in_addr_t,
1337 which in turn is u_int32, i.e. an unsigned 32-bit int.  Yet the man page says
1338 that failure is indicated by returning -1.  I guess this doesn't matter in
1339 32-bit builds, but in the 64-bit world, the test for failure didn't work
1340 right.  I made a Solaris-specific workaround, and checked that it works in
1341 both 32-bit and 64-builds.  I really hate typedefs.  ckcnet.c, 15 Aug 2005.
1342
1343 Changed the plain-text version (as opposed to the popup or GUI version - the
1344 GUI version, at least, already does this) of ASKQ to echo keystrokes
1345 asterisks rather than simply not echo anything, so it's easier to see what
1346 you're doing, the effects of editing, etc.  Experimental; for now, there's
1347 no way to disable this.  Not sure if there needs to be.  Anyway, to get this
1348 working required a fair amount of cleaning up of gtword(), which was echoing
1349 different ways in different places.  ckuus6.c, ckucmd.c, 15 Aug 2005.
1350
1351 Added a solaris9_64 target for building a 64-bit version on Solaris 9 with
1352 Sun cc.  Verified, using the DIR command and \fsize() function on a 4.4GB
1353 file, that the Solaris 64-bit version of Kermit gets the size correctly, and
1354 that it can copy such a file (thus its fopen/fread/fwrite/fclose interface
1355 works right).  Initiated a large-file transfer between here and Utah over
1356 SSH and verified that it puts the correct file size in the A packet when
1357 sending; the right quantites are shown on the file transfer display (file
1358 size CPS, percent done, etc).  But even at 5Mb/sec, it takes a good while to
1359 transfer 4.4GB, more than 2 hours (not streaming; 30 window slots, 4K
1360 packets, maybe it would go faster with streaming)...  After an hour or so,
1361 it filled up the partition and gave up (gracefully) before it reached the
1362 2GB frontier (drained its pending packets, closed the partial file).
1363 Restarted at 12:54, this time with streaming and 8K packets (the speed
1364 wasn't significantly different).  This time it transferred 95% of the file
1365 (4187660288 bytes) before failing because the disk filled up.  Went to Utah
1366 and started a transfer between two Solaris 10/Sparc hosts; this goes about 8
1367 times faster.  The transfer completed successfully after 17m41s.  All fields
1368 in the f.t. display looked right the whole time.  Then I verified various
1369 other 64-bit combinations transferring the same 4.4GB file:
1370
1371         To................
1372   From  Sol  Amd  i64  Tru      
1373   Sol   OK   OK   OK   OK      Sol = Solaris 10 / Sparc
1374   Amd   OK                     Amd = AMD x86_64 RH Enterprise Linux AS4
1375   i64   OK                     i64 = Intel IA64, RH 2.1AS
1376   Tru                          Tru = Tru64 Unix 4.0F Alpha
1377
1378 (The other combinations are difficult to test for logistical reasons.)
1379
1380 Tried sending the same long file with Kermit's FTP client.  It chugged along
1381 for a while until I stopped it; it would have taken hours to complete.
1382 There is no indication that it wouldn't have worked, assuming the FTP server
1383 could also handle long files, which who knows.  Anyway, Kermit showed all
1384 the right data on the display screen.  17 Aug 2005.
1385
1386 On AMD x86_64 and IA64 native 64-bit Linux builds, the pty routines did not
1387 work at all.  ptsname() dumped core.  If I commented out ptsname(), then the
1388 next thing dumped core.  The same code works on the other 64-bit builds.
1389 Poking around, I see that this version of Linux has an openpty() function,
1390 which I could try using instead of the current API -- grantpty(), etc.  Then
1391 I see that openpty() is already coded into Kermit's pty module,
1392 conditionalized under HAVE_OPENPTY, which has never before been defined for
1393 any build.  I added a test to the makefile linux target (look for the
1394 openpty() prototype in <pty.h>, if found define HAVE_OPENPTY as a CFLAG and
1395 also add -lutil to LNKFLAGS).  Works fine on the problem builds, and also
1396 on previously working 32-bit builds.  makefile, 17 Aug 2005.
1397
1398 Fixed a bug in the ASKQ echo asterisks code, which made the VMS version of
1399 C-Kermit always echo asterisks.  Turns out that some code in the main parse
1400 loop to reset command-specific flags was in the wrong place, which had other
1401 effects too, for example ASKQ temporarily turns off debug logging as a
1402 security measure, but the code to turn it back on was skipped in most cases.
1403 Some other side effects related to the DIRECTORY and CD commands might have
1404 been possible but I haven't seen them.  ckuus[56].c, 23 Aug 2005.
1405
1406 Problem reported when sending a file to VMS when the name in the F packet
1407 starts with a device specification and does not include a directory field,
1408 and PATHNAMES are RELATIVE.  Example: dsk:foo.bar becomes f_oo.bar.  The
1409 code assumes that if there is a device field, it is followed by a directory
1410 field, and it inserts a dot after the '[', which in this case is not there.
1411 Later the dot becomes '_' because of the only-one-dot rule.  Solution: only
1412 insert the dot if there really is an opening bracket.  nzrtol(): ckvfio.c,
1413 23 Aug 2005.
1414
1415 A report on the newsgroup complains that C-Kermit and K95 servers were
1416 sending REMOTE DIR listings with only #J line terminators, rather than #M#J.
1417 Yet all the other REMOTE xxx responses arrived with #M#J.  snddir() was
1418 neglecting to switch to text mode.  ckcfns.c, 26 Aug 2005.
1419
1420 Back to long files.  What happens if 32-bit Kermit is sent a long file?
1421 It gets an A-packet that looks like this:
1422
1423   ^A_"A."U1""B8#120050815 18:28:03!'42920641*4395073536,#775-!7@ )CP
1424
1425 The 32-bit receiver reacts like so:
1426
1427   gattr length[4395073536]=100106240
1428
1429 the first number being the string from the A-packet, the second being the
1430 value of the long int it was converted to by atol().  Clearly not equal in
1431 this case.  When this happens Kermit should reject the file instead of
1432 accepting it and then getting a horrible error a long time later.  Added
1433 code to gattr() to convert the result of atol() back to a string and compare
1434 it with the original string; if they're not equal, reject the file on the
1435 assumption that the only reason this could happen is overflow.  Also some
1436 other code in case the sender sends the only LENGTHK attribute.  Now files
1437 whose lengths are too big for a long int are rejected right away, provided
1438 the sender sends the length in an A packet ahead of the file itself.  If
1439 this new code should ever cause a problem, it can be bypassed with SET
1440 ATTRIBUTE LENGTH OFF.  ckcfn3.c, 26 Aug 2005.
1441
1442 As I recall from when I was testing this a few weeks ago, when the too-big
1443 length is not caught at A-packet time, the transfer fails more or less
1444 gracefully when the first attempt is made to write past the limit.  I went
1445 to doublecheck this by sending a big file from the 64-bit Solaris10 version
1446 to a 32-bit Mac OS X version that does not have today's code.  The Mac
1447 thinks the incoming file is 2GB long when it's really 4GB+.  But in this
1448 case, something new happens!  Although the percent done and transfer rate go
1449 negative, the file keeps coming.  It would seem that Mac OS X lets us create
1450 long files without using any special APIs.  The transfer runs to completion.
1451 Mac OS X Kermit says SUCCESS (but gets the byte count and cps wrong, of
1452 course).  But then a STATUS command says FAILURE.  The file was, however,
1453 transferred successfully; it is exactly the same length and compares byte
1454 for byte with the original.  This tells me that in the Mac OS X version --
1455 and how many others like it??? -- today's rejection code should not be
1456 enabled.  Meanwhile I put today's new code in #ifndef NOCHECKOVERFLOW..#endif,
1457 and defined this symbol in the Mac OS X 10.4 target.  Over time, I'll have
1458 to find out what other platforms have this characteristic.  And of course
1459 I'll also have to do something about file-transfer display, statistics, and
1460 status.  makefile, ckcfn3.c, 26 Aug 2005.
1461
1462 From now on I'm going to bump the Dev.xx number each time I upload a new
1463 ckdaily.  This one will be Dev.02.  ckckmai.c, 26 Aug 2005.
1464
1465 Got rid of all the extraneous FreeBSD 4 and 5 build targets.  Now there's
1466 one (freebsd) for all FreeBSD 4.1 and later.  makefile, 27 Aug 2005.
1467
1468 Mac OS X 10.4 (Tiger) is a 64-bit OS.  Building C-Kermit 0n 10.4.2 without
1469 any special switches stilll gives a 32-bit executable.  Ditto building with
1470 -mpowerpc64.  Further investigation turned up a tip sheet on MySQL that says
1471 you have to include all of these: -mpowerpc64 -mcpu=G5 -mtune=G5 -arch
1472 ppc64.  That did the trick.  New makefile target: macosx10.4_64.  But the
1473 10.4.2 system I tried did not have 64-bit [n]curses or resolv libs, so this
1474 build has no -DNOCURSES -DNO_DNS_SRV.  makefile, 27 Aug 2005.
1475
1476 Created a symbol CK_64BIT to indicate true 64-bit builds at compile time.
1477 Added 64-bit announcement to the startup herald and the VERSION text.
1478 ckcdeb.h, ckuus[r5].c, 27 Aug 2005.
1479
1480 Added a built-in variable \v(bits) to indicate the size of the build
1481 (16, 32, 64, or whatever else sizeof() might report).  ckuusr.h, ckuus4.c,
1482 27 Aug 2005.
1483
1484 Got rid of all the warnings in 64-bit Mac OS X about args to getsockopt(),
1485 getsockname(), and getpeername(), and the comparisons on the return value
1486 of inet_addr().  ckcnet.[ch], 27 Aug 2005.
1487
1488 Now to check the effects on other builds...
1489   Linux on AMD64: ok.
1490   Linux on IA64: ok.
1491   Linux on i386: ok.
1492   Mac OS X 10.3.9 32-bit: ok.
1493   Solaris 10 64-bit: ok.
1494   Solaris 9 32-bit: ok.
1495   Tru64 4.0F: ok.
1496   FreeBSD 4.11: ok.
1497   FreeBSD 5.4 ia64 (64-bit): ok.
1498   FreeBSD 5.4 i386 (32-bit): ok.
1499
1500 The Tru64 5.1B build totally blew up because they have their own unique
1501 sockopt/etc length-argument data type (int!), so I had to roll back on using
1502 socklen_t for this in all 64-bit builds.  Checked to make sure it still
1503 builds on Tru64 4.0F after this change (it does).  ckcnet.h, 27 Aug 2005.
1504
1505 The HP-UX 11i/ia64 build comes out to be 32-bit but thinks it's 64-bit.
1506 CK_64BIT is set because __ia64 is defined.  So how do I actually make a
1507 64-bit HP-UX build?  I tried adding +DD64 to CFLAGS, and this generates
1508 64-bit object files but linking fails to find the needed 64-bit libs
1509 (e.g. -lm).  For now I added an exception for HPUX to the CK_64BIT
1510 definition section.  ckcdeb.h, 27 Aug 2005.
1511
1512 Took the time to verify my recollection about the "graceful failure" on a
1513 regular Pentium Linux system when receiving a too-big file...  OK, it's not
1514 exactly graceful.  It gets a "File size limit exceeded" error; the message
1515 is printed in the middle of the file-transfer display, apparently not by
1516 Kermit, and Kermit exits immediately.  Looks like a trap...  Yup.  "File
1517 size limit exceeded" is SIGXFSZ (25).  What happens if we set it to SIG_IGN?
1518 Just the right thing: The receiver gets "Error writing data" at 2147483647
1519 bytes, sends E-packet to sender with this message, and recovers with total
1520 grace (drains packet buffers, returns to prompt).  ckutio.c, 27 Aug 2005.
1521
1522 Backed off from rejecting a file because its announced size overflows a
1523 long.  Now instead, I set the file size to -2 (a negative size means the
1524 size is unknown, but we have always used -1 for this; -2 means "unknown and
1525 probably too big").  In this case, the f-t display says:
1526
1527   File Size: POSSIBLY EXCEEDS LOCAL FILE SIZE LIMIT
1528
1529 then the user can interrupt it with X or whatever, or can let it run and
1530 see if maybe (as in the case of Mac OS X) it will be accepted anyway.  This
1531 way, we skip all the bogus calculations of percent done, time remaining, etc.
1532 ckcfn3.c, ckuusx.c, 27 Aug 2005.
1533
1534 Discovered that VMS C-Kermit on Alpha and IA64 is a 32-bit application;
1535 sizeof(long) == sizeof(char *) == 4.  Tried adding /POINTER_SIZE=64 to VMS
1536 DECC builds on Alpha and IA64, but the results aren't great.  Tons of
1537 warnings about pointer size mismatches between Kermit pointers and RMS ones,
1538 and the executable doesn't run.  It appears that access to long files
1539 would require a lot of hacking, similar to what's needed for 32-bit Linux.
1540
1541 --- Dev.02: 27 Aug 2005 ---
1542
1543 From Jeff, 28 Aug 2005.
1544  . Fix SSH GLOBAL-KNOWN-HOSTS-FILE / USER-KNOWN-HOSTS-FILE parsing, ckuus3.c.
1545  . Pick up K95STARTFLAGS from environment, ckuus4.c.
1546  . Fix some typos in command-line processing (-q), ckuus4.c.
1547  . Be sure to suppress herald if started with -q, ckuus7.c.
1548  . Fix ssh command-line switches, ckuusy.c.
1549
1550 Eric Smutz complained that HTTP POST was adding an extraneous blank line,
1551 which prevented his application from successfully posting.  RFC 2616 states
1552 (in Section 4.1):
1553
1554    In the interest of robustness, servers SHOULD ignore any empty
1555    line(s) received where a Request-Line is expected. In other words, if
1556    the server is reading the protocol stream at the beginning of a
1557    message and receives a CRLF first, it should ignore the CRLF.
1558
1559    Certain buggy HTTP/1.0 client implementations generate extra CRLF's
1560    after a POST request. To restate what is explicitly forbidden by the
1561    BNF, an HTTP/1.1 client MUST NOT preface or follow a request with an
1562    extra CRLF.
1563
1564 This seems pretty clear.  One section of code in http_post() (just above the
1565 postopen: label) was appending a CRLF to a buffer whose last already was
1566 terminated by CRLF, and then appended a second CRLF; thus two empty lines.
1567 I removed the second one.  ckcnet.c, 28 Aug 2005.
1568
1569 I looked into the 64-bitness of NetBSD, it seems to be like Linux and
1570 FreeBSD on 64-bit hardware, i.e. you just build it there and it works, at
1571 least on Alpha and AMD64, going back to NetBSD 1.4 or 1.5.  But I don't have
1572 access to any of these for verification and documentation on the Web is
1573 scanty.
1574
1575 Checked PeterE's complaint again of warnings in ckutio.c about parameter
1576 list of get[ug]id() and gete[ug]id().  When I "make hpux1100o" on HP-UX
1577 11.11 (PA-RISC), there are definitely no warnings.  He says the same thing
1578 happens on 10.xx, but I don't have access to that any more.  I also did
1579 "make hpux1100o" on HP-UX 11.23 (11i v2) (PA-RISC), also no warnings.
1580 (Except in both cases, a warning about a comment within a comment in
1581 /usr/include/sys/ptyio.h).  On HP-UX 11i v2 on Itanium, however, there are
1582 TONS of warnings, mostly of the "variable set but never used" kind.  Also
1583 "dollar sign used in identifier".  Tracking this last one down, I see it's
1584 complaining about code that's in #ifdefs for other platforms, such as
1585 Apollo Aegis.  Is "aegis" defined in HP-UX 11i v2/IA64?  No!  (It would show
1586 up in SHOW FEATURES if it was.)  Some phase of the compiler is complaining
1587 about code that it should be skipping (and that, in fact, it *is* skipping
1588 it because the build is successful).  It's as if cc is running lint for me
1589 but not telling lint which macros are defined and which are not.
1590
1591 Verified that 64-bit linking fails in the same way for HP-UX 11i v2 on both
1592 IA64 and PA-RISC.  Sent a query to HP.
1593
1594 Compiling ckcnet.c and ckcftp.c got the familiar sockopt-related warnings on
1595 HP-UX 11i v2; turns out it is just like Tru64 Unix in using an int for the
1596 length argument.  Added another special case and the warnings went away.
1597 ckcnet.h, 28 Aug 2005.
1598
1599 Added some stuff to SHOW FEATURES to see what kinds of macros are exposed
1600 (e.g. INT_MAX, LONG_MAX, LLONG_MAX, etc) and also show sizeof(long long) and
1601 sizeof(off_t).  Building this code all over the place will give me an idea
1602 of how widespread these data types are, and to what extent I can tell
1603 whether they are available from clues in the header files.  (At first
1604 glance, it appears that I'm not picking up <limits.h>, but adding an
1605 #include for it is just asking for trouble.)  No complaints about long long
1606 or off_t from Solaris 9 or recent Linuxes.  ckuus5.c, 28 Aug 2005.
1607
1608 Fixed a warning in HP-UX 10 and 11 stemming from some old-style prototypes
1609 in ckutio.c for get[re][gu]id().  ckutio.c, 29 Aug 2005.
1610
1611 Updated minix3 target from Andy Tanenbaum.  makefile, 29 Aug 2005.
1612
1613 PeterE confirms that "long long" and off_t are available in all HP-UX 10 and
1614 11, and in HP-UX 9 on PA-RISC but not Motorola.  30 Aug 2005.
1615
1616 Got 64-bit builds to work on HP-UX.  According to my notes, John Bigg of HP
1617 said (in 1999) that HP-UX 10.30 and later require PA-RISC 1.1, and do not
1618 work on PA-RISC 1.0.  But is PA 1.0 64-bit or what?  Today, Alex McKale of
1619 HP said "The 64-bit binaries will work on all machines that have the same or
1620 later release of HP-UX (excluding PA-RISC 1.1 machines)".  Still need
1621 clarification...  Maybe it's that all IA64 builds can be 64-bit but I need
1622 dual builds for PA-RISC.  Meanwhile I started transfer of a 4GB+ file from
1623 Solaris to HP-UX 11i but it exceeded some quota on the HP long before it
1624 approached the 2G point.  It failed cleanly and up until then it was working
1625 fine (numbers, stats, etc).  30 Aug 2005.
1626
1627 Support of large files in 32-bit builds began in 10.20.  64-bit application
1628 support began in 11.00, but not all machines that run 11.00 support 64 bits.
1629 About long files, see HP /usr/share/doc/lg_files.txt.
1630
1631 PeterE found that certain patterns can still make Kermit loop; example:
1632
1633   if match T01011-00856-21-632-073 *[abc] { echo GOOD } else { echo BAD }
1634   if match T01011-00856-21-632-073 *[a-z] { echo GOOD } else { echo BAD }
1635
1636 The minimum offending pattern is * followed immediately by an [xxx]
1637 construction, followed by anything else, including nothing.  Previous
1638 versions of Kermit handled this one correctly, without looping (but failed
1639 certain matches that should have succeeded).  The new section of code I
1640 added on 15 June, upon failure to match, advances the string pointer and
1641 backs up the pattern to the previous pattern, and starts again
1642 (recursively).  However, there needed to be a corresponding check at entry
1643 for an empty target string.  ckmatch(): ckclib.c, 12 Sep 2005.
1644
1645 PeterE discovered that "kermit -y filethatdoesnotexit" gives an erroneous
1646 error message that names the user's customization, rather than the name
1647 given on the command line.  doinit(): ckuus5.c, 12 Sep 2005.
1648
1649 FREAD does not get an error if it tries to read a record or file or piece of
1650 file that is too big for its buffer.  In particular, FREAD /SIZE:xxx seems
1651 to succeed even if less than xxx was read.  It should fail unless, perhaps,
1652 it successfully read up to the end of the file.  Furthermore, if xxx is
1653 bigger than the file buffer size, it should complain.  The buffer is
1654 line[LINBUFSIZ], 32K.  The lack of failure was due to code in dofile() that
1655 adjusted the given size silently if it was greater than the buffer size,
1656 which I removed, and also added a check when parsing the /SIZE: switch.
1657 dofile(): ckuus7.c, 12 Sep 2005.
1658
1659 That still didn't help with FREAD /SIZE:n returning less than n bytes, even
1660 when they were available.  That's because the underlying routine, z_in(),
1661 didn't check fread()'s return code, which is the number of bytes read.
1662 If fread() has smaller buffers, it needs to be called in a loop.  z_in():
1663 ckuus7.c, 12 Sep 2005.
1664
1665 Flen() fails on strings of length 8192 or more.  The limitation is in the
1666 callers of zzstring, which seem to be specifying an 8K buffer, in this case
1667 fneval().  The operable symbols are FNVALL (max length of value returned by
1668 a function) and MAXARGLEN (maximum length of an argument to a function).  I
1669 changed both of these for BIGBUFOK builds to be CMDBL.  Buffers can never be
1670 infinite, there has to be a limit.  It's important to make everything work
1671 consistently within that limit, and to make something useful happen when the
1672 limit is exceeded.  At this point, I can probably also increase the limits
1673 for modern 32-bit systems, and certainly for 64-bit ones.  Also there's no
1674 point in worrying about 16-bit platforms any more; earlier C-Kermit versions
1675 can still be used on them if necessary. ckuusr.h, 12 Sep 2005.
1676
1677 Special #ifdefs for finding resolv.h and nameser.h in MINIX3 from Andy
1678 Tanenbaum.  ckcnet.c, 20 Sep 2005.
1679
1680 PeterE noticed that ckmatch(), even though it works pretty well now, does a
1681 lot of extra and unnecessary recursion after determining the string and
1682 pattern do not match, at least when the pattern is of the form *[abc].
1683 After several false starts I was able reduce this effect to a minor level
1684 (but not eliminate it all together) by changing a while loop into a do loop.
1685 ckmatch(): ckclib.c, 15 Oct 2005.
1686
1687 Added -DNOLONGLONG to HP-UX 8.00 and earlier builds, and to Motorola-based
1688 HP-UX 9.00 builds.  This is simply to inhibit the test for whether "long
1689 long" is supported by the compiler, since when it isn't, the module
1690 containing the test won't compile.  makefile, ckuus5.c, 16 Oct 2005.
1691
1692 Making ASKQ always echo askterisks is a bad idea, because when it doesn't
1693 echo, it's the perfect way to read silently from stdin, e.g. in a CGI script
1694 (INPUT can also be used for this but it's not as straightforward).  So I put
1695 the default for ASKQ back to no echoing, then gave ASKQ its own switch
1696 table, which is the same as for ASK with the addition of an /ECHO:x switch,
1697 which tells what character to echo.  ckucmd.c, ckuus[26].c, 17 Oct 2005.
1698
1699 Fixed a bug in FTP GET /COMMAND filename commandname; it always dumped core
1700 dereferencing a null string (the nonexistent local asname).  ckcftp.c,
1701 17 Oct 2005.
1702
1703 For docs: if you don't like the funny business that happens when you type
1704 an IF command at the prompt, use XIF instead and it won't happen.  Also note
1705 that commands like "if xxx { echo blah } else { echo blah blah }" don't
1706 work when typed at the prompt; you have to use XIF for this. 
1707
1708 Back to ckmatch()...  Under certain conditions (e.g. patterns like *[abc])
1709 failure to match would not stop the recursion because the string and pattern
1710 arguments are on the stack, as they must be, so there was no way for level
1711 n-1 to know that level n had detected a definitive nonmatch and that no
1712 further attempts at matching were required.  The right way to handle this is
1713 to recode the whole thing as coroutines, the cheap way out is with a global
1714 static flag.  Works perfectly, in the sense that the match.ksc test results
1715 are identical to what they were before and the extra backing up and
1716 recursion are eliminated.  (The Oct 15th fix wasn't really a fix, it broke
1717 a couple of cases.)  ckclib.c, 20 Oct 2005.
1718
1719 ckuus7.c(2987): warning #267: the format string requires additional arguments
1720 (in PURGE command); fixed 20 Oct 2005.
1721
1722 From Andy Tanenbaum, final changes for MINIX3: #ifdef out the inline
1723 definitions for gettimeofday() and readlink().  ckutio.c, 23 Oct 2005.
1724
1725 From Jeff: struct gss_trials initializers changed from gss_mech_krb5 to
1726 ck_gss_mech_krb5.  ckcftp.c, 23 Oct 2005.
1727
1728 From Jeff: some improvements to K95 GUI SHOW TERMINAL.  ckuus5.c, 23 Oct 2005.
1729
1730 Found and corrected some misplaced #ifdefs in shofeat(), ckuus5.c, 23 Oct 2005.
1731
1732 --- Dev.03 ---
1733
1734 Fixed a compiler warning in a debug() statement in zzstring() by adding
1735 parens.  ckuus4.c, 24 Oct 2005.
1736
1737 Added -DNOLONGLONG to sv68r3v6 target, makefile, 25 Oct 2005.
1738
1739 New makefile targets for HP-UX from PeterE to handle the 'long long'
1740 situation.   26 Oct 2005.
1741
1742 From Jeff: changes to support OpenSSL 0.9.8, ck_ssl.h.  ckcasc.h has had
1743 short names defined for ASCII control characters for 20-some years but now
1744 they are causing conflicts, so EM becomes XEM (also for OpenSSL 0.9.8).
1745 Changed K95's default terminal type from VT320 to VT220 because VT320
1746 termcaps/terminfos are disappearing from Unix hosts: ckuus7.c.  Reorganize
1747 the data-types section of SHOW FEATURES to add more macro tests for integral
1748 sizes and to provide for the proper printf formatting in order to allow the
1749 sizes to be output ("You are going to need to be careful because %llx is not
1750 supported on all platforms.  On Windows, it is the same as %lx, 32 bits"):
1751 ckuus5.c, 26 Oct 2005.
1752
1753 Defined NOLONGLONG ckcdeb.h for various old platforms where we know we are
1754 never going to need 64-bit ints (even if they support a long long datatype,
1755 chances are pretty slim they supported 64-bit file sizes).  ckcdeb.h,
1756 26 Oct 2005.
1757
1758 PeterE noticed that GOTO targets can only be 50 characters long.  This was
1759 by design, a long time ago, on the assumption that nobody would make longer
1760 labels.  But in SWITCH statements, case labels can be variables that expand
1761 to anything at all.  If we chop them off at 50, we might execute the wrong
1762 case.  Changed the maximum label size to be 8K, and added code to dogoto()
1763 to check when a label or target is too long and fail, to prevent spurious
1764 GOTO or SWITCH results.  ckuusr.h, ckuus[r6].c, 26 Oct 2005.
1765
1766 Testing revealed there was still a problem with SWITCH case labels that were
1767 variables that expanded into long strings.  Turns out that I was being
1768 too clever when I decided that, if the SWITCH macro was n1 characters long
1769 and the case-label search target was n2 characters long, I only had to
1770 search the first n1-n2+1 characters of the macro definition.  That was true
1771 before I allowed case labels to be variables, but not any more!  Fixed in
1772 dogoto(): ckuus5.c, 26 Oct 2005.
1773
1774 --- Dev.04 ---
1775
1776 Dev.04 didn't actually contain Jeff's data-type changes to shofeat(),
1777 I think I saved the wrong buffer in EMACS...  Fixed now.  27 Oct 2005.
1778
1779 PeterE corrected a typo in the HP-UX 7.00 makefile target.  27 Oct 2005.
1780
1781 PeterE had been reporting problems stress-testing the new SWITCH code, but
1782 only on HP-UX 9, primarily stack overrun.  Turns out to be the HP-UX 9
1783 optimizing compiler's fault.  No optimization, no problems.
1784
1785 PeterE found that even when dogoto() detects a string that is too long
1786 and fails, this does not stop SWITCH from producing a result, which can not
1787 possibly be trusted.  Changed the part of dogoto() that handles this to
1788 not just fail, but also to exit the script immediately and return to top
1789 level.  ckuus6.c, 28 Oct 2005.
1790
1791 An idea popped into my head after having typed too many commands like "dir
1792 ck[cuw]*.[cwh]" to check the list of matching files, and then having to
1793 retype the same filespec in a SEND command: Why not unleash some unused
1794 control character such as Ctrl-K to spit out the most recently entered input
1795 filespec?  It was easy, just a few lines in cmifi2() and gtword(), plus a
1796 couple declarations.  To see all the changes, search for "lastfile" (all the
1797 new code is protected by #ifndef NOLASTFILE).  ckucmd.c, 28 Oct 2005.
1798
1799 I added a new variable \v(lastfilespec) that expands to the same last
1800 filespec, for use in scripts.  ckuusr.h, ckuus4.c, 28 Oct 2005.
1801
1802 The Unix version of C-Kermit failed to put anything in the session log if
1803 SET TERMINAL DEBUG ON.  Rearranged the pertinent clause so logging happens
1804 independent of TERMINAL DEBUG.  For now, since the user who noticed this
1805 wanted debug format to go into the session log, that's what I do.  The
1806 alternative would be to just log the raw incoming stream as usual, or to add
1807 Yet Another SET Command to choose.  ckucns.c, 11 Nov 2005.
1808
1809 Fixed HELP INTRO text.  ckuus2.c, 11 Nov 2005.
1810
1811 Added NOLONGLONG for SV68.  ckcdeb.h, 11 Nov 2005.
1812
1813 --- Dev.05 ---
1814
1815 Added a debug() statement in FTP secure_getbyte() to see what's going on
1816 with Muhamad Taufiq Tajuddin's 205-byte-per-second FTP/SSL downloads.
1817
1818 --- Dev.06 ---
1819
1820 Result: nothing, SSL_get_error() does not report any errors.  Suggested
1821 testing SSL_read()'s return code, if 0 don't update the screen.
1822
1823 Created a new data type CK_OFF_T in ckcdeb.h that will eventually resolve
1824 to whatever each platform uses for file sizes and offsets.  ckcdeb.h,
1825 17 Nov 2005.
1826
1827 Made a new library routine ckfstoa() that converts a file size or offset to
1828 a string.  This is to solve the problem with having to use different
1829 printf() formats for different representations of file size (int, long, long
1830 long, off_t, signed, unsigned, etc).  Replaced a few printf("%l",size) with
1831 printf("%s",ckfstoa(size)) with the expected results.  This is just a start,
1832 the definitions will need adjustment for many platforms, variables need to
1833 be redeclared, and all the offending printf's (and printw's) will have to
1834 hunted down and converted.  ckclib.[ch], ckuus4.c, 17 Nov 2005.
1835
1836 Built a minimal version on Linux with:
1837 make linux "KFLAGS=-DNOLOCAL -DNOICP -DNOCSETS -DNODEBUG"
1838 Worked fine, result was 260K on i686.  21 Nov 2005.
1839
1840 Discovered that Kermit's date parser, contrary to the documentation, failed
1841 to handle strings like "Wed, 13 Feb 2002 17:43:02 -0800 (PST)", which are
1842 commonly found in email.  This was because of an overzealous and misguided
1843 check in the code; once removed, all was well.  ckucmd.c, 26 Nov 2005.
1844
1845 Added a new format code 4 to \fcvtdate() to emit asctime() format, used in
1846 BSD-format email message envelopes (i.e. the "From " line).  shuffledate(),
1847 ckucmd.c, ckuus[24].c, 26 Nov 2005.
1848
1849 Added a new function \femailaddress().  Given a From: or Sender: header line
1850 from an RFC2822-format email address, extracts and returns the actual email
1851 address, such as kermit@columbia.edu.  ckuusr.h, ckuus[42].c, 26 Nov 2005.
1852
1853 Using the new functions, I wrote a script to fetch mail from a POP3 server
1854 over a TLS connection.  But the line-at-a-time input (needed for changing
1855 line terminators and byte-stuffing text lines that start with "From ") is
1856 slow, 17 sec to read 29 messages totaling 175K.
1857
1858 Added INPUT /CLEAR so INPUT can be started with a clean buffer without
1859 requiring a sepearate CLEAR INPUT command.  ckuusr.h, ckuus[r24].c,
1860 27 Nov 2005.
1861
1862 One thing that INPUT was never able to do well was read and save the
1863 complete incoming data stream.  That's because, while waiting for its
1864 target, the buffer might overflow wrap around.  Yet there was never a way to
1865 tell it to stop when its buffer fills up and let me save it.  I added a
1866 /NOWRAP switch that does this.  If the buffer fills up before any other
1867 completion criterion is met, INPUT returns failure, but with \v(instatus)
1868 set to 6 (the next available instatus value).  Thus a program that wants to
1869 read and save (say) an email message from a POP server, which could be any
1870 length at all, and which terminates with <CRLF>.<CRLF> could do this:
1871
1872   set flag off
1873   while open connection {
1874       input /nowrap 10 \13\10.\13\10 # Wait for <CRLF>.<CRLF>
1875       if success {
1876           frwrite /string \%o {\freplace(\v(input),\13\10.\13\10,\13\10)}
1877           set flag on
1878           break
1879       } else if ( == \v(instatus) 6 || == \v(instatus) 1 ) {
1880           frwrite /string \%o {\v(input)}
1881           continue
1882       }
1883       break
1884   }
1885   if flag (handle success)
1886
1887 Note carefully the braces around the FWRITE text; without them, trailing
1888 spaces would be lost.
1889
1890 Previously the only way to INPUT an entire data stream without losing
1891 anything (assuming it was ordinary lines of text that were not "too long"),
1892 was line-by-line:
1893
1894   while open connection {
1895       input /clear 10 \13\10
1896       if fail break
1897       if eq "\v(input)" "$ \13\10" break
1898       fwrite /string \%o {\freplace(\v(input),\13\10,\10)}
1899   }
1900
1901 The new code is 3 times faster using the default INPUT buffer length of 4K.
1902 Raising it to 16K makes it 3.6 times faster (not worth it).  Changing the
1903 POP3 script to use INPUT /NOWRAP makes it about twice as fast (it does more;
1904 it has to do all the byte-stuffing and unstuffing).  27 Nov 2005.
1905
1906 Changed ssl_display_xxx() to just return if SET QUIET ON.  Otherwise there
1907 is no way to suppress the messages.  Also protected a previously unprotected
1908 printf("[SSL - OK]\r\n"); by if ( ssl_verbose_flag ).  ck_ssl.c,
1909 28 Nov 2005.
1910
1911 Discovered that FOPEN /APPEND doesn't work if the file doesn't exist.  It
1912 uses cmiofi() which is a super-hokey front end to cmifi2().  I had code to
1913 call it but for some reason it was commented out, with a note to the effect
1914 it didn't work.  I uncommented it but that didn't help much.  So I wrote an
1915 entirely new cmiofi() that works exactly as it should, using chained FDBs,
1916 _CMIFI to _CMOFI (I think the original cmiofi() predated chained FDBs).
1917 ckuus7.c, ckucmd.c, 29 Nov 2005.
1918
1919 Getting rid of the awful hacks required to call cmiofi() meant I also had to
1920 change the EDIT command, which is the only other place where it's used.
1921 Unfortunately now it's no longer possible to give EDIT without a filename
1922 (to just start an empty editor) but I doubt anyone will notice.  ckuusr.c,
1923 29 Nov 2005.
1924
1925 IF KERBANG didn't always work right.  If a kerbang script TAKEs another
1926 kerbang script, the second one should have IF KERBANG false, but it didn't.
1927 Added a check for \v(cmdlevel) == 1.  Now you can write a wrapper that runs
1928 a kerbang script in a loop, and the latter can use IF KERBANG to know
1929 whether to EXIT (if called at top level) or END (if called by another
1930 script, thus allowing -- in this case -- the loop to continue).  ckuus6.c,
1931 29 Nov 2005.
1932
1933 Changed \flop() and flopx() functions to take a third argument, a number
1934 signifying at which occurrence of the break character to lop, so:
1935
1936   \flopx(sesame.cc.columbia.edu) = edu
1937   \flopx(sesame.cc.columbia.edu,,2) = columbia.edu
1938
1939 ckuus[24].c, 1 Dec 2005.
1940
1941 Built OK on VMS 7.2-1 with MultiNet 4.4.  Built with and without OpenSSL on
1942 Linux OK, ditto Solaris 9.  Built OK on RH Linux AS4 on X86_64 (64-bit);
1943 "show var fsize" (using new ckfstoa()) works OK there.  Also Mac OS X 10.3.9
1944 (32-bit), Tru64 UNIX 4.0F (64-bit), HP-UX 11iv2 (64-bit) (picky new compiler
1945 spews out tons of useless warnings), FreeBSD 6.0 on ia64 (64-bit).
1946
1947 --- Dev.07 ---
1948
1949 Changed "make netbsd" to be a synonym for "make netbsd2" because the
1950 original netbsd target was ancient.  Renamed it to netbsd-old.  makefile,
1951 3 Dec 2005.
1952
1953 Updated INPUT and MINPUT help text.  ckuus2.c, 3 Dec 2005.
1954
1955 Discovered that on a SET PORT /SSL connection, Kermit treats incoming
1956 0xff data bytes (e.g. sent from the POP server) as IACs and goes into Telnet
1957 negotiations.  Jeff says "You will need to implement NP_SSLRAW and NP_TLSRAW
1958 that do the same as NP_TCPRAW but negotiate SSL or TLS as appropriate."
1959 This was not as easy as it sounded, because apparently a lot of the Telnet
1960 code is used by SSL and TLS even when Telnet protocol is not being executed.
1961 I wound up doing this as follows: I added /SSL-RAW and /TLS-RAW to the
1962 switch table.  Rather than disable Telnet, they do exactly what the /SSL and
1963 /TLS switches do, but also set a special flag.  This flag is checked in only
1964 two place: netclos() (to prevent Kermit from sending TELNET LOGOUT when
1965 closing the connection), and tn_doop() (to prevent Kermit from reacting to
1966 incoming IACs; it makes tn_doop() return(3), which means "quoted IAC", which
1967 causes the caller to keep the IAC as data).  ckcnet.h, ckctel.h, ckctel.c,
1968 ckuus7.c, 4 Dec 2005.
1969
1970 The INPUT command did not account for tn_doop() returning 3.  Fixed in
1971 doinput(), ckuus4.c, 4 Dec 2005.
1972
1973 Added another debug() statement in FTP secure_getbyte() to see what's going on
1974 with Muhamad Taufiq Tajuddin's 205-byte-per-second FTP/SSL downloads, plus
1975 new code to test SSL_read()'s return code (byte count); if 0 don't update
1976 the screen.  ckcftp.c, 4 Dec 2005.
1977
1978 --- Dev.08 ---
1979
1980 Fixed a typo in the non-ANSIC definition of ckfstoa().  ckclib.c, 7 Dec 2005.
1981
1982 Our Ctrl-C trap (the ON_CTRLC macro) wasn't working for kerbang files.
1983 Rearranged some code to make it work.  ckcmai.c, 8 Dec 2005.
1984
1985 Started converting code to use CK_OFF_T for file sizes and offsets, and
1986 all [s]printf's to replace "%ld" or whatever with "%s", and the size
1987 variable with a call to ckfstoa().  Since I haven't actually changed the
1988 definition of CK_OFF_T from what all the size variables were to begin
1989 with (i.e. long), it shouldn't do any harm.  So far just ckcfn3.c
1990 10 Dec 2005.
1991
1992 An updated HP-UX 9.xx makefile target from PeterE to fix a core dump that
1993 happens on that platform due to insufficient resources.  14 Dec 2005.
1994
1995 Added debug() statements to http_blah() routines to tell whether the
1996 connection is "chunked".  There seems to be a bad performance problem.
1997 ckcnet.c, 14 Dec 2005.
1998
1999 PeterE complained about ugly DIRECTORY error message, ?No files match -
2000 "{blah}".  The braces are used internally in case the user typed more than
2001 one filespec.  I changed the error message to remove them.  Ditto DELETE.
2002 ckuus6.c, 15 Dec 2005.
2003
2004 The problem with HTTP downloads is that Kermit always does single-character
2005 read() or socket_read() calls (or the SSL equivalent); see http_inc().  I
2006 added buffering code for non-SSL connections only but it's gross because it
2007 has to swap ttyfd and httpfd before calling nettchk().  I tried making a
2008 nettchk() clone that accepts a file descriptor as an argument but it didn't
2009 work because too many other routines that are invoked directly or implicitly
2010 by nettchk() (such as in_chk()) are still hardwired to use ttyfd.  HTTP GETs
2011 are now 20 times faster on the local network (the improvement is less
2012 dramatic over a clogged Internet).  ckcnet.[ch], 15 Dec 2005.
2013
2014 --- Dev.09 ---
2015
2016 HTTP file-descriptor swapping is not thread safe.  Doing it right, of
2017 course, is a big deal, so for now I just don't define HTTP_BUFFERING for
2018 Windows.  ckcnet.c, 15 Dec 2005.
2019
2020 Noticed that HTTP not included in FreeBSD and OpenBSD builds.  Fixed in
2021 ckcdeb.h, 22 Dec 2005.
2022
2023 Fleshed out 32/64-bit data type definitions and changed struct zattr
2024 (file attribute structure) members length and lengthk to have the new
2025 CK_OFF_T type.  Changed final arguments of debug() and tlog() to be the new
2026 LONGLONG type.  ckcdeb.h, 22 Dec 2005.
2027
2028 Changed ckfstoa() to return a signed number in string form, rather than an
2029 unsigned one.  That's because off_t is signed (thank goodness).  Added the
2030 inverse function, ckatofs() so we can convert file sizes and offsets back
2031 and forth between binary number and string.  ckclib.c, 22 Dec 2005.
2032
2033 Changed Attribute Packet reader to convert incoming file size attribute
2034 with ckatofs() rather than atol().  ckcfn3.c, 22 Dec 2005.
2035
2036 Converted debug(), tlog(), ckscreen(), etc, to handle potentially "long long"
2037 arguments by making their "n" argument CK_OFF_T.  ckuusx.c, ckcdeb.h,
2038 22 Dec 2005.
2039
2040 Converted the rest of the source files to use CK_OFF_T for all file size
2041 and offset and byte-count related variables, and converted all references to
2042 these variables in printfs to go through ckfstoa().  Then I built it on
2043 Linux/i386 with:
2044
2045   make linux "KFLAGS=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
2046
2047 which makes off_t be 64 bits and magically makes all the regular file APIs
2048 use 64-bit sizes and offsets without changing the API calls in the source
2049 code.  It's going to be a lot of work to get through all the kinks but I was
2050 able to send a long file, do directory listings of long files, do
2051 \fsize(longfile), etc.  When it sends a file, the length is shown correctly
2052 in the A packet.  If the receiver does not support big numbers, it receives
2053 the file OK anyway, without showing the size, the thermometer, or percent
2054 done (and then will get an error when the file keeps coming after the 2G
2055 mark).  Kermit 95 actually refuses long files for "Size", but only if the
2056 announced is less than 2^63 bytes.  When today's Linux version receives a
2057 file, it shows the length correctly in the file-transfer display, as well as
2058 percent done, thermometer, etc.  Also built this version on true 64-bit
2059 Linux, and it worked fine.  Many files changed, 22 Dec 2005.
2060
2061 For the record, this API is specified in X/Open's Single UNIX Specification
2062 Version 2, which is branded as UNIX 98.  It is called Large File Support, or
2063 LFS, and was developed at the Large File Summit.
2064
2065 It looks like the operative feature-test macro in glibc for transitional
2066 large file support is __USE_LARGEFILE64.  So if this is defined, we can also
2067 supply _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64 automatically for 32-bit
2068 Linux builds.  But there's a Catch-22, you don't know if this is defined
2069 until you read the header files, but you have to define _LARGEFILE_SOURCE
2070 and _FILE_OFFSET_BITS before you read the header files.  Maybe it's good
2071 enough to grep through <features.h> for __USE_LARGEFILE64.  makefile,
2072 23 Dec 2005.
2073
2074 Checked this on true 64-bit Linux.  The same symbols are defined in CFLAGS,
2075 but they do no harm; it builds without complaint and works fine.  24 Dec 2005.
2076
2077 Built it on Red Hat Linux 6.1 from 1999.  This picked up the long file
2078 support too.  Guess 6.1 isn't old enough to not have it!  Kermit seems to
2079 work OK on regular files but I don't have enough disk space to create a long
2080 file, and my bigfile.c program (which creates a long file containing only 1
2081 byte) doesn't work ("fseeko: invalid argument").  It looks like parts of
2082 this API were visible in Linux before they were actually working.
2083 24 Dec 2005.
2084
2085 Converted all fseek() and ftell() to macros that expand to fseek() and ftell()
2086 or fseeko() and ftello() depending on whether _LARGEFILE_SOURCE is defined.
2087 ckufio.c, ckuus7.c, ckuusx.c, 24 Dec 2005.
2088
2089 Made a CK_OFF_T version of cmnum().  It would be a very big deal to just
2090 change cmnum() to return a new type, so another idea is to rename cmnum() to
2091 something else, cmnumw(), change its result argument to CK_OFF_T, and then
2092 make a stub cmnum() to call it to get an int, then call cmnumw() explicitly
2093 any time we need a big number.  ckucmd.c, 24 Dec 2005.
2094
2095 Calling cmnumw() directly requires changes to each routine that uses it.
2096 The INCREMENT and DECREMENT commands, for example, required changes to
2097 doincr(), varval(), and incvar(), and all references to them.  ckuusr.[ch],
2098 ckuus[56].c, 24 Dec 2005.
2099
2100 Calling cmnumw() in chained FDBs required defining a new function code,
2101 _CMNUW, adding a new member to the OFDB struct for returning wide results,
2102 and adding a new case to cmfdb().  ckucmd.[ch], 24 Dec 2005.
2103
2104 Changed FSEEK and FCOUNT to use the new chained FDB interface, now we can
2105 seek and look past 2GB.  ckuus7.c, 24 Dec 2005.
2106
2107 Next come switches, which store their results in a struct stringint.  This
2108 struct was defined in each module where it was used (ckuus[r367].c, ckcftp.c).
2109 I moved the definition to ckuusr.h and added a wval member, which can be
2110 referenced by any switch-parsing code that calls cmnumw().  24 Dec 2005.
2111
2112 Changed SEND /CALIBRATE:n to allow big values of n.  This makes it possible
2113 to test the protocol aspects of long-file transfer without actually having a
2114 long file handy.  ckuusr.c, 24 Dec 2005.
2115
2116 SEND /SMALLER-THAN:n, SEND /LARGER-THAN:n, and and SEND /START:n also now
2117 allow large values of n.  ckuusr.c, 24 Dec 2005.
2118
2119 Changed the algebraic expression evaluator to use wide values.
2120 ckuus5.c, 24 Dec 2005.
2121
2122 Fixed ckfstoa() to handle the case when n is negative and (0 - n) is also
2123 negative, which happens for numbers 2^(n-1) or greater, where n is the
2124 number of bits in the word size we're dealing with, e.g. 64, in which case
2125 2^63 has its sign bit set so seems to be negative.  In such cases, ckfstoa()
2126 returns "OVERFLOW" instead of a numeric string.  We'll have to see how this
2127 plays out but I think it's better to cause a parse error and stop things
2128 dead than to return a spurious number.  ckclib.c, 24 Dec 2005.
2129
2130 Converted the S-Expression handler to use wide integers. ckuus3.c, 24 Dec 2005.
2131
2132 Took all the LONGLONG stuff out of ckcdeb.h, we don't need it.
2133
2134 All of these changes result in 64-bit arithmetic (more or less) on 32-bit
2135 Linux, as well as on true 64-bit platforms.
2136
2137 Rebuilt today's code on Solaris 9 in the 32-bit and 64-bit worlds, on Red
2138 Hat 6.1, Red Hat AS4.2.  I haven't bothered trying a 32/64 hybrid build for
2139 Solaris, since I can build a pure 64-bit version there.  Quick tests show
2140 the large-number arithmetic works OK in all cases except, of course, on pure
2141 32-bit builds (unfortunately I can't find a running Linux system old enough
2142 to verify this for Linux, but it's true for other 32-bit platforms).
2143 24 Dec 2005.
2144
2145 Tried building a hybrid version on Solaris 9 after all since the LFS API is
2146 ostensibly the same as for Linux:
2147
2148  make solaris9 "KFLAGS=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
2149
2150 It built smoothly and the resulting binary is 2.5MB compared to 3.4MB for
2151 the 100% 64-bit version.  Looks like a keeper.  For now, added solaris9lfs
2152 and solaris10lfs entries to the makefile but if these work on PCs we can
2153 make these the regular entries for Solaris 9 and 10.  27 Dec 2005.
2154
2155 Built on Mac OS X 10.4 with the regular target.  It seems that in that case,
2156 off_t is 64 bits anyway.  Noticed that a lot of stuff didn't work, like
2157 exponentiation in S-Expressions.  Tried building it as above, which worked,
2158 and now CK_OFF_T is 64 bits instead of 32, but (^ 2 30) is still 2.0.  In
2159 fact 2-to-the-any-power is 2.0.  It seems that the Mac OS X version did not
2160 have FNFLOAT defined.  It also seems that every test in dosexp() like:
2161
2162   if (result != fpresult) fpflag++;
2163
2164 should have been protected by #ifdef FNFLOAT..#endif /* FNFLOAT */ -- a
2165 double-ended break, as they say in the nuclear power industry.  ckuus3.c,
2166 27 Dec 2005.
2167
2168 Added GREP /EXCEPT:pattern.  ckuus[26].c, 27 Dec 2005.
2169
2170 Fixed a problem with uninitialized pv[].wval (switch-parsing parameter-value)
2171 members that showed up on certain platforms or with certain compilers.  Now
2172 the Mac OS X 10.4 version works.  ckuus[r367].c, ckcftp.c, 28 Dec 2005.
2173
2174 Built on Unixware 7.1.1, a pure 32-bit build, seems fine.  Rebuilt on Red
2175 Hat AS 4.2 just to make sure I didn't break anything, it's OK.  No testing
2176 on HP-UX, etc, because HP testdrive file sytem is full, can't upload anything.
2177 29 Dec 2005.
2178
2179 Commented out the SHOW FEATURES section that displays constants like
2180 INT_MAX, CHAR_MAX, etc, because printing each value in the appropriate
2181 format is too tricky, and we don't need them anyway.  ckuus5.c, 29 Dec 2005.
2182
2183 Updated ckvfio.c to use CK_OFF_T for the relevant variables.  Built and
2184 tested on VMS/Alpha 7.2: file transfer in remote mode; making a Telnet
2185 connection and then local-mode file transfer; S-Expressions, all OK.  Also
2186 built a no-net version OK.  29 Dec 2005.
2187
2188 Built and tested on Red Hat AS4 AMD X86_64, used it to upload new sources to
2189 FreeBSD 4.11.  Built on FreeBSD 4.11/i386.  Here's another one where off_t
2190 is 64 bits, even though long is 32 bits.  But it seems to work ok, not sure
2191 why, when CK_OFF_T is 32 bits.  There is no _LARGEFILE_SOURCE stuff in the
2192 header files.  29 Dec 2005.
2193
2194 Built on Mac OS X 10.3.9 using the new macosx10.4 target to pick up LFS.
2195 Works fine.
2196
2197 Built on Red Hat Linux 4WS on IA64 (64-bit).  Now this one is odd, stat()
2198 fails on big files.  It happens also if I use the "linuxnolfs" target, which
2199 does not define _USE_LARGEFILE or _FILE_OFFSET_BITS=64.  DIRECTORY BIGFILE
2200 shows the size as -1, but if "log debug", it says "no files match", i.e.
2201 different behavior, observer effect.  I hate when that happens.
2202
2203 Let's see if that's an anomoly...  Built on Tru64 Unix 4.0F (64-bit Alpha).
2204 It sees long files just fine.  Rebuilt and checked on x86_64 again... fine.
2205 OK, let's not worry about IA64 yet.
2206
2207 Another small fix to the HP-UX 9.0 target from PeterE.  makefile, 29 Dec 2005.
2208
2209 ---Dev.10---
2210
2211 Code adjustments from Jeff, mainly to the SSL and TLS Raw mode code from
2212 several weeks ago, plus changing some data types in the security code to
2213 CK_OFF_T, plus a different data type for CK_OFF_T for K95 because Windows
2214 size_T isn't signed.  This presumably will allow large-number arithmetic but
2215 it will not give large file access because that will require replacing all C
2216 library file i/o calls (esp. in ckofio.c) with native Windows APIs.  Build
2217 on Solaris 9 with and without SSL and on Linux RH AS4.2 with and without
2218 SSL.  ck_crp.c, ck_ssl.c, ck_ssl.h, ckcdeb.h, ckcftp.c, ckcmai.c, ckcnet.c,
2219 ckcnet.h, ckctel.c, ckuat2.h, ckuus4.c, ckuus7.c, ckuusr.c, 30 Dec 2005.
2220
2221 It was reported that WRITE SESSION always returned a failure status, even
2222 when it succeeded.  The problem was that Unix versions of zsout() and
2223 zsoutl(), for the session log only, were using write() and returning
2224 write()'s return code, which is different from what zsout() and zsoutl() are
2225 documented to return.  Also plugged a couple potential holes in zsoutx()
2226 that I noticed while I was in the neighborhood.  ckufio.c, 30 Dec 2005.
2227
2228 Added FSEEK /FIND:pattern.  This form of FSEEK accepts all the other
2229 switches and arguments and performs the desired seek.  Then, if the seek was
2230 successful, it starts from that point and reads through the file, line by
2231 line, searching for the first line that contains the given string or matches
2232 the given (unanchored) pattern and, if found, sets the file pointer to the
2233 beginning of that line.  Useful, e.g., for very long timestamped logs, where
2234 you want to start processing at a certain date or time; searching for a
2235 particular string is much faster than doing date comparisons on each line.
2236 ckuus[27].c, 30 Dec 2005.
2237
2238 It was annoying me that FILE STATUS (FSTATUS) required a channel number to
2239 be given even if only one file was open, so I supplied the correct default
2240 in that case.  ckuus7.c, 30 Dec 2005.
2241
2242 INPUT /NOWRAP, added recently, is used for efficiently copying the INPUT
2243 stream intact, but it's not good for matching because if the INPUT target is
2244 broken between the end of the previous buffer and the beginning of the next
2245 one, the context is lost and the match does not occur.  I thought of several
2246 ways around this, but they all involve saving a huge amount of context --
2247 old input buffers, the arrays of target strings and corresponding match
2248 positions, etc.  The alternative is fairly simple but it's not transparent
2249 to the user.  Here's what I did in a POP script:
2250
2251     .eom := "\13\10.\13\10"
2252     set flag off                           # FLAG ON = success
2253     while ( open connection && not flag ) {
2254         .oldinput := \fright(\v(input),8)  # Save tail of previous INPUT buffer
2255         input /clear /nowrap 4 \m(eom)     # Get new INPUT buffer
2256         if success {                       # INPUT matched - good
2257             .s := {\freplace(\v(input),\m(eom),\13\10)}
2258             set flag on
2259         } else {                           # No match
2260             .s := \v(input)                # Check if target crossed the border
2261             .oldinput := \m(oldinput)\fsubstr(\v(input),1,8)
2262             if \findex(\m(eom),\m(oldinput)) set flag on
2263         }
2264         ...
2265     }
2266
2267 I think this will be easier to explain than any dangerous and grotesque
2268 magic I might put into doinput() itself.  For now, added a few words about
2269 this to HELP INPUT.  ckuus2.c, 30 Dec 2005.
2270
2271 Back to the pattern matcher.  Noticed that "IF MATCH index.html [a-hj-z]*"
2272 succeeded when it should have failed.  In ckmatch(), the clist section
2273 needed one more clause: it can't float the pattern if an asterisk does not
2274 occur in the pattern before the clist.  This change fixes the problem
2275 without breaking any other cases that weren't already broken, most of which
2276 involve slists, i.e. {string,string,string,...}.  ckclib.c, 30 Dec 2005.
2277
2278 Tried FSEEK /FIND: on a largish file (over 100,000 lines), using it to seek
2279 to a line near the end.  It took 0.756 seconds, compared with Unix grep,
2280 which did the same thing in 0.151 sec.  That's because C-Kermit is using
2281 ckmatch().  But if the search target is not a pattern, it should be a bit
2282 faster to use ckindex().  Yup, 0.554 sec, a 36% improvement.  Can't expect
2283 to compete with grep, though; it's highly tuned for its single purpose.
2284 ckclib.[ch], ckuus7.c, 1 Jan 2006.
2285
2286 Updated visible copyright dates to 2006: ckcmai.c, ckuus2.c, ckuus5.c,
2287 1 Jan 2006.
2288
2289 Noticed that NetBSD 2.0.3 has 64-bit off_t, and that _LARGEFILE_SOURCE is
2290 mentioned in <stdio.h>.  Tried building Kermit with _LARGEFILE_SOURCE added
2291 to CFLAGS, it's good.  Added it to the netbsd target.  makefile, 1 Jan 2006.
2292
2293 Fixed typo, #ifdef CK_NOLONGLONG in ckuus5.c should have been #ifndef
2294 CK_LONGLONG (which, it turns out, we don't use anyway).  2 Jan 2005.
2295
2296 Observed that FreeBSD 4.x has a 64-bit off_t, but does not use the
2297 _LARGEFILE_SOURCE convention.  Reasoning that all versions of FreeBSD have
2298 off_t (I was able to check back to FreeBSD 3.3), I simply #define CK_OFF_T
2299 to be off_t in ckcdeb.h within #ifdef __FreeBSD__ .. #endif.  Another one
2300 down.  This can be done for any platform that is guaranteed to have off_t.
2301 Turns out FreeBSD 3.3 has 64-bit off_t too.  2 Jan 2005.
2302
2303 OpenBSD, same as FreeBSD.  Also, added OS-version-getting thing to makefile
2304 target for the program herald, as in the other BSDs.  Built on OpenBSD 2.5
2305 from 1998, it has 64-bit off_t too.  ckcdeb.h, makefile, 2 Jan 2005.
2306
2307 Dumping the command stack every time there's an error is really too much.
2308 I added SET COMMAND ERROR-DISPLAY {0,1,2,3} to set the verbosity level of
2309 error messages.  Only level 3 dumps the stack.  ckuus[235].c, 2 Jan 2005.
2310
2311 Built on HP-UX 11.11 with _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64.  The
2312 result works fine as far as I can tell.  It sees big files, it can open
2313 them, seek to positions past the 2^31 boundary.  It can send large files.
2314 It can do large-number arithmetic (^ 2 62).  The only problem is that during
2315 compilation, every single modules warns:
2316
2317   cc: "/usr/include/sys/socket.h", line 504: warning 562: Redeclaration of
2318   "sendfile" with a different storage class specifier: "sendfile" will have
2319   internal linkage.
2320   cc: "/usr/include/sys/socket.h", line 505: warning 562: Redeclaration of
2321   "sendpath" with a different storage class specifier: "sendpath" will have
2322   internal linkage.
2323
2324 These warnings should be perfectly harmless since they are not coming from
2325 C-Kermit code, nor does C-Kermit use either one of those functions.  These
2326 warnings don't come out in HP-UX 11i v2, but on that one we get tons and tons
2327 of picky compiler warnings (variables set but not used, defined but not
2328 referenced, etc).  A couple, however, turned out to be valid; one case of
2329 "expression has no effect", and two of "string format incompatible with
2330 data type" (I missed a couple file-size printfs).
2331
2332 There were also numerous warnings about signedness mismatch or sign
2333 conversion of constants like IAC (0xff).  Does the HP-UX Optimizing Compiler
2334 have a compiler flag to make all chars unsigned?  Yes, +uc, but the man page
2335 says "Be careful when using this option.  Your application may have problems
2336 interfacing with HP-UX system libraries and other libraries that do not use
2337 this option".  Sigh, better not use it.
2338
2339 After reviewing "HP-UX Large Files White Paper Version 1.4" and HP's
2340 "Writing Portable Code" documents, I added -D_LARGEFILE_SOURCE
2341 -D_FILE_OFFSET_BITS=64 to the hpux1000 target, which is the basis for all
2342 HP-UX 10.00 and later builds.  Large files are available in HP-UX 10.20 and
2343 later.  10.00 and 10.10 were not real releases, and anyway these flags
2344 should be harmless there unless the large-file implementation was only
2345 partly done.  Built OK on both PA-RISC and IA64, optimized and plain.
2346 makefile, 4 Jan 2006.
2347
2348 Built on FreeBSD 6.0 on IA64.  All OK except I got a warning about the
2349 argument passed to time() in logwtmp() in ckufio.c.  This section had
2350 already been partially fixed; thus I put the improved version into
2351 #ifdef CK_64BIT, which is our newly available symbol that should be
2352 automatically defined for any true 64-bit build.  ckufio.c, 4 Jan 2006.
2353
2354 Finally got around to testing Jeff's changes to SSL/TLS RAW mode from
2355 December 30th against our POP server.  It didn't work, couldn't log in.
2356 Tried backing off the ckctel.c changes first; that allowed login and
2357 communication, but it did not suppress activation of Telnet protocol
2358 whenever a 0xff byte arrived.  Backed off the rest of the changes and now
2359 all is OK again.  ckctel.c, ckcnet.c, ckuus7.c, 9 Jan 2006.
2360
2361 Built on NetBSD 1.4.1 (1999), found that it did not like the large file
2362 assumption -- fseeko() and ftello() do not exist; added a clause to the
2363 netbsd target to check for fseeko and not define _LARGEFILE_SOURCE if not
2364 found.  Oddly enough, off_t is 64 bits anyway, but it doesn't look like the
2365 APIs are half-done.  For example, stat() uses off_t (64 bits) for the file
2366 length, but fseek() uses long (32 bits) and there is no 64-bit analog.
2367 Anyway the new netbsd target works on both 1.4.1 and 1.5.2 (no large files)
2368 and on 2.0.3 (large files).  makefile, 9 Jan 2006.
2369
2370 Built on QNX-32 4.25, which has no large file support.  Got a few strange
2371 compiler (WatCom) warnings, but it built and runs OK.  Noticed that file
2372 transfers into QNX over a Telnet connection can't use streaming, but that's
2373 nothing new to this version; same thing happens with C-Kermit 7.0.  9 Jan 2006.
2374
2375 Built on IRIX 6.5.  I didn't bother with large files there because it does
2376 not support the _LARGEFILE_SOURCE interface; you have to change all the APIs
2377 at the source level from blah() to blah64().  Seems to work fine as a 32-bit
2378 app even though its off_t is 64 bits.  Tried a pure 64-bit IRIX 6.5 build
2379 but it dies in ckcnet.c when it hits SOCKOPT_T and GSOCKNAME_T with "The
2380 identifier 'socklen_t' is undefined".
2381
2382 Looks like I no longer have access to SCO OSR5.
2383
2384 Made a pure 32-bit build on SCO UnixWare 7.1.4, all OK.  Found that this
2385 version also supports LFS, added it to the uw7 target.  makefile, 9 Jan 2006.
2386
2387 --- Dev.11 ---
2388
2389 Evidently the HP-UX bundled (non-ANSI non-optimizing) compiler doesn't like
2390 long integers in switch expressions.  Changed three examples of these in the
2391 S-expression code.  ckuus3.c, 10 Jan 2006.
2392
2393 A section of tstats() where GFTIMER isn't defined (e.g. on Motorola
2394 sv68r3v6) was garbled.  Fixed in ckcfn2.c, 10 Jan 2006.
2395
2396 A fix for setting 921600 bps on Linux from Paul Fulghum, Microgate Systems Ltd.
2397 ttgspd(): ckutio.c, 11 Jan 2006.
2398
2399 Noticed that when I changed the compact substring notation code back on
2400 August 9th, I broke the ability to use arithmetic expressions within the
2401 brackets, which explains some rather odd behavior I saw with some of my
2402 scripts.  Looking more deeply into this, I also see that all the parsers I
2403 have been using up to now for this, as well as for array bounds pairs, have
2404 been inadequate because they never allowed for nested constructions, such as
2405 a member of a bounds pair that itself was an array element, possibly with
2406 another array element as a subscript.  I wrote a new routine for this,
2407 called boundspair(), which is like arraybounds() except it accepts an extra
2408 argument, an array of characters that can serve as bounds-pair delimiters,
2409 and it returns the pair separator that was encountered in another new
2410 argument.  For the alternative substring notation for [startpos-endpos] I
2411 had to change the delimiter from '-' to '_' because '-' can be used in
2412 arithmetic but '_' is not a recognized operator.  This is so I can parse,
2413 e.g. [a:b] or [a_b] in the same context, and then find out which form was
2414 used, e.g. \s(line[9:12]) or \s(line[9_12]); the first string is 4 bytes
2415 long, the second is 12.  Everything seems to be OK now.  \s(line[10]) gives
2416 everything starting at 10, but \s(line[10:0]) gives the null string.  Bad
2417 syntax in the bounds pairs results in a null string; missing pieces of the
2418 bounds pair result in defaults that should be compatible with previous
2419 behavior.  ckuus[45].c, ckuusr.h, 13 Jan 2005.
2420
2421 Changed arraybounds() to call boundsdpair().  This was a rather drastic
2422 change, not strictly necessary, but I think I got all the kinks out.
2423 ckuus5.c, 13 Jan 2005.
2424
2425 Changes from PeterE to the makefile for HP-UX 6 and 7, to accommodate bigger
2426 symbol tables, etc.  19 Jan 2005.
2427
2428 Determined that SCO OSR5.0.6 (and earlier) do(es) not support large files.
2429 Don't know about 5.0.7.  30 Jan 2005.
2430
2431 Created a new build target for SCO OSR6.0.0.  Gets the exact 6.x.x version
2432 dynamically.  Supports large files and big-number arithmetic via CK_OFF_T.
2433 The sockopt() family of functions changed the data types of some of their
2434 arguments since OSR5.  It was already possible to define SOCKOPT_T and
2435 GSOCKNAME_T from the command line but I had to add code to also allow this
2436 for GPEERNAME_T too.  ckcnet.c, makefile, 30 Jan 2005.
2437
2438 Apparently, ever since C-Kermit 7.0 was released, it has never been possible
2439 to use a variable for the as-name in a RECEIVE command in Kermit 95.  This
2440 is because evaluation of the as-name field was deferred until after we could
2441 check whether it might be a directory name (which, in Windows, could start
2442 with a backslash).   This little bit of magic was not a good idea, magic
2443 hardly ever is.  I changed the code to evaluate both as-name fields in the
2444 normal way.  If they want to receive to a directory called "\%1", they'll
2445 just have to spell it differently.  The workaround is to turn the whole
2446 command into a macro and evaluate it before executing it, e.g.:
2447
2448   assign xx receive /as-name:\%1
2449   do xx
2450
2451 ckuus6.c, 1 Feb 2006.
2452
2453 Built OK on FreeBSD 6.1 on AMD64.  Adjusted some copyrights and date stamps.
2454 ckcmai.c, makefile, 8 Feb 2006.
2455
2456 --- Dev.12 ---
2457
2458 Fixed a signed/unsigned char warning in the new boundspair() calling code
2459 in the compact substring notation handler.  ckuus4.c, 9 Feb 2006.
2460
2461 Removed a spurious extra linux+openssl label from the makefile, added
2462 solaris10g_64 synonym.  9 Feb 2006.
2463
2464 Satisfied myself that LFS is OK on Solaris 10 i386, and I'm going to assume
2465 it's also OK on Solaris 9.  Made LFS standard for all Solaris 9 and 10
2466 builds (including the secure ones) except the explicitly 64-bit ones, and
2467 made the provisional solarisXXlfs targets into synonyms.  makefile, 9 Feb 2006.
2468
2469 --- Dev.13 ---
2470
2471 Further attempts at SSL/TLS message suppression when QUIET is ON.
2472 ck_ssl.c, 16 Feb 2006.
2473
2474 From J.Scott Kasten: (quote...) I just uploaded a patch to /kermit/incoming.
2475 The file name is "jsk-patch-for-cku211.diff".  I have also included the
2476 patch as ASCII text in this email below.  This patch may be applied to the
2477 cku211.tar.gz source code via:
2478   cd cku211, patch -p1 <../jsk-patch-for-cku211.diff
2479 The patch adds 4 new build targets:
2480   netbsdwoc - a stripped no curses target for iksd used.
2481   netbsdse  - security enhanced target with srp, ssl, and zlib.
2482   irix65gcc - build on SGI Irix 6.5 platform using gcc.
2483   irix65se  - security enhanced target with srp, ssl, and zlib.
2484 The patch fixes one build target:
2485   irix64gcc - The "-s" option is not supported by gcc under Irix.
2486 I thank all of you in the Kermit Project for such a fine utility.  I
2487 recently had to get a 16 MB file overseas across a spotty communications
2488 link to repair a computer remotely.  Kermit was the only thing that could do
2489 the job, so I wanted to contribute these patches back to the mainstream to
2490 say thanks.  This digitally signed email is a binding contract that
2491 officially assigns the rights to the source code patch (shown below) that I
2492 developed to the Kermit Project at Columbia University. (...end quote)
2493 ck_ssl.c, makefile, 23 Feb 2006.
2494
2495 Changed the new NetBSD target names to be consistent with the conventions
2496 used in most other targets:
2497
2498   netbsdwoc -> netbsdnc
2499   netbsdse  -> netbsd+ssl+srp+zlib
2500   irix65se  -> irix65+ssl+srp+zlib
2501
2502 and removed old, now superfluous, NetBSD targets (old-netbsd, netbst15,
2503 netbst16), leaving synonym labels in their place.  Also updated (crudely)
2504 the Linux target variations (curses instead of nocurses, no curses at all)
2505 to be (appropriately modified) copies of the current linux target.  It would
2506 be nicer to combine them, but this gets the job done.  makefile, 23 Feb 2006.
2507
2508 --- Dev.14 ---
2509
2510 Fixed the HELP command when used with tokens like @, ^, #, and ;.  The first
2511 two had been omitted from the table.  The second two required a new path
2512 into the guts of the parser, since comments are normally stripped at a very
2513 low level.  ckuus[r2].c, ckucmd.c, 24 Feb 2006.
2514
2515 Built on AIX 5.1 ("make aix51") without incident.  Then I tried:
2516
2517  make aix51 "KFLAGS=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
2518
2519 This had no effect.  I found the relevant document ath the IBM website.  It
2520 says to use -D_LARGE_FILES instead.  I added this to the AIX 4.2 target
2521 since (a) IBM says large files are supported by AIX 4.2 and later, and (b)
2522 all Kermit AIX targets past 4.2 use the 4.2 one.  Plus a clause to make
2523 sure CK_OFF_T is defined appropriately.  ckcdeb.h, makefile, 6 Mar 2006.
2524
2525 Added a 32-bit aix51+openssl target.  Builds OK, works fine (tested against
2526 our SSL POP server).  Tried I tried adding -D_LARGE_FILES.  It seems to work
2527 fine, so we'll keep it.  Cleaned up the other aix5blah entries a bit also.
2528 makefile, 6 Mar 2006.
2529
2530 Fixes from J. Scott Kasten to the IRIX 6.4 and 6.5 makefile targets.  They
2531 were badly wrong.  makefile, 6 Mar 2006.
2532
2533 The reason Kermit was looping on directories in IRIX was a classic
2534 "double-ended break".  The makefile targets failed to define DIRENT so
2535 Kermit was open/read on directories rather than opendir()/readdir().  But
2536 then it was also failing to account for the fact that read() would return -1
2537 on error.  The makefile fix adds -DDIRENT, and the read() case in traverse()
2538 now properly terminates its loop on error.  ckufio.c, 6 Mar 2006.
2539
2540 --- Dev.14 ---
2541
2542 In response to a complaint that C-Kermit would not build on HP-UX 11 with
2543 OpenSSL, I tried it myself on both 11.11/PA-RISC and 11i v2/Itanium.  It built
2544 OK on both but I had to add a new target (hpux1000o+openssl-nozlib) for no
2545 Zlib since these boxes did not have it installed.  makefile, 9 Mar 2006.
2546
2547 Added OpenSSL version number display to SHOW FEATURES.  ckuus5.c, 9 Mar 2006.
2548
2549 Gavin Graham noticed that FTP [M]GET /DELETE /MOVE-TO: was rejected with
2550 "?Sorry, /DELETE conflicts with /MOVE or /RENAME".  This check belongs in the
2551 PUT code but not in the GET code.  Commented it out and tested the result.
2552 The combination is now accepted but then Kermit refuses the incoming file as
2553 if it had been given a /SMALLER-THAN: or /LARGER-THAN: switch, which it didn't
2554 happen.  Turns out there was one more place where I wasn't initializing the
2555 new "wide int" member of the switch-parsing pv[] struct.  Once this was fixed,
2556 the /MOVE-TO part still didn't work.  Turned out the /DELETE case was part of
2557 a long if-else-if-else- chain, which effectively made /DELETE and /MOVE-TO: or
2558 /RENAME-TO: mutually exclusive.  Fixed this, now it works fine.  ckcftp.c,
2559 13 Mar 2006.
2560
2561 Got access to AIX 5.3, built there, all OK, including large files. 13 Mar 2006.
2562
2563 --- Dev.16 ---
2564
2565 Patches from Mark Sapiro to suppress getsockopt() and getsockname() warnings
2566 in Mac OS X.  ckcnet.[ch], 18 Mar 2006.
2567
2568 In response to a complaint from Clarence Dold, tried "make redhat9" (which
2569 is the rather dated target that tried to include all forms of security) on
2570 RH Linux AS4.3, it failed miserably.  I made a new makefile target, removing
2571 Kerberos IV and got a lot farther.  But then in ckcftp.c, the following
2572 struct definition:
2573
2574   struct {
2575       CONST gss_OID_desc * CONST * mech_type;
2576       char *service_name;
2577   } gss_trials[] = {
2578       { &ck_gss_mech_krb5, "ftp" },
2579       { &ck_gss_mech_krb5, "host" },
2580   };
2581
2582 refers to a variable, ck_gss_mech_krb5, that is not defined anywhere.  Up
2583 above, however, is a static definition for gss_mech_krb5, so I changed the
2584 struct definition to match.  Next, in ckuath.c, the compiler could not find
2585 the com_err.h file.  Turns out in Linux this is in a subdirectory, et, so we
2586 have to add a -I clause to the makefile target for this.  Made a target for
2587 Linux+SSL only.  Made a target for Linux+Krb5 only; this required moving an
2588 #ifdef in ckuus7.c to prevent an unguarded reference to SSLEAY_VERSION.
2589 New targets: linux+krb5+ssl, linux+krb5, linux+krb5.  ckcftp.c, ckuus7.c,
2590 makefile, 27 Mar 2006.  
2591
2592 New targets of HP-UX 10/11 with OpenSSL from PeterE.  makefile, 27 Mar 2006.
2593
2594 Added large file/integer support to SHOW FEATURES.  ckuus5.c, 27 Mar 2006.
2595
2596 Built OK on Solaris 9 and 10 with gcc (someone was complaining that this
2597 didn't work, but that was 8.0.211).
2598
2599 Started build on a Sun 3/80 mc68030 with NetBSD 2.0 and gcc 3.3.3.  But it
2600 died with an assembler error in ckcfn2.c (compiler bug).  27 Mar 2006.
2601
2602 --- Dev.17 ---
2603
2604 NebBSD 2.0 build completed by turning off optimization on ckcfn2.c
2605 ("KFLAGS=-O0").  Result supports 64-bit ints and, presumably, large files.
2606 uname -p = "m68k", -m = "sun3". 29 Mar 2006.
2607
2608 Corrected an omission in applying PeterE's updates to the HP-UX targets.
2609 makefile, 28 Mar 2006.
2610
2611 solaris2xg+krb5+krb4+openssl+shadow:
2612
2613 Tried resurrecting the solaris2xg+krb5+krb4+openssl+shadow target.  It asks
2614 to link with libdes but there is no libdes.  Removed -ldes from the target,
2615 now at least it builds and runs wart.  The compilation blows up in ckcftp.c
2616 for missing header files:
2617
2618   ckcftp.c:462: kerberosIV/krb.h: No such file or directory
2619   ckcftp.c:500: gssapi/gssapi_generic.h: No such file or directory
2620   ckcftp.c:501: gssapi/gssapi_krb5.h: No such file or directory
2621
2622 Got a bit farther by adding appropriate -I's and -L's to KFLAGS but it still
2623 dies compiling (or linking?) ckcftp.c, but it doesn't say exactly why.  OK,
2624 deferred.
2625
2626 Added SET SEXPRESSION TRUNCATE-ALL-RESULTS { ON, OFF }.  This can be used
2627 for force integer arithmetic in any kind of calculation that requires it,
2628 such as date calculations.  This is a global setting, not on any kind of
2629 stack.  Also, updated SHOW SEXP and added HELP SET SEXP which wasn't there
2630 before.  ckuus[23].c, 30 Mar 2006.
2631
2632 To make the RENAME command a bit more useful, need to add some switches.
2633 But it shares a switch table, qvswtab[], with some other commands.  Broke
2634 this off into its own switch table.  ckuus6.c, 17 Apr 2006.
2635
2636 Added RENAME switch values that can be used in the same table with the DELETE
2637 switch values, which are shared by many commands.  ckuusr.h, 17 Apr 2006.
2638
2639 Discovered that the RENAME command could be entered without any arguments
2640 and it would still succeed.  Fixed in dorenam(): ckuus6.c, 17 Apr 2006.
2641
2642 Added parsing for RENAME /UPPER:option (to uppercase the file name(s)),
2643 /LOWER:option (to lowercase), and /REPLACE:{{s1}{s2}} (to do string
2644 replacement on the filename(s)), but not the semantics.  When any of these
2645 switches is given, the target ("to") name is not parsed; they act on the
2646 source name.  The /LOWER: switch takes keyword args to specify whether it
2647 should act only only files that have all UPPER case latters, or on ALL files
2648 (i.e., including files with mixed-case names); similarly for the /UPPER:
2649 switch.  There is some creative parsing allowing these to be given with or
2650 without a colon and keyword argument, which works fine except if you include
2651 the colon but no argument, execute the command (which works fine), and then
2652 recall the command.  I haven't yet decided about the interaction among these
2653 switches.  Clearly if /UPPER is given after /LOWER, it overrides.  But if
2654 /UPPER (or /LOWER) is given with /REPLACE, what should happen?  ckuus6.c,
2655 17 Apr 2006.
2656
2657 Filled in actions for RENAME /UPPER: and /LOWER: for the single file case,
2658 and tested all combinations of switch values and filename configurations.
2659 Once that was OK, moved the code out into a separate routine, renameone(),
2660 and then called it from both the single-file case and the multifile case.
2661 ckuus6.c, 19 Apr 2006.
2662
2663 Added RENAME /SIMULATE.  Filled in the code for string replacement, needs
2664 testing.  ckuus6.c, 20 Apr 2006.
2665
2666 Changed /REPLACE options to allow a negative number to specify an occurrence
2667 from the right, so -1 means the last occurrence, -2 means the next-to-last,
2668 etc.  ckuus6.c, 24 Apr 2006.
2669
2670 Added RENAME /COLLISION:{OVERWRITE,PROCEED,FAIL}.  This is implemented but
2671 not tested.  ckuus6.c, 24 Apr 2006.
2672
2673 Worked on RENAME /COLLISION:FAIL.  I decided it was less than useful to ...
2674
2675 Added SET RENAME { COLLISION, LIST } to let user change default collision
2676 and listing actions.  ckuusr.[ch], ckuus[36].c, 25 Apr 2006.
2677
2678 Experimented with parsing for /CONVERT:cset1:cset2.  The problem here is
2679 that there is no straightforward way for a switch to have multiple
2680 arguments.  Or is there...?  If I parse cset1 with cmswi() rather than
2681 cmkey(), it almost works; the only problem is that the character-set
2682 keywords don't have CM_ARG set, so they don't know to stop on, and ignore, a
2683 colon.  If I make a copy of the table and set CM_ARG in the flags field for
2684 each keyword, it works fine: if I Tab in the first name, it fills itself
2685 out, supplies a colon, and waits for the second name.  So in the code, the
2686 first time that RENAME /CONVERT is invoked, I put code to copy fcstab[] and
2687 set CM_ARG in each flags field.  Works fine, and now we know how to make a
2688 switch that takes multiple arguments.  ckuus6.c, 24 Apr 2006.
2689
2690 I thought I had a function to convert the character set of a string but I
2691 don't, so actually implementing /CONVERT: will be difficult.
2692
2693 Actually the parsing wasn't that easy either.  It works OK interactively,
2694 but not in a TAKE file.  To make a long story short, I had to change
2695 gtword() and cmkey2() to not require "/" at the beginning of a switch, and
2696 then to parse arguments-that-are-followed-by-other-arguments as if they were
2697 switches, so that they can end with colon rather than space.  This might
2698 seem dangerous, but switches always have "/" at the beginning, so the check
2699 is superfluous.  ckucmd.c, 26 Apr 2006.
2700
2701 Back to /CONVERT...  Once I was able to get the code to call cvtstring() I
2702 was able to debug it (at first it was skipping every second character).  And
2703 now we have a general-purpose string-translating function we can call from
2704 anywhere.  Requires that C-Kermit be built with Unicode support.
2705 ckuus6.c, 26 Apr 2006.
2706
2707 Added SHOW RENAME.  ckuusr.h, ckuus[r5].c, 26 Apr 2006.
2708
2709 Conditionalized some Unix/Windows assumptions in renameone() so the code
2710 could work in VMS.  ckuus6.c, 2 May 2006.
2711
2712 Added RENAME /FIXSPACES to change all spaces in the filename(s) to
2713 underscore or any other character or string that is given.  This is just a
2714 special case of RENAME /REPLACE:{{ }{x}} with easier syntax.
2715 ckuusr.h, ckuus6.c, 2 May 2006.
2716
2717 Added an "all-but" control to the /REPLACE options:
2718 /REPLACE:{{.}{_}{~1}} means replace all but the first (this one works);
2719 /REPLACE:{{.}{_}{~-1}} means replace all but the last (this one not yet).
2720 ckuus6.c, 2 May 2006.
2721
2722 Filled in the second one ("all but" the given occurrence).  The algorithm is
2723 simply to reverse the three strings and then use the same code as we use in
2724 the left-right-case, and then unreverse the result.  At first I used
2725 yystring() for this but yikes, what a bad design!  So I made a better
2726 string-reversal routine, gnirts(), for this (luckily yystring() is only used
2727 in one place, for which its design is appropriate). ckuus6.c, 3-4 May 2006.
2728
2729 Added code to handle the case where the file being renamed includes a path
2730 specification.  In this case we separate the path, apply the renaming
2731 functions to the filename only, and then at the end rejoin the original
2732 filename with the path, and join the new name with same path or, if a
2733 destination directory was given, with that.  ckuus6.c, 4 May 2006.
2734
2735 Added HELP SET RENAME and updated HELP RENAME.  ckuus2.c, 4 May 2006.
2736
2737 "Tom Violin" (Tom Hansen) noticed that the first time you FOPEN a file,
2738 Kermit's memory consumption goes way up.  In fact there's a warning to that
2739 effect in the code, where, upon first open, a potentially big array of
2740 potentially big structs is allocated.  I rewrote the code to allocate each
2741 array member (struct ckz_file) as needed, i.e. when a file is opened, and to
2742 free it when the file is closed (or the open fails).  This was actually
2743 quite a lot of work, which is why I didn't do it the first time around:
2744 every single "."  had to be changed to "->".  Every check for a valid
2745 channel first had to check if the channel's struct was allocated and every
2746 other reference to z_file[i]->anything had to be prechecked that z_file[i]
2747 was not a NULL pointer.  Also I made some improvements to FILE STATUS, and I
2748 fixed FILE CLOSE to default the channel number if only one channel was open,
2749 as I did for FILE STATUS a while back.  ckuus7.c, Cinco de mayo 2006.
2750
2751 Ran my old BUILDS script that builds C-Kermit with about 100 different
2752 combinations of feature-selection switches.  Fixed a few small glitches so
2753 now they all build OK (except can't do NOANSI builds any more on recent
2754 Linuxes because of varargs()).  ckuus3.c, ckuus5.c, ckuus6.c, ckuus7.c,
2755 ckucmd.c, ckcfns.c, 6 May 2006.
2756
2757 Fixed RENAME /LOWER and /UPPER, when given with no colon or agrument, to
2758 default to ALL.  ckuus6.c, 13 May 2006.
2759
2760 Built on VMS 7.2-1, tested new RENAME command there; seems to be OK.
2761 13 May 2006.
2762
2763 --- Dev.18 ---
2764
2765 I wanted to test large files against RESEND but I don't have access to any
2766 system that can run C-Kermit and that also has enough space for a large
2767 file.  I created a "fake" large file on Linux (3G hole plus 1 byte), and
2768 sent it over a localhost connection, and interrupted it repeatedly and then
2769 initiated a RESEND at the sender.  In each case, it picked up where it left
2770 off.  But before the 2G boundary was crossed the disk filled up.
2771 Inconclusive.  14 May 2006.
2772
2773 PeterE got a warning in the new FILE OPEN code when building in HP-UX 9.
2774 I added a cast, built on HP-UX 11, no more complaint.  However there
2775 are warnings about internal vs external bindings of sendpath and sendfile
2776 in every module.  Too bad, these are not Kermit tokens, it's a conflict in
2777 HP's header files.  Marc Sapiro doesn't see them; probably it's something
2778 on the HP testdrive site.  ckuus7.c, 17 May 2006.
2779
2780 Fixed the tru64-51b+openssl target -- the terminating doublequote of KFLAGS
2781 was missing -- and also the osf target, which failed to import the LIBS
2782 definition from whatever other target invoked it.  Now the SSL build goes OK
2783 on Tru64 5.1B.  Replaced x.tar.z in the download areas without declaring a
2784 new Dev number.  The new one has a makefile with today's date.  Software
2785 engineering at its best!  makefile, 18 May 2006.
2786
2787 Scott Kasten noted that the estimated-time-remaining calculation would go
2788 bonkers on LFS systems when RESENDing a large file.  It looks like the
2789 shocps() and shoetl() functions escaped the CK_OFF_T conversion.  I made
2790 what seemed to be the right adjustments, and then was lucky enough to find a
2791 computer that had enough free disk space for me to send a large file,
2792 interrupt it several times, resend it, all seems to be OK.  28 May 2006.
2793 Later Scott verified these changes independently for Linux, but the problems
2794 in IRIX remain.
2795
2796 Patches from Scott Kasten for large files on IRIX 6.5: ckcdeb.h, makefile,
2797 12 Jun 2006.
2798
2799 --- Dev.19 ---
2800
2801 Added a new function for dealing with JPGs and GIFs:
2802
2803 \fpicture(filename,&a)
2804   returns 0 if file not recognized or can't be opened;
2805   returns 1 if landscape, 2 if portrait or square.
2806   If array given, element 1 is width, element 2 is height.
2807
2808 ckuusr.h, ckuus4.c, 19 Jun 2006.
2809
2810 Scott Kasten reports that the FTP client can transfer large files OK, at
2811 least in Linux, but has trouble with recovery:
2812
2813  . Kermit takes a very long time to start the transfer, sometimes over
2814    30 minutes.  Suspect the ftp server is counting the bytes in a long file?
2815    Or maybe it's a text-mode transfer and it's counting the lines?  Probably
2816    in response to Kermit's SIZE command.
2817
2818  . The size shown in the FT display is wrong by a random amount.  And of
2819    course so are the progress bar, percent done, and time remaining.
2820
2821  . The file, however, is transferred correctly.  REGET works correctly too.
2822
2823 I tried setting up a test scenario locally but our Solaris FTP server does
2824 not support large files:
2825
2826   FTP SENT [SIZE BIGFILE]
2827   FTP RCVD [550 BIGFILE: not a plain file.]
2828   FTP SENT [PASV]
2829   FTP RCVD [227 Entering Passive Mode (128,59,48,24,246,37)]
2830   FTP SENT [RETR BIGFILE]
2831   FTP RCVD [550 BIGFILE: Value too large for defined data type.]
2832
2833 Created the same 3GB on a Tru64 Unix system that allows FTP access.  Made
2834 the connection from C-Kermit on Solaris (32-bit with LFS):
2835
2836   16:46:12.908 FTP SENT [SIZE BIGFILE]
2837   16:46:12.947 FTP RCVD [213 3000000001]
2838
2839 Note that it takes less than half a second to get the reply.  Now I start
2840 the download and then interrupt it at about 2%:
2841
2842   16:46:12.979 FTP SENT [TYPE I]
2843   16:46:13.174 FTP RCVD [200 Type set to I.]
2844   16:46:13.226 FTP SENT [PASV]
2845   16:46:13.262 FTP RCVD [227 Entering Passive Mode (15,170,178,171,11,37)]
2846   16:46:13.299 FTP SENT [RETR BIGFILE]
2847   16:46:13.337 FTP RCVD [150 Opening BINARY mode data connection for BIGFILE..]
2848   16:47:24.895 FTP RCVD [426 Transfer aborted. Data connection closed.]
2849   16:47:24.934 FTP RCVD [226 Abort successful]
2850   16:47:24.991 FTP SENT [MDTM BIGFILE]
2851   16:47:25.028 FTP RCVD [213 20060706204458]
2852
2853 Now I do a REGET:
2854
2855   16:51:55.321 FTP SENT [PASV]
2856   16:51:55.357 FTP RCVD [227 Entering Passive Mode (15,170,178,171,11,43)]
2857   16:51:55.394 FTP SENT [REST 122736640]
2858   16:51:55.430 FTP RCVD [350 Restarting at 122736640. Send STORE or RETRIEVE..]
2859   16:51:55.431 FTP SENT [RETR BIGFILE]
2860   16:51:55.469 FTP RCVD [150 Opening BINARY mode data connection for BIGFILE..]
2861
2862 This worked perfectly, as far as I can tell; the FT display picked up in the
2863 right place; the thermometer, percent done, and estimated time remaining
2864 were the same as when we left off last time.  I did the same thing several
2865 more times, everything was OK.  It would have taken a really long time to
2866 let this run to completion, but I think this demonstrates that Scott's
2867 symptoms are server-dependent.  No changes.  6 July 2006.
2868
2869 Checked current code on VMS 8.2-1 on IA64 / UCX 5.5, builds fine.
2870 No changes.  Updated listing at HP.  6 July 2006.
2871
2872 Checked FTP GET of large file in ASCII mode against Tru64 FTP server.  It
2873 was fine, and there was no delay in the server's response to our SIZE command
2874 (as there would be if it were scanning the entire file to count how many
2875 bytes would be required to send it in text mode).  7 Jul 2006.
2876
2877 Tested FTP PUT big file against Tru64, OK.  Ditto FTP RESEND big file:
2878
2879   C-Kermit>resend BIGFILE
2880    PUT BIGFILE (binary) (3000000001 bytes)---> PASV
2881   227 Entering Passive Mode (15,170,178,171,13,186)
2882   ---> SIZE BIGFILE
2883   213 343211280
2884   ---> MDTM BIGFILE
2885   213 20060707141243
2886   ---> APPE BIGFILE
2887   150 Opening BINARY mode data connection for BIGFILE (128.59.59.56,45470).
2888
2889 Made REPUT a synonym for RESEND.  ckuusr.c, 7 Jul 2006.
2890
2891 Added FTP REPUT and FTP RESEND since previously there was no FTP-prefixed
2892 command for recovering uploads, only the regular RESEND command, which might
2893 not have been obvious to people.  ckcftp.c, 7 Jul 2006.
2894
2895 Added help text for FTP RESEND and REPUT and amended RESEND help text.
2896 ckcftp.c, ckuus2.c, 7 Jul 2006.
2897
2898 Changed name of \fpicture() to \fpictureinfo() and added help text.  By the
2899 way, ImageMagick can do this too: identify -format "%w %h" dscf0520.jpg.
2900 The advantage of having it in Kermit is that not everybody has ImageMagick.
2901 ckuus[24].c, 7 Jul 2006.
2902
2903 Changed the numeric comparisons = < > <= >= != to allow long integers by
2904 changing the data type to CK_OFF_T, etc.  ckuus6.c, 7 Jul 2006.
2905
2906 Noticed that \fkeywordvalue(foo=this is a string) only kept the first word.
2907 Fixed it to keep the whole definition.  Also added \fkwvalue() as a briefer
2908 synomym.  ckuus4.c, 7 Jul 2006
2909
2910 Sometimes we want to check if a file's status before we've FOPEN'd it, in
2911 which case the channel variable is likely to be empty and \f_status(\%c)
2912 would get an error.  Making the obvious change didn't fix this, however.  It
2913 turns out that the function evaluator failed to adjust argn (argument count)
2914 when trailing arguments were empty, and argn was being used in this case,
2915 and probably others, to test whether an argument existed.  I added code to
2916 adjust argn to reflect the number of aruments up to and including the
2917 rightmost non-empty one.  ckuus4.c, 7 Jul 2006.
2918
2919 Fixed \fstripb() to not dump core if second argument is missing.
2920 ckuus4.c, 7 Jul 2006.
2921
2922 Discovered that it was not obvious what pattern to use to match strings
2923 enclosed in square brackets.  "if match [abc] \[*\]" didn't work.  Neither
2924 did various other tricks like NCRs for the brackets.  However, "if match
2925 [abc] \\[*\\]" does work.  Trying to fix this would no doubt break 100 other
2926 things, so let's call it a feature.  7 Jul 2006.
2927
2928 Added \fgetpidinfo(n) to return info about a process ID; for now it simply
2929 returns 1 if the process is alive and 0 if not (or -1 if the argument is
2930 bad or missing or on any kind of error).  ckuusr.h, ckuus[24].c, 7 Jul 2006.
2931
2932 The "where-did-my-file-go" message seemed to be ending with a LF rather
2933 than CRLF, probably because the terminal modes had not yet been restored,
2934 leaving the next prompt hanging below it, rather than on the left margin,
2935 if C-Kermit exited immediately after the transfer.  Fixed by changing
2936 all \n's to \r\n's in wheremsg(): ckcpro.w, 8 Jul 2006.
2937
2938 Added \v(lastkwval) so we can retrieve programmatically the keyword most
2939 recently processed by \fkeywordval().  ckuusr.h, ckuus4.c, 9 Jul 2006.
2940
2941 --- Dev.20 ---
2942
2943 Added #ifdef SV68, #include <unistd.h>, #endif because Unix System V/68 on
2944 Motorola choked on the SEEK_CUR reference without it.  ckuus4.c, 10 Jul 2006.
2945
2946 Make \fkeywordval(xxx) undefine xxx (i.e. when a keyword is given with no
2947 value).  This way command-line keywords will always override preexisting
2948 default definitions, whether they have a value or not, which makes it easier
2949 to parse command lines like "foo=bar blah xx=yy".  ckuus[24].c, 12 Jul 2006.
2950
2951 On 29 Nov 2005 I changed IF KERBANG to solve a problem (see entry for that
2952 date), but introduced a new one; namely that you can't have (e.g.)  a FATAL
2953 macro that uses IF KERBANG to decide whether to EXIT all the way or STOP
2954 back to the prompt.  Changed it again, this time to require not that the
2955 command level be 1, but that the command *file* level be 0 (i.e. that we are
2956 in the top-level command file, irrespective of the command or macro level,
2957 but not in a subfile).  ckuus6.c, 12 Jul 2006.
2958
2959 It is unhelpful when Kermit gets a syntax error in the middle of a big
2960 compound statement block (e.g. FOR or WHILE loop) and dumps out the whole
2961 thing in an error message.  I changed the two places where this can happen
2962 to call a new routine that, instead of dumping out the entire cmdbuf,
2963 checks its length first and if it's more than a line long, truncates it
2964 and adds an ellipsis.  ckuus6.c, 12 Jul 2006.
2965
2966 The new RENAME command didn't give very good error messages, e.g. if the
2967 filespec didn't match any files.  Fixed in dorenam(): ckuus6.c, 12 Jul 2006.
2968
2969 Fixed DIR /TOP to work if the /TOP:n argument was omitted, defaulting
2970 to 10.  domydir(): ckuus6.c, 12 Jul 2006.
2971
2972 Added DIR /COUNT:v to count the number of files that match the given
2973 criteria and store result in the variable v.  ckuusr.h, ckuus[r26].c,
2974 24 Aug 2006.
2975
2976 Added HDIRECTORY as an invisible synonym for DIR /SORT:SIZE /REVERSE.
2977 Can be used with other switches, of course, so (e.g.) HD /TOP shows the
2978 ten biggest files.  ckuusr.h, ckuus[r26].c, 24 Aug 2006.
2979
2980 DIR /FOLLOWLINKS and /NOFOLLOWLINKS always did the same thing; the switch
2981 was ignored, a symlink is always followed.  Fixed in ckuus6.c, 24 Aug 2006.
2982
2983 Added DIR /NOLINKS, which means don't show or count symlinks at all.
2984 ckuusr.h, ckuus[r26].c, 24 Aug 2006.
2985
2986 Build on Solaris 9 and NetBSD 3.0, 24 Aug 2006.
2987
2988 Added a missing definition for LOCK_DIR in the Linux HAVE_BAUDBOY case,
2989 suggested by Gerry Belanger.  ckutio.c, 6 Oct 2006.
2990
2991 Suggested by Jim Crapuchettes: \v(dialmessage) is the text string
2992 corresponding to \v(dialstatus).  ckuusr.h, ckuus4.c, 6 Oct 2006.
2993
2994 Soewono Effendi sent code for exit sequence to leave DTR on; this amounted
2995 to unsetting HPUCL in c_cflag.  I did it a simpler way, hopefully portable
2996 to all Unixes, but who knows at this late date.  The code is inside
2997 #ifndef CK_NOHUPCL..#endif in case it causes trouble.  It is executed if
2998 SET EXIT HANGUP is OFF and a serial port was open at the time Kermit exits
2999 (or closes it explicitly).  ttclos(): ckutio.c, 6 Oct 2006.
3000
3001 Built on Solaris9/Sparc; FreeBSD 6.2/AMD64; NetBSD 3.0/i386; HP-UX 11i v2;
3002 SCO OSR6.00.
3003
3004 --- Dev.21 ---
3005
3006 Added netbsd+openssl target to makefile.  Built OK (NetBSD 3.0, OpenSSL
3007 0.9.7d) except with some warnings in ck_crp.c.  Connects and logs in OK to a
3008 secure site.  10 Oct 2006.
3009
3010 Added a debug statement to ftp_hookup() to record the TCP port that was used.
3011 ckcftp.c, 11 Oct 2006.
3012
3013 Built with OpenSSL 0.9.7l on Solaris 9.  Built with OpenSSL 0.9.8d on
3014 Solaris 9; connects and logs in to a secure site.  11 Oct 2006.
3015
3016 The new RENAME command didn't work if both the source and destination names
3017 included directory segments, e.g. "rename /tmp/foo ~/bar" (see notes of
3018 4 May 2006).  This was fixed in renameone() by a special case in which
3019 the second argument is given but it is a filename, not a directory name.
3020 ckuus6.c, 11 Oct 2006.
3021
3022 Fixed unguarded reference to dialmsg[] for \fdialmessage(), noticed by
3023 Gerry Belanger.  ckuus4.c, 12 Oct 2006.
3024
3025 Added a TOUCH command that does what UNIX touch does: creates the file if it
3026 does not exist, updates the timestamp if it does.  If a wildcard is given,
3027 it operates only on existing files.  It shares the DIRECTORY command parser,
3028 so all the same file selection switches can be given.  ckuusr.[ch],
3029 ckuus[26].c, 12 Oct 2006.
3030
3031 PeterE noticed that if you FOPEN a file, do some seeks or reads, then FCLOSE
3032 it, then FOPEN it again (or open a different one), some of the old
3033 information is still there (e.g. current line number).  This is an artifact
3034 of the changes of May 4th.  Now the file closing and opening routines are a
3035 bit more careful about scrubbing and initializing the file info struct.
3036 ckuus7.c, 12 Oct 2006.
3037
3038 --- Dev.22 ---
3039
3040 Built OK on Red Hat Linux AS4 with both "make linux" and "make linuxnc". 
3041 15 Oct 2006.
3042
3043 DIRECTORY /BRIEF ignored file selection switches and always listed all
3044 files.  This was because of how I cleverly called filhelp() (the routine
3045 that lists matching files when ? is typed in a filename field) and, of
3046 course, filhelp() doesn't know anything about the DIRECTORY command's file
3047 selections.  Changed filhelp() to accept all the args needed for passing
3048 along to fileselect(), renamed it to xfilhelp(), and made a filhelp() stub
3049 that chains to xfilhelp() with null selections.  ckcker.h, ckucmd.[ch],
3050 ckuus6.c, 29 Nov 2006.
3051
3052 SHOW CONNECTION for an SSH connection said the connection type was "NET"
3053 rather than "SSH".  Fixed in dolognet(): ckuus3.c, 29 Nov 2006.
3054
3055 SHOW CONNECTION didn't show the TCP port number.  This command works by
3056 parsing the current connection log entry string, which doesn't have a field
3057 for this, but which sometimes shows the port number as part of the hostname
3058 (but more often not).  Added code to dolognet() to log the TCP port number,
3059 if known.  This involved adding a gettcpport() function to ckcnet.c.
3060 ckcnet.[ch], ckuus3.c, 29 Nov 2006.
3061
3062 This was impossible: def \%1 upper, echo \f\%1(abc) -- i.e. to "compose" a
3063 function name.  Fixed in zzstring().  But note that it's still not possible
3064 to do this: def \%1 \fupper, echo \%1(abc) -- because at the point where
3065 "\fupper" is encountered, which is automatically fed to fneval(), the
3066 argument list hasn't been read yet.  ckuus4.c, 29 Nov 2006.
3067
3068 The meaningless Lisp command (=) would cause Kermit to hang.  Due to some
3069 idiosyncracy in the parser, it would see this as ((=) and would go into
3070 "wait for the closing paren" mode.  There was already a hack in the code to
3071 compensate for this, but it didn't work.  I fixed the hack but I don't
3072 understand the real problem.  Anyway, comparing Kermit with real (Franz)
3073 Lisp I discovered that comparison operators do not require two arguments, as
3074 Kermit has been doing, although they do require at least one.  I changed
3075 Kermit to not require two, so now all the comparison predicates behave
3076 exactly like Franz Lisp, including getting an error if there are no args).
3077 ckuus[r3].c, 29 Nov 2006.
3078
3079 From to-do list: Make a way to inhibit pattern matching in SWITCH labels.
3080 It's already there; just quote the wildcard characters; the only trick is
3081 that for some reason (such as that SWITCH is really an internally defined
3082 macro), a double quote is needed:
3083
3084   switch \%1 {
3085     :a\\*z, echo literally "a*z", break
3086     :abcxyz, echo literally "abcxyz", break
3087     :a*z, echo a...z, break
3088     :default, echo NO MATCH
3089   }
3090
3091 In first case, the asterisk is taken literally; in the third it's a
3092 metacharacter and the label matches any string that starts with 'a' and
3093 ends with 'z'.
3094
3095 Array initializion would quit early if any initializers were undefined,
3096 e.g. "decl \&a[] = \%a \%b \%c" would stop at the first element if \%b
3097 was not defined, even though \%c might be defined.  Fixed in dodcl():
3098 ckuusr.c, 30 Nov 2006.
3099
3100 DIR /ARRAY:a filespec, when the filespec does not match any files,
3101 terminates with the array undeclared.  It would be better to return a
3102 declared but empty array (\&a[0] = 0).  The code is already there to do
3103 that, but isn't working.  And yet "declare \&a[0]" does indeed create a
3104 0-element array ("show array" shows a dimension of 0).  Turns out there were
3105 two problems; one was the careless recycling of a local variable ("array"),
3106 resulting in failure to create \&a[] (but not any other array).  Fixed in
3107 domydir(): ckuus6.c, 30 Nov 2006.
3108
3109 The other problem was that dclarray(), when called with an array name and a
3110 dimension of zero, does two different things depending on whether the array
3111 already existed.  There is still a fair amount of confusion about whether a
3112 dimension of 0 indicates an array with 1 element (as it should) or a
3113 nonexistent array.  We call dclarray() with a size of 0 to undeclare an
3114 array but we also need to able able to declare an array with only element 0.
3115 I changed dclarray() to treat a negative dimension as a command to destroy
3116 the array, and 0 or positive as a command to create the array with the given
3117 dimension.  ckuus[r56].c, 30 Nov 2006.
3118
3119 Next problem: when chkarray() returns 0, this should not be interpreted to
3120 mean the array does not exist.  Looks like the only place this happened was
3121 in \fcontents(); fixed in ckuus4.c, 30 Nov 2006.
3122
3123 If we include file selectors with DIR /ARRAY:&a and some of the files that
3124 match the given filespec but don't fit the selectors, the array's dimension
3125 is bigger than its number of elements.  Added code at the end of domydir()
3126 to resize the array so \fdim() returns the number of filenames in the array,
3127 and also made sure that element 0 contains that number too.  ckuus6.c,
3128 30 Nov 2006.
3129
3130 This would be a nice elegant way to loop over a bunch of files, if it worked:
3131
3132   for \%i 1 \ffiles(*) 1 { rename \fnextfile() xxx_\flpad(\%i,3,0) }
3133
3134 But in this loop, Kermit skips every other file (beginning with the first)
3135 and then runs out of files halfway through the loop.  Why?  Because in
3136 commands like RENAME and DELETE, the filename parser is in a chained FDB
3137 with the switch parser.  First the switch parser, cmswi(), gets its hands on
3138 \fnextfile(), passing it through the evaluator and thus getting the first
3139 filename, which it then sees is not a switch, so now the field is parsed by
3140 the next parser in the chain, cmifi(), which causes \fnextfile() to be 
3141 executed again.  In fact, the FOR loop has nothing to do with; the same
3142 thing happens like this:
3143
3144   void \ffiles(*)
3145   delete \fnextfile()
3146
3147 This deletes not the first file, but the second one.  Obviously users can be
3148 told not to refer to \fnextfile() in chained-fdb fields:
3149
3150   for \%i 1 \ffiles(*) 1 { .f := \fnextfile(), delete \m(f) }
3151
3152 but this is hardly intuitive.  I had some clever ideas of how to make
3153 \fnextfile() work as expected in this context but it's way too much magic.
3154 Better to simply document that \fnextfile() is "deprecated" and the array
3155 format should be used:
3156
3157   for \%i 1 \ffiles(*,&a) 1 { delete \&a[\%i] }
3158
3159 The difference is, an array element doesn't change every time it's referred to!
3160
3161 Added a /PRESERVE switch to the COPY command to preserve the timestamp and
3162 permissions of the file.  I did this using the Kermit APIs so it should work
3163 for any version of C-Kermit or K95.  ckuus[26].c, 30 Nov 2006.
3164
3165 Added COPY /OVERWRITE:{ALWAYS,NEVER,OLDER,NEWER} to control name collisions
3166 when copying across directories.  ckuus[26].c, 1 Dec 2006.
3167
3168 --- Dev.23 ---
3169
3170 Fixed a bug in SET TELNET PROMPT-FOR-USERID, SET AUTH KERBEROS[45] PROMPT,
3171 and SET AUTH SRP PROMPT in which the user's string was compared with a
3172 literal (s == ""), reported by Pavol Rusnak.  Worse, empty strings (if the
3173 test succeeded) were turned into null pointers, and then fed to strlen().
3174 Fixed in ckuus3.c, 5 Dec 2006.
3175
3176 Added an optional 4th argument to \findex(), \frindex(), \fsearch(), and
3177 \frsearch(): the desired occurrence number of the searched-for string.
3178 \frsearch() was a bit tricky.  ckuus[24].c, 7 Dec 2006.
3179
3180 Added \fcount(s1,s2) to tell the number of occurrences of s1 in s2.
3181 ckuus[24].c, 8 Dec 2006.
3182
3183 Added \ffunction(s1) to tell if a given built-in function is available.
3184 ckuus[24].c, 8 Dec 2006.
3185
3186 Changed RENAME /COLLISION:PROCEED to be /COLLISION:SKIP, which is clearer.
3187 ckuus[26].c, 8 Dec 2006.
3188
3189 For communication protocols: INPUT /COUNT:n to read exactly n characters
3190 without any matching.  Can be used, for example, with CONTENT_LENGTH in CGI
3191 scripts; NUL characters are counted but not collected.  ckuusr.[ch],
3192 ckuus4.c, 8 Dec 2006.
3193
3194 There was a bad bug in the date-parsing routines; it's been there for years.
3195 If a date string includes a timezone, e.g. "Sat, 9 Dec 2006 19:26:23 EST",
3196 and converting to GMT changes the date, the variables for day, month, and
3197 year (which are used later) were not updated, and the final result was a day
3198 off.  Fixed in cmcvtdate(): ckucmd.c, 10 Dec 2006.
3199
3200 Built OK with SSL/TLS.  Tested with the POP script, found that I broke INPUT
3201 when adding the /COUNT feature; there was a path through the code that could
3202 leave the "anychar" variable unset and therefore random.  Fixed in
3203 doinput().  The POP script, which does not use /COUNT, works again and so
3204 does a new CGI script, which does use /COUNT.  ckuus4.c, 10 Dec 2006.
3205
3206 Supplied a missing comma in the help-text array for HELP SET TERMINAL, which
3207 resulted in bad formatting in K95 around SET SNI-FIRMWARE-VERSIONS.
3208 ckuus2.c, 10 Dec 2006.
3209
3210 Made "help locus" a synonym for "help set locus".  ckuusr.[ch], ckuus2.c,
3211 11 Dec 2006.
3212
3213 This morning the Columbia FTP server was malfunctioning in a perfect way
3214 for me to implement and test an FTP timeout mechanism.  The server would
3215 close the data connection after sending the file, but the client never saw
3216 the close and was stuck forever in a recv().  I added code to do a select()
3217 on the data connection prior to entering the recv(), with a timeout on the
3218 select() that the user can establish with SET FTP TIMEOUT.  Built and tested
3219 on Solaris 9, clear-text FTP.  Also built cleanly for FTPS and tested
3220 against a server that does not hang; I don't have access to an FTPS server
3221 that would tickle the timeout code.  ckcftp.c, 11 Dec 2006.
3222
3223 --- Dev.24 ---
3224
3225 Fixed a bug in the INPUT /COUNT: parser: the array of search strings was
3226 never initialized, which didn't matter before, but with /COUNT:, if the
3227 first element was not a NULL pointer, we'd treat it as a search string, and
3228 then if it happened to match something in the input stream, the operation
3229 would stop before the count was exhausted.  Fixed by (a) initializing the
3230 array, and (b) ignoring any search strings if /COUNT: was given.  ckuusr.c,
3231 13 Dec 2006.
3232
3233 Removed a debug() statement from zsattr() that suddenly started making some
3234 version of gcc complain, reported by Gerry Belanger.  ckufio.c, 13 Dec 2006.
3235
3236 --- Dev.25 ---
3237
3238 Some casts for the 3 interior args of the new select() call in ckcftp.c
3239 for HP-UX 9.  14 Dec 2006.
3240
3241 Changed \fkeywordvalue() to accept a string rather than a single word
3242 as its second argument, so that more than one separator could be specified,
3243 and to return -1 on error, 0 if it found nothing, 1 if given a kewyord but
3244 no value, and 2 if there was a keyword and a value.  dokwval(): ckuus[24].c,
3245 14 Dec 2006.
3246
3247 Checked FTP timeout on command channel with FTP DIRECTORY of a big directory
3248 using a path into our ftp server that preserves the hanging behavior.  The
3249 timeout was actually working, but the failure condition wasn't propogating
3250 back to the user, and there was no error message.  Fixed in doftprecv2() and
3251 failftprecv2(): ckcftp.c, 15 Dec 2006.
3252
3253 Added the obvious timeout checks for FTP uploads, but I have no way to test
3254 the code since our misbehaving FTP server does not hang when receiving
3255 files, only when sending them.  But uploads work both with and without a
3256 timeout set, so at least no harm is done.  ckcftp.c, 17 Dec 2006.
3257
3258 When downloading with FILE DESTINATION NOWHERE (= /CALIBRATE), Kermit still
3259 checked the size of the incoming file and refused it if there wasn't enough
3260 free disk space, on platforms (such as VMS) where zchkspa()) actually works;
3261 reported by Bob Gezelter.  ckcfn3.c, 18 Dec 2006.
3262
3263 Built on Mac OS X 10.4.8 and NetBSD 3.1_RC3, all OK.  19 Dec 2006.
3264
3265 --- Dev.26 ---
3266
3267 Built on VMS 7.3-2/Alpha.  Had to squelch a couple compiler warnings by
3268 changing some ints in the new \fpictureinfo() code from unsigned to signed,
3269 and fix a typo in the prototype for the new gettcpport() function.
3270 ckcnet.h, ckuus4.c, 22 Dec 2006.
3271
3272 --- Dev.27 ---
3273
3274 Parameterized pty routines and all references to them for file descriptor,
3275 rather than to use global ttyfd, thus allowing ptys to be created for
3276 different purposes.  Tested on Solaris 9 and Mac OS X 10.4.8, with "set host
3277 /connect /pty emacs" (fine in both cases), and (more to the point) "set host
3278 /connect /pty kermit" -- here we make a connection from one Kermit process
3279 to another and transfer a file; works fine and wasn't especially slow either;
3280 a good sign.  ckcdeb.h, ckutio.c, ckupty.c, 22 Dec 2006.
3281
3282 Created a new version of ttruncmd() called ttyptycmd(), which works by
3283 calling do_pty() to get a pty to run the command on, and then in a loop,
3284 reads from the pty and writes to the net and reads from the net and writes
3285 to the pty, using select() to which of those it should do on each pass.
3286 First cut just uses single-byte reads and writes.  Tested using Kermit
3287 itself as an external protocol.  Works but slowly: 6000cps.  Zmodem doesn't
3288 work at all.  ckutio.c, 24 Dec 2006.
3289
3290 Changed single-character read() and write() to buffered reads and writes,
3291 with ttxin() and ttol() used for network i/o.  Using Kermit as the external
3292 protocol, this gives 450Kcps (about 1/3 normal on this connection).  
3293
3294 But now there's a problem: the loop doesn't know when to stop.  How does it
3295 know when the process that is running on the pty has exited?  With single
3296 character read()'s that are executed unconditionally when select() says the
3297 pty has data waiting, as in the first pass, I get EIO if there actually
3298 isn't any, and can exit the loop.  But now, to avoid blocking, I call
3299 in_chk() to see how much data is waiting, and I don't try to read anything
3300 if it says nothing is waiting.  If the process associated with the pty file
3301 descriptor has terminated, in_chk() would presumably get some kind of error,
3302 but it doesn't.  I changed do_pty to return the pid of the fork where it
3303 execs its command so we can check the pid with kill(pid,0) when in_chk() of
3304 the pty says 0, but this doesn't help either; it seems like the process is
3305 not exiting, but of course it is.
3306
3307 I could not find any legitimate way to test when the pty fork terminated.
3308 Select() always says the pty file descriptor was ready, no matter what.
3309 Select() never reports an exception on the pty file descriptor;
3310 in_chk(ptyfd) returns 0 and not an error.  read(ptyfd,...) gets 0 but not an
3311 error.  fcntl(ptyfd,...) doesn't get an error.  Finally I tried
3312 write(ptyfd,c,0) and this indeed gets EIO (i/o error).  With this, using
3313 Kermit as the external protocol works fine in Solaris but I tend to think
3314 this trick will not be very portable (it isn't).  24 Dec 2006.
3315
3316 Made ttptycmd() use a more intelligent buffering scheme, fixed a few things
3317 about how I was setting up the select() call that should address some of
3318 yesterday's problems.  Still doesn't work but it's progress.  A: 25 Dec 2006.
3319
3320 Debugging yesterday's code...  Still, the error conditions are never set,
3321 we never detect when the pty closes.  In Solaris, if select() says ptyfd is
3322 ready to read but in_chk() says there are no characters there, we can treat
3323 this as a loop-exit condition.  But in NetBSD, in_chk() always says 0 when
3324 used on a pty (but works OK on a serial or net connection).
3325
3326 Realized I could not use in_chk() on the pty because there is too much
3327 baggage with the communication path -- myread(), etc etc) -- so I replaced
3328 this with a simple ioctl(ptyfd,FIONREAD,&n).  This works fine in Solaris but
3329 always returns 0 in NetBSD, despite what the man page says (i.e. that this
3330 function can be used on any file descriptor).
3331
3332 OK, let's see.... select() does not return useful results.  It says
3333 characters are waiting on ptyfd when they are not, and it never detects the
3334 closure of the pty.....  Well of course not, because we are the ones who
3335 have to close it.  Just because the process has stopped doesn't mean the pty
3336 is closed.  So we're back to square one, how do we know when to close it?
3337 ckupty.c seems to keep the process ID in a global variable, pty_fork_pid
3338 (which is not the same as the pid now returned by do_pty(), which is
3339 useless, but I don't understand why).  But it doesn't matter because when we
3340 kill(pty_fork_pid,0), we still get no error of any kind, even after we know
3341 the process has exited.  I am completely flummoxed.  select() lies, and even
3342 if it didn't, there is simply no completion criterion.  In the loop,
3343 select() always says that the pty is ready to read.  To be continued.
3344 26 Dec 2006.
3345
3346 Back to Square One, single-byte reads and writes.
3347
3348  . This works for both ripple and Kermit.
3349  . Doesn't work for Zmodem but we'll deal with that later.
3350  . In this case FD_ISSET(ptyfd) is still true after pty closes.
3351
3352 But the ensuing read() gets EIO so we know the pty is gone.  That means the
3353 same thing should happen in the buffered version, no?  Yes; I went back to
3354 the buffered version and replaced all the other nonworking tests by a
3355 blocking read of 1 byte on the pty and this detects the termination.  Now:
3356
3357  . ripple works perfectly (of course it's only one-way).
3358  . Kermit fails
3359
3360 Let's call the remote, forked, redirected, external Kermit A and its
3361 local partner B.  A sends its S-packet, B receives it OK and Acks.
3362 A apparently does not receive the ACK in time, so sends the S again, but OK.
3363 followed immediately by the F.  B Acks the F.  A sends the A, B Acks it.
3364 But now A sends a piece of the previous F packet and the the first piece
3365 of a D packet.
3366
3367 Clearly the buffering is messed up.  Sure enough, there was an extraneous
3368 statement incrementing a read pointer in a write section.  Removing that
3369 cleared up the problems with Kermit, now we can send and receive substantial
3370 files efficiently in remote mode.  Zmodem seems to work too, except that at
3371 the beginning a bunch of "**B0800000000022d"'s are stuffed into Kermit's
3372 command buffer, so after the transfer we get some error messages.
3373
3374 In local mode, over a Telnet connection, Kermit works fine.  Zmodem works
3375 OK too except it doesn't finish right, so at the very end rz on the far end
3376 is still waiting for something; if I cancel out of it with ^X^X^X^X^X, it
3377 deletes the file.  So there still is something wrong with the termination
3378 test.
3379
3380 Also you don't see anything on your screen when running Kermit or Zmodem
3381 this way.  That's to be expected, since they are using stdio for the
3382 transfer, so they can't also be displaying progress or other messages.
3383
3384 Built this on NetBSD again...  Seems to work this time, but has trouble
3385 finishing, like Zmodem.  Hmmm, on closer examination, it turns out that
3386 since in_chk() always returns 0 on the ptyfd, we fall into our new
3387 single-byte read code, so it's really slow, like 10K cps on a connection
3388 where 1M is the norm.  27 Dec 2006.
3389
3390 Switched the pty from buffer peeking (FIONREAD) and blocking reads to to
3391 nonblocking reads (O_NONBLOCK / O_NDELAY).  Works just fine on NetBSD except
3392 now we no longer get EIO at the end when trying to read from the pty process
3393 that has exited.  In fact, we're back to square one again.  not ioctl(), not
3394 fcntl(), not select(), not even read() gets an i/o error after the pty
3395 process exits.  But in NetBSD, we have to use nonblocking reads because ...
3396 Hmmmm, maybe switch the fd between blocking and nonblocking for the test...
3397 Nope, NetBSD seems to be hopeless (later, Ed Ravin confirmed that similar
3398 problems have been observed with other applications that try to do this).
3399
3400 Switching to Linux, I see that yesterday's Solaris code (blocking reads)
3401 works exactly the same way on Linux.
3402
3403 Tried today's O_NDELAY method on Solaris.  It works perfectly.  And then I
3404 moved this one to Linux and it works perfectly there too.  Except in both
3405 cases we have the wierd thing with Zmodem at the end, but I think that's
3406 because rz/sz don't use standard i/o.  On NetBSD, it still hangs at the end.
3407
3408 Turns out that testing the pid works in NetBSD, even though it didn't in
3409 Solaris.  Turns out read() gets an i/o error in Solaris and Linux but not
3410 in NetBSD.  So checking the read result first, and then checking the pid
3411 if read() got zero bytes catches all three.  28 Dec 2006.
3412
3413 Now the question of return code.  In the original ttruncmd() function, we do
3414 a fork() and a wait().  When the external protocol program finishes, wait()
3415 gives us its return code and we can pass it on through \v(pexitstat) as well
3416 ttruncmd's own return code.  But ttptycmd() has to interact with the pty
3417 continuously, so it can't just sit back and wait() for it.  Instead we have
3418 to detect when the process has exited and then call waitpid() on the fork
3419 pid, before shutting down the pty.  Tested on Solaris using Kermit as the
3420 external protocol and then inducing failure, or letting it run to
3421 completion.  FAILURE and SUCCESS set appropriately in each case.  Tested
3422 with Zmodem too, works OK except for the aforementioned cosmetic glitch at
3423 the end.  Tested on NetBSD, all OK.
3424
3425 To make K5 connection to Panix from Spam:
3426
3427  set telnet debug on
3428  authenticate K5 init /realm:PANIX.COM /password:xxxxx
3429  set host shell.panix.com 23 /k5login
3430
3431 Good...  Now I try to send a file from Spam to Panix over the K5 connection
3432 using Kermit itself as the external protocol.  It fails.  Inspection of the
3433 debug log on the far side shows that the S-Packet was received correctly,
3434 good!  This means we are reading the clear-text S-Packet from the external
3435 Kermit program, and that ttol() is encrypting appropriately.
3436
3437 The remote Kermit sends the Ack and goes to read the next packet: ttinl()
3438 calls myfillbuf() and:
3439
3440   SVORPOSIX myfillbuf calling read()
3441   SVORPOSIX myfillbuf=0                <-- read returns 0
3442   SVORPOSIX myfillbuf ttcarr=2
3443   SVORPOSIX myfillbuf errno=0          <-- and reports no error
3444   HEXDUMP: mygetbuf read (-3 bytes)
3445   mygetbuf errno=0
3446   ttinl myread failure, n=-3
3447   ttinl myread errno=0
3448   ttinl non-EINTR -3[closing]
3449
3450 This happens because myfillbuf() deliberately returns -3 when read() gets 0
3451 bytes.  I don't understand why this happens but the real problem is yet to
3452 come.  The local Kermit (the one that has made the secure connection and is
3453 running the external protocol through ttptycmd()) eventually figures out
3454 that the transfer failed and when we reconnect, we get total garbage -- the
3455 encryption either stopped happening, or got out of sync.
3456
3457 Looking at the local debug log, ttol() is doing its job, converting the
3458 initial "kermit -r\13" from plaintext to cyphertext, as shown by the
3459 hexdumps.  Then it enters ttptycmd()...  Hmmmm, wait, how can it send the
3460 "kermit -r" before it starts the external protocol?  Never mind, worry about
3461 that later...  Anyway, ttptycmd() says:
3462
3463   ttptycmd loop top have_pty=1
3464   ttptycmd loop top have_net=1
3465   ttptycmd FD_SET ptyfd in
3466   ttptycmd FD_SET ttyfd in
3467   ttptycmd nfds=5
3468   ttptycmd select=1
3469   ttptycmd FD_ISSET ttyfd in
3470   ...
3471   ttptycmd in_chk(ttyfd) n=11
3472   ttptycmd ttxin n=11
3473
3474 ttxin() asks for 11 bytes, myfillbuf() gets 11 bytes, and hexdump() shows
3475 the cyphertext, there doesn't seem to be any decrypting going on.  Hmmm, it
3476 looks like the regular code calls ttinc() in a loop, rather than ttxin().
3477 Maybe ttxin() doesn't have decryption hooks.  No, that's not it, the code is
3478 there, but the Kermit packet reader does not use ttxin(), it uses ttinl().
3479 But of course we can't use that for external protocols because it's designed
3480 only to read Kermit packets.  Substituting a loop of ttinc()s for the ttxin()
3481 call fixes things (and stangely enough, it seems to be faster).  And now we
3482 have our first external protocol transfer over a secure connection (external
3483 Kermit program, Linux over Kerberos 5 to NetBSD).  Zmodem worked too for a
3484 short file but "something happens" with longer ones.  29 Dec 2006.
3485
3486 New makefile target for Linux with Kerberos 5, linux+krb5, that doesn't
3487 include anything extra from SSL or other security methods (but apparently it
3488 is still necessary to include -DOPENSSL_097 in order to get the right names
3489 for the DES routines?).  Ditto netbsd+krb5 for NetBSD, except in this case
3490 -DOPENSSL_097 is not necessary.  makefile, 30 Dec 2006.
3491
3492 Note to myself: On Panix:
3493
3494   export LD_LIBRARY_PATH=/usr/local/kerblib
3495   make netbsd+krb5 "K5LIB=-L/usr/local/kerblib" "K5INC=-I/usr/local/include"
3496
3497 Can't telnet-k5 from newly built Kermit on NetBSD; partway through the
3498 negotiations, just after "TELNET RCVD SB ENCRYPTION SUPPORT DES_CFB64
3499 DES_OFB64 IAC SE" it dumps core.  The last two lines in debug.log after
3500 this are:
3501
3502   tn_sb[len]=5
3503   encrypt_support[cnt]=2
3504
3505 Rebuilding with -DOPENSSL_097 doesn't change anything.  Ed Ravin said they
3506 have two different Kerberos installations, Heimdahl and MIT; maybe some
3507 mixup between the two explains the problem (Jeff concurs). The core dump
3508 occurs in ck_crp: encrypt_support():
3509
3510    debug(F100,"XXX ep not NULL","",0);
3511    type = ep->start ? (*ep->start)(DIR_ENCRYPT, 0) : 0; <-- Here
3512    debug(F101,"XXX new type","",type);
3513
3514 Anyway, I can log in with Kerberos 5 to Panix OK from Columbia (sesame)
3515 using 8.0.201.  So let's try to resurrect the Solaris version with everything:
3516
3517   solaris9g+krb5+krb4+openssl+shadow+pam+zlib
3518
3519 I hunted around to find where the current library and header file
3520 directories were...  Last time I tried this (March 2006) it bombed, not
3521 finding libdes.  Instead we have /opt/kerberos5125/lib/libdes425.a.  Made a
3522 new cu-specific target that includes this; now we get farther; it blows up
3523 in ckcftp.c with tons of errors and warnings, which we can worry about
3524 later.  Building again with -DNOFTP, it gets to ckuath.c (the first security
3525 module) and:
3526
3527   ckuath.c:151:18: error: krb5.h: No such file or directory
3528   ckuath.c:152:21: error: profile.h: No such file or directory
3529   ckuath.c:153:21: error: com_err.h: No such file or directory
3530   ckuath.c:176:28: error: kerberosIV/krb.h: No such file or directory
3531   In file included from /opt/openssl-0.9.8d/include/openssl/des.h:101,
3532                    from ckuath.c:219:
3533
3534 Found krb5.h in /opt/kerberos5125/include/krb5.h, added a -I for this
3535 directory ...  Now we get lots of warnings in ckuath.c, but it completes OK,
3536 then we wind up bombing out in ck_crp.c; I don't know why -- there are all
3537 the same warnings (related to argument passing to DES functions), but no
3538 errors.  I have no clue.
3539
3540 Tried to resurrect the solaris2x+krb4 target; this required changing -lkrb
3541 to -lkrb4 and -ldes to -ldes425.  Lots of warnings in ckutio.c, ckcnet.c,
3542 ckctel.c, then it bombs out in ckcftp.c because it can't find krb.h.  I
3543 found it, adjusted the -I flags, but now it bombs because krb.h itself
3544 #includes <kerberosIV/des.h>, which of course it can't find because the
3545 brackets mean it's looking in /usr/include/kerberosIV/, which, of course,
3546 the sys folks have removed.  Giving up on Solaris again.  Later, Jeff said
3547 "Solaris does not publicly export the krb5 libraries.  You need to build
3548 the MIT Kerberos libraries separately and link to them."  30 December 2006.
3549
3550 Changed copyright date to 2007.  ckcmai.c, 1 Jan 2007.
3551
3552 With Ed Ravin's help, successfully built C-Kermit with Kerberos 5 and
3553 OpenSSL (netbsd+krb5+openssl+zlib), but it does not make K5 connections; it
3554 gets hung up in the Telnet negotiations.  3 Jan 2007.
3555
3556 Downloaded MIT Kerberos 5 v1.4.4 to Solaris 9, 54MB worth.  This is just so
3557 I can build a Kerberized C-Kermit for testing ttyptycmd().  Ran the
3558 configure program, got a few warnings but it didn't fail (should it?)  Did
3559 "make install", specifying a private directory but it failed immediately
3560 with "cannot stat libkrb5support.so.0.0: No such file or directory".
3561 OK, I tried.  3 Jan 2007.
3562
3563 Made a new makefile target for Mac OS X, macosx10.4+krb5+ssl, ran it on Mac
3564 OS X 10.4.8.  It bombs out in ckcftp.c with: ckcftp.c:551: error: static
3565 declaration of 'gss_mech_krb5' follows non-static declaration
3566 /usr/include/gssapi/gssapi_krb5.h:76: error: previous declaration of
3567 'gss_mech_krb5' was here".  Ditto for gss_mech_krb5_old, gss_nt_krb5_name,
3568 and gss_nt_krb5_principal.  Tried again with -DNOFTP.  We get lots of
3569 warnings in the network modules, but they complete.  But ck_ssl.c bombed
3570 with a conflict between its own declarations of encrypt_output and
3571 decrypt_input and the ones in ckuat2.h; removed the prototypes from the
3572 latter (as Jeff advised) it built OK and it works OK too.  Built with FTP
3573 too, but with link-time warnings about the aformentioned gss_* symbols.
3574 #ifdef'd them out (gss_mech_krb5, gss_mech_krb5_old, gss_mech_name, and
3575 gss_mech_principal) for MACOSX, where these symbols are exported by the
3576 library.  Now it all compiles and links OK, and runs OK too.  3 Jan 2007.
3577
3578 Spent a day hunting around for a version of Zmodem that would build and
3579 execute on Mac OS X, finally found one.  Now at last I could try a Zmodem
3580 external-protocol transfer over a secure connection.  But phooey, C-Kermit's
3581 pty support didn't work on this box.  Kermit finds master /dev/ptypa OK,
3582 then in ptyint_void_association() tries to open /dev/tty but gets ERRNO=6
3583 "device not configured" (which is apparently OK, because the same thing
3584 happens on other platforms where this works), then tries to open slave
3585 /dev/ttypa and gets ERRNO=13 "permission denied" because, indeed, I don't
3586 have r/w permission on the device.  Left a message.  4 Jan 2007.
3587
3588 Changed TRANSMIT /BINARY output buffer size from 252 to 508 to avoid
3589 TCP fragmentation.  Need to add a SET command for this later.
3590 ckuus4.c, 5 Jan 2007.
3591
3592 Found another Mac where the ptys weren't protected against me, make a K5
3593 connection and transferred a largish file with Zmodem with zero glitches,
3594 except it was kind of slow, 84K cps.  Well, we're doing single-character
3595 reads on the net (ttinc()'s instead of ttxin()).  Hmmm, but then I did it
3596 again and got 2.2Mcps.  Success was reported, but it actually didn't work;
3597 it only sent the first quarter of the file....  Oh well, at least now we
3598 have a testbed.  5 Jan 2007.
3599
3600 Tried again, saw that the file is actually transferred instantly but then
3601 we're not picking up the protocol at the end.  Theory: after the transfer
3602 finishes, we come back to the prompt on the remote host, which means we have
3603 something to read from the net and write to the pty, but the pty has already
3604 exited.  AFTER THE PTY IS GONE, WE DO NOT WANT TO READ FROM THE NET ANY
3605 MORE.  Adding this test makes Kermit succeed right away when sending the
3606 same largish file, with a transfer rate of 4M cps, that's better.  But the
3607 rz program on the far end is evidently not receiving the goodbye handshake
3608 from the receiver, because it sits there foreever in its *B09002402009418
3609 mode until I ^X^X^X^X^X out of it, at which point it deletes the file it
3610 already received, not very helpful.  In the code, I read from the pty if the
3611 pty is open and there is room in the buffer.  This means that when we get to
3612 the end, either there is no room in the buffer (unlikely) or the last bit
3613 sent by sz before exiting was cut off when the fork closed.  Why do we get
3614 in this fix only with Zmodem and not with Kermit?
3615
3616 In Mac OS X, after sz exits, we get ERRNO=5 if we try to write to the pty,
3617 but we still get no errors after that if we try to read from it.  Still,
3618 prior to this we did more than 20 unproductive nonblocking reads from the
3619 pty (no error, no bytes) without incident; there did not seem to be anything
3620 waiting.  In fact, the last thing we read from the pty were the text
3621 messages that are issued at the end of the transfer: "rz 3.73 1-30-03
3622 finished."  After which it pauses a second and spits out a message about
3623 UNREGISTERED COPY.
3624
3625 Figured out how to build lrzsz, in hopes that the previous problems were
3626 with rzsz and crzsz's fiddling with file descriptors, but I get the same
3627 behavior.  Which is good, I guess, because if I can fix one, I fix them all.
3628 Or not...  Testing lrz by itself (not under C-Kermit), I see that it doesn't
3629 work at all with Kermit's own Zmodem implementation.
3630
3631 OK, here's one problem: at the end of the transfer, the Omen Zmodems print
3632 stuff like "Please read the license agreement", Kermit dutifully reads this
3633 from the pty and sends it to the host, the host shell says "Please: command
3634 not found", issues its prompt again, which Kermit reads, feeds to the pty,
3635 and apparently the pty echoes it, so we send it back to the host, and there
3636 ensues an infinite loop of getty babble until the pty closes.  Now, there
3637 ought to be a way to make the external protocol shut up, like Kermit's
3638 -q(uiet) flag, but these are unregistered versions so you can't shut up the
3639 messages.  In fact, the transfer works, but the getty babble at the end
3640 ruins the experience.  Now I'm beginning to wonder how any of these programs
3641 ever worked as external protocols.  Hmmm, now that I try it, I see the
3642 same thing happens the old way, when using ttruncmd() rather than ttptycmd().
3643
3644 Reading the crzsz documentation I see it says that messages come out on
3645 stderr.  OK, that's progress.  In ckupty.c I try redirecting 2 to /dev/null.
3646 Well good, this filters out the messages from csz, but we still get getty
3647 babble on the prompt.  In the debug log, we read the last bunch of stuff
3648 from net, 618 bytes of Zmodem stuff...   Now what happens?
3649
3650 Zmodem on the remote exits, the host prints its prompt.  Kermit, of course,
3651 reads the prompt from the net, now come to the bottom of the loop and we
3652 have 7 bytes to write to the pty, and no error condition, so we continue the
3653 loop.  select() says that the pty is ready for writing.  We write the 7
3654 bytes and and get no error.  Loop again, this time select() says the pty has
3655 data waiting.  Sure enough we get the prompt back, and send it to the net,
3656 and thus begins the getty babble.  There are two causes for this:
3657
3658   1. crzsz does not exit immediately; it sleeps for 10 seconds after
3659      printing its nag message.
3660
3661   2. During this interval the pty seems to be echoing what is sent to it.
3662      csz is not echoing; I checked.  Anyway, removing the pause doesn't
3663      seem to make a difference.
3664
3665 ttptycmd() needs to:
3666
3667  . TELL the pty module to redirect stderr to /dev/null
3668  . SET PTY TO NOECHO (master or slave?)
3669
3670 Tried setting the pty to noecho:
3671
3672   termbuf.c_lflag &= ~(ECHO|ECHOE|ECHOK);
3673
3674 and this seemed to stop the getty babble.  After the file transfer, I read
3675 back the prompt from the host shell, I write the prompt bytes to the pty;
3676 there is no error.  And now select() simply hangs forever (or times out if
3677 a timeout is set).  The question here is: why didn't writing to the pty
3678 produce an error?  And, because we never detect the pty has exited, we can't
3679 set a good return code.  5 Jan 2007.
3680
3681 Moved pty fork testing to a separate routine, pty_get_status(), and 
3682 added a call to it from the place where we time out, in case the fork
3683 terminated; then we can get and return its status.  6 Jan 2007.
3684
3685 Added calls to pty_get_status() to every place where we suspect a pty error,
3686 tried again with lrzsz, crzsz, and regular rzsz.  All three work, but in
3687 each case waitpid() indicates that the sz program gave exit code 1 (failure).
3688 ckutio.c, 7 Jan 2007.
3689
3690 Changing the subject...  On my test system, every time I execute ttptycmd(),
3691 I get "permission denied" on /dev/ttyp3.  Then I run it again and get to
3692 ttyp4 which is OK.  I wanted to skip past any pty for which I lack
3693 permission and try the next without raising an error.  Added debugging code:
3694
3695   16:25:23.524 pty_getpty() pty master open error[/dev/ptyp0]=5
3696   16:25:23.524 pty_getpty() pty master open error[/dev/ptyp1]=5
3697   16:25:23.524 pty_getpty() pty master open error[/dev/ptyp2]=5
3698   16:25:23.524 pty_getpty() found pty master[/dev/ptyp3]
3699   16:25:23.524 pty_getpty() slavebuf [2][/dev/ttyp3]
3700
3701 So it already was skipping past open errors; ttyp3 was opened successfully.
3702 The problem is that ptyp3 is rw-rw-rw-, but the corresponding master,
3703 ttyp3, is rw--r----.  It seems the code assumes that if the master can be
3704 opened, then so can the corresponding slave.  Unfortunately, the code is
3705 not structured to allow us to skip ahead to the next master if the slave
3706 can't be opened.  7 Jan 2007.
3707
3708 Spent a couple hours trying to rearrange the code in the pty module to skip
3709 past inaccessible slaves but it was a rabbit hole, not worth it, backed off.
3710 8 Jan 2008.
3711
3712 Tried an upload over a secure connection using lsz.  Unexpectedly, this time
3713 it worked; not only was the file (about 0.5MB) transferred correctly, but
3714 Kermit detected the fork's termination and got the pid's exit status, and,
3715 for the first time, correctly reported a successful transfer.  I have no
3716 idea why this works today and not yesterday.  More tests; it works most of
3717 the time.  It works with csz and with regular sz too.
3718
3719 (days later...)
3720
3721 ckucns.c seems to do the right thing; it recognize the ZSTART string,
3722 activates the Zmodem-Receive APC, and returns.  doconect() sees the APC and
3723 begins to execute it.  The RECEIVE command results in a call to the GET
3724 command parser, doxget() (IS THAT RIGHT?), then comes a ttflui(), which
3725 throws away a bunch of stuff.  Finally we get to ttptycmd(), we get a pty
3726 and run lrz in it, select() says stuff is waiting from the pty, but read
3727 returns 0, errno 0.  Skipping the ttflui() in doxget() if the protocol was
3728 not Kermit didn't seem to make difference.  ckuus6.c, 8 Jan 2007.
3729
3730 The problem is that in this case, reads from the pty never get anything (no
3731 data, no error), write always gets an error.  It's as if the pty was not
3732 being set up right, or we're using the wrong file descriptor.  And if we
3733 skip the autodownload?  Same thing.
3734
3735 OK, putting downloads aside for a moment, let's get uploads working as well
3736 as possible.  At this point we have the odd situation (at least in this
3737 configuration) that the upload succeeds, but now for some reason we are
3738 unable to read the exit status from the process, even though this was
3739 working before, so ttptycmd() returns 0 (failure), yet Kermit reports
3740 success.
3741
3742 Well, it turns out that kill(pty_fork_pid,0) was gumming up the works.
3743 If we use only waitpid() all is well, I think.  waitpid() with WNOHANG
3744 returns -1 with status -1 errno 0 if the pid has not exited, and it returns
3745 the pid and status > -1 if the process has exited.  Fixed pty_get_status()
3746 to do it this way.  ckutio.c, 7 Jan 2007.
3747
3748 Let's move this from Mac OS to NetBSD and see how it works.  Well, the file
3749 transfer was just fine, but then I used some sexps to calculate the elapsed
3750 time and transfer rate, and Kermit hung in dosexp().  Fine, ignoring that...
3751 The debug log shows that ttptycmd() gets the pty OK, master and slave, the
3752 i/o goes smoothly, and waitpid() does its job perfectly.  Solaris, same
3753 deal; ttruncmd() goes smoothly, but then the sexps afterward get "Arithmetic
3754 exception".  Turns out there was a BAD bug in dosexp() that allowed an
3755 integer division by 0 to occur under certain circumstances; it's always been
3756 there.  Fixed in dosexp(): ckuus3.c, 8 Jan 2007.
3757
3758 After noticing a few problems running the pop.ksc script in production over
3759 the past year, rewrote \femailaddress() to be more reliable and a lot
3760 simpler.  ckuus4.c, 9 Jan 2007.
3761
3762 Back to ttptycmd()...  When we left off, we could send but not receive.  Set
3763 up a test case using Kermit as the external protocol for receiving a short
3764 file.  If I SET STREAMING OFF and use short packets, it actually does work,
3765 so it's not a complete failure to function, but apparently a lack of flow
3766 control for the pty.  Began by completing the parameterization of the pty
3767 module, so it can be called for interactive use (fc 0) or for running
3768 protocols (1).  Confirmed that everything works at least as well as before
3769 (e.g. "set host /pty emacs" vs external protocols).  ckcdeb.h, ckutio.c,
3770 ckupty.c, 9 Jan 2007.
3771
3772 Found in HP-UX "man 7 pty" a description of ioctl(fd,TIOCTTY,fc) which is
3773 exactly what we want: fc 0 turns off all termio processing and guarantees an
3774 ininterrupted, unmolested, flow-controlled stream of bytes in both
3775 directions.  This function also exists in Linux, but not in Solaris, NetBSD,
3776 or Mac OS X (TIOCNOTTY is not what we want, it does something else entirely).
3777
3778 Another possibility is TIOCREMOTE, which "causes input to the pseudoterminal
3779 to be flow controlled and not input edited, regardless of the terminal
3780 mode".  This one exists in at least HPUX, NetBSD, Solaris, and Mac OS X.
3781
3782 Solaris: builds OK, but at runtime we get ENOTTY ("Inappropriate ioctl for
3783 device").  By the time this happens, it's hard to tell from the code whether
3784 the fd we're using is for the master or the slave; TIOCREMOTE can be used
3785 only on the master.  Close inspection shows that I am indeed doing that;
3786 ptyfd as seen by ttptycmd() is truly the master, i.e. the /dev/ptyXX device,
3787 not the /dev/ttyXX device (the slave fd can't be seen at all, as it exists
3788 only in a separate fork).  OK, so now we know that TIOCREMOTE can't be used
3789 on Solaris.
3790
3791 NetBSD: Somehow, whether as a result of today's fiddling or the phase of the
3792 moon, the code in pty_open_slave() that tries to open /dev/tty started
3793 failing on NetBSD ("Device not configured").  Changing it to be run only if
3794 fc == 0 (which doesn't seem to hurt anything), once again I get ENOTTY on
3795 the TIOCREMOTE ioctl.  Zmodem works but Kermit totally fails (the fork exits
3796 immediately with an exit code of 0, even though it didn't do anything).
3797
3798 Mac OS X: Exactly the same sequence and results as NetBSD.
3799
3800 Linux:  It did not execute the new ioctl at all; apparently the TIOC symbols
3801 are hidden or not exported or something.
3802
3803 Where we stand:
3804  . Downloads don't work
3805  . Uploads got slow again
3806  . Kermit doesn't work at all as an external protocol
3807
3808 Actually if I take the debugging out it goes fast, but it doesn't finish.
3809
3810 All today's work on ttptycmd() looks like a dead end.  To roll back to
3811 yesterday:
3812
3813   cp ckutio.c-20070108 ckutio.c
3814   cp ckupty.c-20070108 ckupty.c
3815   cp ckupty.h-20070108 ckupty.h
3816
3817 or to continue with today's:
3818
3819   cp ckutio.c-20070109 ckutio.c
3820   cp ckupty.c-20070109 ckupty.c
3821   cp ckupty.h-20070109 ckupty.h
3822
3823 Comparing Monday's and Tuesday's pty-related code, the differences are:
3824  1. Passing of function code to and among pty modules.
3825  2. Skipping the TIOCSCTTY ioctl and the open("/dev/tty") test.
3826  3. Attempting to put pty in TIOCTTY or TIOCREMOTE mode.
3827
3828 Commenting out 2 and 3 should put us back where we were on Monday if the
3829 parameterization was done right.  And with this, on Solaris, downloading
3830 with Kermit external protocol works but slowly, 8K cps, with or without
3831 debugging.  Debug log does not show any obvious bottlenecks; select() takes
3832 anywhere between no time at all and 0.1 seconds to return.  If I increase
3833 the pty-net buffer size from 1K to 4K, the rate goes up to 55K cps.  If I
3834 make it 8K I get 136K cps.  With 16K I get 346K cps.  32K: 395K cps -- this
3835 last one isn't worth the doubling.  But at 24K I get 490K cps, sometimes
3836 twice that.  Let's stick with 24K for now.  Downloading with Zmodem (rzsz)
3837 works at the same rate, but now we're back to seeing the getty babble
3838 (Several "**B0800000000022d") at the end. 10 Jan 2007.
3839
3840 Moving to Mac OS X, everything works the same as on Solaris, except I don't
3841 get the Zmodem getty babble there, not even with Omen rzsz.  Tested sends
3842 in both remote and local mode, the latter over a secure Kerberos 5 Telnet
3843 connection, using C-Kermit, rzsz, lrzsz, and crzsz, all good.  10 Jan 2007.
3844
3845 Now we're back where we were yesterday morning, but with better throughput.
3846 The big issue then was receiving files.  But yikes, now it works!  Not only
3847 that, I got a transfer rate of 2.1M cps.  That's using Kermit protocol,
3848 streaming, and big (4K) packets.  Which didn't work before.  Not a fluke
3849 either, I uploaded bigger and bigger files up to 6MB, they all went
3850 smoothly, at rates between 1 and 2 MBps.  10 Jan 2007.
3851
3852 Not so great in Zmodem land, however.  If I start the external-protocol
3853 receiver on the far end, escape back and start a Zmodem send... nothing.
3854 If I leave the remote C-Kermit at its prompt (where it supposed to recognize
3855 the Zmodem start string), still nothing.  On the other hand, if I do it
3856 with a script instead of by hand:
3857
3858   def xx output take blah\13, send /proto:zmodem \%1
3859   
3860 it works, at least intermittently.  But that's in remote mode.  We won't be
3861 using this in remote mode.  In local mode, where we have a secure connection
3862 to another computer, it seems we can read from the pty and write to the net,
3863 but we time out waiting to read from the net; nothing arrives.  Well, we
3864 know that i/o works both ways, so there is some kind of screwup with the
3865 Zmodem protocol start itself.  Increasing the (still hardwired timeout) from
3866 5 to 22sec and driving the whole process with a script so as to avoid
3867 autodownload as well as manual dexterity effects...  It just sits there
3868 forever, way longer than 22 sec.  ^C'ing out, I see that sz was indeed
3869 started on the far end and the protocol was executing.  But it looks like
3870 the receiver (the one running under ttptycmd()) is getting trashed packets,
3871 because (a) it seems to be sending the same thing over and over again, and
3872 (b) sometimes it waits as long as 10 seconds before anything arrives from
3873 the remote.  Maybe I was too impatient; I interrupted it after 4 minutes but
3874 it seems to have been making some progress.  Whenever there was data
3875 available to read from the net, it was always 65 bytes, and it was not
3876 actually the same data over and over.  This is using lrz as the external
3877 protocol.  crz gets a bit farther.  In this case we read up to 24K at a
3878 gulp, but the amount varies a lot.  It looks like we took in about 1.2MB of
3879 Zmodem protocol data, but were only able to output the first 20K of the
3880 file.  Clearly there were lots of errors.  In the end, the crz exits with
3881 status 1 (failure).
3882
3883 Anyway it looks like we're back at needing to find a way to accomplish
3884 something like TIOCREMOTE on the pty, which is where we came in.  10 Jan 2007.
3885
3886 Without any way to make the pty transparent and flow controlled, it would
3887 seem to make sense to write to the pty in smaller chunks than we do to the
3888 net.  I left the read-from-pty-write-to-net buffer at 24K and changed the
3889 read-from-net-write-to-pty buffer to 48 bytes.
3890
3891 Upload using lsz worked but took about 3 minutes.  Actually it didn't work.
3892 On the local end it seemed to work, but the file did not appear on the
3893 remote end.  Tried this several times, each time with different results,
3894 adding more debugging each time.  The problem this time was that the pty
3895 read could get EWOULDBLOCK.  Changed the code to not treat this as an error,
3896 now Zmodem uploads are solid again except I never got EWOULDBLOCK again
3897 either, even though I repeated the same upload about 1000 times (with
3898 throughput of over 2MBps even with debugging on), so the test for it has
3899 not been exercised.
3900
3901 OK, uploads still work.  Back to downloading...  The very first pty read
3902 gets 0 bytes, followed by the fork test that shows that it exited with
3903 exit status 2. 
3904
3905 Next we try starting sz with some different options on the far end:
3906
3907  -q: quiet (no messages):
3908      for some reason this gets totally stuck.
3909      it looks as if this option is misdocumented;
3910      sz seems to be sending the letter C (as in Xmodem 1K or whatever)
3911
3912  -e: escape (all control chars):
3913      first attempt to read pty finds the process gone with exit status 2.
3914
3915  -k: send 1k blocks:
3916      this one didn't stop immediately.  It reads 48 bytes from net, writes
3917      48 to the pty with no error.  Then reads 21 bytes from the pty, writes
3918      them to the net OK.  Then reads 48 bytes from net, writes them to pty OK,
3919      reads 21 from pty, writes to net OK, etc etc...  It appears to have
3920      worked but (final read from pty returned 0, fork test showed lrz exited
3921      with status 0), but only 754 bytes were received from the net when the
3922      file is 420K...
3923
3924 Well this only goes to show that the faster we shove stuff into the pty, the
3925 worse it gets.  Zmodem downloads won't work unless we can make the pty
3926 transparent and flow-controlled.  So to summarize today's developments:
3927
3928  . separated in/out buffer sizes
3929  . handled EWOULDBLOCK
3930  . found out that sz options don't help much
3931
3932 11 Jan 2007.
3933
3934 Next day.  This has got to be the most delicate code ever, it's like
3935 Whack-A-Mole, fix A and B pops up.  Even without touching it, something that
3936 worked perfectly a 2:00 doesn't work at all an hour later.  Maybe I could
3937 have used pipes instead of ptys, but pipes have problems of their own.
3938 There has to be a way to do this.  The telnet server, the SSH server, etc --
3939 they all run on ptys, and we can upload files to them with Kermit.  Why?
3940 Because Kermit puts its terminal into all the right modes using the
3941 time-honored methods of ttpkt() and ttvt().  Perhaps all we need is a copy
3942 of ttpkt() that operates on the pty.
3943
3944 On that theory, let's go back to Kermit as the external protocol.
3945 It's important to suppress all messages and displays.  With that,
3946 uploads work fine, no hitches.
3947
3948 Downloads:  We fail right away.  The debug log shows the Kermit program that
3949 we are starting in the pty says:
3950
3951   "" - Invalid command-line option, type "kermit -h" for help.
3952
3953 But of course we are not giving it an invalid command-line option.
3954 Switching to gkermit for the external protocol, now we see that no matter
3955 command-line options we use, we read 0d 0d 0a from the pty and then the
3956 next time we go to read from the pty we get 0 bytes and waitpid() says the
3957 program has exited with status 1.
3958
3959 Why should downloading be different from uploading?  ttptycmd has no idea,
3960 it does everything the same.  The only difference would seem to be which
3961 side sends first, but even that tends to get washed out by each program's
3962 startup messages.
3963
3964 Downloading with Kermit worked 2 days ago, what's different now?  The buffer
3965 sizes.  Putting the net-to-pty back up to 24K (from 48 bytes)...  Now it
3966 works again.
3967
3968 Conclusion: Kermit conditions the pty correctly, Zmodem does not.  Therefore
3969 ttruncmd() must duplicate what ttpkt() does.
3970
3971 Or not.  Because rz works fine on ssh/telnet ptys too.  But not on our pty.
3972 lrz exits immediately with status code 2 = 01000 but there are no clues in
3973 the lrz.c source code, I don't even see this exit status set anywhere.
3974 Unredirecting stderr, I see that the error is "lrz: garbage on command line".
3975
3976 Why do both Kermit and Zmodem sometimes think they are receiving an invalid
3977 command line?  If I could capture the garbage...
3978
3979 Side trip #1: ("pty.log",O_WRONLY) gives "no such file or directory".
3980 Changed this to ("pty.log",O_CREAT,0644) and now it doesn't get an error,
3981 and it creates the file, but not with 0644 permissions, and with nothing
3982 written in it.  How come nothing works?
3983
3984 Fine, the debug log shows that ttptycmd() receives the correct string
3985 (e.g. "lrz -v").  It passes it to do_pty() correctly, and do_pty() passes it
3986 to exec_cmd(), which runs cksplit() on it, coming up (in this case) with
3987 "lrz" and "-v", which is right, and then:
3988
3989     args = q->a_head + 1;
3990     execvp(args[0],args);
3991
3992 execvp() wants the args array to have a null element at the end.  cksplit()
3993 does indeed do that, or at least the code is there.  Added code to exec_cmd()
3994 to verify the argument list and that it is null-terminated.  So far it is.
3995
3996 Anyway, we have traffic between the Zmodem partners, but no joy.
3997 Commenting out the bit that redirects stderr, now I can see it on my screen
3998 in real time:
3999
4000   lrz waiting to receive.Retry 0: Bad CRC
4001   Retry 0: Got ERROR
4002   Retry 0: TIMEOUT
4003   Retry 0: TIMEOUT
4004   Retry 0: TIMEOUT
4005   Retry 0: TIMEOUT
4006
4007 etc etc, forever.  Trying sz -e on the far end, I get:
4008
4009   Retry 0: Bad CRC
4010   Retry 0: Garbage count exceeded
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   ...
4018   Retry 0: Got ERROR
4019   Retry 0: Bad CRC
4020   Retry 0: Got ERROR
4021   Retry 0: Got ERROR
4022   lrz: xxufio.c removed.
4023
4024 So apparently it's not a matter of escaping.  Trying some other stuff, I
4025 caught the command-line problem in the act:
4026
4027   lrz: garbage on commandline
4028   Try `lrz --help' for more information.
4029
4030 Debug log shows:
4031
4032   cksplit result[lrz]=1
4033   cksplit result[-v]=2
4034   exec_cmd arg[lrz]=0
4035   exec_cmd arg[-v]=1
4036   exec_cmd arg[]=2
4037
4038 An empty string at the end instead of a null pointer.  I really do not see
4039 any way that could happen, but rather than dig into cksplit() again after
4040 all these years I added a test for this in exec_cmd(), which, of course
4041 after adding it, never encountered this behavior again.
4042
4043 Fiddled with pty buffer size again.  Made it 512 bytes instead of 24K.
4044 Zmodem downloads are the same (Rety 0: TIMEOUT, over and over).  But I don't
4045 see what the problem is -- every time we receive n bytes from the net, we
4046 write n bytes successfully to the pty and there are no errors.  But it also
4047 looks like the remote sender is sending the file header over and over
4048 because it's not receiving an acknowledgment.  If we're not losing data,
4049 then maybe it's a transparency problem.
4050
4051 Tried uncommenting the TIOCblah stuff I commented out before.  Now instead
4052 of only timeouts I get:
4053
4054   lrz waiting to receive.Retry 0: Bad CRC
4055   Retry 0: Got ERROR
4056   Retry 0: Bad CRC
4057   Retry 0: Got ERROR
4058   Retry 0: Bad CRC
4059   Retry 0: Got ERROR
4060   Retry 0: TIMEOUT
4061
4062 which is odd because the TIOCREMOTE ioctl failed with errno 14, EFAULT,
4063 bad address, which should indicate it had no effect.  We're still receiving
4064 data from the remote in tiny chunks (from 12 to 65 bytes), apparently the
4065 same stuff (file header), and writing them to the pty successfully but
4066 nothing...
4067
4068 Looked at cloning ttpkt() for the pty, but these stupid routines use global
4069 tty mode structs so it's not going to be easy.
4070
4071 Well, we got exactly nowhere today, but I think I'll leave stderr as it is
4072 so users will see some feedback; no reason not to.
4073
4074 WHY DO KERMIT DOWNLOADS WORK AND ZMODEM NOT?
4075
4076 Is it 8-bit transparency?  Up til now I've been testing with text files.
4077 If I try to download a binary what happens?  Fails after 99 seconds.  Packet
4078 log from the far end shows that as soon as the first packet containing 8-bit
4079 data is sent, everything stops.  At least I got one of these:
4080
4081   17:23:56.475 exec_cmd arg[gkermit]=0
4082   17:23:56.475 exec_cmd arg[-qr]=1
4083   17:23:56.475 exec_cmd arg[]=2
4084   17:23:56.475 exec_cmd SUBSTITUTING NULL=2  <-- the code I just added
4085
4086 Doing this again shows the same thing on the near end.  All the 7-bit-only
4087 packets are sent and acknowledged OK.  Three 8-bit data packets arrive and
4088 nothing else happens after that.  This is with G-Kermit.
4089
4090 The same thing happens with C-Kermit receiving.  But if I change C-Kermit's
4091 .kermrc to turn off streaming and use a short packet length:
4092
4093 The transfer works, even though it's sending 8-bit bytes.  So the problem is
4094 not 8-bit data after all, per se.  Facts:
4095
4096  . Kermit can receive streaming transfers of 7-bit files.
4097  . Kermit can not receive streaming transfers of 8-bit files.
4098  . Kermit can receive nonstreaming transfers of 8-bit files with short packets.
4099  . Kermit can receive nonstreaming transfers of 8-bit files with 1K packets.
4100  . Kermit can receive nonstreaming transfers of 8-bit files with 4K packets.
4101
4102 So it's the combination of streaming and 8-bit data?  12 Jan 2007.
4103
4104 As a test I made a new routine pty_make_raw() that does cfmakeraw() (a
4105 nonportable "POSIX-like" function known to be used on ptys in applications
4106 that do approximately what we're attempting).  Results:
4107
4108  Solaris: errno 25 - inappropriate ioctl for device.
4109
4110 This happens even when we try to get the terminal modes with tcgetattr(),
4111 which is completely nuts.  We pass it the file descriptor of the pty master,
4112 which is supposed to work.  But in Mac OS X, there are no errors.  But
4113 downloads still don't work; lots of errors but the pattern is different.
4114 Using a very small buffer:
4115
4116   Retry 0: Bad CRC
4117   Retry 0: Garbage count exceeded
4118   Retry 0: Garbage count exceeded
4119   Retry 0: Got TIMEOUT
4120   Retry 0: TIMEOUT
4121   Retry 0: Bad CRC
4122   Retry 0: Bad CRC
4123   Retry 0: Garbage count exceeded
4124   Retry 0: Garbage count exceeded
4125   Retry 0: TIMEOUT
4126   Retry 0: Got ERROR
4127   Retry 0: TIMEOUT
4128   Retry 0: Garbage count exceeded
4129   Retry 0: Garbage count exceeded
4130   Retry 0: Bad CRC
4131
4132 Using a bigger buffer:
4133
4134   Retry 0: Garbage count exceeded
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   (several screensful)
4141
4142 Various other combinations... Nothing seems to work.
4143
4144 Insight: telnetd does exactly what we want to do, sort of.
4145 But it uses TIOCPKT, so every time it reads from pty, it receives
4146 one control byte and then the data bytes, which would complicate our
4147 buffering scheme considerably.  Anyway the TIOCPKT ioctl() fails on
4148 Mac OS X with 14 "Bad address".
4149
4150 Also see: snoopserver.c (found in Google).  It seems to do things in a
4151 slightly different way -- it sets stdout to raw and then dups it to the
4152 slave side of the pty?
4153
4154 Maybe it's a mistake to use the ckupty.c routines.  They are designed for
4155 creating and accessing an interactive session.  Maybe just copy one of the
4156 other programs.
4157
4158 18 Jan 2007.  Tried going back to blocking rather than nonblocking reads
4159 to see if it would make a difference, after all the other changes.  Nope.
4160 OK, let's look at some of these other programs...
4161
4162 snoopserver.c.  I don't know exactly what this is or where it's from or what
4163 platform it runs on and there are no comments to speak of, but it does
4164 approximately what ttptycmd() does.  To get a pty it uses openpty():
4165
4166   if (openpty(&pty, &tty, NULL, NULL, NULL) == -1)
4167
4168 then creates a fork.  In the fork, it closes the pty (master) and
4169 manipulates the modes of the tty (slave), dups tty to be stdio, and then
4170 doex execv() on the command.  Meanwhile the upper fork closes the tty
4171 (slave), gets the attributes of stdin, using atexit() to have them
4172 automatically restored on exit.  Then it sets stdin to raw mode and enters
4173 the select() loop on stdin, the pty master, and the net.  It uses regular
4174 blocking reads.  It does not use TIOCPKT or anything like it.
4175
4176 openpty() is supported on: Linux, Mac OS X, NetBSD, FreeBSD, ...
4177 openpty() is NOT supported on: Solaris, HP-UX, ...
4178
4179  1. Try copying the pty code, but keep everything else the same.
4180
4181 I did this; it compiles and starts OK, upper fork (ttptycmd) debug log shows
4182 no errors, but nothing happens.  Logs show that the Kermit program that is
4183 started in the subfork seems to die as soon as it reaches eof on its init
4184 file.  The good news, at least, is that select() doesn't report report that
4185 the pty is ready to be read.  Clearly the file descriptors aren't being
4186 assigned as expected, or as before.
4187   
4188 In ckupty.c getptyslave() dup2's the slave fd to 0 and 1.  The new code
4189 does exactly the same thing.  Debug log makes it look like the forked kermit
4190 is not receiving its command line.  But now I'm not even sure that the
4191 forked kermit started at all.  ps from another terminal doesn't show it.
4192
4193 19 Jan 2007: Noticed that in snoopserver, the select() calls use standard
4194 input and output file descriptors, rather than the pty master.  Made that
4195 change...  In doing that I had to look at every file descriptor in every
4196 line of code and discovered a couple mistakes, fixed them, put back the
4197 original code but with the fixes, tried it, but no change; can upload OK but
4198 still can't download with Zmodem without lots of errors and ultimate
4199 failure.  Going back to the alternative version and trying to get the the
4200 file descriptors sorted out, now it appears that the external Kermit program
4201 never even starts in the lower fork.  After a bit more fiddling I sort that
4202 out, but now when the lower Kermit program goes to open "/dev/tty" it gets
4203 errno 6 "Device not configured".  Forcing it to use stdio with "-l 0", it
4204 gets past this and actually sends its first packet.  But the Kermit on top
4205 reads nothing from the pty.
4206
4207 Next, I change the pty fd from STDIN_FILENO and STDOUT_FILENO to slavefd.
4208 No difference.  Next I comment out the dup2() calls.  This time I get some
4209 action.  The transfer starts, but only one packet comes.  Log shows that
4210 the lower Kermit sends its S packet.  The upper Kermit receives the ACK
4211 but the lower Kermit never gets it.  The write to the pty succeeds, no
4212 error.  Different combinations give different results.  If write to master
4213 and read from the slave, I get packets in both directions but tons of
4214 errors....  This happens only if I comment out the dup2()'s.
4215
4216 25 Jan 2007: After leaving it sit for a while, and realizing that what I'm
4217 trying to do has to be possible because so much other software does the same
4218 thing (e.g. Telnet servers), I put things back to how they were originally
4219 -- the upper fork (Kermit) uses the master and the lower fork the slave.
4220 The upper fork puts the master in raw mode, the lower fork puts the slave in
4221 raw mode.  The lower fork dup2's the slave fd to stdin/out.  Send file in
4222 remote mode using external Kermit: works OK but select() times out at the
4223 end.  This means that the self-contained pty code in ttptycmd() is sorted
4224 out -- all the file descriptors go to the right place, etc, and now we can
4225 use this routine as a testbed, rather than the original ckupty.c-based one.
4226
4227 But send with lsz, csz, and regular rz: Nothing happens, times out after 0
4228 bytes of i/o.  Once again, Kermit works, Zmodem doesn't.  The reason for
4229 running Zmodem in a pty is so its i/o will work as it does on a terminal,
4230 no matter how it may fiddle the file descriptors.  So why don't we see a
4231 single byte come out?
4232
4233 Commenting out pty_make_raw(), I get a successful Zmodem send using lsz.
4234 csz manages to get the filename across, but then gets stuck.  regular sz, on
4235 the other hand, works perfectly.  Testing csz by itself (not under Kermit),
4236 I see it fails in exactly the same way ("Got phony ZEOF", etc).  OK, forget
4237 crzsz.
4238
4239 OK, let's move to local mode over a Kerberized Telnet connection...
4240 Uploading (sending) with external Kermit protocol... works.
4241 Downloading (receiving) with external Kermit protocol... works.
4242 Uploading with sz... works.
4243 Downloading with lrz...  Gets tons of errors and fails.
4244
4245 Running pty_make_raw() on the slave but not on the master: no difference.
4246 Running pty_make_raw() on the master but not on the slave: no difference.
4247
4248 Back where we started...  Either:
4249
4250  . Zmodem is overdriving the pty, no matter what modes we put it in.  
4251  . It's a transparency problem.
4252
4253 Theoretically we should be able to test these by using different sz switches:
4254   -q:    quiet (should always use this)
4255   -e:    escape all control characters
4256   -B n:  Buffer n bytes (rather than whole file)
4257   -L n:  Packet length
4258   -l n:  Frame length (>= packet length)
4259   -w n:  Window size
4260   -4:    4K blocksize (doesn't help)
4261
4262 -q by itself doesn't help.
4263 -q -e, this one worked but still got about 100 errors and was very slow.
4264 -q -e -l 200 -L 100, failed fast and bad.
4265 -q -e -w 1.  Failed quickly.
4266 -q -e -w 1 -B 100.  Eventually failed.
4267 -q -w 1, Eventually failed.
4268 -q -l 1024, this gets much more errors, definitely need -e.
4269 -q -e -l 1024, got pretty far before failing.
4270 -q -e -w 1 -l 1024, also got pretty far before failing.
4271 -q -e, this one got farthest of all, about 48K, before getting errors.
4272
4273 In the latter combinations that work somewhat better, we always get up to
4274 16K, or 32K, or 48K, before the errors start coming out and piling up.
4275 Sometimes the errors are recoverable and we receive as much as 300K
4276 successfully before giving up.
4277
4278 Now that we have data flowing pretty well (but not well enough), tried
4279 reinstating pty_make_raw(), but it hurt more than helped.
4280
4281 As a sanity check, I tried transferring from the same host over the same
4282 kind of connection (Kerberized Telnet) directly to K95's built-in Zmodem
4283 protocol, and that worked fine.  So the problem is definitely in the pty.
4284 Or more precisely, where Kermit writes incoming net data to the pty master.
4285
4286 26 Jan 2007: Tried changing the size of the net-to-pty buffer from 24K to
4287 1K.  Result: total failure.  Set both buffers to 1K.  Still total failure.
4288 Set both to 4K: now we get about 45K of data, then failure.  Put them both
4289 back to 24K, still fails totally -- the same code that worked pretty well
4290 yesterday.  Actually, no downloads work, not even Kermit, not even of
4291 text files.
4292
4293 27 Jan 2007: Since I have not been able to find a way to make ptys work for
4294 this, I made a third copy of this routine, this time using pipes instead of
4295 ptys.  The disadvantage here is that if the external protocol does not use
4296 stdio, the pipes won't work, but one thing a time...
4297
4298 Inferior Kermit starts in lower fork, but when it tries to send its first
4299 packet it gets errno=9 EBADF, Bad File Descriptor.  Substituting G-Kermit as
4300 the external protocol, which is simpler, reveals that the problem is that
4301 the external protocol gets errors when it tries to manipulate the its stdio
4302 file descriptors with ioctls, etc; these are not valid for a pipe.  The pipe
4303 mechanism itself works.  If I take out the test for ttpkt() failing in
4304 gkermit, the file transfer works OK.  Trying Zmodem... Sending works OK;
4305 receiving works a lot better than with ptys (it got 360K into the file
4306 before failing).  Making the buffers smaller, doesn't help.
4307
4308 I'm starting to wonder if the problem might be in my buffering code, rather
4309 than in the pty or pipe interface...  Try making a version that does
4310 single-character reads and writes.
4311
4312 This one reads the first packet from the lower Kermit and sends it.  It is
4313 recognized by the other Kermit, which sends an ACK.  We see the ^A of the
4314 ACK, but then select() times out on the next character -- OF COURSE: because
4315 at a lower level, it has already been read.  We have to check the myread
4316 buffer, and then call select() only if it's empty.  Making this change:
4317
4318  . SEND with G-Kermit works (but very slowly).
4319  . SEND with lsz works but gets a lot of errors, eventually succeeds.
4320
4321 Let's work our way back...  With the same changes to the buffered pipe version:
4322
4323  . SEND with G-Kermit/streaming works (fast).
4324  . SEND with lsz works too (fast), but we get gubbish at the end.
4325  . RECEIVE with Kermit fails because "/dev/tty is not a terminal device".
4326  . RECEIVE with rsz... lots of errors ("garbage count exceeded") but succeeded.
4327
4328 But maybe now we're seeing pipe artifacts, so going back one more step to
4329 the version that gets its own pty and starts its own fork:
4330
4331  . SEND with G-Kermit/Streaming works (fast) but select() times out at the end.
4332
4333 Another breakthrough: Moved the write pieces to below the read pieces.  This
4334 is what was preventing the buffer reset code from working -- with the writes
4335 done before the reads, we never catch up and can never reset the buffers.
4336
4337  . SEND with G-Kermit/streaming works (fast) (but there's a pause at the end)
4338  . SEND with lsz works (fast) (but there's a pause at the end)
4339  . RECEIVE with rsz... lots of errors ("garbage count exceeded") and fails.
4340  . RECEIVE with Kermit -- nothing happens (it thinks it succeeded), then we
4341      reconnect, terminal sees S packet and goes into autodownload
4342
4343 From the log it looks like ttpkt() fails in the lower Kermit.  Switching
4344 this with the hacked G-Kermit...  it gets "transmission error on reliable
4345 link".  Tried again with real Kermit below, this time with "-l 0" and not
4346 streaming.  This was actually working, but slowly, I don't see any NAKs in
4347 the packet log, but then select() timed out.
4348
4349 28 Jan 2007: Restored both the calls to pty_make_raw():
4350
4351  . SEND with C-Kermit streaming works, but slow (54Kcps)
4352  . Ditto, but with debugging off -- hangs forever.
4353  . Ditto, but using G-Kermit instead of C-Kermit -- also hangs forever.
4354
4355 Backed off on calling pty_make_raw().  Same thing.
4356 Reduced size of net-to-pty buffer.  Same thing.
4357
4358 15 Feb 2007...  Decided to give up on this and publish it as is, in hopes
4359 that somebody with more experience with ptys can make it work, because I'm
4360 just going in circles.  So today I just have to get the code into shape so
4361 people could choose among the three alternative routines.  The second one,
4362 yttyptycmd(), is the one that uses openpty(), which is not portable, so it
4363 can be enabled only for Mac OS X, NetBSD, FreeBSD, and Linux, or by also
4364 defining HAVE_OPENTPY at compile time.  Anyway, if you build Kermit in the
4365 normal way, you get the regular behavior -- ttruncmd() is used to execute
4366 external protocols.  If you build it with -DXTTPTYCMD, you get the first
4367 version of ttptycmd(); with -DYTTPTYCMD the second, and with -DZTTPTYCMD the
4368 third.
4369
4370 (Then some interruptions, then...)
4371
4372 From Jeff, fix hostname comparison in X.509 certificate checking to work
4373 right in the case of names that contain no periods.  dNSName_cmp(): cl_ssl.c,
4374 21 Feb 2007.
4375
4376 John Dunlap noticed some strange behavior when transferring files between
4377 home base and the EM-APEX oceanographic floats via satellite... long story,
4378 but every so often the transfer would get stuck for a long time, and it
4379 happened only when C-Kermit was sending a file and received two or more
4380 packets (Ack or Nak) back to back from the float.  Years ago I added some
4381 lookahead code to ttinl() to clear the input buffer of any interpacket junk
4382 so that, in the windowing case, we wouldn't be tricked next time around into
4383 thinking a packet was waiting to be read when there wasn't.  The code, which
4384 has been there for a while, was a bit fractured; luckily, it would be
4385 executed only when the debug log was active so it didn't have much effect.
4386 The problem was that if the SOP came immediately after the EOP, it could be
4387 missed because the loop read the next character before checking the current
4388 one.  Fixed by rearranging the loop.  Also I changed it so it would execute
4389 in all cases, not only when the debug log was active.  Also, cleaned up a
4390 bunch of confusing #ifdefs and removed some chunks that had been commented
4391 out for years, decades maybe.  ttinl(): ckutio.c, 21-22 Feb 2007.
4392
4393 Added NOW keyword info to HELP DATE, plus a tip about how to convert to UTC;
4394 suggested by Arthur Marsh.  ckuus2.c, 22 Feb 2007.
4395
4396 When an FTP client sends NLST to the server and no matching files are found,
4397 the server is supposed to respond with an error message on the control
4398 channel and nothing on the data channel.  However it seems that at least one
4399 server sends the error message back on the data channel, as if it were a
4400 filename ("/bin/ls: blah: No such file or directory"), and on the control
4401 channel there is no error indication ("226 ASCII Transfer complete").  At
4402 this point remote_files() has a listfile and, if a match pattern was given,
4403 it looks through list to see if any of the lines match the given filename,
4404 e.g. "blah".  This makes FTP CHECK give false positives.  The problem
4405 (diagnosed by Jeff) is that the match pattern was not given in this case, so
4406 it takes some random default action, resulting in the spurious success
4407 return.  Fixed by using the user's string as the pattern.  Not tested,
4408 however, since I don't have access to a server that behaves this way.
4409 ckcftp.c, 22 Feb 2007.
4410
4411 If an external-protocol file transfer fails, don't print Kermit-specific
4412 hints.  ckuus5.c, 22 Feb 2007.
4413
4414 One more time with ttinl().  Got rid of the "csave" junk, which never could
4415 have worked (which is no doubt why it was in a debugging section).  The
4416 problem was that saving the beginning of the next packet locally did not
4417 synchronize with the buffer clearing (ttflui()) done at a higher level,
4418 between calls to ttinl().  So now, the lookahead code, if it finds the
4419 beginning an as-yet unread packet, puts it back at the head of the input
4420 queue.  This way, if the protocol engine clears the input buffer, it will
4421 get the whole packet, not just the part after the SOH.  ckutio.c, 24 Feb 2007.
4422
4423 From Steven M Schweda, Saint Paul, MN: adaptation of large file support to
4424 VMS (it was already possible to transfer large files in VMS C-Kermit but the
4425 file-transfer display and statistics were wrong).  And a minimal adaptation
4426 of the FTP client to VMS -- no RMS, no special VMS file stuff, Stream_LF and
4427 binary files only, developed and tested only with UCX.  SSL/TLS is
4428 supported.  The source-code changes are minimal; most have nothing to do
4429 with VMS, but with header files, prototypes, and data types (e.g. ftp_port
4430 int rather than short, various signed/unsigned conflicts) to shut up
4431 compiler warnings.  Some of these could be dangerous in terms of
4432 portability; I've marked them with /* SMS 2007/02/15 */.  ckcfns.c,
4433 ckcnet.h, ck_ssl.h, ckuus3.c, ckuus4.c, ckvfio.c, ckcftp.c, ckvker.mms
4434 (which was rewritten to actually reflect the source module dependencies),
4435 ckvker.com (also heavily modified).  ckvker.com (the "makefile" for VMS
4436 C-Kermit) now indludes "F" and "I" option flags for the large File and
4437 Internal ftp features, plus better handling of Vax/Alpha/IA64 distinction.
4438 26 Feb 2007.
4439
4440 Changed NetBSD targets to include -DHAVE_OPENPTY and -lutil, so they
4441 can use openpty().  makefile, 26 Feb 2007.
4442
4443 Built on Solaris without and with SSL OK.
4444 Built on NetBSD with Kerberos 5, OK.
4445 Built on Mac OS X 10.4, regular version, OK.
4446 Built on Mac OS X 10.4 with SSL and Kerberos 5, OK.
4447
4448 On VMS 7.2-1/Alpha with MultiNet 4.4A-X...
4449
4450 'CC' 'CCOPT' KSP:ckuus3
4451 %DCL-W-TKNOVF, command element is too long - shorten
4452  \CKUUS4.OBJ "'CC' 'CCOPT' KSP:ckuus4" "KSP:ckuus4.c KSP:ckcsym.h KSP:ckcdeb.h
4453  KSP:ckclib.h" "KSP:ckcasc.h KSP:ckcker.h KSP:ckcnet.h KSP:ckvioc.h"
4454 "KSP:ckctel.h KSP:ckuusr.h KSP:ckucmd.h KSP:ckuver.h" "KSP:ckcxla.h
4455  KSP:ckuxla.h KSP:ckcuni.h KSP:ckuath.h"
4456
4457 The new rule for ckuus4.c was too long.  I removed one file from the
4458 dependency list (ckcxla.h, which will probably never change again) and that
4459 made it OK.  Built Nonet and Net versions OK, but this is without the new
4460 stuff.
4461
4462 "make f" (large-file support) on VMS 7.2-1...
4463 'CC' 'CCOPT' KSP:ckuus4
4464                     if (CKFSEEK(fp,(CK_OFF_T)j,SEEK_CUR) != 0) {
4465 ........................^
4466 %CC-I-IMPLICITFUNC, In this statement, the identifier "fseeko" is implicitly
4467 declared as a function.
4468
4469 Ditto for ftello and fseeko in various other places, and then fseeko and
4470 ftello come up up undefined at link time.
4471
4472 The rule for ckcftp in "make i" (Internal FTP support) had the same problem.
4473 I removed ckcxla.h from its dependency list too, but "utime" comes up
4474 undeclared at compile time and undefined at link time.
4475
4476 Verdict: neither one of the two new features can be used in VMS 7.2 or
4477 earlier, but the code still builds OK if you don't ask for them.
4478
4479 VMS 8.3 on IA64...  Can't build anything:
4480 %MMS-F-BADTARG, Specified target (WERMIT) does not exist in description file
4481
4482 27 Feb 2007: Changed CKVKER.COM to keep all its dependencies but use a
4483 shorter logical name (Steven M Schweda).  The problem on VMS 8.3 is that MMS
4484 now supports case-sensitive file systems, and so it can't find anything.
4485 Workaround: bypass MMS (include "m" in P1).  With this, "@ckvker.com ifm"
4486 builds OK on HP Testdrive, but I can't test the new features since outbound
4487 connections are not allowed there.  As for fseeko(), ftello(), and utime(),
4488 they simply are not availble prior to VMS 7.3.  It would probably be a good
4489 idea to test for this in CKVKER.COM, but actually it is possible to install
4490 newer C's and CRTLs on older VMS versions, so don't stand in their way.
4491
4492 28 Feb 2007: With additional chages from SMS, and then some further
4493 adjustments, I was able to build the FTP version on VMS 7.2-1.  First I
4494 tested it with GET of a binary file, but it transferred it in text mode.
4495 After a few more attempts with PUT and GET, it crashed with "floating/decimal
4496 divide by zero" in ckscreen, ckuusx.c line 27859.  Of course, that's the
4497 listing line, not the source line, and I don't have a listing.
4498
4499 To get a listing, I deleted CKUUSX.OBJ and then did:
4500
4501   $ make i "" "" "/LIST"
4502
4503 Surprisingly, it recompiled everything.
4504
4505 Anyway, the divide by zero happened in a section of code where the divisor
4506 was not checked, but it was a section of code we should not have been
4507 executing at all, since the file-transfer display was fullscreen, and this
4508 was in the "brief" section.  Anyway, I added the needed check.  Again, it
4509 recompiles everything.  Maybe there's no MMS on grumpy -- right, there isn't.
4510
4511 ANYWAY... Try to GET a binary file like this:
4512
4513   binary
4514   ---> TYPE I
4515   200 Type set to I.
4516   get gkermit
4517   ---> TYPE A
4518   200 Type set to A.
4519   ---> SIZE gkermit
4520   550 gkermit: file too large for SIZE.
4521   GET gkermit (text) (-1 bytes)---> TYPE A
4522
4523 Anyway... "get /binary gkermit" downloads it, seemingly correctly (the byte
4524 count is right).
4525
4526 But "put /binary gkermit.;1" results in a 0-length GKERMIT file being sent.
4527 Here's the debug log:
4528
4529 FTP PUT gnfile[DISK$MSA4:[C.FDC.NET]gkermit.;1]=1
4530 ftp putfile flg[DISK$MSA4:[C.FDC.NET]gkermit.;1]=0
4531 zltor fncnv[DISK$MSA4:[C.FDC.NET]gkermit.;1]=-1
4532 FTP PUT nzltor[GKERMIT]
4533 zfnqfp 1[DISK$MSA4:[C.FDC.NET]gkermit.;1]=675
4534 zfnqfp 2[DISK$MSA4:[C.FDC.NET]GKERMIT.;1]=31
4535 zfnqfp 3[DISK$MSA4:[C.FDC.NET]GKERMIT.;1]=31
4536 zrelnam result 2[gkermit.;1]
4537 ftp sendrequest restart[DISK$MSA4:[C.FDC.NET]gkermit.;1]=0
4538 openi name[DISK$MSA4:[C.FDC.NET]gkermit.;1]
4539 openi sndsrc=-1
4540 openi file number=2
4541 zopeni[DISK$MSA4:[C.FDC.NET]gkermit.;1]=2
4542 zopeni fp=0
4543 chkfn=2
4544 chkfn return=0
4545 zopeni fixed file format - using blk I/O
4546 zopeni binary flag at open=1
4547 zopeni ifile_bmode=1
4548 zopeni binary=1
4549 zopeni RMS operations completed ok
4550 openi zopeni 1[DISK$MSA4:[C.FDC.NET]gkermit.;1]=1
4551 ftpcmd cmd[PASV]
4552 FTP SENT [PASV]
4553 FTP RCVD [227 Entering Passive Mode (166,84,1,2,233,216)]
4554 initconn connect ok
4555 FTP SENT [STOR GKERMIT]
4556 FTP RCVD [150 Opening BINARY mode data connection for 'GKERMIT'.]
4557 doftpsend2 ftpcode[STOR]=150
4558
4559   Here is where the file is supposed to be read and sent but there is nothing
4560   in the log between the "doftpsend2 ftpcode" line and the following line.
4561
4562 rftimer status=1
4563 gftimer status 1=1
4564 gftimer status 2=1409025
4565 gftimer status 3=1409025
4566 gftimer s[0.000000]
4567 zclose n=2
4568 chkfn=2
4569 chkfn return=1
4570 zclose ZIFILE RMS operations completed ok
4571 ftp getreply lcs=0
4572 ftp getreply rcs=-1
4573 ftp getreply fc=0
4574 FTP RCVD [226 Transfer complete.]
4575 ftp getreply[226 Transfer complete.]=2
4576 doftpsend2 ok=0
4577
4578 Everything is OK up until we go to send the file, then it behaves as if we
4579 got EOF immediately and so closes the data connection, and reports success;
4580 an empty copy of the file is left on the far end.
4581
4582 Starting over with a text file....  PUT LOGIN.COM gets another divide by
4583 zero.  But it happened in the code I just fixed, which is impossible.  Swell.
4584 I recompiled everything and this time the upload worked, and downloading it
4585 again worked too.
4586
4587 But a binary file still can't be uploaded.  Trying to upload a text file
4588 after doing this seems to succeed (reports the right number of bytes sent)
4589 but nothing appears on the far side.
4590
4591 SUMMARY:
4592
4593   To download a text file: GET /ASCII blah.txt    (/ASCII is optional)
4594   To download a binary file: GET /BINARY blah.bin (/BINARY is required)
4595   To upload a text file: PUT blah.txt             (/ASCII switch not needed)
4596   To upload a binary file: PUT /BINARY blah.bin   (doesn't work)
4597
4598 Problems:
4599   . Why doesn't BINARY "stick"?
4600   . Why don't binary uploads work?
4601
4602 The culprit seems to be the VMS version of zxin().  In the FTP module,
4603 zxin() is called only when sending binary files.  In VMS, zxin() is just
4604 a front end for C-Library fread().  It probably needs to do just do
4605 zminchar() in a loop, like binary mode does, but calling zzout instead
4606 of xxout.  Or something like that.  FINISH THIS TOMORROW (debug on grumpy).
4607
4608 2 Mar 2007: New logs from John Dunlap.
4609
4610 ema-1636-log-0175.dbg: C-Kermit uploads a short file. It receives an Ack for
4611 the Z packet it just sent, tailgated by the beginning of a Nak for the next
4612 packet.  When the second SOH is encountered, it is put back in the myread
4613 queue.  Then the protocol engine, to which we return the Ack, says, "I have
4614 the packet I wanted so I'm clearing the buffer", and away go the first two
4615 bytes of the Nak from the myread buffer.  Then, having just received the Ack
4616 of our Z packet, we send our B, and go to read the reply.  in_chk finds 0 in
4617 the myread buffer (which we just cleared) and 6 waiting to be read from the
4618 comms channel, which it does, obtaining the remaining 6 bytes of the Nak,
4619 which it properly discards.  (The reason this is proper is that, having
4620 already received the Ack for the last packet it sent, no Ack or Nak that
4621 arrives subsequently -- in the non-windowing case -- could possibly affect
4622 what it does next.)  Since it hasn't yet found a good packet, it keeps
4623 reading, and now it finds the Ack to the B, as soon as it showed up.  This
4624 is how it's supposed to work.  No time was lost because of anything that
4625 C-Kermit did.
4626
4627 ema-1636-log-0174.dbg: C-Kermit uploads a short file. It sends Data packet
4628 #3 and receives the Ack followed immediately by the first 3 bytes of a Nak
4629 for packet 4.  When it gets to the SOH of the second packet, it pushes it
4630 back in the queue.  Again, input() flushes the input buffer (myread queue
4631 and device buffer).  C-Kermit detects EOF on the file it is sending, and
4632 sends the Z packet.  Then it reads the remaining bytes of the Nak,
4633 which it discards, and then it finds the Ack for Z which comes in 23 seconds
4634 later, sends the B, gets a Nak for the B, sends the B again, gets the Ack
4635 for the B 4 seconds later, and done.  Again, it's working right and losing
4636 no time.
4637
4638 The question remains: what would happen if the protocol engine did not clear
4639 the buffer?  Would ttinl() retrieve all packets in sequence even when they
4640 come back to back?  To test this, I had C-Kermit send a file using 30 window
4641 slots and observed the stream of Acks in the reverse direction:
4642
4643   HEXDUMP: mygetbuf read (16 bytes)
4644   01 25 23 59 2f 52 39 0d | 01 25 24 59 2b 26 31 0d  .%#Y/R9. .%$Y+&1.
4645   ttinl lookahead my_count=9
4646   ttinl lookahead removed=^M
4647   ttinl lookahead pushback SOP=^A
4648   HEXDUMP: ttinl got (7 bytes)
4649   01 25 23 59 2f 52 39    |                          .%#Y/R9
4650   RECEIVE BUFFERS:
4651   buffer inuse address length data type seq flag retries
4652      0     1     29212 9667     0   Y    3     0
4653   [\ 1%#Y]
4654   ...
4655   in_chk my_count=8
4656   ...
4657   ttinl lookahead my_count=1
4658   ttinl lookahead removed=^M
4659   HEXDUMP: ttinl got (7 bytes)
4660   01 25 24 59 2b 26 31    |                          .%$Y+&1
4661   RECEIVE BUFFERS:
4662   buffer inuse address length data type seq flag retries
4663      0     1     29212 9667     0   Y    4     0
4664   [\ 1%$Y]
4665
4666 Here we can see that the pushed-back SOH was properly retrieved next time
4667 around, and the tailgating Ack was not lost.  This scenario repeats itself
4668 212 times in the log, and there are no screwups.
4669
4670 Back to VMS FTP...  The problem with sending binary files is that zxin()
4671 uses C-Library fopen()/fread() instead of RMS, so it can't access the input
4672 file, which was opened by zopeni(), which is totally RMS-ified in VMS
4673 C-Kermit.  For VMS only, I replaced the zxin() loop by a zminchar() loop
4674 like the one used in text mode, except without the character set or
4675 record-format conversion.  Tested by PUT /BINARY of some binary files, which
4676 worked fine.  ckcftp.c, 2 Mar 2007.
4677
4678 Next problem...  VMS C-Kermit ftp client sending binary files in text mode.
4679 Variation 1: We just send the file.  zopeni() is supposed to detect that
4680 it's a binary file and automatically set the mode.  And it does:
4681
4682   zopeni fixed file format - using blk I/O
4683   zopeni binary flag at open=0
4684   zopeni ifile_bmode=1
4685   zopeni binary=0
4686   zopeni autoswitch from TEXT to BINARY
4687   zopeni RMS operations completed ok
4688
4689 but then in gnfile():
4690
4691   if (!server || (server && ((whatru & WMI_FLAG) == 0)))
4692     binary = gnf_binary;        /* Restore prevailing transfer mode */
4693
4694 Well, since VMS sets text/binary mode automatically when sending files,
4695 this code can (and should) be skipped in VMS.  gnfile(): ckcfns.c, 2 Mar 2007.
4696
4697 Variation 2: BINARY or SET FILE TYPE BINARY doesn't force binary mode.  But
4698 SET FTP TYPE BINARY does.  But BINARY does indeed call doftptyp() so what's
4699 the problem?  We do indeed set ftp_typ to 1 but it gets reset somewhere
4700 before we call zopeni().  But then zopeni() puts it back to 1.  Tracing
4701 through a transfer, it looks like all of this works right, it's only that
4702 the file transfer display says TEXT when the transfer is really in binary
4703 mode.  This is because screen() is called before openi().  I wonder if we
4704 can call scrft() from the ftp module...  No, that would be too easy.  OK,
4705 sendrequest calls openi() and sets the file mode; putfile() calls
4706 screen(SCR_FN), which prints the transfer mode.  But putfile calls
4707 sendrequest() after it puts up the screen that says the file type.  So it
4708 looks like sendrequest() has to call screen(SCR_FN) again if it changes the
4709 file type.  OK, that did it.  ckuusx.c, ckcftp.c, 2 Mar 2007.
4710
4711 The BINARY and TEXT (ASCII) commands do not inhibit automatic type switching
4712 in VMS.  They don't in Unix either.  They never have.  Should they?  I think
4713 so, otherwise what good are they?  Plus we want the Kermit FTP client to
4714 behave like the others.  I added code for this but it doesn't work, due to
4715 the layers and layers of text/binary detection and switching and
4716 if-this-but-then-if-that...  Anyway, no harm done.  The normal rule is:
4717 when you PUT a file, Kermit figures out on a per-file basis whether to use
4718 text or binary mode unless you include a /TEXT (/ASCII) or /BINARY switch
4719 in the PUT (or MPUT) command.  ckuus[r3].c, ckcftp.c, 2 Mar 2007.
4720
4721 Wed Mar 7 16:21:13 2007 WROTE SHORT TEST PROGRAM for ttruncmd (the openpty
4722 version) on Mac OS X.  On dulce: ~/kermit/ttpty.c / ttpty.sh.  It starts the
4723 external protocol in the lower fork.  The command to run is a command-line
4724 argument.  Sending and receiving files with Kermit works OK.  But again, the
4725 standalone program totally fails when I use sz or lsz as the external
4726 protocol.  So it looks like we can rule out any environmental effects of
4727 running the code inside C-Kermit.
4728
4729 Mon Mar 12 16:52:20 2007: Put some effort into making ttpty.c more useful;
4730 added a debug log.  Found that for some reason, at least on Mac OS X,
4731 select() always timed out at the the end.  I added a SIGCHLD alarm and that
4732 seems to handle the fork exit condition very nicely.  Now we can send (say)
4733 a 3MB file at good speed on Ethernet (1Mcps) considering the debugging, etc,
4734 and it terminates instantly.  But when sending a file into ttptycmd (with
4735 "gkermit -r"), things go wrong at the end -- the Z packet is never
4736 acknowledged.  This is reproducible.  Maybe this is a good lead....  The log
4737 shows that select() timed out, even though the gkermit fork had not yet
4738 exited (or finished).  It looks like gkermit sent the Ack, ttpty.c read it
4739 from the pty and sent it out the net:
4740
4741   0003: read pty=8                <-- read Ack from pty
4742   0003: loop top have_pty=1
4743   0003: loop top have_net=1
4744   0003: FD_SET pty_in
4745   0003: FD_SET ttyfd in
4746   0003: FD_SET ttyfd out=8
4747   0003: nfds=5
4748   0003: select=1
4749   0003: FD_ISSET ttyfd out
4750   0003: write net=8               <-- send ack to net
4751   0003: loop top have_pty=1
4752   0003: loop top have_net=1
4753   0003: FD_SET pty_in
4754   0003: FD_SET ttyfd in
4755   0003: nfds=5
4756   0009: select=0
4757   0009: select timeout - have_pty=1
4758
4759 But Ack never arrived.  This is a streaming transfer.  But nope, streaming
4760 is not the problem.  If I disable streaming ("gkermit -Sr"), we hang in in
4761 the middle of sending the data.  If I use small packets, we don't hang:
4762 1000 is OK, 2000 is not.  In fact, the cutoff is 1024.  OK, TBC...
4763
4764 Wed 14 Mar 2007: Receiving a file thru ttpty "gkermit -e 1200 -Srd"
4765 produces a debug log that shows that gkermit gets a lot of EAGAIN errors
4766 when it tries to read from its stdin.  In fact, it takes 6 tries (read()
4767 calls) to read the S packet (27 bytes).  Then when the first data packet
4768 arrives (1200 bytes), read() never returns even one single byte.  The
4769 timeout interval is 15 seconds and it times out repeatedly.  Added a
4770 primitive hex dump to the ttpty debug log for each read/write (showing only
4771 the first 24 characters and the last character, so it fits on one line).
4772 Tried uploading a file.  The S, F, and A packets (short) are received and
4773 Ack'd OK, but then ttpty select() times out, never receiving even one byte
4774 from the D packet.  Clearly, when the pty driver receives a burst of > 1K
4775 bytes, stops working.  As before, if I limit the packets to < 1K, it works
4776 fine.
4777
4778 Can I send an 8-bit binary file?  Nope.  ttpty reads the binary data just
4779 fine from the net and writes it exactly as it was received to the pty, but
4780 the first time we write an 8-bit byte, we never hear back from the PTY
4781 again.  But the log shows that when the initial 7-bit packets from the pty,
4782 it looks like the PTY is not in rawmode, because these packets end with ^J
4783 rather than ^M.  Calling pty_make_raw() on the masterfd and slavefd
4784 explicitly, however, doesn't change anything.  It doesn't matter if I do
4785 this in the lower fork or the upper fork.  So maybe it's the actual
4786 semantics of pty_make_raw() that are wrong.
4787
4788 Thu 15 Mar 2007: Went thru all the terminal mode flags in Mac OS X; didn't
4789 help.  Changed hex dump to show whole packet.  Put hex dump routine in a
4790 private copy of G-Kermit.  Tried to transfer an 8-bit file, logging both
4791 ttpty and gkermit.  Compared what ttpty received on stdin with what it sent
4792 to the pty (same) and what was received by G-Kermit (same).  Then I realized
4793 that my little test program was not putting its controlling terminal into
4794 raw mode; when I did that, I could upload binary files (streaming, 2MB/sec).
4795 And with Zmodem too (with rz; lrz doesn't work for some reason).  Looking
4796 back at the original in ckutio.c, I see that ttptycmd() never called
4797 ttpkt().  Maybe that was the trouble all along.  (Yup, but maybe not the
4798 whole trouble.)
4799
4800 Moving back to C-Kermit and the original ttptycmd() routine, adding the call
4801 to ttpkt(), and stripping out a lot of cruft, and moving the pty_make_raw()
4802 code to ckupty.c, Kermit uploads and downloads (streaming) work fine in
4803 Solaris.  Zmodem sends a file, but then the transfer hangs at the very end,
4804 as if the signoff protocol were lost.  This happens on Solaris.  If I move
4805 back to Mac OS X, everything works just fine.  Then, making a Kerberized
4806 connection from the Mac to NetBSD, I can send files from the Mac with both
4807 Zmodem and Kermit.  Receiving...  Kermit OK.  Zmodem...  Nope.  "rz:
4808 Persistent CRC or other ERROR" (and created a 265MB debug.log!)
4809
4810 Fri 16 Mar 2007: ttptycmd() was for sending files with Zmodem across
4811 encrypted connections.  But it occurred to me that it's necessary for
4812 clear-text connections too; e.g. Telnet, where 0xff has to be doubled.  Of
4813 course Zmodem doesn't do that itself, so there's no way Zmodem external
4814 protocol could work when executed over a Telnet connection, and in fact
4815 it doesn't.  I wonder why I ever thought it did.
4816
4817 Wed 21 Mar 2007: Back to where we left off a week ago.  Trying C-Kermit's
4818 ttptycmd() on the Mac again, in remote mode:
4819
4820  . G-Kermit send txt (kst): OK  832Kcps  
4821  . G-Kermit recv txt (kr):  OK  425Kcps  
4822  . G-Kermit send bin (ksb): OK 1000Kcps  
4823  . G-Kermit recv bin (kr):  OK  188Kcps  
4824
4825 And Zmodem:
4826
4827  . sz txt (zst): OK  563Kcps  
4828  . sz bin (zsb): OK  714Kcps  
4829  . rz txt (zr):  OK  863Kcps  
4830  . rz bin (zr):  OK  198Kcps  
4831
4832 So in remote mode, everything works.  Now let's try a clear-text Telnet
4833 connection...
4834
4835  . G-Kermit send txt (kst): OK  841Kcps
4836  . G-Kermit recv txt (krt): OK  391Kcps
4837  . G-Kermit send bin (ksb): OK  811Kcps
4838  . G-Kermit recv bin (krb): OK  171Kcps
4839
4840 And Zmodem over the same clear-text telnet connection:
4841
4842  . sz txt (zst): OK  91Kcps (*)
4843
4844 Kermit is sending sz messages like "sz 3.73 1-30-03 finished." to the
4845 host, which tries to execute them, after the transfer is finished.
4846 Of course "sz" is a command, but:
4847
4848   sz: cannot open 3.73: No such file or directory
4849   sz: cannot open 1-30-03: No such file or directory
4850   sz: cannot open finished.: No such file or directory
4851
4852 Did I lose that code that dis-redirects stderr when I went back to using the
4853 pty code from the ckupty module?  No, it's there and it's being executed.
4854 Apparently the copy of sz I have is writing its "finished" message to stdout
4855 because "sz blah 2> /dev/null" does not suppress it.  Starting again with
4856 lsz instead of sz:
4857
4858  . sz txt (lzst): OK  413Kcps
4859  . sz bin (lzsb): OK  FAILED (*)
4860  . rz txt (lzrt): OK  
4861  . rz bin (lzrb): OK
4862
4863 (*) Sigh.  Using lsz, we get "garbage count exceeded" errors and eventual
4864 failure.  But using regular sz, we get the extraneous message that starts
4865 sz on the far tend, and the resulting getty babble.
4866
4867 But even without changing the code, it will work one minute, and then fail
4868 consistently the next.  For example, I was able to send files with sz
4869 successfully over and over, but with the getty babble at the end.  Then,
4870 after trying lsz and then going back to sz, every attempt at sending a file
4871 quits with "Got ZCAN".  The difference has to be that Kermit always does at
4872 least some minimal encoding of C0/C1 control characters such NUL and DEL and
4873 IAC, and I doubt that Zmodem does.
4874
4875 http://zssh.sourceforge.net/ says:
4876
4877   If file transfer is initiated but never completes (ie a line like :
4878
4879      Bytes Sent:      0/    513   BPS:0        ETA 00:00  Retry 0: Got ZCAN
4880
4881    can be seen, but transfer never completes), chances are the pty/tty on one
4882    of the systems are not 8-bit clean.  (Linux is 8-bit clean, NetBSD is not).
4883    Using the -e (escape) option of rz should solve this problem.
4884
4885 It doesn't, at least not with lrz.  And yes, the receiving end happens to be
4886 NetBSD.  But it looks like the zssh people have been down this road too.
4887
4888 But with rz and sz, it worked.  Once.  Twice.  Three times.  But of course,
4889 with the getty babble at the end.  This can be taken care of by doing:
4890
4891   rz -eq ; cat > foo
4892
4893 which puts "sz 3.73 1-30-03 finished" and any other messages in foo (but you
4894 have to type ^D to finish the cat).  Using this method I was also able to
4895 send an 8K binary file that contained a test pattern of all 256 possible byte
4896 values.  Then I tried a 3MB binary executable.  All OK.  So here we go again:
4897
4898  . sz txt (zst): OK
4899  . sz bin (zsb): OK
4900  . rz txt (zrt): 
4901  . rz bin (zrb): 
4902
4903 Downloading fails about halfway through a fairly large file.  I tried an
4904 even bigger file, guaranteed to be 100% ASCII; same thing -- halfway
4905 through: "rz: Persistent CRC or other ERROR".  But it worked with a smaller
4906 version of the same file (82K versus 2MB).  Tried again with the bigger
4907 version, it failed in exactly the same way at exactly the same spot: byte
4908 number 1048320.  But this is just ASCII text so it can't be a transparency
4909 problem.  Substituting another plain ASCII file of the same size but totally
4910 different contents, it doesn't fail (2.36MB).  Back to the previous file, it
4911 fails again, but in a different spot (832960).  So it's not totally
4912 deterministic.
4913
4914 To round things out, I tried downloading the binary test-pattern file; it's
4915 only 8K.  This failed.
4916
4917   -4, --try-4k                go up to 4K blocksize
4918   -B, --bufsize N             buffer N bytes (N==auto: buffer whole file)
4919   -e, --escape                escape all control characters (Z)
4920   -E, --rename                force receiver to rename files it already has
4921   -L, --packetlen N           limit subpacket length to N bytes (Z)
4922   -l, --framelen N            limit frame length to N bytes (l>=L) (Z)
4923
4924 Tried again with "sz -L 256 -B 256 -4aeq".  Doesn't change anything.
4925
4926 NOTE: Mac OS X rz 3.73 1-30-03 does not support -e.
4927 NetBSD rz 0.12.20 does support -e.
4928
4929 Thu 22 Mar 2007: It occurs to me that ttpkt() might still be a problem;
4930 maybe it's the network connection and not the pty that is not transparent
4931 enough.  To test this theory I did "stty raw ; stty -a" and then copied all
4932 of the flag values into ttpkt in the BSD44ORPOSIX section:
4933
4934  . rz txt (zrt): OK (2.36MB file, worked 2 out of 3 times)
4935  . rz bin (zrb): "rz: Persistent CRC or other ERROR"
4936
4937 A little more fiddling with the flags and I got the 8K binary test pattern
4938 to SEEM to download OK (in the sense that rz gave a 0 return code) but the
4939 file itself was truncated, always at 224.  If I changed the test pattern
4940 file to not include any bytes with value 224 (0xe0) or 255 (0xff), the
4941 download worked.  So we have a transparency problem somewhere.  The debug
4942 log shows that all byte values are being received from the network correctly
4943 so the problem has to occur when we try to feed them to the pty.
4944
4945 But no amount of twiddling with the termios flags seems to let these
4946 characters pass through.  Of course, since they are not in the C0 or C1
4947 control range, "sz -e" doesn't quote them (which it does by prefixing with
4948 Ctrl-X and then adding 0x40 to the byte value so (e.g.) NUL becomes ^X@.
4949 Note that 255 does not cause problems because it coincides with the IAC
4950 character; the remote Telnet server doubles outbound IACs, and Kermit's
4951 ttinc() undoubles them automatically (as the log shows).
4952
4953 Trying to send a different file (a C-Kermit binary) shows that 255 is the
4954 real killer; the file is truncated where the first one appears (at about
4955 6K), even though some 224's precede it.  Going back to the remote-mode test,
4956 I see the same thing happens with the binary test-pattern file, if I send it
4957 from K95 direct to rz-under-C-Kermit-in-remote-mode.  So it has nothing to
4958 do with C-Kermit having a network connection.  Yet if I send the same file
4959 direct from K95 to rz, it goes OK and the result is not truncated, so it's
4960 not Zmodem either.  The data arrives to C-Kermit intact, so the failure is
4961 definitely in writing it to the rz process through the slave and master ptys.
4962
4963 BUT if I send the same file from K95 to rz-under-ttpty, that works.  What's
4964 the difference?  Suppose I just transplant ttpty literally into C-Kermit...
4965 It makes no difference.  When receiving the test-pattern, it truncates it
4966 in exactly the same place.
4967
4968 Well, all this is on Mac OS X.  What if I move it to a different platform?
4969 OK, building on Solaris and following the exact same procedure, ttptycmd()
4970 doesn't even use the network connection.  I think that's because rzsz on
4971 Solaris is hardwired to use the controlling terminal and can't be
4972 redirected, even in a pty?
4973
4974 Moved to NetBSD.
4975
4976  . sz txt (zst): Failed ("Got ZCAN")
4977  . sz bin (zsb): 
4978  . rz txt (zrt): OK
4979  . rz bin (zrb): 
4980
4981 Well, this is a big mess.  Sending doesn't work (or sometimes it does but
4982 reports that it didn't).  Receiving...  well, actually it's the same thing;
4983 the file is completely transferred but then the final protocol handshake is
4984 lost.  The local C-Kermit returns to its prompt, but rz is still running:
4985
4986   Retry 0: Got TIMEOUT
4987   Retry 0: TIMEOUT
4988   Retry 0: Got TIMEOUT
4989   Retry 0: TIMEOUT
4990   Retry 0: Got TIMEOUT
4991   Retry 0: TIMEOUT
4992   Retry 0: Got TIMEOUT
4993   Retry 0: TIMEOUT
4994   Retry 0: Got TIMEOUT
4995   Retry 0: TIMEOUT
4996   Retry 0: Got TIMEOUT
4997
4998 I don't see how that is even possible.  Even after I exit from Kermit the
4999 messages keep coming, even though ps doesn't show the rz process anywhere.
5000 Looking at the code, I see a place where end_pty() was still commented out
5001 from the ttpty.c episode, I uncommented it.  But still:
5002
5003  . sz txt (zst): Fails ("Got ZCAN")
5004  . sz bin (zsb): Fails instantly (but with no diagnostic)
5005  . rz txt (zrt): OK
5006  . rz bin (zrb): Fails with tons of "Bad CRC", "Gargage Count exceeded"
5007
5008 Conclusion for the day: I think this is hopeless.  Even if I can get it to
5009 work somewhere, the results depend on the exact Zmodem software, how it uses
5010 stdin/out vs stderr versus getting its own nonredirectable file descriptor,
5011 versus the Zmodem version on the other end and which options are available
5012 on each, versus the pty and select() quirks on each platform, and on and on.
5013 It will be so hard to explain and to set up that nobody would ever use it.
5014 It would be better to just implement Zmodem internally.
5015
5016 Fri 23 Mar 2007: Went back to the small test program, ttpty.c.  Tried
5017 setting both the master and the slave pty to rawmode, even though I have
5018 never seen any other software that did this.  I had it receive the binary
5019 test pattern file; it worked.  I made a bigger test-pattern file, 3MB,
5020 containing single, double, and triple copies of each byte in byte order and
5021 in random order, this one was accepted too.
5022
5023 So it would seem that the ckupty.c module is something to avoid after all.
5024 It's full of stuff I don't understand and probably should not undo.  So
5025 changing C-Kermit's ttptycmd() to manage its own pty again, using openpty()
5026 (which is not portable), I got it all to work in remote mode: Kermit
5027 text/binary up/down and Zmodem text/binary up/down.  But in local mode on
5028 the client side of a Telnet connection...
5029
5030   zst: OK, but we still get the getty babble at the end that starts sz.
5031   zsb: OK, ditto.  This is with the 3MB test-pattern file.
5032   zrt: Not OK -- "Persistent CRC or other ERROR"
5033   zrb: Not OK -- got the cutoff at 224 again "Persistent CRC or other ERROR"
5034
5035 It's close.  But actually this was still with USE_CKUPTY_C defined.  When I
5036 undefined it, it was back to being totally broken.  Start over.  (Check the
5037 new cfmakeraw() code.)
5038
5039 Tue 27 Mar 2007: Starting over.  Back to ttpty.c.  Let's verify, VERY
5040 CAREFULLY, that it really does work, using the most stressful of the four
5041 tests: sending the big (3.2768MB) binary test pattern from K95 into rz
5042 through ttpty, logging everything.  ttpty definitely receives the big file
5043 smoothly with no errors or hiccups when I have it set to use the master side
5044 of the pty for i/o.  The application program (Zmodem in this case) runs on
5045 the slave, and the network and/or control program communicates with the
5046 master.  This implies that Zmodem controls the terminal modes of the slave,
5047 and ttpty should be concerned with those of the master.  Doing it this way
5048 in ttpty confirms this.
5049
5050 Fine.  But if I tell ttpty to SEND a file with sz, nothing happens.  Ditto
5051 with lsz.  Select times out waiting for input from the pty.  But if I
5052 manually tell K95 to RECEIVE /PROTOCOL:ZMODEM it works OK.  Somehow sz's
5053 initial B000000 string is being swallowed somewhere, and it's waiting for
5054 a reply from the receiver.  sigh...  But "ttpty gkermit -s filename" works
5055 fine.  What's the difference?  It has nothing to do with stdout vs stderr;
5056 sz is not writing to stderr at all.  Is it some timing thing between the
5057 forks?  Aha.  It's that I change the modes of the pty master in one fork
5058 while sz is already starting in the other fork.
5059
5060 OK, good, now for the first time we have Kermit and Zmodem both able to
5061 upload and download a large worst-case binary test-pattern file... in
5062 remote mode.  Now taking today's lessons and fitting them back into
5063 C-Kermit so I can try it local mode...
5064
5065 Using G-Kermit as the external protocol, first in remote mode...  All good:
5066 text/binary up/down.  The "halting problem" is solved by SIGCHLD, which
5067 catches fork termination instantly and lets ttptycmd() know there is no more
5068 pty.  Zmodem:
5069
5070   zst: OK
5071   zsb: OK
5072   zrt: OK
5073   zrb: OK
5074
5075 That's a first.  Next, repeat in local mode, in which C-Kermit is the client
5076 and has made a Telnet connection to another host over a secure (Kerberos V)
5077 connection:
5078
5079   kst: OK     zst: ...
5080   ksb: OK
5081   krt: OK  
5082   krb: OK
5083   
5084 It seems we can never end a day on a high note.  Somehow I seem to have
5085 broken regular internal Kermit protocol transfers over encrypted connections
5086 -- the en/decryption engine loses sync.  But they still work OK over a
5087 clear-text Telnet connection.
5088
5089 Today's code in ~/80/dulce.tar (27 Mar 2007).
5090
5091 Added makefile target solaris10g+openssl.  Gathered all the standard CFLAGS
5092 for Solaris into cdcdeb.h so they don't have to be included in every single
5093 makefile target for Solaris.  On local Solaris 10 host OpenSSL is in
5094 /opt/openssl-0.9.8e/.  Tried the new makefile target, works OK.  Also made
5095 solaris10+openssl for Sun CC, but couldn't test it because I can't find any
5096 Solaris 10 host that has Sun CC.  Built with gcc at another site that has
5097 OpenSSL 0.9.8f-dev, all OK.  ckcdeb.h, makefile, 24 Jun 2007.
5098
5099 It occurs to me that Kermit transfers on secure connections might have been
5100 broken by the changes I made back in February to ttinl() for John Dunlap.
5101 Here, for the first time, we invoke myunrd() to push a byte back into the
5102 input queue, and there is also some funny business with "csave", which
5103 changed, and which an old comment notes that it has to be treated specially
5104 when encrypting.  So it could be that the broken Kermit transfer has nothing
5105 to do with the work on external protocols, and that putting back the
5106 previous ttinl() will fix it.  But now I can't seem to make a Kerberized
5107 connection from Panix to Panix, even though I can make one from Columbia to
5108 Panix.  This means I have to build a Kerberized binary from the current
5109 source code on either Solaris or Mac OS X.  Trying Solaris
5110 first... [~/solaris9k5/mk5.sh] This didn't work the first time due to
5111 undefined krb5_init_ets, which is referenced if MIT_CURRENT is not defined
5112 (it should be for Kerberos 5 1.05 and later and we have 1.42 here), tried
5113 again with -DMIT_CURRENT=1...  Nope, that one totally blew up in ck_crp.c.
5114 Later, Jeff says krb5_init_ets is a no-op in Kerberos 1.4.x and later,
5115 so I added an #ifdef (NO_KRB5_INIT_ETS) for skipping it; now it builds and
5116 runs OK.  ckuath.c, makefile, 9 Jul 2007.
5117
5118 Meanwhile, using C-Kermit on Mac OS X, which makes the Kerberized connection
5119 just fine, but still has the problem transferring files over it.  Packet log
5120 shows:
5121
5122   s-00-01-^A9 Sz/ @-#Y3~Z! z0___F"U1@A^M 
5123   r-00-01-^A9 Y~/ @-#Y3~^>J)0___J"U1@I
5124   s-01-01-^A(!Fx.x)(V^M
5125   r-xx-08-<timeout>
5126   S-01-08-^A(!Fx.x)(V^M
5127   r-xx-08-<timeout>
5128   S-01-08-^A(!Fx.x)(V^M
5129   r-xx-16-<timeout>
5130
5131 Note that S packet is sent, received, and Ack'd OK.  The F packet is sent but
5132 is never Ack'd.  Tried this several times and noticed that it's just
5133 receiving that is screwed up, not sending.  After ^C'ing out of the
5134 transfer, I can still type commands, and they are executed on the far end,
5135 but the results coming back are gibberish.  Mon Jul 9 16:08:22 2007 (come
5136 back to this later... substitute Dev.27 ttinl for current one and see if
5137 the problem goes away, and if so, conditionalize the new code for clear-text
5138 connections).
5139
5140 Built C-Kermit with Kerberos 5 on Solaris with a version of ckutio.c that
5141 uses the old ttinl() and transferred a file OK over a Kerberized connection.
5142 So now it's just a matter of reconciling the old and new ttinl.  The easiest
5143 way to do this is to have new ttinl() chain to old ttinl() if the connection
5144 is encrypted, which is what I did and it works fine.  At some point the two
5145 versions of ttinl() should be reconciled.  ckutio.c, 12 Aug 2007.
5146
5147 There was a function, islink(), used in only one place (ckuus6.c) that had
5148 the same name as a commonly used scalar variable, and it was missing a
5149 prototype.  Changed its name to isalink() and added the prototype (Unix
5150 only), ckuus6.c, ckufio.c, ckcdeb.h. 12 Aug 2007.
5151
5152 Revisiting the ASCII and BINARY top-level commands, which are supposed to
5153 be like in other FTP clients, but don't seem to have any effect.  I added a
5154 new routine to the FTP module, doftpglobaltype(), that sets the global,
5155 sticky, permanent transfer mode (ASCII or BINARY) (TENEX could be added to
5156 if anybody asks).  These commands (now that they work) are different from
5157 SET FTP TYPE { ASCII, BINARY }, which set the *default* transfer mode when
5158 automatic switching fails for a given file.  ckuusr.c, ckcftp.c, 12 Aug 2007.
5159  (notify: Matt <mlist@cmcflex.com>)
5160
5161 Even though the code hasn't changed, suddenly we're getting:
5162
5163   "ckuusx.c", line 5682: warning: implicit function declaration: tgetent
5164   "ckuusx.c", line 6183: warning: implicit function declaration: tgetstr
5165   "ckuusx.c", line 6262: warning: implicit function declaration: tputs
5166   "ckuusx.c", line 6266: warning: implicit function declaration: tgoto
5167
5168 in ckuusx.c on Solaris 9.  <curses.h> is still in /usr/include, dated 2002.
5169 A quick search shows the missing functions are hiding in <term.h>, which
5170 until now was included only in Linux.  Added a USE_TERM_H clause.  No, that
5171 doesn't help, the prototypes are not selected at compile time; there are
5172 #ifdefs in that file that skip over these prototypes.  I had to put them in
5173 the code under #ifdef BUG999..#endif (I could have used a longer name like
5174 #ifdef ADD_PROTOTYPES_FOR_CURSES_FUNCTIONS, but that would not be portable).
5175 ckuusx.c, 12 Aug 2007.
5176
5177 Also:
5178
5179   "ckuusx.c", line 9232: warning: implicit function declaration: creat
5180
5181 This is called in the IKSD dababase code, used for getting a lockfile.
5182 creat() is a Unixism in code that is supposed to be portable.  But IKSD only
5183 runs on Unix and Windows, so I assume the Windows C library has a creat()
5184 function.  Anyway, suddenly the Solaris header files seem to have blocked
5185 whatever path previously existed to the creat() prototype (which is in
5186 <fcntl.h>), so I added an #include in the appropriate spot.  ckuusx.c,
5187 12 Aug 2007.
5188
5189 Kermit functions for converting the number base -- \fradix(), \fhexify(),
5190 \unfhexify() -- did not work with big numbers; ckradix() was missed in the
5191 CK_OFF_T conversion.  Fixed in ckclib.c, 12 Aug 2007.
5192
5193 Updated the help text for ASCII, BINARY, and SET FTP TYPE to clarify the
5194 semantics.  ckuus2.c, ckcftp.c, 12 Aug 2007.
5195
5196 Error messages were printed upon failure to open any of the four log file,
5197 even with SET QUIET ON.  Fixed in ckuus4.c, 12 Aug 2007.
5198
5199 Built OK on NetBSD 1.3_RC3.  Tried to build secure version but the libraries
5200 had disappeared.  13 Aug 2007.
5201
5202 Built OK on Mac OS X 10.4.9.  Tried the secure version, macosx10.4+krb5+ssl.
5203 Here we get the usual pile of "pointer targets in passing argument 1 of
5204 (function name) differ in signedness", regarding security functions, but it
5205 built OK.  13 Aug 2007.
5206
5207 Reconciling the two ttinl's...  On encrypted connections myread() returns
5208 encrypted bytes; ttinl() has to decrypt them; it wasn't doing this in the
5209 lookahead section so I fixed it.  The new code works on both encrypted and
5210 clear-text connections.  I removed the chaining to oldttinl(), and
5211 oldttinl() itself.  ckutio.c, 13 Aug 2007.
5212
5213   (Wouldn't it make more sense and be more efficient and less confusing
5214   for myfillbuf() to do the decrypting?)
5215
5216 When C-Kermit uses Zmodem as an external protocol, it doesn't seem to scan
5217 files before sending them to set text or binary mode appropriately.  It's
5218 that external protocols bypass Kermit's whole "get next file" mechanism; the
5219 (possibly wild) filespec is simply passed to the external protocol program.
5220 Changing this would be a very big deal.  But if only one file is being sent
5221 (the filespec is not wild) it's easy enough to check.  I added this to the
5222 external protocols section of the protocol module.  It can be overridden in
5223 any of the regular ways (/TEXT or /BINARY switch on SEND command, SET
5224 PATTERNS OFF, SET TRANSFER MODE MANUAL, etc).  ckcpro.w, 13 Aug 2007.
5225
5226 [FTP SEND /RECURSIVE]
5227 Peter Crowley reported a problem with FTP recursive uploads getting the
5228 directory tree wrong when the previous pathname was a left substring of the
5229 new pathname (e.g. foo/bar/ and foo/bar2/).  The logic did not handle this
5230 case and created the bar2 directory as a subdirectory of bar, rather than as
5231 a parallel directory.  Fixed in syncdir() and tested with various edge cases.
5232 ckcftp.c 14 Aug 2007.
5233
5234   notify <peter.crowley@alumni.utexas.net>
5235
5236 Added CD messages to FTP BRIEF display to track the ups and downs of
5237 recursive uploads.  ckcftp.c, 14 Aug 2007.
5238
5239 The OUTPUT command gave a misleading error message ("Connection to xxx not
5240 open") when used on a serial port that was, indeed, open but was not
5241 presenting the Carrier signal, when CARRIER-WATCH was not OFF.  Added a new
5242 message for this, and some others.  ckuus5.c, 14 Aug 2007.
5243
5244 Sending from the command line, e.g. kermit -s foo, did not give an
5245 informative error message if the file could not be found or opened.  Fixed
5246 in ckuusy.c, 14 Aug 2007.
5247
5248 OK, back to ttptycmd....  It seems that back on March 27th, I got everything
5249 working but I thought that there was still something wrong with it because
5250 an unrelated problem so I put it aside.  The version of ttpty.c from that
5251 date worked OK, and it looks like I updated ckutio.c from it, but that
5252 version of ckutio.c was put aside.  Since then I have been working on the
5253 ckutio.c version that was NOT put aside and so now I have to reconcile the
5254 two:
5255
5256   ~/80/ttypty/20070327/ckutio.c
5257   ~/80/ckutio.c
5258
5259 As a first cut I did this simply by replacing the contents of the #ifdef
5260 CK_REDIR section of the latter with that of the former.  Of course in
5261 Solaris this comes up with openty() implicitly declared at compile time and
5262 unresolved at link time.  So the first task is to get HAVE_OPENPTY defined
5263 for platforms that have it and have the others use the ttruncmd().  For
5264 starters I put an #ifdef block in ckcdeb.h that defines HAVE_OPENPTY for
5265 Linux, FreeBSD, NetBSD, OpenBSD, and Mac OS X.  Ones that don't have
5266 openpty() include AIX, HP-UX, and Solaris.  Others like SCO I don't know but
5267 I doubt it.  The real solution is to get the ckupty.c module to work but one
5268 thing at a time...  This version is supposed work with secure builds on the
5269 openpty() platforms, and on the others like Solaris, if an external protocol
5270 is attempted on a secure (encrypted) connection, an error message is
5271 printed and the command fails.  ckutio.c, 14 Aug 2007.
5272
5273 How to test?  Apparently I did all my testing on Panix before, and that's
5274 where all my Zmodem builds are, but now when I build a Kerberized version
5275 (which works if I do it on the right pool host), it won't make a local
5276 connection, and there is no other place I can connect to that has a
5277 Kerberized Telnet server.  I can, however, connect to Panix from here, using
5278 the same code, but on Mac OS X...
5279
5280 Slight detour: Got access to AIX again (5.3.0.0).  Picky compiler, some
5281 things needed fixing....  Also it says "1506-507 (W) No licenses available.
5282 Contact your program supplier to add additional users. Compilation will
5283 proceed shortly" and of course it goes kind of slow.  For some reason, I
5284 can't do streaming transfers into AIX over a local network (to its SSH
5285 server), but windowed transfers are OK.  Anyway, noting that we've been
5286 using the same basic makefile target since AIX 4.2, changing nothing but the
5287 version herald, I made a new target, simply "aix", that picks up the AIX
5288 version automatically and sets the herald from it.  Ditto for aix+openssl,
5289 but on this host requires setting SSLINC and SSLLIB to /opt/ssl/include and
5290 /opt/ssl/lib.  Also the make program here was extremely sensitive to spacing
5291 so I had to make some minor edits to get the link step to work for the SSL
5292 version.  ckuusy.c, makefile, 14-15 Aug 2007.
5293
5294 Got rid of the special Panix secure NetBSD target, replaced it with a
5295 regular one, which is invoked in the normal way by defining K5INC and K5LIB
5296 to point to to where the stuff is hidden.  Cleaned up and modernized the
5297 comments in the makefile a bit.  makefile 15 Aug 2007.
5298
5299 Changed some data types and added some casts to ckctel.c to do away with
5300 tons of "pointer targets in passing argument 1 of 'xxx' differ in signedness"
5301 warnings.  15 Aug 2007.
5302
5303 Set up Mac OS X as the testbed for ttptycmd(), with Panix as the remote
5304 partner over a Kerberos 5 connection.  The first test is to send a 300K
5305 text file with gkermit as the external protocol.  It worked fine, and the
5306 debug log showed all the right components were active (namely encryption and
5307 ttptycmd) [kermit/zmodem send/receive text/binary]:
5308
5309   Kermit    Zmodem
5310   kst OK    zst OK
5311   ksb OK    zsb OK
5312   krt OK    zrt OK
5313   krb OK    zrb Failed "rz: Persistent CRC or other ERROR"
5314
5315 We've seen this before.  The problem is 0xff, Telnet IAC, as I proved to
5316 myself by constructing a 3MB file that contained every byte but 0xff in every
5317 mixture and order and transferring it successfully over the same connection.
5318 Presumably the Telnet server is doubling IACs, whereas of course rz is not
5319 undoubling, thus the CRC error.  This is progress.  15 Aug 2007.
5320
5321 Log shows that indeed every IAC in the source file arrives doubled.  Adding
5322 code to remove the first IAC of every adjacent pair, a small test file with
5323 different-length runs of IACs transfers OK.  The 3MB all.bin file does not.
5324
5325 Starting over...  I can receive a big text file with Zmodem OK.  The 3.2MB
5326 binary test pattern that contains no IACs failed after 1.8MB, but the part
5327 that it transferred was OK.  A second try, almost the whole thing arrived,
5328 it stopped just 584 bytes short of the end.  Could be that file size is a
5329 separate problem.  Making a new copy exactly 1MB long...  Well, that's
5330 interesting, this one too stopped just short of the end.  And again, the
5331 same thing.  When connecting back to the host, the last Zmodem packet can
5332 be seen on the screen; it's as if the local Zmodem exited before reading
5333 the last packet...  But OK, if I change the options on the remote sz
5334 sender to use small blocks, etc, then it works.
5335
5336 Now, changing from the 1MB no-IAC-binary test pattern, to the 1MB all-values
5337 test pattern, we fail after 81K.  But the part that was transferred is
5338 correct.  Second try, same thing, but 57K.  Third: 40K.  Each time, upon
5339 connecting back, the session is completely dead.
5340
5341 IF I HAVE TO undouble IACs for incoming files, don't I have to double them
5342 going out?  To send a block to net we just call ttol(), but ttol() doesn't
5343 do any doubling (because Kermit protocol always quotes 0xff).  To see what
5344 happens, I changed the ttol() call to ttoc() in a loop that doubles IACs.  I
5345 tested this by sending the full 3.2MB test pattern, which worked fine.
5346
5347 For receiving, it's slow but it works OK with files that don't contain IACs
5348 (my concern was that IACs might appear in outbound files or in Zmodem
5349 protocol messages).  It receives the 1MB no-IAC test pattern, so there are
5350 no problems with protocol or timing.  But the full test pattern always gets
5351 cut off, but at different points, as before, with the remote session dead.
5352 Changing the Zmodem receiver from rz to lrz on the local end (since the
5353 sender on the remote end is lsz) does not change the behavior.
5354
5355 Anyway, I went back and replaced the byte loop with something more
5356 efficient, and it goes about 20 times faster.  But this doesn't help either,
5357 it only makes it fail faster.  But aha, what if a doubled IAC is broken
5358 across successive pty reads -- we have to make the "previous character"
5359 memory persistent.  Well, that was a good insight, but it still didn't fix
5360 it.  The log shows the IAC handling code is working fine.
5361
5362 What does sz say?  Capturing its stderr to a file... "Retry 1: Got ZCAN".
5363 Next time: "Retry 1: Got TIMEOUT".  Next time: Got ZCAN.
5364
5365 Trying different Zmodem options...  apparently I don't need to use short
5366 blocks.  But I do need to use -e, probably because of Telnet NVT treatment
5367 of carriage return; without -e, there is a "persistent CRC error".  -O
5368 disables timeouts, but this makes no difference.
5369
5370 OK, we still have two Big Problems:
5371
5372  1. When a long file has no IACs, the final < 1K of the file is not received.
5373  2. When a long file has IACs, the transfer generally stops very early.
5374
5375 Problem 1: the transfer consistently fails less than 1K from the end of the
5376 file.  Upon CONNECT back to the host, a big Zmodem packet is sitting there
5377 waiting to be read, which means ttptycmd()'s copy of rz is terminating
5378 early.  Can we catch it in the debug log?  Doing this takes forever and
5379 writes a GB to the disk...  And then the problem doesn't happen.  Also, I
5380 can receive a HUGE text file almost instantly with no errors at all.
5381
5382 Switching to lrz on the receiving end, now I see the error messages, about
5383 300 lines like this:
5384
5385   Retry 0: Garbage count exceeded
5386   Bytes received:  872352/1000000   BPS:85464  ETA 00:01  Retry 0: Bad CRC
5387   Bytes received:  892448/1000000   BPS:86690  ETA 00:01  Retry 0: Bad CRC
5388   Retry 0: Garbage count exceeded
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: Got ERROR
5395   Bytes received:  898336/1000000   BPS:84293  ETA 00:01  Retry 0: Bad CRC
5396   Retry 0: Garbage count exceeded
5397   Retry 0: Garbage count exceeded
5398   Bytes received:  900384/1000000   BPS:83751  ETA 00:01  Bad escape sequence
5399   2fRe
5400   try 0: Bad data subpacket
5401   Bytes received:  941472/1000000   BPS:86191  ETA 00:00  Retry 0: Bad CRC
5402   Retry 0: Garbage count exceeded
5403
5404 Even when it succeeds, it gets these.  But if I receive a text file, no
5405 matter how big, no errors or retries or timeouts at all.  So it appears that
5406 there is only one problem: a big-time lack of transparency regarding 8-bit
5407 and/or control characters.  The odd thing is, it's not that the characters
5408 can't get through -- they all can -- but they seem to cause transitory
5409 blockages.  16 Aug 2007.
5410
5411 Cleaned up the remaining pointer signedness warnings in ckutio.c, but this
5412 was a mistake, it broke Kerberos connections completely.  Undid the changes.
5413 ckutio.c, 17 Aug 2007.
5414
5415 Changed all return() in the fork()==0 section of ttptycmd() to exit().
5416 ckutio.c, 17 Aug 2007.
5417
5418 Tried explicitly setting the slave pty to rawmode.  Makes no difference.
5419 Tried using the Mac OS X (curses) raw() function, and also system("stty
5420 raw"); still no difference.  Tried doing all of these in different
5421 combinations and orders.  I found one combination that cuts the errors about
5422 in half, and the transfer of the no-IAC test pattern almost always succeeds
5423 (but it's slow).  Anyway, it doesn't help much with the test pattern that
5424 contains IACs.  Well, the code is more solid than it was before but
5425 functionally we have not advanced much if we can't download a binary file
5426 with Zmodem!  On the other hand, we can upload them, and we can transfer
5427 text files in both directions, which is an improvement over the previous
5428 situation, in which the entire session would hang due to loss of
5429 synchronization of the encryption stream.
5430
5431 Tried adding -funsigned-char to CFLAGS of Mac OS X target.  It does not
5432 make the "signedness" warnings go away and it doesn't change the runtime
5433 symptoms.
5434
5435 I tried a simpler version of pty_make_raw(), the one from Serg Iakovlev, but
5436 it was a total failure.  That's encouraging though, because it indicates
5437 that pty_make_raw() is the right place to be working.
5438
5439 Then I made pty_make_raw() set or unset every single terminal flag
5440 explicitly.  This made no difference, but didn't hurt anything either.
5441
5442 Then I made pty_make_raw() explicitly set all the c_cc[] characters to 0
5443 (but left c_cc[VMIN] as 1).  This made no difference either.
5444
5445 I checked pty_make_raw() against ttpkt() and the only difference I found in
5446 the terminal flags is that ttpkt() sets IGNPAR thinking it means "ignore
5447 parity errors" when really it means "discard any character that has a parity
5448 error" (at least according to Iakovlev) -- exactly the opposite.  But I
5449 tried it both ways, no difference.  17 Aug 2007.
5450
5451 I noticed that even Zmodem text receives can fail.  They don't get any
5452 errors, they just get cut off shortly before the end.  (But usually they
5453 succeed, and fast too, like 500K cps).
5454
5455 What if I don't call pty_make_raw() at all on the slave pty?
5456
5457 zrt: EESSSSSSSS: 80% good (E = stopped just before end but no other errors)
5458
5459 zrb no-IAC test pattern, short blocks:
5460  1. S/5 (success with 5 screens of errors.
5461  2. S/7
5462  3. S/7
5463  4. S/6
5464  5. E/7 (failed just before end)
5465  6. S/7
5466  7. S/6
5467  8. S/6
5468  9. S/6
5469 10. S/4
5470
5471 So, lots of errors, but it recovered 90% of the time.
5472 Next, same thing, but without requesting short blocks:
5473
5474  1. E/5
5475  2. S/5
5476  3. E/4
5477  4. S/5
5478  5. S/5
5479  6. S/5
5480  7. X/0 (hard failure right away: "Got ZCAN"
5481  8. S/5
5482  9. S/5
5483 10. S/5
5484
5485 So it doesn't look like short blocks make that much difference.  Now what if
5486 I turn off prefixing?  Bad CRC, fails immediately every time.  Putting back
5487 pty_make_raw(slave), it still fails hard.
5488
5489 Tried a new strategy with pty_make_raw(): rather than modify existing flags,
5490 I set all flags to 0, and then turn on only those few that we need like CS8.
5491 Now we get only 2.5 screens of errors instead 4-7 and the transfer rate is
5492 higher for binary files (all of the previous ones were under 100K CPS, while
5493 for text files it was 400-500K CPS):
5494
5495  1. S/2 195669 CPS
5496  2. S/2 194720
5497  3. E/3
5498  4. S/2 192550
5499  5. S/3 192325
5500  6. S/3 145066
5501  7. S/2 200689
5502  8. S/3 188948
5503  9. S/2 209461
5504 10. S/3 181991
5505
5506 I noticed that there was no TIOCSTTY ioctl in the pty/fork setup sequence,
5507 which is recommended somewhere, so I tried that and it was a disaster; the
5508 entire session hung.  I took it back out.  18 Aug 2007.
5509
5510 Tried some transfers over a clear-text (not encrypted) connection with the
5511 same results: smooth, fast transfer of a big text file (400K cps); rocky but
5512 successful transfer of the no-IAC binary pattern file (135K cps).  Switching
5513 back to ttruncmd(), the same binary file is received at 1.5M cps, and the
5514 no-IAC binary file totally fails after too many "Bad CRC"s; and we already
5515 know that any file that contains IACs will fail.  One might say that
5516 ttptycmd() is better in every respect than ttruncmd() except in speed
5517 (when it works).
5518
5519 Let's see if ttyptycmd still works in remote mode (to local K95):
5520  . sz / text works, but slowly.
5521  . lsz / text works but some wierd errors are reported.
5522  . lsz / binary / no IAC doesn't work at all (CRC-32 mismatch for a header;
5523         Unexpected control character ignored: 13, etc).
5524  . sz / binary / no IAC works OK but slow.
5525  . sz / binary / full test pattern with IAC works OK but slow.
5526  . Sending text into rz fails completely.
5527
5528 What about ttruncmd() in remote mode?
5529  . send /text works, fast.
5530  . send /binary works, fast. 
5531  . receive /text works, not so fast but not bad.
5532  . receive /binary works, not so fast but not bad.
5533
5534 So we use ttruncmd() for remote mode, and we use it for local mode
5535 serial-port and modem connections, and we use ttptycmd() on network
5536 connections because (a) they might be encrypted, and (b) even if they are
5537 not, they use some protocol that we have to handle, e.g. Telnet, Rlogin.
5538 19 Aug 2007.
5539
5540 Discovered that Sending binary files no longer works.  Text is OK, binary
5541 transfers don't even start.  This happens on both encrypted and clear-text
5542 connections.  ttptycmd() is being used in both cases.  But oddly enough,
5543 receiving binary still works as before.  What did I break, and when?
5544 Oh, it was just the script, when I changed it from using sz to lsz.  Putting
5545 it back to sz makes it work, even with the full 3.2MB binary pattern with
5546 IACs.
5547
5548 I backed off the changes I made to ckctel.c to suppress some warnings, in
5549 view of the fact that similar changes to ckutio.c broke things so badly.
5550 19 Aug 2007.
5551
5552 If sz is not given the -e flag, it sends control characters bare, except ^P,
5553 ^Q, ^S, and ^X.  ^X is the control prefix, so ^A is sent ^X followed by A.
5554 With -e, all C0 control chars are prefixed, but with ^X, which is, of
5555 course, a control character.  Interestingly, the C1 analogs of ^P, ^Q, ^S
5556 (but not ^X and, unfortunately, not IAC) are also prefixed.  -e makes no
5557 difference for 8-bit characters.
5558
5559 If we have a Telnet connection and the server is in ASCII (NVT) mode, CR is
5560 always followed by LF or NUL.  Well, it seems the server is putting us
5561 (Kermit) in binary mode in this case, but staying in ASCII mode itself.
5562 Added code to handle NVT byte stuffing and unstuffing in each direction
5563 independently, according to the TRANSMIT_BINARY state in that direction.  I
5564 made a file containing just the bytes 0-31 and 127 and 128-159 and 255 (66
5565 bytes all together) and sending it from the host to C-Kermit, the local log
5566 shows that every control character was received correctly and all TELNET
5567 conversions were done right -- NUL removed after CR (and only after CR); IAC
5568 removed after IAC (and only after an IAC meant as a quote).  For the first
5569 time, I can receive the 1MB all-values test pattern, but there are still
5570 tons of (correctable) CRC errors, so the transfer rate is really awful, like
5571 about 5% of what we get with a text file (25Kcps instead of 500).
5572
5573 Further experimentation shows that the fundamental transparency problem is
5574 fixed; we can receive short files (say, 1K or less) containing absolutely
5575 any byte values in any combination with no errors at all.  But once the file
5576 size reaches (say) 10K, we get CRC errors, like one every 2 or 3K of data.
5577 These are not deterministic.  In successive transfers of the same file, they
5578 come in different spots.  It's tempting to blame pty buffer overruns, but
5579 then text files would show the same behavior.  When a binary file size
5580 exceeds, say, 1MB, the chances of successful completion go way down,
5581 independent of whether my external protocol is rz or lrz.  I like lrz better
5582 because the error reports come out on the screen as the transfer is going
5583 on.  Trying to download a real-world binary file -- a 2.2MB C-Kermit
5584 executable -- I get 4500 error messages but the transfer evenually succeeds,
5585 with an effective throughput of 21Kcps.
5586
5587 Actually it turns out that "sz -a somebigtextfile" (2.2MB) also gets a lot
5588 of CRC errors.  The -e flag (escape all control characters) makes the same
5589 big text file transfer with few or no errors.  It's not sure-fire.
5590 Sometimes no errors, sometimes one or two, and sometimes a fatal error that
5591 kills the transfer.
5592
5593 With binary files... a 32K binary file seems to make it every time.  40K
5594 fails about 50% of the time.  48K fails 60% and every time it fails, it has
5595 created a partial file of exactly 32K (32768 bytes).  96K fails 9 out of 10
5596 times, when it fails, the partial file is always 0 bytes, or 32768, or
5597 65536, but that just means that rz's file output buffer is 32K.
5598
5599 Why, then, do binary files cause trouble if it is not a solid transparency
5600 problem?  If a certain file can get through once, why can't it get through
5601 every time?  When a character arrives at the pty, the pty driver probably
5602 takes a different path through its code, checking the terminal flags that
5603 would affect that character.  I tried making Kermit's network read buffers
5604 very small but, surprisingly, this made things worse.  I also tried making
5605 them very much bigger, which didn't help either.  24K still seems to be the
5606 right size.
5607
5608 So, is it that some characters take longer to process than others?  So long
5609 that data is lost due to lack of flow control between TCP and the pty?  One
5610 way to test this theory is to slow Zmodem down.  I tried "-l 32" which,
5611 according to the man page, tells sz to "wait for the receiver to acknowledge
5612 correct data every N (32 <= N <= 1024) characters.  This may be used to
5613 avoid network over-run when XOFF flow control is lacking."  Makes no
5614 difference.  I also tried the -w (Window) switch, ditto.  In fact there are
5615 all sorts of options to set the "window size", "packet length", "block
5616 size", and "frame length", but with no explanation of what these mean or how
5617 they are related.  If I crank everything down to minimum value:
5618
5619   lsz q -L 32 -l 32 -w 1
5620
5621 I get 50% success with the 96K file instead of 10%.  Adding -e, oddly
5622 enough, made it worse.  I also tried setting the environment variable
5623 ZNULLS to different numbers like 512, no help there either.
5624
5625 I tried making the read-from-net-write-to-pty buffer small (1K) but leaving
5626 the pty-to-net one big.  This improves chances of success, but it's
5627 intolerably slow (3Kcps when the connection is capable of 500K).
5628
5629 I also changed the write-to-pty operation from a single write() call of
5630 possibly many K characters to a byte loop, one write() per byte.  Same
5631 result: success (but still about 300 recoverable errors), throughput 3Kcps.
5632 20 Aug 2007.
5633
5634 With ttptycmd() configured to write to the pty in a byte loop, it is
5635 possible to delay each write.  Adding a 10msec delay per character results
5636 in a transfer that runs at about 20 cps and (for the 96K test file) would
5637 take about 80 minutes to complete.  And yet it still gets just as many
5638 errors.  So it's not a matter of timing either.  The errors come, on
5639 average, every file 388 bytes, but not at regular intervals.
5640
5641 I tried the TIOCREMOTE ioctl on the pty master, as discussed somewhat
5642 obliquely in the Mac OS X "man pty" page; "This mode causes input to the
5643 pseudo terminal to be flow controlled and not input edited (regardless of
5644 the terminal mode)" -- sounds like just the ticket but it made no
5645 difference.  Actually, looking at a man page on another OS (Solaris), it
5646 says this is only for lines of text, EOLs are supplied, so that would mess
5647 up the protocol.  So remember: don't use this.
5648
5649 Tried without O_NDELAY; the behavior was the same but the speed was much
5650 slower.
5651
5652 Tried switching back to the ckupty.c routines on Mac OS X and found that it
5653 works now the same as with openpty(), except that I seem to get more getty
5654 babble at the end.  But this means I can run some tests on Solaris.  I moved
5655 the entire test environment from Mac OS X 10.4.9 to Solaris 9.  But it
5656 doesn't work at all.
5657
5658 Trying to figure out the ckupty.c modules again.
5659  . do_pty() calls pty_getpty() which returns in arg1 the fd of the pty master.
5660  . Then it creates a pipe as a way to tell when the child dies
5661  . Then it creates a fork:
5662     - The parent does a blocking read from the pipe
5663     - The child calls getptyslave() to get the pty slave
5664       and writes one byte to the pipe
5665       and then execs the command it's supposed to run
5666 Note that the file descriptor of the slave is known only to the lower fork.
5667 Therefore the lower fork is the one that has to set all the tty modes, etc.
5668 I took care of all that but the ckupty.c method doesn't work at all on
5669 Solaris.  But it works "fine" on Mac OS X (the 32K all-bytes test file
5670 transfers instantly with no errors, but the 96K one errors out).
5671
5672 The problem on Solaris is that pty_make_raw() fails on the masterfd (but not
5673 on the slavefd) with errno 25 "ioctl inappropriate for device".  It doesn't
5674 matter whether I do it in ckupty.c or ckutio.c.  I found a web page on
5675 kde.org that says Solaris does not allow tcget/setattr() on a pty master.
5676 But the Sun "knowledge base" is not open to the public.  Well, presumably
5677 changes made to the slave are reflected in the master (comments in Solaris
5678 telnetd seem to confirm this...)  Let's come back to Solaris later.
5679
5680 Moving to a Linux with lrzsz installed...  Built a Kerberos 5 version with
5681 USE_CKUPTY_C.  Like on Mac OS X, it transfers short files OK and chokes on
5682 longer ones.  Switched to openpty(), it behaves the same.  So the problems
5683 on Mac OS X are evidently not OS-specific, which is good I guess, since that
5684 means finding the way around them will apply to more than one platform.
5685 21 Aug 2007.
5686
5687 Look into TIOCSCTTY again.  On System V based OS's, opening a pty acquires a
5688 controlling terminal automatically.  On BSD-based OS's, no; you have to use
5689 the TIOCSCTTY on the slave file descriptor to give it one.  I'm not sure why
5690 a controlling terminal would be needed, except that without one, the virtual
5691 device "/dev/tty" does not exist for the process that runs on the pty, and
5692 maybe the application that runs there (e.g. rzsz) checks for it.  On the
5693 downside, having a controlling terminal opens the process up to terminal
5694 interrupts like SIGINT and SIGQUIT.  Until now I have not been using this
5695 ioctl().  Results (in Linux):
5696
5697   With TIOCSCTTY: 96K all-bytes test: 11 screens of errors, then success
5698   Without TIOCSCTTY: exactly the same.
5699
5700 Tried the same thing with TIOCNOTTY instead of TIOCSCTTY, with exactly the
5701 same results (no effect whatsoever).
5702
5703 There has to be a way to make this work, because Zmodem works through
5704 telnetd, which basically the same thing as ttptycmd(): a relay between the
5705 network and a pty.  ttptycmd() is like telnetd backwards.  Modern telnetds
5706 are not much help; they don't access ptys or the network directly, they go
5707 through "mux" devices so I can't see what they're doing to get transparency
5708 and flow control.  An old BSD telnetd uses packet mode but that would be a
5709 big deal...
5710
5711 I tried ignoring various signals like SIGTTOU and SITSTP, since some Telnet
5712 clients do this.  No effect, no difference.  Anyway, in Linux the transfers
5713 almost always finish OK despite the many errors.  There is just some trick
5714 I'm missing to make the pty accept a stream of arbitrary bytes without
5715 hiccuping.
5716
5717 What about Solaris, which uses ckupty.c?  In streams-based OS's, where line
5718 disciplines and whatnot are pushed on top of the pty, it looks like the pty
5719 module saves the file descriptor of the "bare" slave pty (as 'spty') before
5720 pushing things onto it, and then later uses spty rather than the regular
5721 slave pty file descriptor when getting/setting terminal modes.  I'm not sure
5722 what this is all about but it's definitely SysVish...  It happens if
5723 STREAMSPTY is defined, but I noticed that STREAMSPTY is never defined
5724 anywhere.  I tried defining it so we take an entirely different path through
5725 the code.  It made absolutely no difference.
5726
5727 Then I noticed that HAVE_STREAMS is not defined for Solaris either.  Tried
5728 defining it, but the session didn't work at all, no i/o.  Removing the
5729 HAVE_STREAMS definition but keeping the STREAMSPTY defined, I rebuilt and
5730 tried "set host /connect /pty emacs".  I got an EMACS screen but could not
5731 type anything into it, which means that STREAMSPTY should not be defined
5732 either.  Removed the definition and "set host /pty" works again.  So what's
5733 the problem with ttptycmd()?
5734
5735 In fact, ttptycmd() works on Solaris with Kermit as the external protocol,
5736 but not with Zmodem, not even with text files.  So again, there is no
5737 fundamental problem with the code or the logic, it's Just A Matter Of
5738 Transparency to control and/or 8-bit characters -- some trick I don't know
5739 about.
5740
5741 Looking at the Solaris debug log...  I see that ckupty.c is calling
5742 init_termbuf() to set the tty modes of the master, not the slave, and
5743 set_termbuf() to set them, but you can't do that in Solaris, error 25.  This
5744 is in getptyslave().  Shouldn't getptyslave() be setting the tty modes of
5745 the slave, not the master?  I changed it to do this, but like all other
5746 changes, it made no difference.  I checked to make sure that after the change,
5747 "set host /pty /connect emacs" still worked and it did.
5748
5749 And then what...  I had some code to redirect stderr in ckupty.c that was
5750 not being executing due to a typo.  When I fixed the typo, poof, Zmodem
5751 binary transfers started working, or working as well as they work in Linux
5752 and Mac OS X.  It turns out that if I don't redirect stderr, sz and rz
5753 just don't work.  But lsz and lrz do.  But if I do redirect it, I don't see
5754 the progress messages from lsz/lrz.  22 Aug 2007.
5755
5756 Built on HP-UX 11i v3 (B.11.31 U ia64) with optimizing compiler, got tons of
5757 picky warnings, but it finished and linked and runs OK.  Many of the
5758 warnings were like this:
5759
5760   "ckucns.c", line 1606: warning #2068-D: integer conversion resulted in a
5761   change of sign:   tnopt[0] = (CHAR) IAC;
5762
5763 IAC is defined as 255 in ckctel.h.  If I define it as 0xff, I don't get the
5764 warnings.  I changed the definitions of all the Telnet commands to be in hex
5765 notation rather than decimal.  If cuts way down on the HP-UX warnings and
5766 doesn't seem to cause problems elsewhere.  ckctel.h, 23 Aug 2007.
5767
5768 Now it looks like Solaris is working but then it hangs at the end.  It
5769 appears as if the ckupty.c module is blocking SIGCHLD.  Debug log shows that
5770 when the transfer is complete, we received IAC DM (Telnet Data Mark) after
5771 sz's last gasp and before the shell prompt is printed.  But calling
5772 tn_doop() in this case is a mistake because we are reading the number of
5773 bytes that we know are available in a counted loop, but tn_doop() would
5774 consume an unknown number of bytes and we would never know when to exit the
5775 loop.  Anyway, C-Kermit doesn't do anything with DM.  Skipping over
5776 tn_doop() (and not writing out the Telnet command bytes) fixes the hanging
5777 condition at the end, even though SIGCHLD is never raised.  ckutio.c,
5778 23 Aug 2007.
5779
5780 Some tests, Solaris to NetBSD over K5.
5781 zst sends ascii.txt, a 2.36MB ascii text file (Kcps / Errors).
5782 zrt receives the same file:
5783
5784   zst 587/0 526/0 542/0 434/0 423/0
5785   zrt 827/0 800/0 847/0 FAIL  610/0
5786
5787 So text is good.  Binary not so good.  Here we transfer the 1MB all-bytes
5788 pattern file.  zrb receives it successfully, but with 1248 errors, at only
5789 15Kcps.  Sending the same file out always fails:
5790
5791   Begin 20070823 16:32:07: SEND BINARY all2.bin [sz]
5792   Sending: all2.bin
5793   Bytes Sent:   5600/1000000   BPS:12446    ETA 01:19   FAILURE
5794   End 20070823 16:32:13
5795   Elapsed time: 6.617992999999842
5796   cps = 151103.2121067556
5797   lsz: caught signal 1; exiting
5798
5799 Decided to move to Linux but found that something is screwed up in Linux
5800 C-Kermit with tilde expansion:
5801
5802   send ~/testfiles/all.bin
5803
5804 doesn't expand at all (but it did yesterday!).  The problem was in the
5805 ancient, ancient realuid/setuid handling code; real_uid() no longer works in
5806 Linux.  I worked around this in whoami() by setting ruid to getuid() if
5807 real_uid() returned a negative number.  Maybe dangerous, worry about it
5808 later.  ckufio.c, 23 Aug 2007.
5809
5810 ANYWAY... after fixing that, I tested zsb on Linux, and it's broken there
5811 too, using openpty(), so it's nothing to do with ckupty.c.  After sending
5812 the first Zmodem data packet, it just hangs, nothing comes back.  In text
5813 mode it gets farther, but then the same thing happens.  Captured stderr from
5814 rz on the far end:
5815
5816   Bytes received:     608/1000000   BPS:21137  ETA 00:47  Retry 0: Bad CRC
5817   Bytes received:     864/1000000   BPS:23540  ETA 00:42  Retry 0: Bad CRC
5818   Bytes received:    1120/1000000   BPS:25003  ETA 00:39  Retry 0: Bad CRC
5819   Bytes received:    5696/1000000   BPS:56988  ETA 00:17  Retry 0: Bad CRC
5820   Bytes received:    9120/1000000   BPS:62227  ETA 00:15  Retry 0: Bad CRC
5821   Bytes received:    9376/1000000   BPS:60766  ETA 00:16  Retry 0: Bad CRC
5822   Bytes received:    9632/1000000   BPS:60361  ETA 00:16  Retry 0: Got TIMEOUT
5823   Retry 0: Sender Canceled
5824   Retry 0: Got ZCAN
5825
5826 The local sz, however, doesn't give any error message.  ZCAN means: "other
5827 end canceled session by sending 5 ^X's" (or user typed them).  What actually
5828 happens is that ttptycmd()'s select() times out waiting for something from
5829 the Zmodem partner and ttptycmd() itself kills the sz fork with SIGHUP.
5830 When lsz receives SIGHUP it sends the ZCAN.  So the real problem is that
5831 after some point we're not receiving anything.
5832
5833 I changed the timeout from 4 seconds to 30 seconds and now I see it just
5834 stops for long periods of time and then resumes.  The lrz log on the
5835 receiving end shows tons of timouts, CRC errors, and other errors.  The
5836 local log shows that lsz wound up sending ZCAN (2 x (10 x ^H, 10 x ^X)).
5837
5838 Moving on to another problem...  Turns out Ctrl-C (SIGINT) is working right
5839 after all.  Since I'm using my test scripts like kerbang scripts, Ctrl-C
5840 exits through trap(), as it should, closing the connection and cleaning up.
5841 If I start Kermit and tell it to TAKE the script, then Ctrl-C brings me back
5842 to the prompt with the connection still open (as it should).  However, until
5843 now I haven't done anything about the fork or the ptys.  Added code to
5844 trap() to kill the fork and close the master pty.  ckuusx.c, 24 Aug 2007.
5845
5846 Added code to try to break the deadlock.  If select() times out, but we have
5847 stuff to write either to the pty or the net, try to do it anyway, even
5848 though select() did not say we could.  But this doesn't help because when
5849 select() times out we don't have anything to write.  The problem is that
5850 after receiving that last packet from the remote rz, the local lsz doesn't
5851 seem to do anything, as if the lower fork wasn't running (and to confirm
5852 this hypothesis, sometimes I noticed that when I Ctrl-C'd out of this, the
5853 transfer would take off again).
5854
5855 Backing up and testing with gkermit rather than zmodem:
5856
5857  kst ripple.txt [824K] OK
5858  kst ascii.txt [1359K] OK
5859  krt ripple.txt -- FAILED
5860
5861 It seems that we can't handle streaming.  If I set up krt to disable
5862 streaming on receipt, it works OK.
5863
5864  krt ripple.txt [824K] OK
5865  krb all2.bin  [1000K] OK
5866
5867 So here we have no trouble sending but big trouble receiving unless we
5868 disable streaming.  Whereas with Zmodem we have trouble receiving.
5869
5870 But this wasn't happening before, what changed?  Using C-Kermit on the far
5871 end to receive the file with debug log on, I see that it is sending 4K data
5872 packet after 4K data packet, with the local gkermit silent, as expected.
5873 About midway through the transfer, the local Kermit sends an error packet
5874 "Transmission error on reliable link".  Looking at G-Kermit's debug log...
5875 It receives the first five 4K data packets OK, but gets a CRC error on the
5876 fifth one, and sends the Error packet.  So it has received a stream of
5877 20-some thousand bytes OK and then messes up.  That number sounds a lot like
5878 ttptycmd()'s buffer size.  I changed the buffer sizes to be different:
5879
5880   Read from pty and write to net: 4K  
5881   Read from net and write to pty: 1K
5882
5883 This time it received the first 4K packet and failed on the second one.
5884 Then I increased the buffers to 98K each, expecting to receive lots more
5885 packets successfully but it bombed out on the 5th one.  But that's good, it
5886 confirms there's no logic error in the buffer management.  Just to make
5887 sure, though, let's set the buffer size smaller than the packet size and
5888 disable streaming.  In this case we get 4 good data packets and a CRC error
5889 on the 5th one and so we request retransmission, and the next 8 times it
5890 arrives it gets a different CRC error, but the 9th copy is OK.  Then the
5891 next packet comes and it gets a CRC error every time.  And this is nothing
5892 but plain ASCII text.
5893
5894 Switching to remote mode:
5895
5896   REMOTE=1 kk kst
5897
5898 (after tricking myself because it was using ttruncmd() for this...) I see
5899 that nothing works at all.  What did I break?  24 Aug 2007.
5900
5901 Fixed ttptycmd() to restore console modes after a remote-mode transfer.
5902 ckutio.c, 25 Aug 2007.
5903
5904 Noticed that error codes like ESRCH are not available in all modules.
5905 That's because of some complicated in #ifdefs in ckcdeb.h that wind up not
5906 always #including <errno.h>.  But I notice that ckutio.c includes it
5907 unconditionally with no ill effects, and so does ckvfio.c.  Does any version
5908 of Unix at all not have <errno.h>?  Added a catch-all clause to ckcdeb.h to
5909 #include <errno.h> (in UNIX only) if, after the other clauses, ESRCH was
5910 still not defined.  ckcdeb.h, 25 Aug 2007.
5911
5912 Now back to debugging ttptycmd()...  Remote-mode transfers with ttptycmd()
5913 were broken in two places, maybe as long as 2 weeks ago (this would have
5914 affected non-network transfers too, which I can't test any more).
5915 The logic was missing in a couple places for the non-network and/or
5916 non-Telnet and/or non-encrypting connections (if statements with no else
5917 parts).  Fixed in ckutio.c, 25 Aug 2007.
5918
5919 Testing remote mode:
5920
5921  kst OK   zst OK
5922  ksb OK   zsb OK
5923  krt OK   zrt OK
5924  krb OK   zrb OK
5925
5926 Functionally it all works but there are hitches with Zmodem as always.
5927 When sending to K95:
5928
5929  . If I send with lsz, there are hundreds of "Subpacket too long" errors,
5930    and the transfer is very slow, but it succeeds.
5931
5932  . If I send with the 1994 Omen version of sz, transmission is instantaneous
5933    and without errors, but then it hangs at the end.
5934
5935  . If I bypass C-Kermit and send direct from lsz or sz, both work fine.
5936
5937 So clearly the ptys are getting in the way.  The hanging at the end would be
5938 caused by the sz process closing before its last output reached the master
5939 pty.  It would need to do some form of flushing and/or pausing at the end
5940 but there's nothing I can do about that; these programs were not designed to
5941 be used in this way.  Anyway, it only seems to happen with files longer than
5942 100K.
5943
5944 For local mode, testing in Solaris over our Kerberos 5 connection again:
5945
5946  gkermit  lrzsz
5947  kst OK   zst FAIL
5948  ksb OK   zsb FAIL
5949  krt OK   zrt OK but with errors
5950  krb OK   zrb FAIL
5951
5952 If I use Omen rzsz as the external protocol (e.g. with zst), it blocks
5953 redirection and it sends the file to my terminal, rather than over the
5954 connection.  This would probably be because it finds out the device name of
5955 the job's controlling terminal and opens it, to prevent redirection.  This
5956 is hard to prevent in Solaris because there is no TIOCSTTY ioctl().
5957 Supposedly the same thing is accomplished by closing and reopening the slave
5958 pty after doing setsid().  I added code to do this, but it made no
5959 difference.  (If I use lsz instead of sz, it is indeed redirected, but jams
5960 up after about 15K.)  ckupty.c, 27 Aug 2007.
5961
5962 On Mac OS X with sz 3.73 1-30-03, however, the redirection works, so I
5963 assume it would also work in Linux, FreeBSD, NetBSD, etc, too.  Doing the
5964 full test suite on Mac OS X:
5965
5966  gkermit   lrzsz          rzsz
5967   kst OK   zst FAIL (1)    OK
5968   ksb OK   zsb FAIL (2)    OK
5969   krt OK   zrt OK   (3)    OK for 100K file, fails for longer.
5970   krb OK   zrb FAIL (4)    OK (1MB all-bytes test pattern)
5971
5972 (1) 64K file OK every time; 100K file fails every time.
5973 (2) 10K file fails every time.
5974 (3) Succeeds with 800K file but gets a few recoverable errors.
5975 (4) Succeeds with 48K binary file with some errors, fails with longer ones.
5976
5977 So actually it looks pretty good, it's just that lrzsz messes up.  When
5978 sending with lsz if I include -L 512 it sends the 100K test file with no
5979 errors, but still chokes on longer ones.
5980
5981 Testing on Mac OS X again, but this time over a clear-text Telnet connection:
5982
5983  gkermit        lrzsz    rzsz
5984   kst OK   zst  FAIL(1)   OK
5985   ksb OK   zsb  FAIL(2)   OK
5986   krt OK   zrt  OK(3)     OK
5987   krb OK   zrb  FAIL(4)   OK 
5988
5989 (1) Almost worked, finished 777K out of 824K without errors.
5990 (2) Got tons of errors, failed in first 30K out of 1000K.
5991 (3) OK for 100K file but fails for larger.
5992 (4) OK for 48K binary fail but fails for larger.
5993
5994 Maybe see if we can do without the OPENPTY part.
5995
5996 TOMORROW -- just clean up the code, add some SET / SHOW / HELP commands,
5997 document it, and move on.
5998
5999 Note: In K95, SET WINDOW sets the Zmodem packet length, 32 - 1024, multiple
6000 of 64.
6001
6002 SEE ~/80/external.txt
6003
6004 Changed ftp port from int to unsigned int.  ckcftp.c, 30 Aug 2007.
6005
6006 Tried again to build KRB4/KRB5/SSL/TLS version for Solaris 9.  Had to update
6007 the build procedure again, of course, because of new file and directory
6008 names, but ran into problems anyway because the
6009 cu-solaris9g+krb5+krb4+openssl+shadow+pam+zlib target was calling another
6010 target that did not know about the hardwired pathnames.  Integrated the two
6011 targets and tried building again.  It actually compiled ok (but with lots of
6012 warnings from the security modules), but failed at link time with
6013 krb5_init_ets not found; fixed that with an #ifdef NO_KRB5_INIT_ETS, now it
6014 builds OK but without the ftp client.  Tried building it WITH the FTP and
6015 that was OK too, no changes needed except to the build procedure.  12 Feb
6016 2008, that is: C-Kermit 8.0.212 : 20080212.
6017
6018 Tried to build with -DCK_SRP and -lsrp but:
6019
6020   hash_supported                      ckcftp.o
6021   hash_getdescbyname                  ckcftp.o
6022   hash_getdescbyid                    ckcftp.o
6023   cipher_getdescbyname                ckcftp.o
6024   krypto_delete                       ckcftp.o
6025   krypto_new                          ckcftp.o
6026   cipher_supported                    ckcftp.o
6027   krypto_msg_priv                     ckcftp.o
6028   krypto_msg_safe                     ckcftp.o
6029   hash_getlist                        ckcftp.o
6030   cipher_getlist                      ckcftp.o
6031   cipher_getdescbyid                  ckcftp.o
6032
6033 Sent mail to Tom Wu and backed off for now.  makefile, 14 Feb 2008.
6034 (Tom Wu never answered; seems like SRP is defunct.)
6035
6036 The ".blah = xxx" form of variable assignment only worked for variables
6037 names of length 22 or less, noticed and fixed by Wolfram Sang.  ckucmd.c,
6038 5 Mar 2008.
6039
6040 In "set host /pty ssh ..." connections, the INPUT command suddenly stopped
6041 working.  This is in Solaris 9.  It happens with all 8.0.* versions of
6042 C-Kermit, so it's nothing to do with ttptycmd().  Added some debug()
6043 statements but they don't show anything.  Turns out there wasn't a problem
6044 after all.  Wed Mar 26 16:04:53 2008
6045
6046 Changed cmifi() to not print "?No files match" (or whatever) if SET QUIET ON.
6047 ckucmd.c, 26 Mar 2008.
6048
6049 Added \v(remoteip) for the IP address of the host we're connected to,
6050 and \v(inmessage) for INPUT status messages corresponding to \v(instatus).
6051 ckuusr.h, ckcmai.c, ckuus[24].c, 26 Mar 2008.
6052
6053 Made \fkeywordval() strip braces/quotes from the right-hand side so we can
6054 handle things like:
6055
6056   password="stringwithspaceatend "
6057
6058 ckuus4.c, 6 Aug 2008.
6059
6060 Added invisible PUTENV command for UNIX only.  Value should not be enclosed
6061 in doublequotes.  Requires lge \v(buildid) 20080826.  ckuusr.[ch], 26 Aug 2008.
6062
6063 Added SET VARIABLE-EVALUATION { RECURSIVE, SIMPLE }.  This is highly
6064 experimental, but also highly desirable if it works out.  SIMPLE inhibits
6065 the default recursive method of evaluating \%x and \&x[] variables, which
6066 is, quite frankly, nuts and makes programming in Kermit at best
6067 counterintuitive.  I made an exception in the case of array subscripts,
6068 because changing how they are evaluated could break a lot of scripts, and
6069 anyway there should never be any harm in evaluating them recursively because
6070 their final value is always (or should be) numeric, not some string that
6071 might contain backslashes.  The SET VAR setting is on the stack, just like
6072 SET QUIET (it follows the quiet/xquiet code in ckuus[356].c), so macros or
6073 command files that change it can't break the script that invokes them.
6074 Added \frecurse() to force recursive evaluation of a \%x or \&x[] variable
6075 regardless of the VARIABLE-EVALUATION setting.  Added \v(vareval) to allow
6076 programmatic setting to current setting.  Tested on Solaris 9 but should be
6077 totally portable.  ckuusr.[ch], ckuus[356].c, 11 Sep 2008.
6078
6079 From Günter Knauf: 64-bit builds were failing on SuSE Linux because
6080 libresolv and libcrypt were in lib64 rather than lib; updated the tests in
6081 the linux makefile target to find them.  makefile, 12 Jan 2009.
6082
6083 Tried building on Red Hat Enterprise Linux Server release 5.3 64-bit.
6084 There is no curses or ncurses.  "make linuxnc" compiled OK but collapsed at
6085 link time looking for crypt(), res_search(), and dn_expand().  Turned out
6086 the linuxnc (and linuxc) targets needed the same treatment as the Linux one
6087 for 64-bit Linuxes.  makefile, 3 Mar 2009.
6088
6089 Consolidated the linux targets so we no longer need three separate ones for
6090 curses, ncurses, and no curses.  "make linux" works ok on computers with and
6091 without (n)curses.  "make linux+ssl", ditto.  "linux+krb5+ssl builds OK but
6092 needs -DNO_KRB5_INIT_ETS".  Makefile, 3 Mar 2009.
6093
6094 Fixed copyright date announced in herald, ckuus5.c, 3 Mar 2009.
6095
6096 Patch from Seth Therault to avoid deprecation warning for utmp references
6097 in ckufio.c in Mac OS X 10.5 (later, this became a consolidated makefile
6098 target that works automatically for at least Mac OS X 10.3.9 through
6099 10.5.6).  makefile, ckufio.c, 28 April 2009.
6100
6101 zshcmd() (the function used by RUN and ! to run external commands) was not
6102 falling back as expected in Linux RHEL4/5 if SHELL was not defined in the
6103 environment.  Also in all Unix versions, there was no indication if a RUN/!
6104 command failed (other than the return code) because the specified shell
6105 didn't exist or was not executable (e.g. the SHELL environment variable was
6106 misdefined).  Now it prints the name of the offending shell and the reason
6107 it couldn't be executed (Not found, Permission denied, etc).  ckufio.c,
6108 28 April 2009.
6109
6110 There is no easy way to get the last field of string; for example, the
6111 extension from a filename, which might have any number of fields.  In
6112 general we want to be able to get "word number n" counting from the right;
6113 \fword() lacks this ability.  Now if you give it a negative word number,
6114 that says to count from the right; for example \fword(one two three four
6115 five, -2) returns "four".  ckclib.c, ckuusr.c, 14 May 2009.
6116
6117 Fixed a typo in the aix51+openssl (SSLLIBS should have been SSLLIB).
6118 From Jason Lehr.  makefile, 27 May 2009.
6119
6120 Updated the linux+openssl+zlib+shadow+pam target to chain to the new main
6121 Linux target.  A bunch of other ones remain un-updated. makefile, 12 Jun 2009.
6122
6123 Updates to the new Mac OS X 10.5 target from Seth Therault (which is
6124 supposed to work on all Mac OS 10-point-anything) to avoid warnings
6125 that came up on on Mac OS 10.4.11/Intel.  Once this one is proven we should
6126 be able to remove/consolidate lots of other ones.  makefile, 12 Jun 2009.
6127
6128 C-Kermit disables SSL with the message "?OpenSSL libraries do not match
6129 required version." if the version of OpenSSL that Kermit was built with is
6130 not exactly the same as the version that is loaded dynamically at runtime.
6131 This is actually the proper behavior, since APIs are not guaranteed not to
6132 change between OpenSSL versions prior to 1.0.0.  Made the error message more
6133 informative.  ck_ssl.c, 26 Aug 2009, and again 28 Aug 2009.
6134
6135 AIX 6.1 is out, it is really just a new name for AIX 5.4.  Added makefile
6136 targets, plus for the first I made AIX 4.2 and later figure out its version
6137 number in the makefile target so we don't have to keep adding new -DAIXnn
6138 sections to the code, and also get its hardware name (e.g. "powerpc") from
6139 uname at make time, rather than hardwiring "rs6000" as I did before.
6140 Consolidated all AIX 4.2 and later targets so now just "make aix" or "make
6141 aix+ssl" can be used.  Except not the gcc ones as they have some quirks so
6142 I'd rather not disturb them.  Tested this on AIX 5.3.
6143 makefile, 28 Aug 2009.
6144
6145 From Kinjal Shah, a correction to the Linux makefile entry that allows it
6146 find the 64-bit curses or ncurses library.  makefile, 29 Aug 2009.
6147
6148 Renamed aix4[23]: to oldaix4[23]: in makefile to fix the warning messages
6149 I didn't notice before.  I didn't want to remove them because they have
6150 some special things that might still be needed, if anybody still has these 
6151 AIX versions.  makefile, 29 Aug 2009.
6152
6153 Built on RHEL 5.3 64-bit, regular and with OpenSSL 0.9.8e.  31 Aug 2009.
6154
6155 Built on NetBSD 5.0.1/i386, regular and with OpenSSL 0.9.9-dev, 1 Sep 2009.
6156
6157 Changed SSL message to mention LD_LIBRARY_PATH (Solaris), SHLIB_PATH (HP-UX),
6158 LIBPATH (AIX), or LD_LIBRARY_PATH (Linux).  ck_ssl.c, 3 Sep 2009
6159
6160 Noticed that "make linux+openssl" fails to include -lutil a link time, which
6161 it needs for openpty().  That's because this target is obsolete.  I renamed
6162 it to be oldlinux+openssl and added linux+openssl as a synonym for
6163 linux+ssl.  makefile, 3 Sep 2009.
6164
6165 Tested linux+openssl+zlib+shadow+pam, it's OK.  Also linux+krb5.  Also
6166 linux+krb5+ssl.  makefile, 3 Sep 2009.
6167
6168 Tried building on Solaris 9 with OpenSSL 0.9.8k with
6169 solaris9g+openssl+shadow+pam+zlib, it failed like so:
6170
6171   ck_ssl.c:2875: error: conflicting types for 'inet_aton'
6172   /usr/include/arpa/inet.h:52: previous declaration of 'inet_aton' was here
6173   make[2]: [ck_ssl.o] Error 1
6174   make[2]: Leaving directory hmt/sirius1/prv0/kd/fdc/solaris9ssl'
6175   make[1]: [solaris2xg+openssl+zlib+pam+shadow] Error 2
6176   make[1]: Leaving directory hmt/sirius1/prv0/kd/fdc/solaris9ssl'
6177   make: [solaris9g+openssl+shadow+pam+zlib] Error 2
6178
6179 The problem was caused by including an inet_aton() function ck_ssl.c for
6180 the benefit of platforms that don't have one in their libraries.  This is
6181 defeated by including NO_DCL_INET_ATON in KFLAGS.  I added this, but then
6182 I thought it would be a good idea to automatically sense the OpenSSL
6183 version so we can automatically set OPENSSL_097 or OPENSSL_098 rather than
6184 bombing out, so I added code to do that too, and also to set the Solaris
6185 version number: 9, 10, or 11.  The new entry is solaris9g+openssl.
6186 ckcdeb.h, makefile, 3 Sep 2009.
6187
6188 Fixed a complaint in ckufio.c about implicit declaration of initgroups.
6189 ckufio.c, 4 Sep 2009.
6190
6191 Built on Solaris 10 with gcc and Sun CC using new solaris{9,10,11} target
6192 that is like the new solaris{9,10,11}g one but without the gccisms.
6193 makefile, 4 Sep 2009.
6194
6195 Changed solaris{9,10,11}g+ssl target to set only the SSL-specific things and
6196 then chain to the main solaris{9,10,11}g target.  Tested OK on Solaris 9 and
6197 10.  makefile, 4 Sep 2009.
6198
6199 Created solaris{9,10,11}+ssl target that is exactly like the
6200 solaris{9,10,11}g+ssl except it chains to the solaris{9,10,11} target
6201 instead of the solaris{9,10,11}g one.  That is, it builds an SSL version of
6202 C-Kermit using Sun CC rather than gcc.  makefile, 4 Sep 2009.
6203
6204 Tried building on HP-UX 10.20, bundled (non-ANSI) compiler ("make
6205 hpux1000").  This failed until I:
6206
6207  . Moved a struct inititialization out of setextern(), ckuus3.c.
6208  . Removed an ANSIism from the declaration of sigchld_handler() in ckutio.c
6209  . Added a cast to strcmp() in zvuser(), ckufio.c.
6210
6211 Builds OK now.  Built OK with "hpux1000o" (the ANSI compiler) too.
6212 And with "hpux1000gcc".  Couldn't test "hpux1000o+openssl".  21 Sep 2009.
6213
6214 The Sony Playstation 2 and 3 are 64-bit PowerPC platforms that can run Linux
6215 if it is installed as an "other OS" on its hard disk; and the Linux kernel
6216 since 2.6.21 supports the PS3 without any patching required.  Pawel Rogocz
6217 reported that "make linuxppc" (one of the old targets that has not yet been
6218 integrated into the main "linux" target) compiles OK on 2.6.29-ydl61.3
6219 (Yellow Dog Linux release 6.2 'Pyxis'), but fails at link time because
6220 'openpty' isn't found, because -lutil was not included, because that part
6221 was added only to the main linux target.  I asked him to try "make linux"
6222 and he sent back a transcript in which there were thousands of errors from
6223 the curses code ckuusx.c.  Later I tried it myself and it built without a
6224 hitch.  My theory is that between then and now, a missing piece of the
6225 ncurses library (/usr/include/ncursesw) was installed.  21 Sep 2009.
6226
6227 HP-UX 9.05 on PA-RISC 9000/712 building with hpux0900 (bundled compiler):
6228  . ckutio.c compilation failed with PENDIN and FLUSHO not defined in
6229    pty_make_raw().  I dummied definitions for them to handle this situation
6230    on this or any other platform where it might crop up.
6231    ckutio.c, 24 Sep 2009.
6232  . Ditto for the PTY module, + IMAXBEL.  ckupty.c, 24 Sep 2009.
6233  . References to endusershell() were fatal in the bundled compiler.  Changed
6234    the hpux0900 target to define NODCLENDUSERSHELL, and put a special case
6235    in ckufio.c to not put a cast in front of the call if NODCLENDUSERSHELL
6236    is defined.  Now it builds and links OK.  makefile, ckufio.c, 24 Sep 2009.
6237
6238 HP-UX 9.05 on PA-RISC 9000/712 building with hpux0900o (optimizing compiler):
6239  . Warnings in ckutio.c at line 14860 about arguments to select (pointers
6240    are not assignment-compatible).  "man select" says arguments are ints.
6241    Defining INTSELECT fixes these warnings but results in fatal errors later
6242    around line 14881 and others in the area involving FD_SET.  This was too
6243    involved so I put it back as it was.  24 Sep 2009.
6244
6245 Built OK on Solaris 10 with Sun CC.  A couple warnings about implicit
6246 function declarations for curses routines because apparently they aren't
6247 declared in curses.h.  Tuff.  25 Sep 2009.
6248
6249 Tried building on Solaris 10 with Sun CC and OpenSSL 0.9.8k, and this
6250 uncovered various loose ends in the solaris9+openssl target, which I fixed.
6251 makefile, 25 Sep 2005.
6252
6253 Fixed four typos in printfs in ck_ssl.c, \% instead of just %.  25 Sep 2009.
6254
6255 Squelched 20-some complaints about a character array being referred to
6256 directly instead of by a pointer, plus several other similar nits to get rid
6257 of all the compilation warnings on Solaris 10 with Sun C 5.8 Patch 121015-06
6258 2007/10/03.  ckctel.c, ckctel.h, 25 Sep 2009.
6259
6260 Built the result on the same Solaris 10 system with gcc 4.2.4 using the
6261 new solari10g+openssl target, working out a few kinks here too.
6262 makefile, 25 Sep 2009.
6263
6264 Made consolidated Solaris 9/10/11 64-bit targets for gcc, solaris9g64,
6265 solaris10g64, solaris11g64, tested on Solaris 10 Sparc. makefile, 25 Sep 2009.
6266
6267 Made consolidated Solaris 9/10/11 64-bit targets for Sun cc: solaris9_64,
6268 solaris10_64, solaris11_64.  These simply set a couple flags and chain to
6269 the main solaris9 target.  makefile, 25 Sep 2009.
6270
6271 Removed a bunch of old superfluous Solaris 9 and 10 targets: oldsolaris9,
6272 oldsolaris9lfs, solaris9g64 solaris9g_64, oldsolaris10 old solaris10lfs,
6273 oldsolaris10+openssl, oldsolaris10g+openssl, solaris10_64, oldsolaris10g,
6274 solaris10g_64, solaris10g64.  There are still plenty more to prune but it's
6275 a start.  makefile, 25 Sep 2009.
6276
6277 Added or fixed some missing prototypes in ckctel.h:
6278 fwdx_send_xauth_to_xserver(), fwdx_parse_displayname.  25 Sep 2009.
6279
6280 Improved the instructions for building secure versions in the makefile,
6281 using this example:
6282
6283   make solaris9+openssl "SSLINC=-I/opt/openssl-0.9.8k/include" \
6284    "SSLLIB=-L/opt/openssl-0.9.8k/lib"
6285
6286 makefile, http://kermit.columbia.edu/security.html, 25 Sep 2009.
6287
6288 Built on HP-UX 11.11, 26 Sep 2009:
6289  . make hpux1100 (ok)
6290  . make hpux1100gcc (ok)
6291  . make hpux1100o (gets a lot of warnings about sendpath and sendfile,
6292     because they are also declared in <sys/socket.h>, but builds OK)
6293  . make hpux1000gcc+openssl \
6294     SSLINC=-I/opt/openssl/include SSLLIB=-L/opt/openssl/lib
6295
6296 Note: sendpath and sendfile are not Kermit symbols.  The warnings are coming
6297 from socket.h: 'Redeclaration of "sendfile" with a different storage class
6298 specifier'.  This is nothing new; see notes of 2-4 Jan 2005.
6299
6300 From Peter Eichhorn:
6301  . Update to makefile to make current code build OK on HP-UX 8.00.
6302  . Changes to format of some hints to make them more copy-and-pastable.
6303 makefile, ckuu5.c, 28 Sep 2009.
6304
6305 From Peter Eichhorn: Changes to HP-UX 7.0 target to increase the switch table
6306 stack size, which was overflowing.  makefile, 30 Sep 2009
6307
6308 HP-UX 6.5 (1989), "make hpux0650tcpc"... (8:19...)  Needed to not include
6309 arpa/inet.h (which doesn't exist) and not use host address lists (add
6310 -DNOHADDRLIST), which gets us past ckcnet.c, but in ckcftp.c we bomb out on
6311 FD_SETSIZE undefined.  Somehow we worked around this in ckcnet.c.  Patched
6312 in a definition in ckcftp.c, and also added -DINTSELECT to compiler flags.
6313 Compiles ok, bombs at link time on bcopy, bzero, FD_ZERO, FD_SET, FD_ISSET.
6314 Now it compiles and links OK but dumps core when started.  Added
6315 -DNOCKGETFQHOST, rebuilt from scratch (takes 35 minutes).  It starts OK, but
6316 it dumps core when given a "telnet xxx" command, where xxx is a hostname.
6317 However, it works OK if an IP address is used: "telnet 123.45.6.78".  It
6318 took all day to track this down, but now it's fixed (see the #ifdef HPUX6
6319 sections of ckcnet.c).  So now (for the first time, I think) we have both
6320 telnet and ftp in HP-UX 6.x, if anyone cares.  ckcnet.[ch], ckcftp.c,
6321 makefile, 2 Oct 2009.
6322
6323 Changed default SET TERMINAL TYPE type for K95 from vt320 to vt220.  This is
6324 because Unix OS's such as Solaris have dropped vt320 as a terminal type.
6325 settrmtyp(), ckuus7.c, 5 Oct 2009.
6326
6327 I moved the PUTENV command code, which was inline, to a function, doputenv().
6328 ckuus[r7].c, ckuusr.h, 5 Oct 2009.
6329
6330 Changed the UNIX version of SET TERMINAL TYPE to take a value and then do
6331 the equivalent of "export TERM=value" by calling doputenv().  This sets
6332 \$(TERM) correctly and passes its value along to inferior processes.
6333 However, to make this take effect within Kermit itself (for the fullscreen
6334 file transfer display and for the SCREEN command, Ctrl-L, etc) I also had to
6335 reinitialize the curses database, which is tricky because normally if you
6336 feed it an unknown terminal name, it just exits.  ckuus7.c, 5 Oct 2009.
6337
6338 Changed the little-known and little-used RESET command (which closes all
6339 open files) to also put command echoing back to normal in case it got
6340 messed up somehow (as in HP-UX 6.5, upon returning from PUSH).
6341 ckuusx.c, 5 Oct 2009.
6342
6343 For Unix, increased string buffer sizes for wildcard expansion for all
6344 platforms that have BIGBUFOK defined from 500000 (0.5M) to 10000000 (10M)
6345 bytes, and for 64-bit builds to 2000000000 (2G) bytes.  No point making
6346 it bigger than that because malloc's argument is a size_t, which is an int.
6347 ckufio.c, 5 Oct 2009.
6348
6349 Built on Mac OS X 10.4.11, required one minor adjustment to the makefile
6350 (-DNODCLINITGROUPS).  This was using the macosx10.5 target, which is
6351 supposed to be universal like the linux and netbsd targets, but not yet
6352 proven.  Also built a 64-bit version (-mpowerpc64 -mcpu=G5 -mtune=G5
6353 -arch ppc64); it compiles and links OK but won't start: "Bad CPU Type
6354 in executable".  Fix later...  makefile, 5 Oct 2009.
6355
6356 Changes from Seth Theriault to suppress signed vs unsigned char warnings in
6357 Mac OS 10.5.8 from gcc4, and a new makefile target for Mac OS X (presumably
6358 10.3.9 or later) + Kerberos 5 and OpenSSL.  ckutio.c, ckuath.c, ckctel.c,
6359 ckcnet.c, ckcftp.c, ck_crp.c, makefile, 6 Oct 2009.
6360
6361   Later I had to back out of these, because although it made for a
6362   clean build, in the resulting executable SSL connections didn't work.
6363
6364 Tue Oct  6 17:23:27 2009
6365 FTP address resolution is broken, but ftp_hookup() hasn't changed.
6366 So... (see the #ifdef HPUX6 sections of ckcnet.c)  (I did, and I rolled
6367 back some of the changes from the other day, but it made no difference.)
6368 Putting back the ckcftp.c from a few weeks ago makes no difference.
6369 Putting back the ckcnet.c from a few weeks ago makes no difference.
6370
6371 Added patches from Seth Theriault so macosx10.5+krb5+openssl would build
6372 on Mac OS X 10.3.9.  makefile, ckcftp.c, 7 Oct 2009.
6373
6374 Built today's code on Linux RHEL4, NetBSD 5.0.1, Solaris 9, and Mac OS X
6375 10.4.11, both with and without SSL.  The NetBSD system has OpenSSL 0.9.9-dev.
6376 7 Oct 2009.
6377
6378 In Mac OS X 10.6, the following symbols are unresolved at link time:
6379 _des_key_sched, _des_new_random_key, _des_ecb_encrypt,
6380 _des_init_random_number_generator, _des_fixup_key_parity.  This is
6381 with OpenSSL 0.9.8k.  But it doesn't happen on other platforms that
6382 have 0.9.8k.
6383
6384 Added SET SESSION-LOG NULL-TERMINATED-TEXT.  This is for the benefit of a
6385 speech synthesizer that will speak a line of text only after receiving a
6386 NUL character.  A more general solution would be to define a filter or
6387 whatever, but who has time.  ckuus[23x].c, 7 Oct 2009.
6388
6389 Consolidated Mac OS X targets, and removed experimental 64-bit ones, because
6390 they never could work in 10.5 and earlier because 64-bit libs are missing,
6391 and 10.6 and later are 64-bit automatically.  makefile, 8 Oct 2009.
6392
6393 Built on Mac OS X 10.6.1.  It came out automatically as a 64-bit build
6394 because __LP64__ is defined somewhere that I can't find.  But this explains
6395 why the 0.9.8k on 10.6 comes up with missing symbols when the 0.9.8k lib
6396 10.5 (or on Solaris or on Linux) does not: it's a different library: "Mach-O
6397 64-bit dynamically linked shared library x86_64", rather than "Mach-O
6398 dynamically linked shared library ppc".  Probably the 64-bit version has
6399 some things #ifdef'd out.  Added -m32 to the CFLAGS and LNKFLAGS for the
6400 macosx+krb5+openssl targets, and it built OK one time.  But then the errors
6401 came back.  makefile, 8 Oct 2009.
6402
6403 Updated C-Kermit installation for Mac OS X in ckuwr.html on the website.
6404 8 Oct 2009.
6405
6406 Tried some things to get around the problem with OpenSSL in Mac OS X 10.6,
6407 to no avail.  Asked Jeff.  He said, "MacOS X no longer includes DES anywhere
6408 on the system.  Not for SSL, not for Kerberos, not for anything.  This will
6409 increasingly become the situation on new operating systems.  Windows 7 and
6410 2008 R2 will also ship with no DES."  Sure enough, the Mac OS X Server
6411 Upgrading and Migrating document for 10.6 says, "Mac OS X Server v10.6 does
6412 not support single DES encryption. It supports AES 128 and 256 encryption
6413 types. However, during a migration or upgrade from v10.4 to v10.6, servers
6414 that were Kerberized by the v10.5 Open Directory server will not use the AES
6415 128 or 256 encryption types. To use the AES 128 or 256 encryption types you
6416 must re-Kerberize all servers."  12 Oct 2009.
6417
6418 DES and 3DES encryption can be excluding removing the -DCK_DES flag.  I
6419 removed this one and -DLIBDES (and -m32) and this makes a working 64-bit
6420 version.  Then I added code to the macosx+krb5+openssl target to use these
6421 flags if the Mac OS X version was 10.5 or less and leave them out for 10.6
6422 or later.  Tested on 10.4.11 and 10.6.1.  A better way to do it might have
6423 been "nm -gj libssl.dylib | grep des_", but that gives the same results on
6424 10.4 and 10.6.  Also, 10.6 still has /usr/include/ssl/des.h.
6425 makefile, 13 Oct 2009.
6426
6427 Next issue:
6428   In file included from ckutio.c:15674:
6429   /usr/lib/gcc/i386-redhat-linux/3.4.6/include/varargs.h:4:2: #error "GCC no
6430   longer implements <varargs.h>."
6431   /usr/lib/gcc/i386-redhat-linux/3.4.6/include/varargs.h:5:2: #error "Revise
6432   your code to use <stdarg.h>."
6433
6434 The problem occurs when trying to force a non-ANSIC build with GCC.
6435 Changing the source file to include <stdarg.h> instead of <varargs.h>
6436 doesn't help because evidently <stdarg.h> requires an ANSI C compiler.
6437 Nothing can be done about this.  13 Oct 2009.
6438
6439 Next issue: Can't compile ckcftp.c with -DNOCSETS or -DNOSPL; some
6440 #ifdef/#endif doesn't match up.  Sigh, this is the hardest kind of thing to
6441 debug.  There's 17,622 lines of code in this module and no tool that I know
6442 of.... Wait, I wrote one.  But it shows all the #if/#ifdef/#ifndef's and
6443 #endifs matching up just fine.  Backing off to ckcftp.c of a few days ago
6444 (before char / unsigned char casts were added), I see that it builds OK, so
6445 I backed off to that one, but put back the special case #ifdef for MACOSX103
6446 declaring CONST gss_OID_desc, and it builds OK (the other stuff was purely
6447 cosmetic, when will I learn?).  ckcftp.c, 13 Oct 2009.
6448
6449 Protected cvtstring() and related functions with #ifdef NOCSETS..#endif,
6450 and ditto for the character-set conversion code in dorename().
6451 ckuus6.c, 13 Oct 2009.
6452
6453 Fixed an #endif /* TNCODE */ that was a line too low in ttptycmd(),
6454 causing -DNONET builds to fail.  ckutio.c, 13 Oct 2009.
6455
6456 There was a reference to doputenv() that wasn't guarded by #ifndef NOPUTENV,
6457 fixed in ckuus7.c, 13 Oct 2009.
6458
6459 Moved doputenv() and settermtyp() out of an #ifdef NOLOCAL section because
6460 these are useful even when not making connections.  ckuus7.c, 13 Oct 2009.
6461
6462 Moved havelfs declaration outside of #ifdef NOXFER because it was also used
6463 for other things.  ckcmai.c, 13 Oct 2009.
6464
6465 COPY /PRESERVE depended on code from the Kermit protocol module, which
6466 is omitted in -DNOXFER builds.  Disabled COPY /PRESERVE in -DNOXFER
6467 builds.  ckuus6.c, 14 Oct 2009.
6468
6469 SHOW PROTOCOL code for external protocols had to be #ifdef'd out for
6470 -DNOPUSH builds.  ckuus4.c, 14 Oct 2009.
6471
6472 There was some confusion between "No XYZMODEM" and "No extermal protocols";
6473 cleared up in ckuus3.c, 14 Oct 2009.
6474
6475 After all that, 86 different combinations of feature selections built OK on
6476 Linux.  And the Kerberized version (K5) works OK on Linux for Telnet and FTP.
6477 14 Oct 2009.
6478
6479 Changed version number to 9.0.  All modules, 16 Oct 2009.
6480
6481 Need to make LOG SESSION log to a tty.  Right now "log session
6482 /dev/ttyKeySerial1" says "Write permission denied" even though the device is
6483 crw-rw-rw-.  This happens in zchko(), which is called by cmofi().  The
6484 problem is that /dev/ is not writeable.  I added a Unix-only clause that
6485 attempts to open the file for write access using open(), in order to get a
6486 file descriptor, which then can be passed to isatty() to check if it's a
6487 tty, and if so, to allow access.  And then close it.  I tested this on Mac
6488 OS X as follows:
6489
6490   log session /dev/ttyKeySerial1
6491   telnet somehost
6492
6493 The Mac's serial port was connected to the serial port of another computer
6494 where Kermit displayed the incoming characters in CONNECT mode.  Glitches:
6495
6496  1. The port has to be set up as desired in advance, outside of Kermit.
6497  2. log session /dev/ttyKeySerial1 will hang if any required modem signals
6498     are not present when the port is opened.
6499  3. Bypasses lockfile mechanism - so we do this only if -DNOUUCP.
6500
6501 For (2), I tried setting O_NDELAY / O_NONBLOCK, and this allowed zchko() to
6502 continue, but then it freezes in the subsequent fopen().  So I changed
6503 zopeno() to also check if the device is a serial port, and if so, to open()
6504 it with O_NDELAY / O_NONBLOCK, and then convert the file descriptor into a
6505 file pointer with fdopen().
6506
6507 Now for the speaking device that needs lines to be terminated by NUL...
6508
6509   set session-log binary       <-- need to put these in SHOW LOG
6510   set session-log null-padded      (and in HELP SET LOG)
6511   set line /dev/ttyKeySerial1
6512
6513 This part works.
6514
6515 This feature is enabled only for -DNOUUCP builds because serial ports aren't
6516 like other Unix files; we would have to create a lockfile, but we can't do
6517 that...  actually, ttlock() takes a name as an argument, but ttunlck() does
6518 not, so there would be no way to remove the lock.  Anyway, there is only one
6519 API for configuring the port (speed, flow control, etc) and it only works
6520 with the SET LINE device, not any random file.  To fix this would require
6521 massive redesign and changes.  ckuus[23].c, ckufio.c, 19-20 Oct 2009.
6522
6523 I made -DNOUUCP the default for Mac OS X, since everybody winds up building
6524 it that way anyhow.  To undo this, do "make macosx KFLAGS=-UNOUUCP".
6525 makefile, 21 Oct 2009.
6526
6527 Changed SET SESSION-LOG TEXT to strip out ANSI escape sequences; 
6528 previously there wasn't that much difference between TEXT and BINARY logs.
6529 It's still not perfect; for example it doesn't delete characters that the
6530 user erased.  (Made sure this still builds with -DNOESCSEQ.)
6531 ckucns.c, 22 Oct 2009.
6532
6533 Changed SHOW LOG to show the SET SESSION-LOG settings, as well as
6534 SET DEBUG, which was not shown before.  ckuus5.c, 22 Oct 2009.
6535
6536 If a series of PUTENV commands is given, each new one undoes the previous
6537 one, so only the last definition is seen by the new fork (or by Kermit
6538 itself).  Turns out you can't feed automatic variables to putenv(); they
6539 have to be static, so to allow for multiple PUTENV commands Kermit has to
6540 maintain an array of static strings.  ckuus7.c, 6 Nov 2009.
6541
6542 From Seth Theriault, a better way for the makefile to determine the
6543 Mac OS X version number; there's a program for this, sw_ver.  makefile,
6544 6 Nov 2009.
6545
6546 Peter Eichhorn reported that file-transfer failure hints were not coming
6547 out since Dev.27.  The only change I made since then was to skip them if
6548 the file-transfer protocol was not Kermit.  I was using the wrong variable
6549 in the tests, 'proto' instead of 'protocol'.  ckuus5.c, 6 Nov 2009.
6550
6551 Changed Mac OS X targets to correctly extract the Mac OS major version
6552 from uname -r in order to choose correctly between utmp and utmpx; this
6553 wasn't working in 10.6.1.  makefile, 6 Nov 2009.
6554
6555 Fix from Seth T. for an oversight in the previous edit.  Also add
6556 MACOSX103 to "show features" display.  makefile, ckuus5.c, 10 Nov 2009.
6557
6558 Added REJECT as a synonym for DISCARD in SET FILE COLLISION; it's more
6559 intuitive and more accurate.  ckuus[27].c, 15 Nov 2009.
6560
6561 \fsplit() and \fword() always break on 8-bit characters unless you explicitly
6562 put every single 8-bit value into the include set, e.g. (for a TSV file):
6563
6564   undef include
6565   for \%i 128 255 1 {
6566       if == \%i 9 continue
6567       .include := \m(include)\fchar(\%i)
6568   }
6569   .\%n := \fsplit(\m(line),&a,\9,\m(include))
6570
6571 I changed cksplit() to treat all 8-bit bytes 128-255 as non-break characters
6572 by default.  It might have made more sense to do this for 160-255 (since
6573 128-159 are traditionaly C1 control characters) but thanks to Microsoft
6574 tradition is out the window.  To treat one or more 8-bit characters as break
6575 characters, put them in the break set.  This might break some scripts, but I
6576 doubt it because this flaw was so awful that if anyone had come up against
6577 they would have let me know.  ckclib.c, 16 Nov 2009.
6578
6579 Changed the netbsd target to set -funsigned-char, since cc on NetBSD is
6580 actually gcc.  makefile, 16 Nov 2009.
6581
6582 Changed macosx targets to get the CPU type from the HOSTTYPE environment
6583 variable.  Also added getenv("HOSTTYPE") as a last-resort method to set the
6584 \v(cpu) variable at runtime (maybe it should be the first resort?)...
6585 ckuus4.c, makefile, 16 Nov 2009.
6586
6587 Made sure the solaris9_64 and solaris10 targets still work.  16 Nov 2009.
6588
6589 Made sure the current source package builds OK on HP-UX 10.20...  Got a lot
6590 of "warning 6062: Optdriver: Exceeding compiler resource limits in xxx; some
6591 optimizations skipped. Use +Onolimit if override desired" but it builds OK.
6592 Tested long file transfer; works OK.  17 Nov 2009.
6593
6594 Built on FreeBSD 7.2 with and without OpenSSL, all OK.  17 Nov 2009.
6595
6596 Built on NetBSD 5.0.1 with and without OpenSSL, all OK, but netbsd+krb5
6597 fails with "can't find -lgssapi_krb5"; worked around this with
6598 "K5LIB=-L/usr/local/kerblib" (where the lib actually is on this host) but
6599 then it failed with "ckcftp.c:13868: error: 'gss_nt_service_name' undeclared".
6600 17 Nov 2009.
6601
6602 I found a VMS 6.2 system... Takes a loooong time to build there.  In
6603 ckuusy.c, DEC C didn't like the prototypes and declarations of dorlgarg()
6604 and dotnarg() as static so I made them not static.  But that didn't help,
6605 now it fails at the very end, saying the final #ifdef is an invalid
6606 statement.  It looks like an #ifdef mismatch that affects only VMS.  I ran
6607 my #ifdef matcher, it turned up nothing.  I substituted a copy of ckuusy.c
6608 from 2007, it comes up with the same errors.  Then I substituted the copy
6609 from 8.0.211 from 2004, and this one compiled OK and, miraculously, the
6610 whole mess even linked OK and runs OK.  The Alpha binary is 2.84MB.  Now I
6611 have 4500 lines of code to compare....  I went through the two files line by
6612 line and I can't see a single thing wrong.  I gave up and tried building the
6613 TCP/IP version.  It builds fine except for ckuusy.c, with the utterly
6614 useless error message:
6615
6616   #endif /* NOCMDL */
6617   ...................^
6618   %CC-E-BADSTMT, Invalid statement.
6619
6620 Indicating the last line in the file.  Just for the heck of it, I put
6621 another line after that one:
6622
6623   /* This is a test */
6624
6625 and got:
6626
6627   /* This is a test */
6628   ....................^
6629   %CC-E-BADSTMT, Invalid statement.
6630
6631 So it is not objecting to anything in the file.  Trying the old LISP trick,
6632 I put an extraneous closing bracket after that.  Success!  Honestly, I don't
6633 see anything wrong with file.  It's DEC C V5.3-006.  I suspect a C bug.
6634 I'll leave it like this for now until I get access to some other VMS
6635 versions.  Another clue is that when building the network version I get a
6636 horrible warning I never saw before from a module that hasn't been touched
6637 in a very long time (ckvrtl.c).  Also, in the network version, I note that
6638 the FTP code is not compiled in.  We have to try this again with some
6639 command-line switches, but it'll do for now.  ckuusy.c, 18 Nov 2009.
6640
6641 ---C-Kermit 9.0 Alpha.01---
6642
6643 From Steven Schweda (SMS), the real solution for the VMS closing brace
6644 problem, it wasn't a DECC bug, it was a me bug.  ckuusy.c, 20 Nov 2009.
6645
6646 Rediscovered the new VMS build options: f for Long Files, i for Internal
6647 FTP.  "make mnf" doesn't work on VMS 6.2, it looks like the VMS definition
6648 for CK_OFF_T got lost.  Same thing with "make mfi".  Come back to this later.
6649
6650 From Gerry Belanger, a fix to INPUT /COUNT:n.  ckuus4.c, 26 Nov 2009.
6651
6652 Added \fsqueeze(s), returns string s with leading and trailing whitespace
6653 removed, Tabs converted to Spaces, and multiple spaces converted to single
6654 spaces.  For now, ASCII only, no options.  ckuusr.h, ckuus[24].c, 27 Nov 2009.
6655
6656 I wrote a Kermit script to read a big file of addresses on Solaris 9,
6657 \fsqueeze()ing each line.  After about 14000 lines, there was a malloc
6658 failure in getnct() (the command-file reader).  There's nothing wrong with
6659 \fsqueeze(), the failure is on a deeper level, because the same thing
6660 happens if I use \fupper() (which is structurally identical to \fsqueeze())
6661 in the same script.  The problem is not in getnct() either, because every
6662 malloc() is freed (I checked).  On the other hand, the same script (with
6663 \fupper() instead of \fsqueeze() completes OK in C-Kermit 8.0.201.  If I
6664 remove the function call (\fsqueeze() or \fupper()) from the script, it also
6665 runs OK in 9.0.  This seems to point the finger at fnevel(), which contains
6666 countless malloc's and free's.  But comparing fneval() between 8.0.211 and
6667 9.0, I don't see any difference that would explain this behavior -- nothing
6668 at all that involves malloc(), makstr(), or free().  Nor any pertinent
6669 change in the caller (zzstring) of fneval().  27 Nov 3009.
6670
6671 Another problem is that when this happens, the error is not caught (e.g. by
6672 the IF FAIL statement after the command that contains the function call);
6673 instead, C-Kermit returns immediately to its prompt.  27 Nov 2009.
6674
6675 It could simply be that some of the buffers we allocate are much bigger now.
6676 But again, I don't see much difference between 8.0.211 and 9.0; we were
6677 already allocating 32K command-related buffers (malloc() takes a size_t, and
6678 size_t is an int almost everywere).  I built the same source on NetBSD and
6679 ran the same script (with \fqueeze()), and it worked fine.  Let's worry
6680 about this later, if it comes up.  27 Nov 2009.
6681
6682 Built OK on Silicon Graphics IRIX 6.5 R10000; regular build OK, SSL and
6683 Kerberos builds failed.  30 Nov 3009.
6684
6685 Tried to build on Digital Unix 4.0F but it blew up in ckutio.c, apparently
6686 not recognizing any of the terminal struct symbols from termios.h.  Tried
6687 again with gcc, same thing.  Tried explicitly #including <sys/termios.h>
6688 within #ifdef TRU64, same thing.  What could have changed?  30 Nov 2009.
6689
6690 Built OK on Linux RHEL5.4/Itanium-2, make linux.  The secure build
6691 required "FLAGS=-DNO_KRB5_INIT_ETS" and built OK.  30 Nov 2009.
6692
6693 Built OK on Digital Unix 4.0F using "make osf" instead of "make tru64-40f".
6694 I don't know why the specific target doesn't work, but it's not worth
6695 chasing down.  2 Dec 2009.
6696
6697 Built OK on MirBSD 10, despite a lot of gratuitous compiler warnings.  Built
6698 OK on MirBSD 10, OpenBSD 4.5, and Fedora 10.  3 Dec 2009.
6699
6700 (Various other successful Unix builds in these weeks...)
6701
6702 Built on VMS 7.2 and 8.3 with and without TCP/IP, no problems.  11 Jan 2010.
6703
6704 Built on VMS 8.3 with "make fi" to include the FTP client and long-file
6705 support (mid Jan 2010).
6706
6707 Built on VMS 8.3 with UXC 5.6 and HP SSL 1.3, which is OpenSSL 0.9.7e.
6708 It compiled and linked OK but when I tried to make an FTP SSL connection
6709 it crashed in SSL$LIBSSL_SHR, which is called from ssl_auth(), after having
6710 had TLS accepted as an authentication type, but before actually
6711 authenticating.  In Unix:
6712
6713  19. ftp open ftp.somecompany.com /user:pge.com/test_quota /password:xxxxxx
6714 Connected to ftp.somecompany.com.
6715 220-Somecompany FTP v6.0 for WinSock ready...
6716 220 Welcome to the online storage FTP server.  Please check the main web
6717 site for system announcements and AUP. (O)
6718 ---> AUTH TLS
6719 234 AUTH command OK. Initializing SSL connection.
6720 TLS accepted as authentication type
6721 SSL DEBUG ACTIVE
6722 =>START SSL/TLS connect on COMMAND
6723
6724 In VMS:
6725
6726  19. ftp open ftp.somecompany.com /user:pge.com/test_quota /password:xxxxxx
6727 Connected to ftp.somecompany.com.
6728 220 Somecompany FTP v6.0 for WinSock ready...
6729 ---> AUTH TLS
6730 234 AUTH command OK. Initializing SSL connection.
6731 TLS accepted as authentication type
6732 SSL DEBUG ACTIVE
6733 %SYSTEM-F-ACCVIO, access violation, reason mask=04, virtual
6734 address=FFFFFFFF8001A120, PC=000000000068B118, PS=0000001B
6735
6736 Note: The Unix version received the second 220 response, the VMS version did
6737 not.  That's odd, it's the same code...  25 Jan 2010.
6738
6739 Added some essential details to the HELP FSEEK text.  ckuus2.c, 25 Jan 2010.
6740
6741 Discovered that the result returned by \fsearch() is totally unreliable.
6742 This is probably too hard to fix.
6743
6744 FSEEK did not pay attention to SET CASE, searches were always case sensitive.
6745 Fixed in ckuus7.c, 26 Jan 2010.
6746
6747 FSEEK failed to find anything if the search pattern was matched in the first
6748 line of the file.  Fixed in ckuus7.c, 26 Jan 2010.
6749
6750 \fword() and \fsplit()....  Another change, but not backwards-incompatible.
6751 One may now put the word ALL (just like that, all uppercase) as the include
6752 set (4th argument) to indicate that there will be no break characters other
6753 than those explicitly given in the break set, e.g. \fsplit(\m(xx),&a,:,ALL)
6754 breaks a line only on a colon (:), nothing else.  The original rules for
6755 cksplit() were more than a little counterintuitive: the default break set is
6756 all non alphanums, and the default include set is all alphanums, so if you
6757 wanted to parse (say) a CSV file, breaking only on comma, you had to think
6758 of all the characters you wanted to keep.  This way you just say ALL.
6759 ckclib.c, 26 Jan 2010.
6760
6761 Speaking of CSV files... How can you put comma as a function argument when
6762 comma is the function-argument separator?  Use one of these forms:
6763
6764  \fsplit(\m(xx),&a,",",ALL)
6765  \fsplit(\m(xx),&a,{,},ALL)
6766  \fsplit(\m(xx),&a,\44,ALL)
6767  \fsplit(\m(xx),&a,\fchar(44),ALL)
6768
6769 From John Dunlap, U. of Washington Applied Physics Lab: 'When "stty -a <
6770 /dev/ttyS0 | grep crtscts" shows "crtscts" (not "-crtscts") and when using a
6771 three wire serial interface and when asking kermit to not use flow control
6772 (set flow none) then "ckutio.c1" (see attachments) fails while "ckutio.c"
6773 works.  The result of "diff -u ckutio.c1 ckutio.c" is attached as "diffs"'.
6774 ckutio.c, 26 Jan 2010.
6775
6776 Changed the year from 2009 to 2010 in the modules I worked on today and in
6777 the heralds, etc.  ckckmai.c, ckuus5.c, ckutio.c, ckclib.c, ckuus7.c,
6778 26 Jan 2010.
6779
6780 Built on Linux Fedora Core 3, regular and with OpenSSL 0.9.7a.  Built on
6781 Ubuntu 9.4 OK, but SSL and Kerberos builds failed due to not finding libs
6782 and/or header files.  I'm sure this could be fixed...  27 Jan 2010.
6783
6784 Added SSL, KRB4, and KRB5 to the startup herald for versions that were
6785 built with SSL, Kerberos 4, or Kerberos 5.  Built OK on Fedora 3 with
6786 linux+krb5+ssl and new banner shows correctly.  ckuus5.c, 27 Jan 2010.
6787
6788 Set NO_KRB5_INIT_ETS by default in ckuath.h since krb5_init_ets() is a no-op
6789 in Kerberos 1.4.x and later and in some installations it can't be found,
6790 which clobbers the build.  ckuath.h, 27 Jan 2010.
6791
6792 Adapted to MINIX 3 1.5, the first version that has virtual memory according
6793 to Andy T, who should know.  On earlier versions (e.g. MINIX 3 1.2) any
6794 attempt to build C-Kermit causes the compiler to crash.  Now the compiler
6795 doesn't crash but it spews out countless warnings about old-fashioned
6796 function declarations that I don't get anywhere else.  The real problems
6797 came in ckutio.c where numerous symbols were undefined at compile time and
6798 the POSIX function tcgetpgrp() was not found at link time, even though there
6799 is a prototype for it in the MINIX header files, and there is no alternative
6800 (since POSIX doesn't let us use ioctl()).  Also note that there is some
6801 confusion over the compile-time symbols MINIX, MINIX2, MINIX3, and MINIX315.
6802 You would expect MINIX to mean "any version of MINIX" but in some parts of
6803 ckutio.c it means MINIX 1.0.  I sincerely doubt that C-Kermit 9.0 can be
6804 built on any version of Minix before 3.1.5 so I removed the confusion and
6805 made MINIX mean "any Minix".  It builds on 3.1.5 OK now, except for the FTP
6806 client.  This can probably be fixed but...  Modules changed: ckcdeb.h,
6807 ckuver.h, ckcmai.c, ckuus5.c, ckutio.c, 1 Feb 2010.
6808
6809 Later.. Andy says MINIX does not support job control, so no program is ever
6810 in the background.  That settles that!  1 Feb 2010.
6811
6812 Built OK on Minix, Linux, Mac OS X, Solaris 9, NetBSD 5.0.1...  1 Feb 2010.
6813
6814 ---C-Kermit 9.0 Alpha.02---
6815
6816 From Christian Corti at Uni-Stuttgart.de: fixes to allow building on SunOS
6817 4.1, which once was my main development platform but which is long-gone from
6818 here.  ckupty.c, ckutio.c, 9 Feb 2010.  (He says it is also necessary to
6819 comment out the "struct winsize" and "struct ttysize" in sys/ioctl.h;
6820 otherwise there will be a conflict with sys/ttycom.h (included by termios.h)
6821 which also declares these structs. But you need both includes.')
6822
6823 From John Dunlap, a fix for Kermit protocol fixed packet-timeout interval
6824 going to a unexpected value (missing else clause in two places).
6825 ckcfn2.c, 9 Feb 2010.
6826
6827 Added an aixg target to build on AIX with gcc when gcc is not installed as
6828 cc, and also added CC=$(CC) CC2=$(CC) clauses to the aix and aix+ssl
6829 targets.  Wow, AIX really loses bigtime when receiving files through its ssh
6830 server.  Streaming can't be used, sliding windows recover from errors but
6831 there are tons of them using the default 4K packets; 500 works much better.
6832 Built with IBM cc and gcc, and also tested (successfully) the new aix+ibmssl
6833 target, in which the OpenSSL headers and libs are in a standard place.
6834 makefile, 9 Feb 2010.
6835
6836 In ckupty.h, make the #include <sys/ioctl.h> be #ifndef SUNOS41.
6837 From Christian Corti.  10 Feb 2010.
6838
6839 Built on VMS E8.4.  12 Feb 2010.
6840
6841 Tried to build on a real VAX-11/785 but the machine seems to be seriously
6842 wedged.  12-15 Feb 2010.
6843
6844 Added note to CKVKER.COM to the effect the the 'f' option has no effect
6845 on VAX architecture.  15 Feb 2010.
6846
6847 Moved the #include "ckvrtl.h" in the FTP module to below the include for
6848 utime.h, because building the VMS version with the 'i' option (meaning
6849 "include internal ftp client") results in "struct utimbuf tp" erroring out
6850 because struct utimbuf is not defined yet (at least in some version of VMS
6851 with some version of C).  From Rob Brown, ckcftp.c, 20 Feb 2010.
6852
6853 From Martin Vorlaender: new code in VMS C-Kermit build procedure to detect
6854 OpenSSL version automatically.  ckvker.com, 22 Feb 2010.
6855
6856 Added code to INPUT command to strip ANSI escape sequences.  It's activated
6857 by SET SESSION-LOG TEXT.  ckuusr.h: added prototype for chkaes();
6858 ckucon.c, ckucns.c: made inesc[] and oldesc[] global instead of static; 
6859 ckuus4.c: doinput() code for skipping escape sequences.  1 Mar 2010.
6860
6861 Peter Eichhorn complained that if you make an ssh connection with Kermit,
6862 then log out from the ssh host, and then use a "connect" command to
6863 make a new connection to the same host (which you can do with Telnet),
6864 Kermit says (e.g.):
6865
6866  DNS Lookup... Can't get address for ssh -e none somehostname
6867  Sorry, can't open ssh -e none somehostname: Error 0
6868
6869 I added code to detect and handle this case and it seems to work OK, even
6870 though it's kind of a hack.  ckuusr.[ch], ckuus7.c, 1 Mar 2010.
6871
6872 There has never been a clean way to put debugging messages (ECHO commands)
6873 in a script which are executed only if debugging is desired and ignored
6874 otherwise.  You'd have to set a random variable and test it, or define a
6875 macro or whatever.  To make this more straightforward, I added SET DEBUG
6876 MESSAGE ON/OFF/STDERR, and added a new MESSAGE (syn: MSG) command for printing
6877 debugging messages to stdout if SET DEBUG MESSAGE is ON or to stderr if SET
6878 DEBUG MESSAGE is STDERR.  ckcmai.c, ckuus[r23].c, 12 Mar 2010.
6879
6880 Also for debugging and error messages, I added \v(lastcommmand) so that
6881 the command that failed can be included in an IF FAIL or DEBUG error message.
6882 This works even for commands that have syntax errors.
6883 ckuusr.h, ckuus5.c, ckucmd.c, 12 Mar 2010.
6884
6885 From SMS for VMS: 'Added/documented P3 options INTSELECT, OLDFIB, OLDIP.
6886 Disabled (commented out) automatic definition of NOSETTIME for VMS before
6887 V7.2 (vms_ver .lts. "VMS_V72").'  ckcdeb.h, ckcftp.c, ckcnet.c, ckuus[2567].c,
6888 ckvfio.c, ckvker.com, ckvrtl.[ch], 15 Mar 2010.
6889
6890 Exposed inesc[] and oldesc[] for VMS, so new INPUT command escape-sequence
6891 stripping can work (really, chkaes() and related global variables should be
6892 moved out of ck[uvd]con.c/ckucns.c and into a common module; do that later).
6893 ckuusr.h, ckvcon.c, 15 Mar 2010.
6894
6895 Built OK on Solaris9, Mac OS X 10.4.11, RHEL4 (32-bit), RHEL5 (64-bit),
6896 AIX 5.3, SCO OpenServr 6.0.0...  15 Mar 2010.
6897
6898 Not so good on VMS, turns out I made a typo in one of the VMS updates
6899 (#ifndef OLDIP instead of #ifdef...).  ckcnet.c, 16 Mar 2010.
6900
6901 More from SMS for VMS, 16 Mar 2010:
6902  . Set MAXPATH correctly for VMS, ckcdeb.h.
6903  . NAM -> NAML, QIO replaces system( "SET PROTECTION"), bugfixes in
6904    cvtdir() and nzltor(), ...  (See comments): ckvfio.c, new ckvrms.h.
6905    (The RMS code in ckvfio.c was almost totally rewritten)
6906  . Moved "NAMX$*" (and related) macros to ckvrms.h, and renamed to
6907    "NAMX_*" (and similar "$" -> "_"), moved "FIB_*" macros from ckvrtl.c.
6908
6909 These changes are mainly to accommodate the ODS5 file system, which has
6910 longer and mixed-case filenames, and also to execute certain commands
6911 (e.g. for setting file protection, deleting directories) directly instead
6912 of using a system() command.
6913
6914 Built OK on VMS 8.3 (with and without network support).  16 Mar 2010.
6915
6916 Failed to build on VMS 6.2.  16 Mar 2010.
6917
6918 FreeBSD 8.0 <libutil.h> has a hexdump() prototype that conflicts with the
6919 hexdump macro defined in ckcdeb.h.  Since the same thing is likely to happen
6920 elsewhere, I changed the Kermit macro to ckhexdump as well all references to
6921 it: ckcdeb.h, ckcftp.c, ckcnet.c, ckctel.c, ckuath.c, ckutio.c, 16 Mar 2010.
6922
6923 Built OK on Digital Unix Tru-64 4.0E using "make osf", 16 Mar 2010.
6924
6925 Tried again to build Digital Unix Tru64 4.0E using "make tru64-40e", but
6926 something prevents it from picking up the termios symbols and it blows up in
6927 ckutio.c, whereas this used to work in earlier C-Kermit versions.  This is
6928 the only Tru64 system I still have access to, so I can't tell if it's a
6929 local peculiarity or what.  Note that POSIX is not defined for this build.
6930 But if I define it, I get into trouble with "struct timeval".  Tried again
6931 with "KFLAGS=-DPOSIX -DNOTIMEVAL" but that doesn't help.  Tried "make
6932 dec-osf" and that worked OK but oddly enough it makes a Kermit with less
6933 features than "make osf".  16 Mar 2010.
6934
6935 To go with MESSAGE and SET DEBUG MESSAGE, I added IF DEBUG, which is true
6936 if SET DEBUG MESSAGE is not OFF and false otherwise.  ckuusr.h, ckuus6.c,
6937 16 Mar 2010.
6938
6939 From SMS: Corrections to my merging of SMS's changes, ckcftp.c, ckvrtl.h.
6940 Builds OK on VMS 6.2 now.  Also did an SSL build on VMS 8.3 with OpenSSL
6941 m0.9.7e and "OPENSSL_DISABLE_OLD_DES_SUPPORT" was included in P3
6942 automatically by Martin V's addition to ckvker.com.  17 Mar 2010.
6943
6944 From SMS: #include <types.h> earlier for VMS in ckcdeb.h to pick up off_t
6945 before it is referenced.  This allows C-Kermit to compile on VMS/Alpha 6.2
6946 but linking fails on fseeko() and ftello() (and yet, a functional executable
6947 is created, and FSEEK works right).  Builds the same way with no problems at
6948 all on VMS 8.3 / Alpha.  In this case we get the full 64-bit arithmetic...
6949 Well, 62 bits:
6950
6951   ATLAS::C-Kermit>( ^ 2 63)
6952    9223372036854775000.0
6953   ATLAS::C-Kermit>( ^ 2 62)
6954    4611686018427387904
6955
6956 whereas on VMS 6.2 we get integers only up to (^ 2 30).  17 Mar 2010.
6957
6958 Changed the VMS build procedure to enable large file support automatically
6959 for non-VAX and VMS 7.3 or greater.  No reason not to include this feature.
6960 Changed the sense of the F option to DISABLE large file support in the
6961 unlikely case that C-Kermit is being built on a suitable platform but the
6962 C library is older than VMS73_ACRTL-V0200, in which case fseeko() and
6963 ftello() will come up missing at link time.  ckvker.com, 18 Mar 2010.
6964
6965 Changed VMS build procedure to include the FTP client in any network build
6966 by default.  Changed the sense of the I option to exclude the FTP client,
6967 in case anybody would want to do that.  ckvker.com, 18 Mar 2010.
6968
6969 From SMS: updated dependencies in CKVKER.COM, fix the "don't reinclude me"
6970 clause in CKVRTL.H.  19 Mar 2010.
6971
6972 Built OK on VMS 6.2 and 8.3 with and without networking.  Large file support
6973 included automatically in VMS 8.3  FTP client included automatically in both
6974 network builds.  19 Mar 2010.
6975
6976 Changed hexdump() to ckhexdump() in ck_crp.c, which I missed before.
6977 19 Mar 2010.
6978
6979 ---C-Kermit 9.0 Alpha.03---
6980
6981 In HP-UX with the bundled-non ANSI compiler, we get warnings about functions
6982 such as endusershell(), which are declared void in the header files.  But in
6983 non-ANSI builds we defind VOID to be int rather than void, so our prototypes
6984 are wrong.  I checked that HP-UX 9, 10, and 11 all have void datatype and
6985 changed the definition of VOID to void in those cases.  ckcdeb.h, 29 Mar 2010.
6986
6987 Fixed a typo in a debug() statement in cksplit() that was causing some
6988 warnings.  ckclib.c, 29 Mar 2010.
6989
6990 Ditto in tls_load_certs().  ck_ssl.c, 29 Mar 2010.
6991
6992 "make hpux1000o+ssl" files with:
6993 /usr/ccs/bin/ld: Unsatisfied symbols:
6994    __umoddi3 (code)
6995    __udivdi3 (code)
6996    __eprintf (code)
6997
6998 It appears that OpenSSL (0.9.7c in this case) requires -lgcc.
6999 And indeed hpux1000gcc+ssl builds fine.  29 Mar 2010.
7000
7001 There are various warnings in the SSL code in ckutio.c, ckcftp.c, and
7002 ckcnet.c about pointers not being assignment compatible, but I have learned
7003 from experience not to try to fix these (see notes from 6 Oct 2009).
7004 29 Mar 2010.
7005
7006 connect(s, (struct sockaddr *)&hisctladdr, sizeof (hisctladdr)): In FTP,
7007 this doesn't work on RHEL5 / Mac OX X 6.1/2 64-bit.  But the connect() in
7008 Telnet works.  On Mac OS X 6.2 I tried changing the socket() call to be like
7009 the one in ckcnet.c for Telnet, but it made no difference.  On a RHEL5.4
7010 system on i386, FTP works fine, so it's not the Red Hat version.  On Digital
7011 Unix 4.0E 64-bit, same thing:
7012
7013   11:23:10.722 ftp_hookup[kermit.columbia.edu]=21
7014   11:23:10.722 ftp hookup A[kermit.columbia.edu]
7015   11:23:10.722 ftp hookup C[kermit.columbia.edu]
7016   11:23:10.722 ftp hookup socket=4
7017   11:23:10.722 ftp hookup HADDRLIST
7018   11:23:10.723 ftp hookup connect failed=13
7019   11:23:10.723 ftp hookup bad
7020
7021 13 = Permission denied:
7022
7023   [EACCESS] Search permission is denied for a component of the path prefix;
7024     or write access to the named socket is denied.
7025
7026 On Gentoo Linux, also on Alpha, the errno is 51: Network is unreachable.
7027 Clearly some data type in the sockets structs is out of whack.
7028
7029 The third connect() argument is "address length".  The address is a
7030 struct sockaddr.  About the third argument, RHEL5 "man connect" says:
7031
7032   The third argument of connect() is in reality an int (and this is what 
7033   4.x BSD and libc4 and libc5 have).  Some POSIX confusion resulted in 
7034   the present socklen_t, also used by glibc.  See also accept(2).
7035
7036 Building on RHEL5 on x86_64, where size_t is 8 and socklen_t is 4, I get a
7037 warning:
7038
7039   ckcftp.c: In function 'ftp_hookup':
7040   ckcftp.c:14667: warning:
7041    comparison is always true due to limited range of data
7042
7043 Referring to:
7044
7045   if (hisctladdr.sin_addr.s_addr != (unsigned long) -1)
7046
7047 This seems to be the problem; if I remove the (unsigned long) cast (in two
7048 places), the problem goes away.  Actually what I should be comparing it with
7049 is INADDR_NONE, which is defined appropriately in some header file, e.g. as
7050 0xffffffff.  Also I define it explicitly as -1 if it is not defined in any
7051 header file (as is the case in Solaris 9).  Tested OK on 64-bit RHEL5,
7052 32-bit RHEL5, Digital Unix 4.0E 64-bit, Solaris 9 32-bit, Mac OS X 10.4.11
7053 32-bit, Mac OS X 10.6.3 64-bit, AIX 5.3, Gentoo Linux 2.6.31 on Alpha
7054 64-bit, NetBSD 5.0.1 32-bit....  ckcftp.c, 29 Mar 2010.
7055
7056 ---C-Kermit 9.0 Alpha.04---
7057
7058 Yesterday's VOID redefinition caused problems for HP-UX in ckuusx.c, in the
7059 curses section where VOID is undef'd and not used to avoid a conflict with
7060 curses.h.  As a workaround I defined a new macro CKVOID with the same
7061 definition as VOID and used it in the offending section of ckuusx.  The real
7062 solution is to replace all references to VOID with CKVOID (since VOID is
7063 increasingly likely to cause conflicts), but a mass search and replace is
7064 not without risks.  ckcdeb.h, ckuusx.c, 30 Mar 2010.
7065
7066 Changed VOID and CKVOID definition to be 'void' for all HP-UX (verified by
7067 PeterE back to HP-UX 6.5, 1989).  Still need to check this on HP-UX 5.21;
7068 if that's an exception it can be done in the makefile.  ckcdeb.h, 30 Mar 2010.
7069
7070 The change I made to allow CONNECT to reestablish a previous SSH connection
7071 prevented a new SSH connection to a different host to be made.  Fixed in
7072 ckuus7.c, 30 Mar 2010.
7073
7074 Fixed mistaken extern declarations of krb4_errno and krb5_errno as strings
7075 in nvlook(); they are ints. Built OK on Mac OS X 10.6.3. ckuus4.c, 30 Mar 2010.
7076
7077 A fix to Trusted HP-UX makefile target from PeterE, to account for the
7078 equivalence of +openssl and +ssl as target suffixes.  30 Mar 2010.
7079
7080 Added a new function \fcvtcsets(string,cset1,cset1) that converts a string
7081 from one character set to another.  The csets are File Character-Set names.
7082 ckuus4.c, 31 Mar 2010.
7083
7084 Added a new function \fdecodehex(string,prefix) that decodes a string
7085 containing prefixed hex bytes.  Default prefix is %%, but any prefix of
7086 one of two chars (such as % or 0x) can be specified.  ckuusr.h, ckclib.h,
7087 ckclib.c, ckuusr.c, 31 Mar 2010.
7088
7089 Richard Nolde reports that Kermit can't find -lpam on Fedora 12 because it's
7090 in /lib rather than /usr/lib.  RHEL5 has symlinks, FC12 should too.  Added a
7091 note to the makefile.  1 Apr 2010.
7092
7093 Build on Solaris 11 for the first time.  Had to adjust ckuver.h to get the
7094 version herald right.  This was on a box that reported its architecture as
7095 i86pc.  1 Apr 2010.
7096
7097 Added MIME character-set names as invisible synonyms in the file and
7098 terminal character-set tables, fcstab[] and tcstab[].  Note that not all the
7099 character sets known to Kermit are registered in MIME.  But at least now
7100 MIME-registered character sets can be referred to by their MIME names, e.g.
7101 ISO-8859-1, ISO646-ES, IBM437, WINDOWS-1252.  These are not listed if you
7102 type ? in a field that is parsing them, unless you type a letter first,
7103 e.g. "i?" lists ISO- and IBM set names.  Later maybe I'll make parallel
7104 tables, or keyword attribute bit that says whether a name is MIME or not.
7105 The real benefit of this change is that now Kermit can take its
7106 character-set names from external sources like email headers or web logs.
7107 ckuxla.c, 1 Apr 2010.
7108
7109 Changed the IF command to accept a bare macro name its condition.  This will
7110 parse and execute correctly if the macro is defined and if it has a numeric
7111 value, or if it is not defined, in which case it evaluates to 0 (FALSE).  If
7112 it is defined but has a non-numeric value, a parse error occurs.  ckuus6.c,
7113 2 Apr 2010.
7114
7115 Added \fstringtype() function.  Given a string argument, it tells whether
7116 the string is 7bit, 8bit, utf8, binary, etc.  ckuusr.h, ckuus[4x].c,
7117 2 Apr 2010.
7118
7119 Did a few builds to make sure there were no booboos.  Solaris 9, NetBSD
7120 5.01, Linux RHEL4, HP-UX 10.20 (non-ANSI compiler and ANSI optimizing
7121 compiler), Mac OS X 10.4.11, SCO OSR 6.00.  5 Apr 2010.
7122
7123 ---C-Kermit 9.0 Alpha.05---
7124
7125 Increased maximum variable name length from 4K to 16K. Verified that
7126 too-long names are caught and recovered from correctly.  ckuusr.h, 6 Apr 2010.
7127
7128 Implemented a new \fsplit() option for parsing CSV files, which turns out to
7129 be a little complicated, because the separator is not just a comma, but a
7130 comma and all its surrounding spaces.  Also there are special quoting rules
7131 for fields with embedded commas and fields with embedded quotes.  ckclib.c,
7132 7 Apr 2010.
7133
7134 ---C-Kermit 9.0 Alpha.06---
7135
7136 VMS changes from SMS.  They build OK, Kermit file transfers are still OK,
7137 but FTP text-mode GETs always hang on the 10th 8K network read.  Couldn't
7138 get a debug log this time.  ckcmai.c, ckvfio.c, ckvrms.h, ckvker.com.
7139 8 Apr 2010.
7140
7141 Changing VNAML from 4K to 16K broke the build on HP-UX 9.  Put it back to
7142 4K.  9 Apr 2010.
7143
7144 John Dunlap, running days-long stress tests between E-Kermit and C-Kermit,
7145 found a bug in the packet-reading and -decoding code: If a NAK packet
7146 arrives with its length field corrupted to indicate a bigger size, and there
7147 are enough bytes following in the pipeline, ttinl() will return a too-long
7148 packet (if there are not enough bytes waiting to be read, then ttinl() will
7149 properly time out).  In the bad case rpack() trusts the packet length, uses
7150 it as the basis for computation of the block-check length, which is then
7151 used to access memory that might not be there, causing (at least on John's
7152 Linux system) a segmentation fault.  John added the normal clause to check
7153 the result of the block-check calculation, and I changed ttinl() to always
7154 break on the eol character (normally carriage return), since this can never
7155 appear in a packet, even if we "set control unprefix all".  Also added a
7156 check to ttinl() to protect against length fields corrupted into illegal
7157 values.  ckcfn2.c, ckutio.c, 13 Apr 2010.
7158
7159 From Lewis McCarthy:
7160   Based on code inspection, C-Kermit appears to have an SSL-related security
7161   vulnerability analogous to that identified as CVE-2009-3767 (see e.g.
7162   http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3767).
7163
7164   I'm attaching a patch for this issue relative to the revision of ck_ssl.c
7165   obtained from a copy of http://www.columbia.edu/kermit/ftp/test/tar/x.zip
7166   downloaded on 2010/07/30, which I believe is the latest.
7167
7168   When this flaw was first widely publicized at last year's Black Hat
7169   conference, it was claimed that some public certificate authorities had
7170   indeed issued certificates that could be used to exploit this class of
7171   vulnerability. As far as I know they have not revealed specifically which
7172   public CA(s) had been found issuing such certificates.
7173   Some references: http://www.mseclab.com/?p=180
7174   http://www.theregister.co.uk/2009/07/30/universal_ssl_certificate/
7175
7176 Patches added to ck_ssl.c, 4 Aug 2010.
7177
7178 Peter Eichhorn reported that "RENAME ../x ." didn't work.  This is a side
7179 effect of the changes of 2006 to the RENAME command, there was a little
7180 confusion in the renameone() routine; fixed in ckuus6.c, 4 Aug 2010.
7181
7182 If only one file is FOPEN'd, FCLOSE given with no arguments would close it.
7183 Turns out to be a bad idea. Example: program with an input and output file,
7184 try to close the output file before it is opened by just typing FCLOSE; this
7185 can mess up the input file.   For safety FCLOSE has to require a channel
7186 number or ALL.  ckuus7.c, 4 Aug 2010.
7187
7188 Added \fstrcmp(s1,s2,case,start,length), which has the advantage over IF
7189 EQU,LGT,LLT that case senstivity can be specified as a function arg, and
7190 also substrings can be specified.  ckuusr.h, ckuus[24].c, 5 Aug 2010.
7191
7192 The CSV feature of Alpha.06 had a subtle flaw, namely that if the last item
7193 in a comma separated list was enclosed within doublequotes with a trailing
7194 space after the closing doublequote, a spurious empty final element would be
7195 created in the result array.  Fixed in cksplit(), ckclib.c, 5 Aug 2010.
7196
7197 ---Alpha.07---
7198
7199 The CSV feature of \fsplit() splits a comma-separated list into an array.
7200 To turn the array back into a comma separated list, \fjoin(&a,\44,1) almost
7201 works, except for elements contain literal doublequotes, such as:
7202
7203   Mohammad "The Greatest" Ali
7204
7205 This calls for making a symbolic CSV argument for \fjoin() like the one that
7206 was made for \fsplit(): \fjoin(&a,CSV).  Also \fjoin(&a,TSV) for
7207 Tab-separated list.  Thus if Kermit reads a record in CSV format, splits it
7208 into an array, and then joins the array back into a CSV record, the result
7209 will be equivalent to the original, according to the CSV definition.  It
7210 might not be identical, because if the result had extraneous spaces before
7211 or after the separating commas, these are discarded, but that does not
7212 affect the elements themselves.  Furthermore it is now possible to convert
7213 a comma-separated list into a tab-separated list, and vice versa (which is
7214 not a simple matter of changing commas to tabs or vice versa).  ckuus4.c,
7215 12 Aug 2010.
7216
7217 From Joop Boonen 26 Juli 2010: "Added HAVE_LOCKDEV as openSuSE >= 11.3 uses
7218 lockdev but not baudboy.  They use ttylock directly.  The program code has
7219 been added so the the program works without a problem."  makefile, ckcdeb.h,
7220 ckutio.c, ckuus5.c, 23 Aug 2010.
7221
7222 ---Alpha.08---
7223
7224 From Gary Mills at the U of Manitoba: convert Solaris version from BSD ptys
7225 to streams ptys because there are only 48 BSD-style ptys and he was running
7226 out.  No code changes needed, the only change necessary was to add the
7227 following flags to the makefile target:
7228
7229   -DHAVE_STREAMS -DHAVE_GRANTPT -DHAVE_PTSNAME
7230   -DPUSH_PTEM -DPUSH_LDTERM -DPUSH_TTCOMPAT
7231
7232 makefile, ckcmai.c, 21 Sep 2010.
7233
7234 Testing this in Solaris 9 I see that the DES library disappeared.  Added
7235 code to the solaris9 targets (also used by Solaris 10 and 11) to check for
7236 this.  makefile, 21 Sep 2010.
7237
7238 The Solaris target checked the OpenSSL version automatically to set the
7239 right flag, the Linux target didn't.  Put the OpenSSL-version testing code
7240 in the Linux target too.  makefile, 21 Sep 2010.
7241
7242 A couple minor changes to the tru64-51b makefile targets from Steven Schweda
7243 but there still are some problems with the Tru64 Unix builds.
7244 makefile, 21 Sep 2010.
7245
7246 ---Alpha.09---
7247
7248 \fcontents(\&a[3]) got an error if the array was declared but its dimension
7249 was less than 3, which is bad when dealing with (say) an array created
7250 dynamically by \fsplit(), which might or might not have a third element.
7251 In case it doesn't -- i.e. in case we are referring to an out of range
7252 element of any array that is declared -- we should just return a null
7253 string, as we do with other types of variables that are not defined.
7254 For that matter, ditto even if the array is not declared; what useful
7255 purpose is served by throwing an error in this case?
7256 ckuus4.c, 30 Dec 2010.
7257
7258 cksplit() treats \ as a quoting character.  If the source string contains
7259 backslashes, they are swallowed (or, if doubled, one is kept).  That's not
7260 good for parsing external data, such as lines read from files, where there
7261 are no quoting rules.  This came up when parsing CSV files; as a workaround,
7262 I made \fsplit() treat backslash as an ordinary character for CSV and TSV
7263 splitting (a better solution might be yet another argument that specifies
7264 a quote character).  ckclib.c, 30 Dec 2010.
7265
7266 Began converting C-Kermit to Open Source with the Simplified 3-Clause BSD
7267 license.  Updated the text for the INTRO, LICENSE, NEWS, and SUPPORT
7268 commands.  Fixed things so the copyright year to be displayed is defined in
7269 one place (ck_cryear in ckcmai.c), rather than hardwired into text strings
7270 all over the place.  COPYING.TXT, ckcmai.c, ckuus[256].c, 2 Jun 2011.
7271
7272 When I added MIME synonyms for Kermit character-set names, I left a bogus
7273 entry in the tables ("windows-1251") that was in the wrong place
7274 alphabetically, thus preventing most references to file character-set names
7275 from working right.  Removed the bogus entry.  ckuxla.c, 2 Jun 2011.
7276
7277 Most combinations work OK, but not translating Cyrillic text from UTF-8
7278 to Latin/Cyrillic, and probably the same would be true for any case of
7279 converting from UTF-8 or UCS-2 to anything else.  The problem was in
7280 xgnbyte(), which converts the input stream from the specified character to
7281 UCS2; it needed to make a special case for when the input file was already
7282 Unicode.  Believe it or not, this problem occurred at least as far back as
7283 8.0.201 (9.5 years ago) and nobody noticed.  So if the fix isn't perfect
7284 probably nobody will notice that either.  ckcfns.c, 3 Jun 2011.
7285
7286 The SET BLOCK CHECK command did not parse all the items in its keyword
7287 list.  Fixed in ckuus3.c, 3 Jun 2011.
7288
7289 For EM-APEX ocean floats project, where buoys in stormy waters have to
7290 transmit data through an earth satellite using non-error-correcting modems,
7291 John Dunlap ran exhaustive stress tests of Kermit protocol transfers through
7292 a simulated connection that injected errors and delays and identified a
7293 weakness in Kermit protocol when it is used under extremely bad conditions:
7294 If a data byte of the S packet (or its Ack) is corrupted and the 1-byte
7295 checksum is also corrupted in such a way that that the checksum matches the
7296 corrupted data, the two Kermit programs will disagree as to the negotiated
7297 parameters.  For example, if file Sender's RPT field is changed from '~' to
7298 '^', the receiver will decode the packet incorrectly.  Ditto for most of the
7299 other parameters.  The result is that a corrupted file is received but
7300 reported correct.  John suggested a new mode of operation in which the Type
7301 3 block check is used for all packets.  Such a mode can not be negotiated
7302 because the negotiation packet itself is assumed by all Kermit programs to
7303 have a 1-byte checksum.  Added SET BLOCK-CHECK 5 to the parser (with
7304 invisible synonym FORCE-3".  ckuus3.c, 3 Jun 2011.
7305
7306 Added supporting code for SET BLOCK 5: ckcfn[23].c, ckcpro.w, ckcmai.c,
7307 ckuus3.c, 3 Jun 2011.
7308
7309 Added code to skip the heuristic that S and I packets always have block
7310 check type 1.  File transfer OK between two C-Kermits with SET BLOCK 5.
7311 rpack(): ckcfn2.c, 5 Jun 2011.
7312
7313 Made the file receiver put "5" in the block-check-type in its ACK to the
7314 S-Packet.  spar(): ckcfns.c, 5 Jun 2011.
7315
7316 Now the question is: Can we make the file receiver automatically and safely
7317 recognize a three-byte block check on an incoming S or I packet?  It's
7318 tricky because the block check field is not self-identified, it's just the
7319 last "n" characters of string indicated by the length field, so correct
7320 decoding of the packet depends on stateful knowledge of "n".  How about this:
7321 rpack() already knows what type of packet it is, so if it's an S or I packet
7322 and the 8th byte of the data field is "5" and last 3 bytes, when interpreted
7323 as the CRC, match the packet contents, then we accept the packet and switch
7324 to BLOCK 5 mode.  
7325
7326 On the other hand, if the "5" was put there by corruption, the CRC should
7327 catch the error.  In that case we NAK the packet and presumabely get a
7328 different version back.  There would be no reason to try to re-read the same
7329 packet with a different block check, because the "5" could not possibly be
7330 there legitimately unless it had a 3-byte CRC.  To be clear, this is
7331 cheating.  We read the packet contents before we know the packet is correct,
7332 then we check that it *is* correct.  I made the 4-line change to rpack()
7333 and it works OK in the absense of transmission errors.  ckcfn2.c, 3 Jun 2011.
7334
7335 So the various combinations should work as desired:
7336
7337  . Sender and receiver both support and are told to SET BLOCK 5 ("SB5").
7338  . Sender SB5, but receiver doesn't support it (errors out).
7339  . Sender SB5, receiver supports it but wasn't told (auto-recognizes it).
7340  . Receiver SB5 but sender no (errors out).
7341
7342 Note in the last case, the receiver should NOT automatically fall back to
7343 standard behavior because if the user said SET BLOCK 5 that means every
7344 packet MUST be protected by CRC to prevent the I/S packets from being
7345 corrupted.
7346
7347 Installed new HELP SET BLOCK-CHECK text.  ckuus2.c, 5 Jun 2011.
7348
7349 Autodownload didn't work when the S or I packet had a 3-byte block check
7350 because kstart() checked it for a 1-byte checksum.  Fixed in kstart(),
7351 ckcfn2.c, 6 Jun 2011.  However, older Kermit versions and programs that
7352 claim to do "autodownload" will never recognize this type of packet.  No
7353 big deal since even if they did, the transfer would fail anyway.
7354
7355 Added 'FORCE 3' to E-Kermit, called it EK 1.7.  The option is "-b 5".  Works
7356 OK for sending and receiving, both with and without the new option.  Also
7357 works with "-b 5" if you send an S packet to it with '5' in the BCT field.
7358 Changes were minimal, I have them all in ek17.diff.
7359
7360 I could probably also make a new G-Kermit in about 10 minutes, but who cares
7361 about G-Kermit...  We already have two useful Kermit programs that
7362 interoperate with the new protocol.  6 Jun 2011.
7363
7364 Replaced the very inadequate help texts for functions \fword() and
7365 \fsplit() with new ones.  ckuus2.c, 6 Jun 2011.
7366
7367 There were a couple reports of file corruption that I was saving for later.
7368 Now that now is later I dug up the messages, files, and logs and it turns
7369 out that nobody had reported a reproducible case of Kermit corrupting a
7370 file.  There have been non-reproducible cases though, almost certainly due
7371 to corruption of the S or I packet or its ACK, which is why we now have SET
7372 BLOCK 5.  Even with BLOCK CHECK 5, there is no guarantee that the same thing
7373 won't happen, it is just far less likely.  Even if we added a 32-bit CRC or
7374 even 64-bit one, there would still be a small chance it could happen.
7375
7376 7 Jun 2011:
7377
7378 Corrected various #ifdefs (or lack of them) when building C-Kermit with
7379 different combinations of feature-selection options such as NOCSETS, NOICP,
7380 NOLOCAL, NOSPL, NOUNICODE, etc.  ckcfns.c ckcmai.c ckcxla.h ckuus2.c
7381 ckuus4.c ckuus5.c ckuus6.c ckuusr.c, 7 Jun 2011.  After running the script
7382 that does all these builds (84 of them) I ran it again to make sure that
7383 none of the changes broke builds that succeeded before the changes were made.
7384
7385 Built OK on Solaris9 ("make solaris9")
7386 Ditto with Krb5 and OpenSSL 0.9.8q  ("make solaris9g+openssl+shadow+pam+zlib")
7387
7388 Built OK on Mac OS X 10.4.11 ("make macosx").
7389 Also "make macosx+krb5+openssl.
7390
7391 Built OK on Linux RHEL4 ("make linux").
7392 Built OK on Linux RHEL4 with OpenSSL 0.9.7a ("make linux+ssl").
7393 Built OK on Linux RHEL5 ("make linux").
7394
7395 "make linux+ssl" fails on RHEL5 because of DES, even though the target
7396 tests for the presence or absence of the DES libraries.  In this case the
7397 libraries are there but they lack the functions des_ecb3_encrypt,
7398 des_random_seed, and des_set_odd_parity.  The build succeeds as:
7399
7400   make linux+ssl KFLAGS=-UCK_SSL
7401
7402 Since DES is now considered harmful, Jeff Altman suggests that all OpenSSL
7403 builds, even for old versions, should omit it ("If you are building with
7404 openssl and no kerberos or srp, just disable DES.  Disabling DES will impact
7405 telnet and rlogin but it won't matter if you have no ability to negotiate a
7406 session key").
7407
7408 From Ian Beckwith, patches for Debian Linux:
7409  . Change all '-' to '\(hy' in man page (new pedantry): ckuker.nr.
7410  . Make IKSD authentication (using PAM) ask for a password when an invalid
7411    username has been given, to avoid disclosing which account names are valid:
7412    ckufio.c, ckuus7.c.
7413  . Fix spelling errors: ckcftp.c, ckuus2.c, ckuker.nr, ckcpro.w, ckuusr.h.
7414  . Patch makefile to support install to a staging area with DESTDIR.
7415  . Some other patches (mainly for typos) were for plain-text documentation
7416    files that were generated from Web pages; I updated the web pages.
7417
7418 A big corporate C-Kermit user has an application where a local C-Kermit
7419 makes a connection to a remote one, uploads some files, and then if the
7420 server has any new patch files for the local, it sends the patches and
7421 does a REMOTE HOST command to run the patch program.  This stopped working
7422 in C-Kermit 6.0 or 7.0 when I put a check to prevent it, because "it makes
7423 no sense to send REMOTE commands to the local end, because the results are
7424 sent back to the remote to be displayed on its screen but it has no screen".
7425 That may be true, but if the user needs to control the local from the
7426 remote, they should be able to.  I removed the checks.  This doesn't solve
7427 the problem of where the output goes; ideally it would go to the local
7428 screen but I don't see any elegant and simple way to make that change.
7429 However the output redirectors can still be used with the REMOTE command
7430 so the results can be captured to a remote file, which could then be sent.
7431 ckuus7.c, 7 Jun 2011.
7432
7433 Changed SET VARIABLE-EVALUATION to SET COMMAND VARIABLE-EVALUATION, but left
7434 the former version available.  ckuusr.c, 9 Jun 2011.
7435
7436 Documented the SET COMMAND VARIABLE-EVALUATION command, which I added in
7437 2008.  ck90.html, 9 Jun 2011.
7438
7439 Renamed all old Mac OS X makefile targets to have the prefix "old" to avoid
7440 confusing them with the current targets, and made macosx10 a synonym for
7441 macosx, so those who used previous makefiles will get a current target
7442 without having to know the new name.  makefile, 9 Jun 2011.
7443
7444 Added XMESSAGE, which is to MESSAGE as XECHO is ECHO: prints the text
7445 without a line terminator, so it can be continued by subsequent [X]MESSAGE
7446 commands.  ckuusr.[ch], 9 Jun 2011.
7447
7448 Back to "make linux+ssl" on RHEL5...  I took the coward's way out and added
7449 code to the makefile target to check whether the build worked (somebody let
7450 me know if there is a better way to check), and if not to give a message
7451 suggesting they "make clean ; make linux+ssl KFLAGS=-UCK_DES".  makefile,
7452 9 Jun 2011.
7453
7454 Noticed that \frecurse() would dump core if called with no arguments.
7455 Fixed in ckuus4.c, 9 Jun 2011.
7456
7457 Added \q() as an alternative to the more verbose \fliteral() for quoting
7458 strings that contain characters (like \) that would otherwise be significant
7459 to Kermit.  It's more efficient because it isn't a function call, and 'q'
7460 is an intuitive letter to mean 'quote'.  It also works better than
7461 \fliteral() because functions treat commas and braces specially.  ckuus4.c,
7462 10 Jun 2011.
7463
7464 Built OK on VMS 8.3 on Alpha, no net.  DEC C caught a couple glitches in the
7465 new code that gcc didn't catch, which I fixed.  ckuus[25].c, 10 Jun 2011.
7466
7467 Built OK on VMS 8.3 on Alpha with Multinet 5.3.  The SSL build failed but
7468 I'm not going to worry about it.  10 Jun 2011.
7469
7470 Built OK on NetBSD 5.1.  10 Jun 2011.
7471
7472 Tried to resurrect my old "build-all" machine, an IBM Netfinity 3500 from
7473 1997 with 20-some mountable bootable hard disks with lots of 1990s OS's on
7474 them.  No dice.  I can see the BIOS but not the hard disks.  The
7475 configuration is still correct because it tries to boot from the mountable
7476 hard disk, but it fails (I tried six different ones).
7477
7478 Tried to resurrect my old Siemens Nixdorf RM 200 MIPS machine.  Booted OK,
7479 headless even, but makes a hellish high-pitched whine, like a dentist drill.
7480 It's pretty slow too.  "make sinix542" (for SINIX 5.4.2) bombed at link
7481 time on no rdchk().  Fixed by #including <sys/filio.h>.  ckutio.c, 10 Jun 2011.
7482
7483 Tried to resurrect my old SCO Xenix 2.3.4 machine, also headless.  Amazingly
7484 it still works; it can't use a monitor but I can Telnet to it.  Had to tweak
7485 some #ifdefs but I got a no-net version built successfully.  According to my
7486 notes, it hasn't been possible to build with TCP/IP since C-Kermit 8.0,
7487 but how many people ever had SCO Xenix 2.3.4 with TCP/IP anyway?  Anyway we
7488 still have the binaries for C-Kermit 7.0.  ckuus4.c, 10 Jun 2011.
7489
7490 Built OK on AIX 5.3.  Built OK on Solaris 10.  11 Jun 2011.
7491
7492 Tried harder to revive the build-all machine, now it sort of works, but not
7493 all of the bootable OS's work.  Built C-Kermit 9.0 OK on OpenBSD 3.0.  Built
7494 OK on QNX 4.25 but had to #ifdef references to IXANY in ckutio.c and ckupty.
7495 Built OK on NetBSD 1.5.1 (2000).  Tried "make netbsd+ssl" on this one, it's
7496 OpenSSL 0.9.5a 1 Apr 2000, but it bombs out in ckuath.c, no big deal.
7497 Another problem in NetBSD 1.5.2 is that even though off_t is 8, CK_OFF_T
7498 is 4.  Worth noting but not worth fixing unless someone else notices.
7499 13 Jun 2011.
7500
7501 SuSE 7.0... boots OK but telnet server doesn't work.  Can telnet out but
7502 it's too flaky, connection drops if I try to transfer a file.
7503
7504 OpenBSD 2.5 [1999] OK.  Red Hat 7.1 OK.  Red Hat 7.1 with OpenSSL 0.9.6
7505 not OK, same error as with 0.9.5a:
7506
7507 ckuath.c
7508 In file included from ck_ssl.h:48,
7509                  from ckuath.c:225:
7510 /usr/include/openssl/des.h:77: warning: redefinition of `Block'
7511 ckuat2.h:86: warning: `Block' previously declared here
7512 /usr/include/openssl/des.h:83: redefinition of `struct des_ks_struct'
7513 /usr/include/openssl/des.h:91: warning: redefinition of `Schedule'
7514 ckuat2.h:90: warning: `Schedule' previously declared here
7515
7516 So it appears that OpenSSL support is broken for pre-0.9.7.  Tried
7517 building it again with -UCK_SSL (since the errors are originating from
7518 from des.h)...  But it still failed exactly the same way.  I found
7519 #includes for des.h in ckuath.c and and ck_ssl.h and #ifdef'd them out,
7520 but it still fails:
7521
7522 In file included from /usr/include/openssl/evp.h:89,
7523                  from /usr/include/openssl/x509.h:67,
7524                  from /usr/include/openssl/ssl.h:69,
7525                  from ck_ssl.h:51,
7526                  from ckuath.c:227:
7527 /usr/include/openssl/des.h:77: warning: redefinition of `Block'
7528 ckuat2.h:86: warning: `Block' previously declared here
7529 /usr/include/openssl/des.h:83: redefinition of `struct des_ks_struct'
7530 /usr/include/openssl/des.h:91: warning: redefinition of `Schedule'
7531 ckuat2.h:90: warning: `Schedule' previously declared here
7532
7533 Built OK on Debian 2.1.  13 Jun 2011.
7534
7535 On FreeBSD 4.4, it blows up with:
7536 ckufio.c: In function vpass':
7537 ckufio.c:8201: conflicting types for 'initgroups'
7538 /usr/include/unistd.h:154: previous declaration of 'initgroups'
7539 ckufio.c:8201: warning: extern declaration of 'initgroups' doesn't match global
7540 one.  Fixed by defining NODCLINITGROUPS for FreeBSD in ckufio.c. It might not 
7541 be the right fix, but I don't have a lot of other FreeBSD versions to
7542 compare with.  Anyway now it builds OK on 4.4, and also on FreeBSD 3.3.
7543 ckufio.c, 13 Jun 2011.
7544
7545 Tried to build on SCO Open Server 5.0.7 but it fails at link time because
7546 it can't find rdchk().  But it's supposed to be there!  Come back to this
7547 later...
7548
7549 Red Hat 6.1             i386   32/64   linux          2332545
7550 Red Hat 7.1             i386   32/64   linux          2368528
7551 Red Hat EL4             i386   32/74   linux          2363067
7552 Red Hat EL5.6           i386    64     linux          2371279
7553 Solaris9                sparc  32/64   solaris9       2849896
7554 Solaris9+ssl            sparc  32/64   solaris9       5021764
7555 Solaris10               sparc  32/64   solaris10      2855776
7556 QNX                     i386    32     qnx32          2012323 
7557 NetBSD 1.5.1            i386   32/64   netbsd         2198055
7558 NetBSD 5.1              i386   32/64   netbsd         2159863
7559 OpenBSD 2.5             i386   32/64   openbsd        2236036
7560 Mac OS X 10.6.7         x86_64  64     macosx         2.7M
7561 Mac OS X 10.4.11        ppc    32/64   macosx         2496304
7562 Debian 2.1              i386   32/64   linux          2213221
7563 FreeBSD 4.4             i386   32/64   freebsd        2291333
7564 FreeBSD 3.3             i386   32/64   freebsd        2147370
7565 SINIX 5.42              mips    32     sinix542       3319325 (1995)
7566 SCO Unixware 2.1.3      i386    32     uw213          2242176
7567 SCO OSR6.0.0            i386   32/64   sco_osr600     2368300
7568
7569 More builds, 14 June 2011:
7570
7571 VMS 6.2                 alpha   32     make mn        2556928 No TCP/IP
7572 VMS 6.2                 alpha   32     make m         3112960 UCX 4.0
7573 Solaris 11              i386   32/64   solaris11      2823860
7574 Solaris 11              i386   32/64   solaris11+ssl  2993660 OpenSSL 0.9.8l
7575 NetBSD 5.1              i386   32/64   netbsd+krb5    2307855 Kerberos 5
7576 Linux Slackware 12.1.0  i386   32/65   linux          2175754
7577 Linux Fedora 14         i386   32/64   linux          2256514
7578 Linux Fedora 14         i386   32/64   linux+ssl      ....... OpenSSL 1.0.0d
7579 Linux Fedora 14         i386   32/64   linux+krb      2449614 (*)
7580
7581 (*) make linux+krb5 "LIBS=$LIBS /lib/libk5crypto.so.3 /lib/libcom_err.so.2"
7582
7583 Noticed that netbsd+ssl build on NetBSD 5.1 said "NetBSD 1.5" in its banner.
7584 Fixed by replacing the old hardwired target with the new "subroutinized"
7585 target a'la linux+ssl and adapting it to NetBSD.  makefile, 15 Jun 2011.
7586
7587 Same deal for Kerberos 5, make a new netbsd+krb5 target and it builds ok,
7588 at least once one figures out where the Kerberos headers and libs are.
7589 makefile, 15 Jun 2011.
7590
7591 Same deal for the netbsdnc target, now it simply defined NOCURSES and
7592 chains to the main netbsd target.  makefile, 15 Jun 2011.
7593
7594 Tried to build with Kerberos 5 on Solaris, fails because the DES library
7595 no longer exists.  This one is beyond me, sorry.
7596
7597 Made new targets for MirBSD, mirbsd and mirbsd+ssl, makefile 15 Jun 2011.
7598
7599 In OpenSUSE 11.2 with OpenSSL 0.9.8r we bomb on undefined references from
7600 various DES library routines.  Builds OK without DES.
7601
7602 Various linux+krb5 builds fail because can't find -lgssapi_krb5
7603
7604 SSL builds with OpenSSL < 0.9.7 fail even though there is code to support
7605 the older SSL.
7606
7607 Fixed some printf %ld vs int instances in the sizeofs section of SHOW FEATURES.
7608 ckuus5.c, 15 Jun 2011.
7609
7610 Fixed the new linux+ssl target to actually use the SSLINC and SSLLIBS
7611 definitions, oops.  makefile, 15 Jun 2011.
7612
7613 15 June 2011 builds (Beta.01):
7614
7615 AIX 5.3                 ppc    32/64   aix+ssl        3283846 OpenSSL 0.9.8m
7616 NetBSD 5.1              i386   32/64   netbsd         2159863
7617 NetBSD 5.1              i386   32/64   netbsd+ssl     2350274 OpenSSL 0.9.9-dev
7618 NetBSD 5.1              i386   32/64   netbsd+krb5    2349627 MIT Krb5 1.6.3
7619 FreeBSD 8.2             i386   32/64   freebsd        2298414
7620 FreeBSD 8.2             i386   32/64   freebsd+ssl    2448961 OpenSSL 0.9.8q
7621 OpenBSD 4.7             i386   32/64   openbsd        2266132
7622 OpenBSD 4.7             i386   32/64   openbsd+ssl    2409263 OpenSSL 0.9.8k
7623 MirBSD 10               i386   32/64   mirbsd         2216601
7624 MirBSD 10               i386   32/64   mirbsd+ssl     2358318 OpenSSL 0.9.8r
7625 OpenSuse 11.2           x86_64  64     linux          2348468
7626 OpenSuse 11.2           x86_64  64     linux+ssl (*)  2546540 OpenSSL 0.9.8r
7627 RHEL 5.6                ia64    64     linux          4390687
7628 RHEL 5.6                ia64    64     linux+ssl (*)  4775007 OpenSSL 0.9.8e
7629 Ubuntu 9.10             i386   32/64   linux          2275523
7630 Ubuntu 9.10             i386   32/64   linux+ssl      2466708 OpenSSL 0.9.8r
7631 Gentoo 1.12.13          ppc    32/64   linux          2386597
7632 Gentoo 1.12.13          ppc64   64     linux          2749015
7633 Gentoo 1.12.13          ppc64   64     linux+ssl      3002150 OpenSSL 0.9.8r
7634 Gentoo 1.12.13          sparc  32/64   linux          2478382
7635 Gentoo 1.12.13          sparc  32/64   linux+ssl      2690499 OpenSSL 0.9.8r
7636 Solaris 9               sparc  32/64   solaris9       2849896
7637 Solaris 10              i386   32/64   solaris10      2837620
7638 IRIX 6.5                R10000 32/64   irix65         2869704
7639
7640 * and KFLAGS=-UCK_DES
7641
7642 Tried building on NetBSD 5.1 with Heimdal Kerberos using:
7643
7644 make netbsd+krb5 \
7645  "KFLAGS=-DHEIMDAL" \
7646  "K5INC=-I/usr/include" \
7647  "K5LIB=-L/usr/lib"
7648
7649 It found all its headers OK, but it blew up in ckuath.c.  Small wonder,
7650 ckccfg.html says:
7651
7652 HEIMDAL
7653     Should be defined if Kerberos V support is provided by HEIMDAL. Support
7654     for this option is not complete in C-Kermit 8.0. Anyone interested in
7655     working on this should contact kermit-support. 
7656
7657 'krb5-config --version' gives the MIT Kerberos 5 version number.
7658
7659 Make a new netbsd+krb5+ssl target based on the combination of the new
7660 netbsd+ssl and netbsd+krb5 targets.  There were lots of warnings in the
7661 compilation but no errors, but it produced an executable that starts and
7662 does normal things but I have no idea if the SSL or Kerberos functions work.
7663 makefile, 16 Jun 2011.
7664
7665 Changed the cu-solaris9-krb5 target to test for the presence of DES because
7666 DES isn't there, to see if this would allow a Kerberos build to proceed.
7667 And it worked, amazing.  At least the build completed, I have no way to test
7668 the Kerberos part.  makefile, 16 Jun 2011.
7669
7670 Updated the solaris9+ssl target to do the DES testing.  makefile, 16 Jun 2011.
7671
7672 Updated cu-solaris+krb5 target to test whether the GSSAPI library is called
7673 libgassapi or libgassapi_krb5.  makefile, 16 Jun 2011.
7674
7675 Added lots of tests to the Linux Kerberos 5 entries, linux+krb5 and
7676 linux+krb5+ssl, because some have libk5crypto and some don't; some have
7677 libcom_err and some don't; and some have libgssapi_krb5 (e.g. RHEL5,
7678 OpenSuse 11.2) whereas others have libgssapi (Gentoo).
7679
7680 16 June 2011 builds (Beta.01):
7681
7682 NetBSD 5.1 i386   32/64  netbsd+krb5+ssl   2451757 OpenSSL 0.9.9 MIT Krb5 1.6.3
7683 Solaris 9  sparc  32/64  solaris9+krb5     2543036 MIT Kerberos 5 1.7.1
7684 Solaris 9  sparc  32/64  solaris9+ssl      5021544 OpenSSL 0.9.8q (gcc)
7685 Gentoo...  ppc    32/64  linux             2386597
7686 Gentoo...  ppc    32/64  linux+ssl         2593561 OpenSSL 0.9.8r 
7687 Gentoo...  ppc64   64    linux             2749015
7688 Gentoo...  ppc64   64    linux+ssl         3002150 OpenSSL 0.9.8r 
7689 RHEL5      x86_64  64    linux+krb5 (*)    2563878 MIT Kerberos 5 1.6.1
7690 RHEL5      x86_64  64    linux+krb5+ssl(*) 2563878 MIT Kerberos 5 1.6.1
7691 Fedora 14  i386   32/64  linux+krb5+ssl    2539891 MIT Krb5 + OpenSSL 0.9.8r
7692
7693 * KFLAGS=-UCK_DES
7694
7695 --- C-Kermit 9.0.299 Beta.01 ---
7696
7697 sizeof() can return a long or an int, so neither printf("%d",sizeof(blah));
7698 or printf("%ld",sizeof(blah)); can be used everywhere.  Changed the
7699 "sizeofs" section of SHOW FEATURES in the dumbest (and therefore most
7700 portable) way to squelch the warnings.  ckuus5.c, 17 Jun 2011.
7701
7702 From John Dunlap: "Watching the server screen led me to offer a cosmetic
7703 patch for ckuusx.c.  I noticed that the server screen said it was
7704 "RESENDING" when it really wasn't.  The attached patch emits blanks to
7705 insure that old labels are completely erased."  ckuusx.c, 17 Jun 2011.
7706
7707 Nelson Beebe found two places where I had SSLLIBS in the makefile instead of
7708 SSLLIB.  makefile, 18 Jun 2011.
7709
7710 More important he knew how to force gcc to load the right header files for
7711 OpenSSL 1.0.0d (by using '-isystem' rather than '-I').  Previously it was
7712 using the 0.9.8r header files but linking with the 1.0.0d libraries.  This
7713 is not in the sources, it's done in the 'make' command, e.g.:
7714
7715   export PATH=/usr/bin:$PATH
7716   export SSLINC=-isystem/usr/include
7717   export "SSLLIB=-L/usr/lib -Wl,-rpath,/usr/lib"
7718   make linux+ssl
7719
7720 Folded the previous linux+openssl+zlib+shadow+pam and linux+openssl+shadow
7721 targets into linux+ssl.  Checked the linuxso (scripting only) target, builds
7722 OK, 600K.  Made new subroutinized linux+krb5+krb4 target but can't find
7723 anyplace to test it.   Made new subroutinized linux+shadow+pam target, works
7724 fine on RHEL4.  Revised comments and lists again.  makefile, 18 Jun 2011.
7725
7726 For the pluggable-disk OS's that boot OK but lack a working network, I
7727 rigged up a serial connection using a DB9-FF null modem cable, and then a
7728 DB9-MF modem cable to make it reach.  I don't see any modem signals on
7729 either end, but the data goes through OK.  COM1 on the desktop PC,
7730 /dev/ttyS1 or whatever on Lab.  Since there are no modem signals, can't use
7731 RTS/CTS.  At 57600bps with Xon/Xoff, 500-byte packets and sliding windows,
7732 transfers work OK at about 5000cps using 5 window slots; takes 8 minutes to
7733 transfer the gzipped C-Kermit tarball.  Kermit to the rescue.  19 Jun 2011.
7734
7735 Transferred the tarball over serial ports to SCO OSR5.0.5 at 38.4Kbps, the
7736 highest speed supported, 12 minutes, no errors, 3300cps.  Unpack, make
7737 sco32v505udk, OK.  Also built the TCP/IP version and it almost made an
7738 outbound connection, but only once.  19 Jun 2011.
7739
7740 Ditto for Solaris 2.6/i386, except 57.6Kbps, 4K-byte packets, no problem.
7741 Solaris 8/i386, ditto.  19 Jun 2011.
7742
7743 SCO OpenServer 5.0.5  i386   32   sco32v505udk     1940964  No TCP/IP
7744 SCO OpenServer 5.0.5  i386   32   sco32v505udknet  2314668  With TCP/IP
7745 Sun Solaris 2.6       i386   32   solaris26g       4661368
7746 Sun Solaris 8         i386   32   solaris8g        4675432
7747
7748 When using compact substring notation, \s(xx[4]) returns the whole string
7749 xx starting at position 4, but \s(xx[4:]) returns an empty string.  Fixed
7750 the latter to be like the former.  ckuus5.c, 20 Jun 2010.
7751
7752 Really it would have been nicer if \s(xx[4]) returned a single character,
7753 the 4th character of xx, but it's too late now.  Added another "separator"
7754 character '.' (period) for that: \s(xx[4.]) is the 4th character of xx.
7755 ckuus4.c, 20 Jun 2010.
7756
7757 Back to SCO OSR5.0.7... This failed before because 'rdchk' came up unknown
7758 at link time, unlike all previous OSR5's, that used rdchk() in place of the
7759 FIONREAD ioctl.  Added #ifdefs to make a special case for 5.0.7.  I'm not
7760 sure this is the best way, but this is the minimal change to get it to work.
7761 If anybody cares, maybe the same can be done for previous OSR5 releases.
7762 ckutio.c, 20 Jun 2010 (search for SCO_OSR507).
7763
7764 SCO OpenServer 5.0.7  i386   32   sco32v507        1895724  No TCP/IP
7765 SCO OpenServer 5.0.7  i386   32   sco32v507net     2246792  With TCP/IP
7766
7767 Checked current code on RHEL4, found that my GSSAPI-lib finding makefile
7768 target didn't look in enough places; added some more.  makefile, 21 Jun 2011.
7769
7770 Got reports back on HPUX from Peter Eichhorn, almost all good on HP-UX 8, 9,
7771 10, and 11.  21 Jun 2011.
7772
7773 Got access to Debian 5.0 and 7-to-be ("Wheezy/Sid").  Regular 'make linux' is
7774 OK in Debian 5, but in 7 can't find crypt, res_search, or dn_expand; had
7775 to add more library search clauses to 'make linux'.  makefile, 21 Jun 2011.
7776
7777 In Debian 7.0, libk5crypto could not be found without adding another clause
7778 to 'make linux+krb5'.  That done, the SSL build (1.0.0d) was OK, as well as
7779 the krb5+ssl one.  makefile, 21 Jun 2011.
7780
7781 I found a Linux box that had both Kerberos 4 and 5 installed and tried 'make
7782 linux+krb5+krb4', which failed because of missing DES functions.  Tried
7783 'make linux+krb5+krb4 KFLAGS=-UCK_DES', but that fails too, even though it
7784 doesn't fail for Kerberos 5 alone, so probably some Krb4 code is making
7785 unguarded calls to the DES routines.  What is really needed is a way to
7786 completely strip all DES references from any given build.  21 Jun 2011.
7787
7788 -----------------------------------
7789 To check:
7790
7791 after logging out from "ssh jezebel":
7792 (/home/fdc/) C-Kermit>ssh jezebel
7793  Closing connection
7794 Sorry, network type not supported
7795 (/home/fdc/) C-Kermit> # This happens in Linux but not Solaris
7796
7797 ---------------------------------
7798 ***************************