source: trunk/third/kermit/ckcplm.txt @ 20081

Revision 20081, 137.6 KB checked in by zacheiss, 21 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r20080, which included commits to RCS files with non-trunk default branches.
RevLine 
[20080]1
2                         C-Kermit Program Logic Manual
3                                       
4     Frank da Cruz
5     [1]The Kermit Project
6     [2]Columbia University
7     
8   As of: C-Kermit 8.0.209, 17 March 2003
9   This page last updated: Sun Mar 23 19:25:30 2003 (New York USA Time)
10   
11     IF YOU ARE READING A PLAIN-TEXT version of this document, note that
12     this file is a plain-text dump of a Web page. You can visit the
13     original (and possibly more up-to-date) Web page here:
14     
15  [3]http://www.columbia.edu/kermit/ckcplm.html
16
17   [ [4]C-Kermit Home ] [ [5]Kermit Home ]
18    ________________________________________________________________________
19 
20  CONTENTS
21 
22  1. [6]INTRODUCTION
23  2. [7]FILES
24  3. [8]SOURCE CODE PORTABILITY AND STYLE
25  4. [9]MODULES
26     4.A. [10]Group A: Library Routines
27     4.B. [11]Group B: Kermit File Transfer
28     4.C. [12]Group C: Character-Set Conversion
29     4.D. [13]Group D: User Interface
30     4.E. [14]Group E: Platform-Dependent I/O
31     4.F. [15]Group F: Network Support
32     4.G. [16]Group G: Formatted Screen Support
33     4.H. [17]Group H: Pseudoterminal Support
34     4.I. [18]Group I: Security
35  I. [19]APPENDIX I: FILE PERMISSIONS
36    ________________________________________________________________________
37 
38  1. INTRODUCTION
39 
40   The Kermit Protocol is specified in the book Kermit, A File Transfer
41   Protocol by Frank da Cruz, Digital Press / Butterworth Heinemann,
42   Newton, MA, USA (1987), 379 pages, ISBN 0-932376-88-6. It is assumed
43   the reader is familiar with the Kermit protocol specification.
44   
45   This file describes the relationship among the modules and functions
46   of C-Kermit 5A and later, and other programming considerations.
47   C-Kermit is designed to be portable to any kind of computer that has a
48   C compiler. The source code is broken into many files that are grouped
49   according to their function, as shown in the [20]Contents.
50   
51   C-Kermit has seen constant development since 1985. Throughout its
52   history, there has been a neverending tug-of-war among:
53   
54    a. Functionality: adding new features, fixing bugs, improving
55       performance.
56    b. Adding support for new platforms.
57    c. "Buzzword 1.0 compliance".
58       
59   The latter category is the most frustrating, since it generally
60   involves massive changes just to keep the software doing what it did
61   before in some new setting: e.g. the K&R-to-ANSIC conversion (which
62   had to be done, of course, without breaking K&R); Y2K (not a big deal
63   in our case); the many and varied UNIX and other API "standards";
64   IPv6.
65   
66   [ [21]Contents ] [ [22]C-Kermit ] [ [23]Kermit Home ]
67    ________________________________________________________________________
68 
69  2. FILES
70 
71   C-Kermit source files begin with the two letters "ck", for example
72   ckutio.c. Filenames are kept short (6.3) for maximum portability and
73   (obviously I hope) do not contain spaces or more than one period. The
74   third character in the name denotes something about the function group
75   and the expected level of portability:
76   
77     a General descriptive material and documentation (text)
78     b BOO file encoders and decoders (obsolete)
79     c All platforms with C compilers (*)
80     d Data General AOS/VS
81     e Reserved for "ckermit" files, like ckermit.ini, ckermit2.txt
82     f (reserved)
83     g (reserved)
84     h (reserved)
85     i Commodore Amiga (Intuition)
86     j (unused)
87     k (unused)
88     l Stratus VOS
89     m Macintosh with Mac OS 1-9
90     n Microsoft Windows NT/2000/XP
91     o OS/2 and/or Microsoft Windows 9x/ME/NT/2000/XP
92     p Plan 9 from Bell Labs
93     q (reserved)
94     r DEC PDP-11 with RSTS/E (never used, open for reassigment)
95     s Atari ST GEMDOS (last supported in version 5A(189))
96     t DEC PDP-11 with RT-11 (never used, open for reassigment)
97     u Unix-based operating systems (*)
98     v VMS and OpenVMS
99     w Wart (Lex-like preprocessor, platform independent)
100     x (reserved)
101     y (reserved)
102     z (reserved)
103     0-3 (reserved)
104     4 IBM AS/400
105     5-8   (reserved)
106     9 Microware OS-9
107     _ Encryption modules
108     
109   (*) In fact there is little distinction between the ckc*.* and cku*.*
110   categories. It would make more sense for all cku*.* modules to be
111   ckc*.* ones, except ckufio.c, ckutio.c, ckucon.c, ckucns.c, and
112   ckupty.c, which truly are specific to Unix. The rest (ckuus*.c,
113   ckucmd.c, etc) are quite portable.
114   
115   One hint before proceeding: functions are scattered all over the
116   ckc*.c and cku*.c modules, where function size has begun to take
117   precedence over the desirability of grouping related functions
118   together, the aim being to keep any particular module from growing
119   disproportionately large. The easiest way (in UNIX) to find out in
120   what source file a given function is defined is like this (where the
121   desired function is foo()...):
122   
123  grep ^foo\( ck*.c
124
125   This works because the coding convention has been to make function
126   names always start on the left margin with their contents indented,
127   for example:
128   
129static char *
130foo(x,y) int x, y; {
131    ...
132}
133
134   Also note the style for bracket placement. This allows
135   bracket-matching text editors (such as EMACS) to help you make sure
136   you know which opening bracket a closing bracket matches, particularly
137   when the opening bracket is above the visible screen, and it also
138   makes it easy to find the end of a function (search for '}' on the
139   left margin).
140   
141   Of course EMACS tags work nicely with this format too:
142   
143  $ cd kermit-source-directory
144  $ etags ck[cu]*.c
145  $ emacs
146  Esc-X Visit-Tags-Table<CR><CR>
147
148   (but remember that the source file for ckcpro.c is [24]ckcpro.w!)
149   
150   Also:
151   
152     * Tabs should be set every 8 spaces, as on a VT100.
153     * All lines must no more than 79 characters wide after tab
154       expansion.
155     * Note the distinction between physical tabs (ASCII 9) and the
156       indentation conventions, which are: 4 for block contents, 2 for
157       most other stuff (obviously this is not a portability issue, just
158       style).
159       
160   [ [25]Contents ] [ [26]C-Kermit ] [ [27]Kermit Home ]
161    ________________________________________________________________________
162 
163  3. SOURCE CODE PORTABILITY AND STYLE
164 
165   C-Kermit was designed in 1985 as a platform-independent replacement
166   for the earlier Unix Kermit. c-Kermit's design was expected to promote
167   portability, and judging from the number of platforms to which it has
168   been adapted since then, the model is effective, if not ideal
169   (obviously if we had it all to do over, we'd change a few things). To
170   answer the oft-repeated question: "Why are there so many #ifdefs?",
171   it's because:
172   
173     * Many of them are related to feature selection and program size,
174       and so need to be there anyway.
175     * Those that treat compiler, library, platform, header-file, and
176       similar differences have built up over time as hundreds of people
177       all over the world adapted C-Kermit to their particular
178       environments and sent back their changes. There might be more
179       politically-correct ways to achieve portability, but this one is
180       natural and proven. The basic idea is to introduce changes that
181       can be selected by defining a symbol, which, if not defined,
182       leaves the program exactly as it was before the changes.
183     * Although it might be possible to "clean up" the "#ifdef mess",
184       nobody has access to all the hundreds of platforms served by the
185       #ifdefs to check the results.
186       
187   And to answer the second-most-oft-repeated question: "Why don't you
188   just use GNU autoconfig / automake / autowhatever instead of
189   hard-coding all those #ifdefs?" Answers:
190   
191     * The GNU tools are not available on all the platforms where
192       C-Kermit must be built and I wouldn't necessarily trust them if
193       they were.
194     * Each platform is a moving target, so the tools themselves would
195       need to updated before Kermit could be updated.
196     * It would only add another layer of complexity to an already
197       complex process.
198     * Conversion at this point would not be practical unless there was a
199       way to test the results on all the hundreds of platforms where
200       C-Kermit is supposed to build.
201       
202   When writing code for the system-indendent C-Kermit modules, please
203   stick to the following coding conventions to ensure portability to the
204   widest possible variety of C preprocessors, compilers, and linkers, as
205   well as certain network and/or email transports. The same holds true
206   for many of the "system dependent" modules too; particularly the Unix
207   ones, since they must be buildable by a wide variety of compilers and
208   linkers, new and old.
209   
210   This list does not purport to be comprehensive, and although some
211   items on it might seem far-fetched, they would not be listed unless I
212   had encountered them somewhere, some time. I wish I had kept better
213   records so I could cite specific platforms and compilers.
214   
215     * Try to keep variable and function names unique within 6
216       characters, especially if they are used across modules, since 6 is
217       the maximum for some old linkers (actually, this goes back to
218       TOPS-10 and -20 and other old DEC OS's where C-Kermit never ran
219       anyway; a more realistic maximum is probably somewhere between 8
220       and 16). We know for certain that VAX C has a 31-character max
221       because it complains -- others might not complain, but just
222       silently truncate, thus folding two or more routines/variables
223       into one.
224     * Keep preprocessor symbols unique within 8 characters; that's the
225       max for some preprocessors (sorry, I can't give a specific
226       example, but in 1988 or thereabouts, I had to change character-set
227       symbols like TC_LATIN1 and TC_LATIN2 to TC_1LATIN and TC_2LATIN
228       because the digits were being truncated and ignored on a platform
229       where I actually had to build C-Kermit 5A; unfortunately I didn't
230       note which platform -- maybe some early Ultrix version?)
231     * Don't create preprocessor symbols, or variable or function names,
232       that start with underscore (_). These are usually reserved for
233       internal use by the compiler and header files.
234     * Don't put #include directives inside functions or { blocks }.
235     * Don't use the #if or #elif preprocessor constructions, only use
236       #ifdef, #ifndef, #define, #undef, and #endif.
237     * Put tokens after #endif in comment brackets, e.g.
238       #endif /* FOO */.
239     * Don't indent preprocessor statements - # must always be first char
240       on line.
241     * Don't put whitespace after # in preprocessor statements.
242     * Don't use #pragma, even within #ifdefs -- it makes some
243       preprocessors give up.
244     * Same goes for #module, #if, etc - #ifdefs do NOT protect them.
245     * Don't use logical operators in preprocessor constructions.
246     * Avoid #ifdefs inside argument list to function calls (I can't
247       remember why this one is here, but probably needn't be; we do this
248       all the time).
249     * Always cast strlen() in expressions to int:
250       if ((int)strlen(foo) < x)...
251     * Any variable whose value might exceed 16383 should be declared as
252       long, or if that is not possible, then as unsigned.
253     * Avoid typedefs; they might be portable but they are very confusing
254       and there's no way to test for their presence or absence at
255       compile time. Use preprocessor symbols instead if possible; at
256       least you can test their definitions.
257     * Unsigned long is not portable; use a preprocessor symbol (Kermit
258       uses ULONG for this).
259     * Long long is not portable. If you really need it, be creative.
260     * Similarly 1234LL is not portable, nor almost any other constant
261       modifier other than L.
262     * Unsigned char is not portable, use CHAR (a preprocessor symbol
263       defined in the Kermit header files) and always take precautions
264       against character signage (more about this [28]below).
265     * Don't use initializers with automatic arrays or structs: it's not
266       portable.
267     * Don't use big automatic arrays or structs in functions that might
268       be called recursively; some platforms have fixed-size stacks (e.g.
269       Windows 9x: 256K) and recursive functions crash with stack
270       overflow. Even when there is not a compiler limitation, this
271       causes memory to be consumed without bound, and can end up filling
272       swap space.
273     * Don't assume that struct assignment performs a copy, or that it
274       even exists.
275     * Don't use sizeof to get the size of an array; someone might come
276       along later and and change it from static to malloc'd. Always use
277       a symbol to refer to the array's size.
278     * Don't put prototypes for static functions into header files that
279       are used by modules that don't contain that function; the link
280       step can fail with unresolved references (e.g. on AOS/VS).
281     * Avoid the construction *++p (the order of evaluation varies; it
282       shouldn't but at least one compiler had a bug that made me include
283       this item).
284     * Don't use triple assignments, like a = b = c = 0; (or quadruple,
285       etc). Some compilers generate bad code for these, or crash, etc
286       (some version of DEC C as I recall).
287     * Some compilers don't allow structure members to have the same
288       names as other identifiers. Try to give structure members unique
289       names.
290     * Don't assume anything about order of evaluation in boolean
291       expressions, or that they will stop early if a required condition
292       is not true, e.g.:
293
294  if (i > 0 && p[i-1] == blah)
295       can still dump core if i == 0 (hopefully this is not true of any
296       modern compiler, but I would not have said this if it did not
297       actually happen somewhere).
298     * Don't have a switch() statement with no cases (e.g. because of
299       #ifdefs); this is a fatal error in some compilers.
300     * Don't put lots of code in a switch case; move it out to a separate
301       function; some compilers run out of memory when presented with a
302       huge switch() statement -- it's not the number of cases that
303       matters; it's the overall amount of code.
304     * Some compilers might also limit the number of switch() cases, e.g.
305       to 254.
306     * Don't put anything between "switch() {" and "case:" -- switch
307       blocks are not like other blocks.
308     * Don't jump into or out of switches.
309     * Don't make character-string constants longer than about 250 bytes.
310       Longer strings should be broken up into arrays of strings.
311     * Don't write into character-string constants (obviously). Even when
312       you know you are not writing past the end; the compiler or linker
313       might have put them into read-only and/or shared memory, and/or
314       coalesced multiple equal constants so if you change one you change
315       them all.
316     * Don't depend on '\r' being carriage return.
317     * Don't depend on '\n' being linefeed or for that matter any SINGLE
318       character.
319     * Don't depend on '\r' and '\n' being different (e.g. as separate
320       switch() cases).
321     * In other words, don't use \n or \r to stand for specific
322       characters; use \012 and \015 instead.
323     * Don't code for "buzzword 1.0 compliance", unless "buzzword" is K&R
324       and "1.0" is the first edition.
325     * Don't use or depend on anything_t (size_t, pid_t, etc), except
326       time_t, without #ifdef protection (time_t is the only one I've
327       found that is accepted everywhere). This is a tough one because
328       the same function might require (say) a size_t arg on one
329       platform, whereas size_t is unheard of on another; or worse, it
330       might require a totally different data type, like int or long or
331       some other typedef'd thing. It has often proved necessary to
332       define a symbol to stand for the type of a particular argument to
333       a particular library or system function to get around this
334       problem.
335     * Don't use or depend on internationalization ("i18n") features,
336       wchar_t, locales, etc, in portable code; they are not portable.
337       Anyway, locales are not the right model for Kermit's
338       multi-character-set support. Kermit does all character-set
339       conversion itself and does not use any external libraries or
340       functions.
341     * In particular, don't use any library functions that deal with wide
342       characters or Unicode in any form. These are not only nonportable,
343       but a constantly shifting target (e.g. the ones in glibc).
344     * Don't make any assumption about signal handler type. It can be
345       void, int, long, or anything else. Always declare signal handlers
346       as SIGTYP (see definition in ckcdeb.h and augment it if necessary)
347       and always use SIGRETURN at exit points from signal handlers.
348     * Signals should always be re-armed to be used again (this barely
349       scratches the surface -- the differences between BSD/V7 and System
350       V and POSIX signal handling are numerous, and some platforms do
351       not even support signals, alarms, or longjmps correctly or at all
352       -- avoid all of this if you can).
353     * On the other hand, don't assume that signals are disarmed after
354       being raised. In some platforms you have to re-arm them, in others
355       they stay armed.
356     * Don't call malloc() and friends from a signal handler; don't do
357       anything but setting integer global variables in a signal handler.
358     * malloc() does not initialize allocated memory -- it never said it
359       did. Don't expect it to be all 0's.
360     * Did You Know: malloc() can succeed and the program can still dump
361       core later when it attempts to use the malloc'd memory? (This
362       happens when allocation is deferred until use and swap space is
363       full.)
364     * memset(), memmove(), and memcpy() are not portable, don't use them
365       without protecting them in ifdefs (we have USE_MEMCPY for this).
366       bzero()/bcopy() too, except we're guaranteed to have
367       bzero()/bcopy() when using the sockets library (not really). See
368       examples in the source.
369     * Don't assume that strncpy() stops on the first null byte -- most
370       versions always copy the number of bytes given in arg 3, padding
371       out with 0's and overwriting whatever was there before. Use
372       C-Kermit ckstrncpy() if you want predictable non-padding behavior,
373       guaranteed NUL-termination, and a useful return code.
374     * DID YOU KNOW.. that some versions of inet_blah() routines return
375       IP addresses in network byte order, while others return them local
376       machine byte order? So passing them to ntohs() or whatever is not
377       always the right thing to do.
378     * Don't use ANSI-format function declarations without #ifdef
379       CK_ANSIC, and always provide an #else for the non-ANSI case.
380     * Use the Kermit _PROTOTYP() macro for declaring function
381       prototypes; it works in both the ANSI and non-ANSI cases.
382     * Don't depend on any other ANSI preprocessor features like
383       "pasting" -- they are often missing or nonoperational.
384     * Don't assume any C++ syntax or semantics.
385     * Don't use // as a comment introducer. C is not C++.
386     * Don't declare a string as "char foo[]" in one module and "extern
387       char * foo" in another, or vice-versa: this causes core dumps.
388     * With compiler makers falling all over themselves trying to outdo
389       each other in ANSI strictness, it has become increasingly
390       necessary to cast EVERYTHING. This is increasingly true for char
391       vs unsigned char. We need to use unsigned chars if we want to deal
392       with 8-bit character sets, but most character- and string-oriented
393       APIs want (signed) char arguments, so explicit casts are
394       necessary. It would be nice if every compiler had a
395       -funsigned-char option (as gcc does), but they don't.
396     * a[x], where x is an unsigned char, can produce a wild memory
397       reference if x, when promoted to an int, becomes negative. Cast it
398       to (unsigned), even though it ALREADY IS unsigned.
399     * Be careful how you declare functions that have char or long
400       arguments; for ANSI compilers you MUST use ANSI declarations to
401       avoid promotion problems, but you can't use ANSI declarations with
402       non-ANSI compilers. Thus declarations of such functions must be
403       hideously entwined in #ifdefs. Example: latter:
404
405  int                          /*  Put character in server command buffer  */
406  #ifdef CK_ANSIC
407  putsrv(char c)
408  #else
409  putsrv(c) char c;
410  #endif /* CK_ANSIC */
411  /* putsrv */ {
412      *srvptr++ = c;
413      *srvptr = '\0';           /* Make sure buffer is null-terminated */
414      return(0);
415  }
416     * Be careful how you return characters from functions that return
417       int values -- "getc-like functions" -- in the ANSI world. Unless
418       you explicitly cast the return value to (unsigned), it is likely
419       to be "promoted" to an int and have its sign extended.
420     * At least one compiler (the one on DEC OSF/1 1.3) treats "/*" and
421       "*/" within string constants as comment begin and end. No amount
422       of #ifdefs will get around this one. You simply can't put these
423       sequences in a string constant, e.g. "/usr/local/doc/*.*".
424     * Avoid putting multiple macro references on a single line, e.g.:
425
426  putchar(BS); putchar(SP); putchar(BS)
427
428   This overflows the CPP output buffer of more than a few C
429   preprocessors (this happened, for example, with SunOS 4.1 cc, which
430   evidently has a 1K macro expansion buffer).
431   
432   C-Kermit needs constant adjustment to new OS and compiler releases.
433   Every new OS release shuffles header files or their contents, or
434   prototypes, or data types, or levels of ANSI strictness, etc. Every
435   time you make an adjustment to remove a new compilation error, BE VERY
436   CAREFUL to #ifdef it on a symbol unique to the new configuration so
437   that the previous configuration (and all other configurations on all
438   other platforms) remain as before.
439   
440   Assume nothing. Don't assume header files are where they are supposed
441   to be, that they contain what you think they contain, that they define
442   specific symbols to have certain values -- or define them at all!
443   Don't assume system header files protect themselves against multiple
444   inclusion. Don't assume that particular system or library calls are
445   available, or that the arguments are what you think they are -- order,
446   data type, passed by reference vs value, etc. Be conservative when
447   attempting to write portable code. Avoid all advanced features.
448   
449   If you see something that does not make sense, don't assume it's a
450   mistake -- it might be there for a reason, and changing it or removing
451   is likely to cause compilation, linking, or runtime failures sometime,
452   somewhere. Some huge percentage of the code, especially in the
453   platform-dependent modules, is workarounds for compiler, linker, or
454   API bugs.
455   
456   But finally... feel free to violate any or all of these rules in
457   platform-specific modules for environments in which the rules are
458   certain not to apply. For example, in VMS-specific code, it is OK to
459   use #if, because VAX C, DEC C, and VMS GCC all support it.
460   
461   [ [29]Contents ] [ [30]C-Kermit ] [ [31]Kermit Home ]
462    ________________________________________________________________________
463 
464  3.1. Memory Leaks
465 
466   The C language and standard C library are notoriously inadequate and
467   unsafe. Strings are arrays of characters, usually referenced through
468   pointers. There is no native string datatype. Buffers are fixed size,
469   and C provides no runtime bounds checking, thus allowing overwriting
470   of other data or even program code. With the popularization of the
471   Internet, the "buffer exploit" has become a preferred method for
472   hackers to hijack privileged programs; long data strings are fed to a
473   program in hopes that it uses unsafe C library calls such as strcpy()
474   or sprintf() to copy strings into automatic arrays, thus overwriting
475   the call stack, and therefore the routine's return address. When such
476   a hole is discovered, a "string" can be constructed that contains
477   machine code to hijack the program's privileges and penetrate the
478   system.
479   
480   This problem is partially addressed by the strn...() routines, which
481   should always be used in preference to their str...() equivalents
482   (except when the copy operation has already been prechecked, or there
483   is a good reason for not using them, e.g. the sometimes undesirable
484   side effect of strncpy() zeroing the remainder of the buffer). The
485   most gaping whole, however, is sprintf(), which performs no length
486   checking on its destination buffer, and is not easy to replace.
487   Although snprintf() routines are starting to appear, they are not yet
488   widespread, and certainly not universal, nor are they especially
489   portable, or even full-featured.
490   
491   For these reasons, we have started to build up our own little library
492   of C Library replacements, ckclib.[ch]. These are safe and highly
493   portable primitives for memory management and string manipulation,
494   such as:
495   
496   ckstrncpy()
497          Like strncpy but returns a useful value, doesn't zero buffer.
498         
499   ckitoa()
500          Opposite of atoi()
501         
502   ckltoa()
503          Opposite of atol()
504         
505   ckctoa()
506          Returns character as string
507         
508   ckmakmsg()
509          Used with ck?to?() as a safe sprintf() replacement for up to 4
510          items
511         
512   ckmakxmsg()
513          Like ckmakmsg() but accepts up to 12 items
514         
515   More about library functions in [32]Section 4.A.
516   
517   [ [33]Contents ] [ [34]C-Kermit ] [ [35]Kermit Home ]
518    ________________________________________________________________________
519 
520  3.2. The "char" vs "unsigned char" Dilemma
521 
522   This is one of the most aggravating and vexing characteristics of the
523   C language. By design, chars (and char *'s) are SIGNED. But in the
524   modern era, however, we need to process characters that can have (or
525   include) 8-bit values, as in the ISO Latin-1, IBM CP 850, or UTF-8
526   character sets, so this data must be treated as unsigned. But some C
527   compilers (such as those based on the Bell UNIX V7 compiler) do not
528   support "unsigned char" as a data type. Therefore we have the macro or
529   typedef CHAR, which we use when we need chars to be unsigned, but
530   which, unfortunately, resolves itself to "char" on those compilers
531   that don't support "unsigned char". AND SO... We have to do a lot of
532   fiddling at runtime to avoid sign extension and so forth.
533   
534   Some modern compilers (e.g. IBM, DEC, Microsoft) have options that say
535   "make all chars be unsigned" (e.g. GCC "-funsigned-char") and we use
536   them when they are available. Other compilers don't have this option,
537   and at the same time, are becoming increasingly strict about type
538   mismatches, and spew out torrents of warnings when we use a CHAR where
539   a char is expected, or vice versa. We fix these one by one using
540   casts, and the code becomes increasingly ugly. But there remains a
541   serious problem, namely that certain library and kernel functions have
542   arguments that are declared as signed chars (or pointers to them),
543   whereas our character data is unsigned. Fine, we can can use casts
544   here too -- but who knows what happens inside these routines.
545   
546   [ [36]Contents ] [ [37]C-Kermit ] [ [38]Kermit Home ]
547    ________________________________________________________________________
548 
549  4. MODULES
550 
551   When C-Kermit is on the far end of a connection, it is said to be in
552   remote mode. When C-Kermit has made a connection to another computer,
553   it is in local mode. (If C-Kermit is "in the middle" of a multihop
554   connection, it is still in local mode.)
555   
556   On another axis, C-Kermit can be in any of several major states:
557   
558   Command State
559          Reading and writing from the job's controlling terminal or
560          "console". In this mode, all i/o is handled by the Group E
561          conxxx() (console i/o) routines.
562         
563   Protocol State
564          Reading and writing from the communicatons device. In this
565          mode, all i/o is handled by the Group E ttxxx() (terminal i/o)
566          routines.
567         
568   Terminal State
569          Reading from the keyboard with conxxx() routines and writing to
570          the communications device with ttxxx() routines AND vice-versa.
571         
572   When in local mode, the console and communications device are
573   distinct. During file transfer, Kermit may put up a file-transfer
574   display on the console and sample the console for interruption
575   signals.
576   
577   When in remote mode, the console and communications device are the
578   same, and therefore there can be no file-transfer display on the
579   console or interruptions from it (except for "in-band" interruptions
580   such as ^C^C^C).
581   
582   [ [39]Contents ] [ [40]C-Kermit ] [ [41]Kermit Home ]
583    ________________________________________________________________________
584 
585  4.A. Group A: Library Functions
586 
587   Library functions, strictly portable, can be used by all modules on
588   all platforms: [42]ckclib.h, [43]ckclib.c.
589   
590   (To be filled in... For now, see [44]Section 3.1 and the comments in
591   ckclib.c.)
592   
593   [ [45]Contents ] [ [46]C-Kermit ] [ [47]Kermit Home ]
594    ________________________________________________________________________
595 
596  4.B. Group B: Kermit File Transfer
597 
598   The Kermit protocol kernel. These files, whose names start with "ckc
599   are supposed to be totally portable C, and are expected to compile
600   correctly on any platform with any C compiler. "Portable" does not
601   mean the same as as "ANSI" -- these modules must compile on 10- and
602   20-year old computers, with C preprocessors, compilers, and/or linkers
603   that have all sorts of restrictions. The Group B modules do not
604   include any header files other than those that come with Kermit
605   itself. They do not contain any library calls except from the standard
606   C library (e.g. printf()). They most certainly do not contain any
607   system calls. Files:
608   
609   [48]ckcsym.h
610          For use by C compilers that don't allow -D on the command line.
611         
612   [49]ckcasc.h
613          ASCII character symbol definitions.
614         
615   [50]ckcsig.h
616          System-independent signal-handling definitions and prototypes.
617         
618   [51]ckcdeb.h
619          Originally, debugging definitions. Now this file also contains
620          all definitions and prototypes that are shared by all modules
621          in all groups.
622         
623   [52]ckcker.h
624          Kermit protocol symbol definitions.
625         
626   [53]ckcxla.h
627          Character-set-related symbol definitions (see next section).
628         
629   [54]ckcmai.c
630          The main program. This module contains the declarations of all
631          the protocol-related global variables that are shared among the
632          other modules.
633         
634   [55]ckcpro.w
635          The protocol module itself, written in "wart", a lex-like
636          preprocessor that is distributed with Kermit under the name
637          CKWART.C.
638         
639   [56]ckcfns.c, [57]ckcfn2.c, [58]ckcfn3.c
640          The protocol support functions used by the protocol module.
641         
642   [59]Group B modules may call upon functions from [60]Group E, but not
643   from [61]Group D modules (with the single exception that the main
644   program invokes the user interface, which is in Group D). (This last
645   assertion is really only a conjecture.)
646   
647   [ [62]Contents ] [ [63]C-Kermit ] [ [64]Kermit Home ]
648    ________________________________________________________________________
649 
650  4.C. Group C: Character-Set Conversion
651 
652   Character set translation tables and functions. Used by the [65]Group
653   B, protocol modules, but may be specific to different computers. (So
654   far, all character character sets supported by C-Kermit are supported
655   in [66]ckuxla.c and [67]ckuxla.h, including Macintosh and IBM
656   character sets). These modules should be completely portable, and not
657   rely on any kind of system or library services.
658   
659   [68]ckcxla.h
660          Character-set definitions usable by all versions of C-Kermit.
661         
662   ck?xla.h
663          Character-set definitions for computer "?", e.g. [69]ckuxla.h
664          for UNIX, [70]ckmxla.h for Macintosh.
665         
666   [71]ck?xla
667          Character-set translation tables and functions for computer
668          "?", For example, CKUXLA.C for UNIX, CKMXLA.C for Macintosh. So
669          far, these are the only two such modules. The UNIX module is
670          used for all versions of C-Kermit except the Macintosh version.
671         
672   [72]ckcuni.h
673          Unicode definitions
674         
675   [73]ckcuni.c
676          Unicode module
677         
678   Here's how to add a new file character set in the original
679   (non-Unicode modules). Assuming it is based on the Roman (Latin)
680   alphabet. Let's call it "Barbarian". First, in ck?xla.h, add a
681   definition for FC_BARBA (8 chars maximum length) and increase
682   MAXFCSETS by 1. Then, in ck?xla.c:
683   
684     * Add a barbarian entry into the fcsinfo array.
685     * Add a "barbarian" entry to file character set keyword table,
686       fcstab.
687     * Add a "barbarian" entry to terminal character set keyword table,
688       ttcstab.
689     * Add a translation table from Latin-1 to barbarian: yl1ba[].
690     * Add a translation table from barbarian to Latin-1: ybal1[].
691     * Add a translation function from Barbarian to ASCII: xbaas().
692     * Add a translation function from Barbarian to Latin-1: xbal1().
693     * Add a translation function from Latin-1 to Barbarian: xl1ba().
694     * etc etc for each transfer character set...
695     * Add translation function pointers to the xls and xlr tables.
696       
697   Other translations involving Barbarian (e.g. from Barbarian to
698   Latin-Cyrillic) are performed through these tables and functions. See
699   ckuxla.h and ckuxla.c for extensive examples.
700   
701   To add a new Transfer Character Set, e.g. Latin Alphabet 9 (for the
702   Euro symbol), again in the "old" character-set modules:
703   
704   In ckcxla.h:
705         
706          + Add a TC_xxxx definition and increase MAXTCSETS accordingly.
707           
708   In ck?xla.h (since any transfer charset is also a file charset):
709         
710          + Add an FC_xxxx definition and increase MAXFCSETS accordingly.
711           
712   In ck?xla.c:
713         
714          + Add a tcsinfo[] entry.
715          + Make a tcstab[] keyword table entry.
716          + Make an fcsinfo[] table entry.
717          + Make an fcstab[] keyword table entry.
718          + Make a tcstab[] keyword table entry.
719          + If necessary, make a langinfo[] table entry.
720          + Make entries in the function pointer arrays.
721          + Provide any needed functions.
722           
723   As of C-Kermit 7.0, character sets are also handled in parallel by the
724   new (and very large) Unicode module, ckcuni.[ch]. Eventually we should
725   phase out the old way, described just above, and operate entirely in
726   (and through) Unicode. The advantages are many. The disadvantages are
727   size and performance. To add a character to the Unicode modules:
728   
729   In ckcuni.h:
730         
731          + (To be filled in...)
732           
733   In ckcuni.c:
734         
735          + (To be filled in...)
736           
737   [ [74]Contents ] [ [75]C-Kermit ] [ [76]Kermit Home ]
738    ________________________________________________________________________
739 
740  4.D. Group D: User Interface
741 
742   This is the code that communicates with the user, gets her commands,
743   informs her of the results. It may be command-line oriented,
744   interactive prompting dialog, menus and arrow keys, windows and mice,
745   speech recognition, telepathy, etc. The one provided is command-and
746   prompt, with the ability to read commands from various sources: the
747   console keyboard, a file, or a macro definition. The user interface
748   has three major functions:
749   
750    1. Sets the parameters for the file transfer and then starts it. This
751       is done by setting certain (many) global variables, such as the
752       protocol machine start state, the file specification, file type,
753       communication parameters, packet length, window size, character
754       set, etc.
755    2. Displays messages on the user's screen during the file transfer,
756       using the screen() function, which is called by the group-1
757       modules.
758    3. Executes any commands directly that do not require Kermit
759       protocol, such as the CONNECT command, local file management
760       commands, parameter-setting commands, FTP client commands, etc.
761       
762   If you plan to imbed the [77]Group B, files into a program with a
763   different user interface, your interface must supply an appropriate
764   screen() function, plus a couple related ones like chkint() and
765   intmsg() for handling keyboard (or mouse, etc) interruptions during
766   file transfer. The best way to find out about this is to link all the
767   C-Kermit modules together except the ckuu*.o and ckucon.o modules, and
768   see which missing symbols turn up.
769   
770   C-Kermit's character-oriented user interface (as opposed to the
771   Macintosh version's graphical user interface) consists of the
772   following modules. C-Kermit can be built with an interactive command
773   parser, a command-line-option-only parser, a graphical user interface,
774   or any combination, and it can even be built with no user interface at
775   all (in which case it runs as a remote-mode Kermit server).
776   
777   [78]ckucmd.h
778         
779   [79]ckucmd.c
780          The command parsing primitives used by the interactive command
781          parser to parse keywords, numbers, filenames, etc, and to give
782          help, complete fields, supply defaults, allow abbreviations and
783          editing, etc. This package is totally independent of Kermit,
784          but does depend on the [80]Group E functions.
785         
786   [81]ckuusr.h
787          Definitions of symbols used in Kermit's commands.
788         
789   ckuus*.c
790          Kermit's interactive command parser, including the script
791          programming language: [82]ckuusr.c (includes top-level keyword
792          tables); [83]ckuus2.c (HELP command text); [84]ckuus3.c (most
793          of the SET command); [85]ckuus4.c (includes variables and
794          functions); ckuus[567].c (miscellaneous);
795         
796   [86]ckuusy.c
797          The command-line-option parser.
798         
799   [87]ckuusx.c
800          User interface functions common to both the interactive and
801          command-line parsers.
802         
803   [88]ckuver.h
804          Version heralds for different implementations.
805         
806   [89]ckuscr.c
807          The (old, uucp-like) SCRIPT command
808         
809   [90]ckudia.c
810          The DIAL command. Includes specific knowledge of many types of
811          modems.
812         
813   Note that none of the above files is actually Unix-specific. Over time
814   they have proven to be portable among all platforms where C-Kermit is
815   built: Unix, VMS, AOS/VS, Amiga, OS-9, VOS, etc etc. Thus the third
816   letter should more properly be "c", but changing it would be too
817   confusing.
818   
819   ck?con.c, ckucns.c
820          The CONNECT command. Terminal connection, and in some cases
821          (Macintosh, Windows) also terminal emulation. NOTE: As of
822          C-Kermit 7.0, there are two different CONNECT modules for UNIX:
823          [91]ckucon.c -- the traditional, portable, fork()-based version
824          -- and [92]ckucns.c, a new version that uses select() rather
825          than forks so it can handle encryption. ckucns.c is the
826          preferred version for Unix; ckucon.c is not likely to keep pace
827          with it in terms of upgrades, etc. However, since select() is
828          not portable to every platform, ckucon.c will be kept
829          indefinitely for those platforms that can't use ckucns.c. NOTE:
830          SunLink X.25 support is available only in ckucon.c.
831         
832   ck_*.*, ckuat*.*
833          Modules having to do with authentication and encryption. Since
834          the relaxation of USA export laws, they are included with the
835          general source-code distribution. Secure C-Kermit binaries can
836          be built using special targets in the standard makefile.
837          However, secure prebuilt binaries may not be distributed.
838         
839   For other implementations, the files may, and probably do, have
840   different names. For example, the Macintosh graphical user interface
841   filenames start with "ckm". Kermit 95 uses the ckucmd and ckuus*
842   modules, but has its own CONNECT command modules. And so on.
843   
844   Here is a brief description of C-Kermit's "user interface interface",
845   from ckuusr.c. It is nowhere near complete; in particular, hundreds of
846   global variables are shared among the many modules. These should, some
847   day, be collected into classes or structures that can be passed around
848   as needed; not only for purity's sake, but also to allow for multiple
849   simultaneous communication sessions and or user interfaces. Our list
850   of things to do is endless, and reorganizing the source is almost
851   always at the bottom.
852   
853   The ckuus*.c modules (like many of the ckc*.c modules) depend on the
854   existence of C library features like fopen, fgets, feof, (f)printf,
855   argv/argc, etc. Other functions that are likely to vary among
856   operating systems -- like setting terminal modes or interrupts -- are
857   invoked via calls to functions that are defined in the [93]Group E
858   platform-dependent modules, ck?[ft]io.c. The command line parser
859   processes any arguments found on the command line, as passed to main()
860   via argv/argc. The interactive parser uses the facilities of the cmd
861   package (developed for this program, but, in theory, usable by any
862   program). Any command parser may be substituted for this one. The only
863   requirements for the Kermit command parser are these:
864   
865    1. Set parameters via global variables like duplex, speed, ttname,
866       etc. See [94]ckcmai.c for the declarations and descriptions of
867       these variables.
868    2. If a command can be executed without the use of Kermit protocol,
869       then execute the command directly and set the sstate (start state)
870       variable to 0. Examples include SET commands, local directory
871       listings, the CONNECT command.
872    3. If a command requires the Kermit protocol, set the following
873       variables:
874
875 sstate                             string data
876   'x' (enter server mode)            (none)
877   'r' (send a 'get' command)         cmarg, cmarg2
878   'v' (enter receive mode)           cmarg2
879   'g' (send a generic command)       cmarg
880   's' (send files)                   nfils, cmarg & cmarg2 OR cmlist
881   'c' (send a remote host command)   cmarg
882
883       cmlist is an array of pointers to strings.
884       cmarg, cmarg2 are pointers to strings.
885       nfils is an integer (hmmm, probably should be an unsigned long).
886       
887        cmarg can be:
888                A filename string (possibly wild), or:
889                a pointer to a prefabricated generic command string, or:
890                a pointer to a host command string.
891               
892        cmarg2 is:
893                The name to send a single file under, or:
894                the name under which to store an incoming file; must not
895                be wild.
896                If it's the name for receiving, a null value means to
897                store the file under the name it arrives with.
898               
899        cmlist is:
900                A list of nonwild filenames, such as passed via argv.
901               
902        nfils is an integer, interpreted as follows:
903                -1: filespec (possibly wild) in cmarg, must be expanded
904                internally.
905                0: send from stdin (standard input).
906                >0: number of files to send, from cmlist.
907               
908   The screen() function is used to update the screen during file
909   transfer. The tlog() function writes to a transaction log (if TLOG is
910   defined). The debug() function writes to a debugging log (if DEBUG is
911   defined). The intmsg() and chkint() functions provide the user i/o for
912   interrupting file transfers.
913   
914   [ [95]Contents ] [ [96]C-Kermit ] [ [97]Kermit Home ]
915    ________________________________________________________________________
916 
917  4.E. Group E: Platform-Dependent I/O
918 
919   Platform-dependent function definitions. All the Kermit modules,
920   including the command package, call upon these functions, which are
921   designed to provide system-independent primitives for controlling and
922   manipulating devices and files. For Unix, these functions are defined
923   in the files [98]ckufio.c (files), [99]ckutio.c (communications), and
924   [100]ckusig.c (signal handling).
925   
926   For VMS, the files are [101]ckvfio.c, ckvtio.c, and [102]ckusig.c (VMS
927   can use the same signal handling routines as Unix). It doesn't really
928   matter what the files are called, except for Kermit distribution
929   purposes (grouping related files together alphabetically), only that
930   each function is provided with the name indicated, observes the same
931   calling and return conventions, and has the same type.
932   
933   The Group E modules contain both functions and global variables that
934   are accessed by modules in the other groups. These are now described.
935   
936   (By the way, I got this list by linking all the C-Kermit modules
937   together except ckutio and ckufio. These are the symbols that ld
938   reported as undefined. But that was a long time ago, probably circa
939   Version 6.)
940   
941  4.E.1. Global Variables
942 
943   char *DELCMD;
944          Pointer to string containing command for deleting files.
945          Example: char *DELCMD = "rm -f "; (UNIX)
946          Example: char *DELCMD = "delete "; (VMS)
947          Note trailing space. Filename is concatenated to end of this
948          string. NOTE: DELCMD is used only in versions that do not
949          provide their own built-in DELETE command.
950         
951   char *DIRCMD;
952          Pointer to string containing command for listing files when a
953          filespec is given.
954          Example: char *DIRCMD = "/bin/ls -l "; (UNIX)
955          Example: char *DIRCMD = "directory "; (VMS)
956          Note trailing space. Filename is concatenated to end of this
957          string. NOTE: DIRCMD is used only in versions that do not
958          provide their own built-in DIRECTORY command.
959         
960   char *DIRCM2;
961          Pointer to string containing command for listing files when a
962          filespec is not given. (currently not used, handled in another
963          way.)
964          Example: char *DIRCMD2 = "/bin/ls -ld *";
965          NOTE: DIRCMD2 is used only in versions that do not provide
966          their own built-in DIRECTORY command.
967         
968   char *PWDCMD;
969          Pointer to string containing command to display current
970          directory.
971          Example: char *PWDCMD = "pwd ";
972          NOTE: PWDCMD is used only in versions that do not provide their
973          own built-in PWD command.
974         
975   char *SPACMD;
976          Pointer to command to display free disk space in current
977          device/directory.
978          Example: char *SPACMD = "df .";
979          NOTE: SPACMD is used only in versions that do not provide their
980          own built-in SPACE command.
981         
982   char *SPACM2;
983          Pointer to command to display free disk space in another
984          device/directory.
985          Example: char *SPACM2 = "df ";
986          Note trailing space. Device or directory name is added to this
987          string. NOTE: SPACMD2 is used only in versions that do not
988          provide their own built-in SPACE command.
989         
990   char *TYPCMD;
991          Pointer to command for displaying the contents of a file.
992          Example: char *TYPCMD = "cat ";
993          Note trailing space. Device or directory name is added to this
994          string. NOTE: TYPCMD is used only in versions that do not
995          provide their own built-in TYPE command.
996         
997   char *WHOCMD;
998          Pointer to command for displaying logged-in users.
999          Example: char *WHOCMD = "who ";
1000          Note trailing space. Specific user name may be added to this
1001          string.
1002         
1003   int backgrd = 0;
1004          Flag for whether program is running in foreground (0) or
1005          background (nonzero). Background operation implies that screen
1006          output should not be done and that all errors should be fatal.
1007         
1008   int ckxech;
1009          Flag for who is to echo console typein:
1010          1: The program (system is not echoing).
1011          0: The OS, front end, terminal, etc (not this program).
1012         
1013   char *ckxsys;
1014          Pointer to string that names the computer and operating system.
1015          Example: char *ckxsys = " NeXT Mach 1.0";
1016          Tells what computer system ckxv applies to. In UNIX Kermit,
1017          this variable is also used to print the program herald, and in
1018          the SHOW VERSION command.
1019         
1020   char *ckxv;
1021          Pointer to version/edit info of ck?tio.c module.
1022          Example: char *ckxv = "UNIX Communications Support, 6.0.169, 6
1023          Sep 96";
1024          Used by SHOW VERSION command.
1025         
1026   char *ckzsys;
1027          Like ckxsys, but briefer.
1028          Example: char *ckzsys = " 4.3 BSD";
1029          Tells what platform ckzv applies to. Used by the SHOW VERSION
1030          command.
1031         
1032   char *ckzv;
1033          Pointer to version/edit info of ck?fio.c module.
1034          Example: char *ckzv = "UNIX File support, 6.0.113, 6 Sep 96";
1035          Used by SHOW VERSION command.
1036         
1037   int dfflow;
1038          Default flow control. 0 = none, 1 = Xon/Xoff, ... (see FLO_xxx
1039          symbols in ckcdeb.h)
1040          Set by Group E module. Used by [103]ckcmai.c to initialize flow
1041          control variable.
1042         
1043   int dfloc;
1044          Default location. 0 = remote, 1 = local. Set by Group E module.
1045          Used by ckcmai.c to initialize local variable. Used in various
1046          places in the user interface.
1047         
1048   int dfprty;
1049          Default parity. 0 = none, 'e' = even, 'o' = odd, 'm' = mark,
1050          's' = space. Set by Group E module. Used by ckcmai.c to
1051          initialize parity variable.
1052         
1053   char *dftty;
1054          Default communication device. Set by Group E module. Used in
1055          many places. This variable should be initialized the the symbol
1056          CTTNAM, which is defined in ckcdeb.h, e.g. as "/dev/tty" for
1057          UNIX, "TT:" for VMS, etc. Example: char *dftty = CTTNAM;
1058         
1059   char *mtchs[];
1060          Array of string pointers to filenames that matched the most
1061          recent wildcard match, i.e. the most recent call to zxpand().
1062          Used (at least) by command parsing package for partial filename
1063          completion.
1064         
1065   int tilde_expand;
1066          Flag for whether to attempt to expand leading tildes in
1067          directory names (used in UNIX only, and then only when the
1068          symbol DTILDE is defined.
1069         
1070   int ttnproto;
1071          The protocol being used to communicate over a network device.
1072          Values are defined in ckcnet.h. Example: NP_TELNET is network
1073          protocol "telnet".
1074         
1075   int maxnam;
1076          The maximum length for a filename, exclusive of any device or
1077          directory information, in the format of the host operating
1078          system.
1079         
1080   int maxpath;
1081          The maximum length for a fully specified filename, including
1082          device designator, directory name, network node name, etc, in
1083          the format of the host operating system, and including all
1084          punctuation.
1085         
1086   int ttyfd;
1087          File descriptor of the communication device. -1 if there is no
1088          open or usable connection, including when C-Kermit is in remote
1089          mode. Since this is not implemented everywhere, references to
1090          it are in #ifdef CK_TTYFD..#endif.
1091         
1092   [ [104]Contents ] [ [105]C-Kermit ] [ [106]Kermit Home ]
1093    ________________________________________________________________________
1094 
1095  4.E.2. Functions
1096 
1097   These are divided into three categories: file-related functions (B.1),
1098   communication functions (B.2), and miscellaneous functions (B.3).
1099   
1100    4.E.2.1. File-Related Functions
1101   
1102   In most implementations, these are collected together into a module
1103   called ck?fio.c, where ? = "u" ([107]ckutio.c for Unix), "v"
1104   ([108]ckvtio.c for VMS), [109]etc. To be totally platform-independent,
1105   C-Kermit maintains its own file numbers, and provides the functions
1106   described in this section to deal with the files associated with them.
1107   The file numbers are referred to symbolically, and are defined as
1108   follows in ckcker.h:
1109   
1110  #define ZCTERM      0           /* Console terminal */
1111  #define ZSTDIO      1           /* Standard input/output */
1112  #define ZIFILE      2           /* Current input file for SEND command */
1113  #define ZOFILE      3           /* Current output file for RECEIVE command */
1114  #define ZDFILE      4           /* Current debugging log file */
1115  #define ZTFILE      5           /* Current transaction log file */
1116  #define ZPFILE      6           /* Current packet log file */
1117  #define ZSFILE      7           /* Current session log file */
1118  #define ZSYSFN      8           /* Input from a system function (pipe) */
1119  #define ZRFILE      9           /* Local file for READ command */  (NEW)
1120  #define ZWFILE     10           /* Local file for WRITE command */ (NEW)
1121  #define ZMFILE     11           /* Auxilliary file for internal use */ (NEW)
1122  #define ZNFILS     12           /* How many defined file numbers */
1123
1124   In the descriptions below, fn refers to a filename, and n refers to
1125   one of these file numbers. Functions are of type int unless otherwise
1126   noted, and are listed mostly alphabetically.
1127   
1128   int
1129          chkfn(n) int n;
1130          Checks the file number n. Returns:
1131           -1: File number n is out of range
1132            0: n is in range, but file is not open
1133            1: n in range and file is open
1134         
1135   int
1136          iswild(filspec) char *filespec;
1137          Checks if the file specification is "wild", i.e. contains
1138          metacharacters or other notations intended to match multiple
1139          filenames. Returns:
1140            0: not wild
1141            1: wild.
1142         
1143   int
1144          isdir(string) char *string;
1145          Checks if the string is the name of an existing directory. The
1146          idea is to check whether the string can be "cd'd" to, so in
1147          some cases (e.g. DOS) it might also indicate any file
1148          structured device, such as a disk drive (like A:). Other
1149          nonzero returns indicate system-dependent information; e.g. in
1150          VMS isdir("[.FOO]") returns 1 but isdir("FOO.DIR;1") returns 2
1151          to indicate the directory-file name is in a format that needs
1152          conversion before it can be combined with a filename. Returns:
1153            0: not a directory (including any kind of error)
1154            1: it is an existing directory
1155         
1156   char *
1157          zfcdat(name) char *name;
1158          Returns modification (preferably, otherwise creation) date/time
1159          of file whose name is given in the argument string. Return
1160          value is a pointer to a string of the form yyyymmdd hh:mm:ss,
1161          for example 19931231 23:59:59, which represents the local time
1162          (no timezone or daylight savings time finagling required).
1163          Returns the null string ("") on failure. The text pointed to by
1164          the string pointer might be in a static buffer, and so should
1165          be copied to a safe place by the caller before any subsequent
1166          calls to this function.
1167         
1168   struct zfnfp *
1169          zfnqfp(fn, buflen, buf) char * fn; int buflen; char * buf;
1170          Given the filename fn, the corresponding fully qualified,
1171          absolute filename is placed into the buffer buf, whose length
1172          is buflen. On failure returns a NULL pointer. On success
1173          returns a pointer to a struct zfnfp containing pointers to the
1174          full pathname and to just the filename, and an int giving the
1175          length of the full pathname. All references to this function in
1176          mainline code must be protected by #ifdef ZFNQFP..#endif,
1177          because it is not present in all of the ck*fio.c modules. So if
1178          you implement this function in a version that did not have it
1179          before, be sure to add #define ZFNQFP in the appropriate spot
1180          in ckcdeb.h or in the build-procedure CFLAGS.
1181         
1182   int
1183          zcmpfn(s1,s2) char * s2, * s2;
1184          Compares two filenames to see if they refer to the same.
1185          Internally, the arguments can be converted to fully qualified
1186          pathnames, e.g. with zfnqfp(), realpath(), or somesuch. In Unix
1187          or other systems where symbolic links exist, the link should be
1188          resolved before making the comparison or looking at the inodes.
1189          Returns:
1190            0: Files are not identical.
1191            1: Files are identical.
1192         
1193   int
1194          zfseek(pos) long pos;
1195          Positions the input pointer on the current input file to the
1196          given position. The pos argument is 0-based, the offset
1197          (distance in bytes) from beginning of the file. Needed for
1198          RESEND, PSEND, and other recovery operations. This function is
1199          not necessarily possible on all systems, e.g. record-oriented
1200          systems. It should only be used on binary files (i.e. files we
1201          are sending in binary mode) and stream-oriented file systems.
1202          Returns:
1203           -1: on failure.
1204            0: On success.
1205         
1206   int
1207          zchdir(dirnam) char *dirnam;
1208          Changes current or default directory to the one given in
1209          dirnam. Returns:
1210            0: On failure.
1211            1: on success.
1212         
1213   long
1214          zchki(fn) char *fn;
1215          Check to see if file with name fn is a regular, readable,
1216          existing file, suitable for Kermit to send -- not a directory,
1217          not a symbolic link, etc. Returns:
1218           -3: if file exists but is not accessible (e.g.
1219          read-protected);
1220           -2: if file exists but is not of a readable type (e.g. a
1221          directory);
1222           -1: on error (e.g. file does not exist, or fn is garbage);
1223          >=0: (length of file) if file exists and is readable.
1224          Also see isdir(), zgetfs().
1225         
1226   int
1227          zchkpid(pid) unsigned long pid;
1228          Returns:
1229            1: If the given process ID (e.g. pid in UNIX) is valid and
1230          active
1231            0: otherwise.
1232         
1233   long
1234          zgetfs(fn) char *fn;
1235          Gets the size of the given file, regardless of accessibility.
1236          Used for directory listings. Unlike zchki(), should return the
1237          size of any kind of file, even a directory. zgetfs() also
1238          should serve as a mini "get file info" function that can be
1239          used until we design a better one, by also setting some global
1240          variables:
1241            int zgfs_link   = 1/0 = file is (not) a symbolic link.
1242            int zgfs_dir    = 1/0 = file is (not) a directory.
1243            char linkname[] = if zgfs_link != 0, name of file link points
1244          to.
1245          Returns:
1246           -1: on error (e.g. file does not exist, or fn is garbage);
1247          >=0: (length of file) if file exists and is readable.
1248         
1249   int
1250          zchko(fn) char *fn;
1251          Checks to see if a file of the given name can be created.
1252          Returns:
1253           -1: if file cannot be created, or on any kind of error.
1254            0: if file can be created.
1255         
1256   int
1257          zchkspa(fn,len) char *f; long len;
1258          Checks to see if there is sufficient space to store the file
1259          named fn, which is len bytes long. If you can't write a
1260          function to do this, then just make a dummy that always returns
1261          1; higher level code will recover from disk-full errors. The
1262          receiving Kermit uses this function to refuse an incoming file
1263          based on its size, via the attribute mechanism. Returns:
1264           -1: on error.
1265            0: if there is not enough space.
1266            1: if there is enough space.
1267         
1268   int
1269          zchin(n,c) int n; int *c;
1270          Gets a character from file number n, return it in c (call with
1271          &c). Returns:
1272           -1: on failure, including EOF.
1273            0: on success with character in c.
1274         
1275   int
1276          zchout(n,c) int n; char c;
1277          Writes the character c to file number n. Returns:
1278           -1: on error.
1279            0: on success.
1280         
1281   int
1282          zclose(n) int n;
1283          Closes file number n. Returns:
1284           -1: on error.
1285            1: on success.
1286         
1287   int
1288          zdelet(fn) char *name;
1289          Attempts to delete (remove, erase) the named file. Returns:
1290           -1: on error.
1291            1: if file was deleted successfully.
1292         
1293   char *
1294          zgperm(char * f)
1295          Returns a pointer to the system-dependent numeric
1296          permissions/protection string for file f, or NULL upon failure.
1297          Used if CK_PERMS is defined.
1298         
1299   char *
1300          ziperm(char * f)
1301          Returns a pointer to the system-dependent symbolic
1302          permissions/protection string for file f, or NULL upon failure.
1303          Used if CK_PERMS is defined. Example: In UNIX zgperm(f) might
1304          return "100770", but ziperm() might return "-rwxrwx---". In
1305          VMS, zgperm() would return a hexadecimal string, but ziperm()
1306          would return something like "(RWED,RWED,RE,)".
1307         
1308   char *
1309          zgtdir()
1310          Returns a pointer to the name of the current directory, folder,
1311          etc, or a NULL pointer if the current directory cannot be
1312          determined. If possible, the directory specification should be
1313          (a) fully specified, e.g. as a complete pathname, and (b) be
1314          suitable for appending a filename. Thus, for example, Unix
1315          directory names should end with '/'. VMS directory names should
1316          look like DEV:[NAME] (rather than, say, NAME.DIR;1).
1317         
1318   char *
1319          zhome()
1320          Returns a pointer to a string containing the user's home
1321          directory, or NULL upon error. Should be formatted like
1322          zgtdir() (q.v.).
1323         
1324   int
1325          zinfill()
1326          Fill buffer from input file. This function is used by the macro
1327          zminchar(), which is defined in ckcker.h. zminchar() manages
1328          its own buffer, and calls zinfill() to fill it whenever it
1329          becomes empty. It is used only for sending files, and reads
1330          characters only from file number ZIFILE. zinfill() returns -1
1331          upon end of file, -2 upon fatal error, and -3 upon timeout
1332          (e.g. when reading from a pipe); otherwise it returns the first
1333          character from the buffer it just read.
1334         
1335   int
1336          zkself()
1337          Kills the current job, session, process, etc, logs out,
1338          disappears. Used by the Kermit server when it receives a BYE
1339          command. On failure, returns -1. On success, does not return at
1340          all! This function should not be called until all other steps
1341          have been taken to close files, etc.
1342         
1343   VOID
1344          zstrip(fn,&fn2) char *fn1, **fn2;
1345          Strips device and directory, etc, from file specification fn,
1346          leaving only the filename (including "extension" or "filetype"
1347          -- the part after the dot). For example DUA0:[PROGRAMS]OOFA.C;3
1348          becomes OOFA.C, or /usr/fdc/oofa.c becomes oofa.c. Returns a
1349          pointer to result in fn2.
1350         
1351   int
1352          zsetperm(char * file, unsigned int code)
1353          Set permissions of file to given system-dependent code.   0: On
1354          failure.
1355            1: on success.
1356         
1357   int
1358          zsetroot(char * dir)
1359          Sets the root for the user's file access, like Unix chroot(),
1360          but does not require privilege. In Unix, this must be
1361          implemented entirely by Kermit's own file access routines.
1362          Returns:
1363            1: Success
1364           -1: Invalid argument
1365           -2:
1366           -3: Internal error
1367           -4: Access to given directory denied
1368           -5: New root not within old root
1369         
1370   int
1371          zinroot(char * file)
1372          If no root is set (zsetroot()), returns 1.
1373          Otherwise, if given file is in the root, returns 1.
1374          Otherwise, returns 0.
1375         
1376   VOID
1377          zltor(fn,fn2) char *fn1, *fn2;
1378          Local-To-Remote filename translation. OBSOLETE: replaced by
1379          nzltor() (q.v.). Translates the local filename fn into a format
1380          suitable for transmission to an arbitrary type of computer, and
1381          copies the result into the buffer pointed to by fn2.
1382          Translation may involve (a) stripping the device and/or
1383          directory/path name, (b) converting lowercase to uppercase, (c)
1384          removing spaces and strange characters, or converting them to
1385          some innocuous alphabetic character like X, (d) discarding or
1386          converting extra periods (there should not be more than one).
1387          Does its best. Returns no value. name2 is a pointer to a
1388          buffer, furnished by the caller, into which zltor() writes the
1389          resulting name. No length checking is done.
1390         
1391   #ifdef NZLTOR
1392          VOID
1393          nzltor(fn,fn2,convert,pathnames,max) char *fn1,*fn2; int
1394          convert,pathnames,max;
1395          Replaces zltor(). This new version handles pathnames and checks
1396          length. fn1 and fn2 are as in zltor(). This version is called
1397          unconditionally for each file, rather than only when filename
1398          conversion is enabled. Pathnames can have the following values:
1399         
1400            PATH_OFF: Pathname, if any, is to be stripped
1401            PATH_REL: The relative pathname is to be included
1402            PATH_ABS: The full pathname is to be included
1403         
1404          After handling pathnames, conversion is done to the result as
1405          in the zltor() description if convert != 0; if relative or
1406          absolute pathnames are included, they are converted to UNIX
1407          format, i.e. with slash (/) as the directory separator. The max
1408          parameter specifies the maximum size of fn2. If convert > 0,
1409          the regular conversions are done; if convert < 0, minimal
1410          conversions are done (we skip uppercasing the letters, we allow
1411          more than one period, etc; this can be used when we know our
1412          partner is UNIX or similar).
1413         
1414   #endif /* NZLTOR */
1415         
1416   int
1417          nzxpand(fn,flags) char *fn; int flags;
1418          Replaces zxpand(), which is obsolete as of C-Kermit 7.0.
1419          Call with:
1420            fn = Pointer to filename or pattern.
1421            flags = option bits:
1422              flags & ZX_FILONLY  Match regular files
1423              flags & ZX_DIRONLY  Match directories
1424              flags & ZX_RECURSE  Descend through directory tree
1425              flags & ZX_MATCHDOT Match "dot files"
1426              flags & ZX_NOBACKUP Don't match "backup files"
1427              flags & ZX_NOLINKS  Don't follow symlinks.
1428         
1429          Returns the number of files that match fn, with data structures
1430          set up so the first file (if any) will be returned by the next
1431          znext() call. If ZX_FILONLY and ZX_DIRONLY are both set, or
1432          neither one is set, files and directories are matched. Notes:
1433         
1434         1. It is essential that the number returned by nzxpand() reflect
1435            the actual number of filenames that will be returned by
1436            znext() calls. In other words:
1437
1438  for (n = nzxpand(string,flags); n > 0; n--) {
1439      znext(buf);
1440      printf("%s\n", buf);
1441  }
1442            should print all the file names; no more, no less.
1443         2. In UNIX, DOS, OS-9, etc, where directories contain entries
1444            for themselves (.) and the superior directory (..), these
1445            should NOT be included in the list under any circumstances,
1446            including when ZX_MATCHDOT is set.
1447         3. Additional option bits might be added in the future, e.g. for
1448            sorting (sort by date/name/size, reverse/ascending, etc).
1449            Currently this is done only in higher level code (through a
1450            hack in which the nzxpand() exports its filename array, which
1451            is not portable because not all OS's can use this mechanism).
1452           
1453   int
1454          zmail(addr,fn) char *addr, fn;
1455          Send the local, existing file fn as e-mail to the address addr.
1456          Returns:
1457            0: on success
1458            2: if mail delivered but temp file can't be deleted
1459           -2: if mail can't be delivered
1460         
1461   int
1462          zmkdir(path) char *path;
1463          The path can be a file specification that might contain
1464          directory information, in which the filename is expected to be
1465          included, or an unambiguous directory specification (e.g. in
1466          UNIX it must end with "/"). This routine attempts to create any
1467          directories in the given path that don't already exist. Returns
1468          0 or greater success: no directories needed creation, or else
1469          all directories that needed creation were created successfully;
1470          the return code is the number of directories that were created.
1471          Returns -1 on failure to create any of the needed directories.
1472         
1473   int
1474          zrmdir(path) char *path;
1475          Attempts to remove the given directory. Returns 0 on success,
1476          -1 on failure. The detailed semantics are open -- should it
1477          fail if the directory contains any files or subdirectories,
1478          etc. It is probably best for this routine to behave in whatever
1479          manner is customary on the underlying platform; e.g. in UNIX,
1480          VMS, DOS, etc, where directories can not be removed unless they
1481          are empty.
1482         
1483   VOID
1484          znewn(fn,s) char *fn, **s;
1485          Transforms the name fn into a filename that is guaranteed to be
1486          unique. If the file fn does not exist, then the new name is the
1487          same as fn; Otherwise, it's different. this function does its
1488          best, returns no value. New name is created in caller's space.
1489          Call like this: znewn(old,&new);. The second parameter is a
1490          pointer to the new name. This pointer is set by znewn() to
1491          point to a static string in its own space, so be sure to the
1492          result to a safe place before calling this function again.
1493         
1494   int
1495          znext(fn) char *fn;
1496          Copies the next file name from a file list created by zxpand()
1497          into the string pointed to by fn (see zxpand). If no more
1498          files, then the null string is placed there. Returns 0 if there
1499          are no more filenames, with 0th element the array pointed to by
1500          fn set to NUL. If there is a filename, it is stored in the
1501          array pointed to by fn and a positive number is returned. NOTE:
1502          This is a change from earlier definitions of this function
1503          (pre-1999), which returned the number of files remaining; thus
1504          0 was the return value when returning the final file. However,
1505          no mainline code ever depended on the return value, so this
1506          change should be safe.
1507         
1508   int
1509          zopeni(n,fn) int n; char *fn;
1510          Opens the file named fn for input as file number n. Returns:
1511            0: on failure.
1512            1: on success.
1513         
1514   int
1515          zopeno(n,fn,zz,fcb) int n; char *name; struct zattr *zz; struct
1516          filinfo *fcb;
1517          Attempts to open the named file for output as file number n. zz
1518          is a Kermit file attribute structure as defined in ckcdeb.h,
1519          containing various information about the file, including its
1520          size, creation date, and so forth. This function should attempt
1521          to honor as many of these as possible. fcb is a "file control
1522          block" in the traditional sense, defined in ckcdeb.h,
1523          containing information relevant to complicated file systems
1524          like VMS (RMS), IBM MVS, etc, like blocksize, record length,
1525          organization, record format, carriage control, etc. Returns:
1526            0: on failure.
1527            1: on success.
1528         
1529   int
1530          zoutdump()
1531          Dumps a file output buffer. Used with the macro zmchout()
1532          defined in ckcker.h. Used only with file number ZOFILE, i.e.
1533          the file that is being received by Kermit during file transfer.
1534          Returns:
1535           -1: on failure.
1536            0: on success.
1537         
1538   int
1539          zprint(p,fn) char *p, *f;
1540          Prints the file with name fn on a local printer, with options
1541          p. Returns:
1542            0: on success
1543            3: if file sent to printer but can't be deleted
1544           -3: if file can't be printed
1545         
1546   int
1547          zrename(fn,fn2) char *fn, *fn2;
1548          Changes the name of file fn to fn2. If fn2 is the name of an
1549          existing directory, or a file-structured device, then file fn
1550          is moved to that directory or device, keeping its original
1551          name. If fn2 lacks a directory separator when passed to this
1552          function, an appropriate one is supplied. Returns:
1553           -1: on failure.
1554            0: on success.
1555         
1556   int
1557          zcopy(source,dest) char * source, * dest;
1558          Copies the source file to the destination. One file only. No
1559          wildcards. The destination string may be a filename or a
1560          directory name. Returns:
1561            0: on success.
1562           <0: on failure:
1563            -2: source file is not a regular file.
1564            -3: source file not found.
1565            -4: permission denied.
1566            -5: source and destination are the same file.
1567            -6: i/o error.
1568            -1: other error.
1569         
1570   char *
1571          zlocaltime(char *)
1572          Call with: "yyyymmdd hh:mm:ss" GMT/UTC date-time. Returns
1573          pointer to local date-time string "yyyymmdd hh:mm:ss" on
1574          success, NULL on failure.
1575         
1576   VOID
1577          zrtol(fn,fn2) char *fn, *fn2;
1578          Remote-To-Local filename translation. OBSOLETE: replaced by
1579          nzrtol(). Translates a "standard" filename to a local filename.
1580          For example, in Unix this function might convert an
1581          all-uppercase name to lowercase, but leave lower- or mix-case
1582          names alone. Does its best, returns no value. New name is in
1583          string pointed to by fn2. No length checking is done.
1584         
1585   #ifdef NZLTOR
1586         
1587   int
1588          nzrtol(fn,fn2,convert,pathnames,max) char *fn1,*fn2; int
1589          convert,pathnames,max;
1590          Replaces zrtol. Like zrtol but handles pathnames and checks
1591          length. See nzltor for detailed description of parameters.
1592         
1593   #endif /* NZLTOR */
1594         
1595   int
1596          zsattr(xx) struct zattr *xx;
1597          Fills in a Kermit file attribute structure for the file which
1598          is to be sent, namely the currently open ZIFILE. Note that this
1599          is not a very good design, but we're stuck with it. Callers
1600          must ensure that zsattr() is called only on real files, not on
1601          pipes, internally generated file-like objects such as server
1602          REMOTE command responses, etc. Returns:
1603           -1: on failure.
1604            0: on success with the structure filled in.
1605          If any string member is null, it should be ignored by the
1606          caller.
1607          If any numeric member is -1, it should be ignored by the
1608          caller.
1609         
1610   int
1611          zshcmd(s) char *s;
1612          s contains to pointer to a command to be executed by the host
1613          computer's shell, command parser, or operating system. If the
1614          system allows the user to choose from a variety of command
1615          processors (shells), then this function should employ the
1616          user's preferred shell. If possible, the user's job
1617          (environment, process, etc) should be set up to catch keyboard
1618          interruption signals to allow the user to halt the system
1619          command and return to Kermit. The command must run in ordinary,
1620          unprivileged user mode. If possible, this function should
1621          return -1 on failure to start the command, or else it should
1622          return 1 if the command succeeded and 0 if it failed.
1623         
1624   int
1625          pexitstatus
1626          zshcmd() and zsyscmd() should set this to the command's actual
1627          exit status code if possible.
1628         
1629   int
1630          zsyscmd(s) char *s;
1631          s contains to pointer to a command to be executed by the host
1632          computer's shell, command parser, or operating system. If the
1633          system allows the user to choose from a variety of command
1634          processors (shells), then this function should employ the
1635          system standard shell (e.g. /bin/sh for Unix), so that the
1636          results will always be the same for everybody. If possible, the
1637          user's job (environment, process, etc) should be set up to
1638          catch keyboard interruption signals to allow the user to halt
1639          the system command and return to Kermit. The command must run
1640          in ordinary, unprivileged user mode. If possible, this function
1641          should return -1 on failure to start the command, or else it
1642          should return 1 if the command succeeded and 0 if it failed.
1643         
1644   VOID
1645          z_exec(s,args) char * s; char * args[];
1646          This one executes the command s (which is searched for using
1647          the system's normal searching mechanism, such as PATH in UNIX),
1648          with the given argument vector, which follows the conventions
1649          of UNIX argv[]: the name of the command pointed to by element
1650          0, the first arg by element 1, and so on. A null args[] pointer
1651          indicates the end of the arugment list. All open files must
1652          remain open so the exec'd process can use them. Returns only if
1653          unsuccessful.
1654         
1655   int
1656          zsinl(n,s,x) int n, x; char *s;
1657          Reads a line from file number n. Writes the line into the
1658          address s provided by the caller. Writing terminates when
1659          newline is read, but with newline discarded. Writing also
1660          terminates upon EOF or if length x is exhausted. Returns:
1661           -1: on EOF or error.
1662            0: on success.
1663         
1664   int
1665          zsout(n,s) int n; char *s;
1666          Writes the string s out to file number n. Returns:
1667           -1: on failure.
1668            0: on success.
1669         
1670   int
1671          zsoutl(n,s) int n; char *s;
1672          Writes the string s out to file number n and adds a line
1673          (record) terminator (boundary) appropriate for the system and
1674          the file format. Returns:
1675           -1: on failure.
1676            0: on success.
1677         
1678   int
1679          zsoutx(n,s,x) int n, x; char *s;
1680          Writes exactly x characters from string s to file number n. If
1681          s has fewer than x characters, then the entire string s is
1682          written. Returns:
1683           -1: on failure.
1684          >= 0: on success, the number of characters actually written.
1685         
1686   int
1687          zstime(fn,yy,x) char *fn; struct zattr *yy; int x;
1688          Sets the creation date (and other attributes) of an existing
1689          file, or compares a file's creation date with a given date.
1690          Call with:
1691          fn: pointer to name of existing file.
1692          yy: Pointer to a Kermit file attribute structure in which
1693          yy->date.val is a date of the form yyyymmdd hh:mm:ss, e.g.
1694          19900208 13:00:00, which is to be used for setting or comparing
1695          the file date. Other attributes in the struct can also be set,
1696          such as the protection/permission (See [110]Appendix I), when
1697          it makes sense (e.g. "yy->lprotect.val" can be set if the
1698          remote system ID matches the local one).
1699           x: A function code: 0 means to set the file's creation date as
1700          given. 1 means compare the date from the yy struct with the
1701          file's date.
1702          Returns:
1703           -1: on any kind of error.
1704            0: if x is 0 and the file date was set successfully.
1705            0: if x is 1 and date from attribute structure > file
1706          creation date.
1707            1: if x is 1 and date from attribute structure <= file
1708          creation date.
1709         
1710   VOID
1711          zstrip(name,name2) char *name, **name2;
1712          Strips pathname from filename "name". Constructs the resulting
1713          string in a static buffer in its own space and returns a
1714          pointer to it in name2. Also strips device name, file version
1715          numbers, and other "non-name" material.
1716         
1717   int
1718          zxcmd(n,s) char *s;
1719          Runs a system command so its output can be accessed as if it
1720          were file n. The command is run in ordinary, unprivileged user
1721          mode.
1722          If n is ZSTDIO or ZCTERM, returns -1.
1723          If n is ZIFILE or ZRFILE, then Kermit reads from the command,
1724          otherwise Kermit writes to the command.
1725          Returns 0 on error, 1 on success.
1726         
1727   int
1728          zxpand(fn) char *fn;
1729          OBSOLETE: Replaced by nzxpand(), q.v.
1730         
1731   #ifdef ZXREWIND
1732         
1733   int
1734          zxrewind()
1735          Returns the number of files returned by the most recent
1736          nzxpand() call, and resets the list to the beginning so the
1737          next znext() call returns the first file. Returns -1 if zxpand
1738          has not yet been called. If this function is available,
1739          ZXREWIND should be defined; otherwise it should not be
1740          referenced.
1741         
1742   #endif /* ZXREWIND */
1743         
1744   int
1745          xsystem(cmd) char *cmd;
1746          Executes the system command without redirecting any of its i/o,
1747          similar (well, identical) to system() in Unix. But before
1748          passing the command to the system, xsystem() ensures that all
1749          privileges are turned off, so that the system command executes
1750          in ordinary unprivileged user mode. If possible, xsystem()
1751          returns the return code of the command that was executed.
1752         
1753    4.E.2.2. IKSD Variables and Functions
1754   
1755   These must be implemented in any C-Kermit version that is to be
1756   installed as an Internet Kermit Service Daemon (IKSD). IKSD is
1757   expected to be started by the Internet Daemon (e.g. inetd) with its
1758   standard i/o redirected to the incoming connection.
1759   
1760   int ckxanon;
1761          Nonzero if anonymous logins allowed.
1762         
1763   extern int inserver;
1764          Nonzero if started in IKSD mode.
1765         
1766   extern int isguest;
1767          Nonzero if IKSD and user logged in anonymously.
1768         
1769   extern char * homdir;
1770          Pointer to user's home directory.
1771         
1772   extern char * anonroot;
1773          Pointer to file-system root for anonymous users.
1774         
1775   Existing functions must make "if (inserver && isguest)" checks for
1776   actions that would not be legal for guests: zdelete(), zrmdir(),
1777   zprint(), zmail(), etc.
1778   
1779   int
1780          zvuser(name) char * name;
1781          Verifies that user "name" exists and is allowed to log in. If
1782          the name is "ftp" or "anonymous" and ckxanon != 0, a guest
1783          login is set up. Returns 0 if user not allowed to log in,
1784          nonzero if user may log in.
1785         
1786   int
1787          zvpass(string) char * string;
1788          Verifies password of the user from the most recent zvuser()
1789          call. Returns nonzero if password is valid for user, 0 if it
1790          isn't. Makes any appropriate system log entries (IKSD logins,
1791          failed login attempts, etc). If password is valid, logs the
1792          user in as herself (if real user), or sets up restricted
1793          anonymous access if user is guest (e.g. changes file-system
1794          root to anonroot and sets isguest = 1).
1795         
1796   VOID
1797          zsyslog()
1798          Begins any desired system logging of an IKSD session.
1799         
1800   VOID
1801          zvlogout()
1802          Terminates an IKSD session. In most cases this is simply a
1803          wrapper for exit() or doexit(), with some system logging added.
1804         
1805    4.E.2.3. Privilege Functions
1806   
1807   These functions are used by C-Kermit to adapt itself to operating
1808   systems where the program can be made to run in a "privileged" mode,
1809   e.g. setuid or setgid in Unix. C-Kermit should NOT read and write
1810   files or start subprocesses as a privileged program. This would
1811   present a serious threat to system security. The security package has
1812   been installed to prevent such security breaches by turning off the
1813   program's special privileges at all times except when they are needed.
1814   
1815   In UNIX, the only need Kermit has for privileged status is access to
1816   the UUCP lockfile directory, in order to read, create, and destroy
1817   lockfiles, and to open communication devices that are normally
1818   protected against the user (see the [111]Unix C-Kermit Installation
1819   Instructions for discussion). Therefore, privileges should only be
1820   enabled for these operations and disabled at all other times. This
1821   relieves the programmer of the responsibility of putting expensive and
1822   unreliable access checks around every file access and subprocess
1823   creation.
1824   
1825   Strictly speaking, these functions are not required in all C-Kermit
1826   implementations, because their use (so far, at least) is internal to
1827   the Group E modules. However, they should be included in all C-Kermit
1828   implementations for operating systems that support the notion of a
1829   privileged program (UNIX, RSTS/E, what others?).
1830   
1831   int
1832          priv_ini()
1833          Determine whether the program is running in privileged status.
1834          If so, turn off the privileges, in such a way that they can be
1835          turned on again when needed. Called from sysinit() at program
1836          startup time. Returns:
1837            0 on success
1838            nonzero on failure, in which case the program should halt
1839          immediately.
1840         
1841   int
1842          priv_on()
1843          If the program is not privileged, this function does nothing.
1844          If the program is privileged, this function returns it to
1845          privileged status. priv_ini() must have been called first.
1846          Returns:
1847            0 on success
1848            nonzero on failure
1849         
1850   int
1851          priv_off()
1852          Turns privileges off (if they are on) in such a way that they
1853          can be turned back on again. Returns:
1854            0 on success
1855            nonzero on failure
1856         
1857   int
1858          priv_can()
1859          Turns privileges off in such a way that they cannot be turned
1860          back on. Returns:
1861            0 on success
1862            nonzero on failure
1863         
1864   int
1865          priv_chk()
1866          Attempts to turns privileges off in such a way that they can be
1867          turned on again later. Then checks to make sure that they were
1868          really turned off. If they were not really turned off, then
1869          they are cancelled permanently. Returns:
1870            0 on success
1871            nonzero on failure
1872         
1873    4.E.2.4. Console-Related Functions
1874   
1875   These relate to the program's "console", or controlling terminal, i.e.
1876   the terminal that the user is logged in on and types commands at, or
1877   on a PC or workstation, the actual keyboard and screen.
1878   
1879   int
1880          conbin(esc) char esc;
1881          Puts the console into "binary" mode, so that Kermit's command
1882          parser can control echoing and other treatment of characters
1883          that the user types. esc is the character that will be used to
1884          get Kermit's attention during packet mode; puts this in a
1885          global place. Sets the ckxech variable. Returns:
1886           -1: on error.
1887            0: on success.
1888         
1889   int
1890          concb(esc) char esc;
1891          Put console in "cbreak" (single-character wakeup) mode. That
1892          is, ensure that each console character is available to the
1893          program immediately when the user types it. Otherwise just like
1894          conbin(). Returns:
1895           -1: on error.
1896            0: on success.
1897         
1898   int
1899          conchk()
1900          Returns a number, 0 or greater, the number of characters
1901          waiting to be read from the console, i.e. the number of
1902          characters that the user has typed that have not been read yet
1903          by Kermit.
1904         
1905   long
1906          congspd();
1907          Returns the speed ("baud rate") of the controlling terminal, if
1908          known, otherwise -1L.
1909         
1910   int
1911          congks(timo) int timo;
1912          Get Keyboard Scancode. Reads a keyboard scan code from the
1913          physical console keyboard. If the timo parameter is greater
1914          than zero, then times out and returns -2 if no character
1915          appears within the given number of seconds. Upon any other kind
1916          of error, returns -1. Upon success returns a scan code, which
1917          may be any positive integer. For situations where scan codes
1918          cannot be read (for example, when an ASCII terminal is used as
1919          the job's controlling terminal), this function is identical to
1920          coninc(), i.e. it returns an 8-bit character value. congks() is
1921          for use with workstations whose keyboards have Alternate,
1922          Command, Option, and similar modifier keys, and Function keys
1923          that generate codes greater than 255.
1924         
1925   int
1926          congm()
1927          Console get modes. Gets the current console terminal modes and
1928          saves them so that conres() can restore them later. Returns 1
1929          if it got the modes OK, 0 if it did nothing (e.g. because
1930          Kermit is not connected with any terminal), -1 on error.
1931         
1932   int
1933          coninc(timo) int timo;
1934          Console Input Character. Reads a character from the console. If
1935          the timo parameter is greater than zero, then coninc() times
1936          out and returns -2 if no character appears within the given
1937          number of seconds. Upon any other kind of error, returns -1.
1938          Upon success, returns the character itself, with a value in the
1939          range 0-255 decimal.
1940         
1941   VOID
1942          conint(f,s) SIGTYP (*f)(), (*s)();
1943          Sets the console to generate an interrupt if the user types a
1944          keyboard interrupt character, and to transfer control the
1945          signal-handling function f. For systems with job control, s is
1946          the address of the function that suspends the job. Sets the
1947          global variable "backgrd" to zero if Kermit is running in the
1948          foreground, and to nonzero if Kermit is running in the
1949          background. See ckcdeb.h for the definition of SIGTYP. No
1950          return value.
1951         
1952   VOID
1953          connoi()
1954          Console no interrupts. Disable keyboard interrupts on the
1955          console. No return value.
1956         
1957   int
1958          conoc(c) char c;
1959          Writes character c to the console terminal. Returns:
1960          0 on failure, 1 on success.
1961         
1962   int
1963          conol(s) char *s;
1964          Writes string s to the console. Returns -1 on error, 0 or
1965          greater on success.
1966         
1967   int
1968          conola(s) char *s[]; {
1969          Writes an array of strings to the console. Returns -1 on error,
1970          0 or greater on success.
1971         
1972   int
1973          conoll(s) char *s;
1974          Writes string s to the console, followed by the necessary line
1975          termination characters to put the console cursor at the
1976          beginning of the next line. Returns -1 on error, 0 or greater
1977          on success.
1978         
1979   int
1980          conres()
1981          Restores the console terminal to the modes obtained by congm().
1982          Returns: -1 on error, 0 on success.
1983         
1984   int
1985          conxo(x,s) int x; char *s;
1986          Write x characters from string s to the console. Returns 0 or
1987          greater on success, -1 on error.
1988         
1989   char *
1990          conkbg();
1991          Returns a pointer to the designator of the console keyboard
1992          type. For example, on a PC, this function would return "88",
1993          "101", etc. Upon failure, returns a pointer to the empty
1994          string.
1995         
1996    4.E.2.5. Communications Functions
1997   
1998   The communication device is the device used for terminal emulation and
1999   file transfer. It may or may not be the same device as the console,
2000   and it may or may not be a terminal (serial-port) device; it could
2001   also be a network connection. For brevity, the communication device is
2002   referred to here as the "tty". When the communication device is the
2003   same as the console device, Kermit is said to be in remote mode. When
2004   the two devices are different, Kermit is in local mode.
2005   
2006   int
2007          ttchk()
2008          Returns the number of characters that have arrived at the
2009          communication device but have not yet been read by ttinc(),
2010          ttinl(), and friends. If communication input is buffered (and
2011          it should be), this is the sum of the number of unread
2012          characters in Kermit's buffer PLUS the number of unread
2013          characters in the operating system's internal buffer. The call
2014          must be nondestructive and nonblocking, and as inexpensive as
2015          possible. Returns:
2016            0: or greater on success,
2017            0: in case of internal error,
2018           -1: or less when it determines the connection has been broken,
2019          or there is no connection.
2020         
2021          That is, a negative return from ttchk() should reliably
2022          indicate that there is no usable connection. Furthermore,
2023          ttchk() should be callable at any time to see if the connection
2024          is open. When the connection is open, every effort must be made
2025          to ensure that ttchk returns an accurate number of characters
2026          waiting to be read, rather than just 0 (no characters) or 1 (1
2027          or more characters), as would be the case when we use select().
2028          This aspect of ttchk's operation is critical to successful
2029          operation of sliding windows and streaming, but "nondestructive
2030          buffer peeking" is an obscure operating system feature, and so
2031          when it is not available, we have to do it ourselves by
2032          managing our own internal buffer at a level below ttinc(),
2033          ttinl(), etc, as in the UNIX version (non-FIONREAD case).
2034         
2035          An external global variable, clsondisc, if nonzero, means that
2036          if a serial connection drops (carrier on-to-off transition
2037          detected by ttchk()), the device should be closed and released
2038          automatically.
2039         
2040   int
2041          ttclos()
2042          Closes the communication device (tty or network). If there were
2043          any kind of exclusive access locks connected with the tty,
2044          these are released. If the tty has a modem connection, it is
2045          hung up. For true tty devices, the original tty device modes
2046          are restored. Returns:
2047           -1: on failure.
2048            0: on success.
2049         
2050   int
2051          ttflui()
2052          Flush communications input buffer. If any characters have
2053          arrived but have not yet been read, discard these characters.
2054          If communications input is buffered by Kermit (and it should
2055          be), this function flushes Kermit's buffer as well as the
2056          operating system's internal input buffer. Returns:
2057           -1: on failure.
2058            0: on success.
2059         
2060   int
2061          ttfluo()
2062          Flush tty output buffer. If any characters have been written
2063          but not actually transmitted (e.g. because the system has been
2064          flow-controlled), remove them from the system's output buffer.
2065          (Note, this function is not actually used, but it is
2066          recommended that all C-Kermit programmers add it for future
2067          use, even if it is only a dummy function that returns 0
2068          always.)
2069         
2070   int
2071          ttgmdm()
2072          Looks for the modem signals CTS, DSR, and CTS, and returns
2073          those that are on in as its return value, in a bit mask as
2074          described for ttwmdm, in which a bit is on (1) or off (0)
2075          according to whether the corresponding signal is on (asserted)
2076          or off (not asserted). Return values:
2077           -3: Not implemented
2078           -2: if the line does not have modem control
2079           -1: on error
2080          >=0: on success, with bit mask containing the modem signals.
2081         
2082   long
2083          ttgspd()
2084          Returns the current tty speed in BITS (not CHARACTERS) per
2085          second, or -1 if it is not known or if the tty is really a
2086          network, or upon any kind of error. On success, the speed
2087          returned is the actual number of bits per second, like 1200,
2088          9600, 19200, etc.
2089         
2090   int
2091          ttgwsiz()
2092          Get terminal window size. Returns -1 on error, 0 if the window
2093          size can't be obtained, 1 if the window size has been
2094          successfully obtained. Upon success, the external global
2095          variables tt_rows and tt_cols are set to the number of screen
2096          rows and number of screen columns, respectively. As this
2097          function is not implemented in all ck*tio.c modules, calls to
2098          it must be wrapped in #ifdef CK_TTGWSIZ..#endif. NOTE: This
2099          function must be available to use the TELNET NAWS feature
2100          (Negotiate About Window Size) as well as Rlogin.
2101         
2102   int
2103          tthang()
2104          Hang up the current tty device. For real tty devices, turn off
2105          DTR for about 1/3-1/2 second (or other length of time,
2106          depending on the system). If the tty is really a network
2107          connection, close it. Returns:
2108           -1: on failure.
2109            0: if it does not even try to hang up.
2110            1: if it believes it hung up successfully.
2111         
2112   VOID
2113          ttimoff()
2114          Turns off all pending timer interrupts.
2115         
2116   int
2117          ttinc(timo) int timo; (function is old, return codes are new)
2118          Reads one character from the communication device. If timo is
2119          greater than zero, wait the given number of seconds and then
2120          time out if no character arrives, otherwise wait forever for a
2121          character. Returns:
2122           -3: internal error (e.g. tty modes set wrong)
2123           -2: communications disconnect
2124           -1: timeout or other error
2125          >=0: the character that was read.
2126          It is HIGHLY RECOMMENDED that ttinc() be internally buffered so
2127          that calls to it are relatively inexpensive. If it is possible
2128          to to implement ttinc() as a macro, all the better, for example
2129          something like:
2130         
2131  #define ttinc(t) ( (--txbufn >= 0) ? txbuf[ttbufp++] : txbufr(t) )
2132
2133          (see description of txbufr() below)
2134         
2135   int
2136          ttinl(dest,max,timo,eol,start,turn) int max,timo,turn; CHAR
2137          *dest, eol, start;
2138          ttinl() is Kermit's packet reader. Reads a packet from the
2139          communications device, or up to max characters, whichever
2140          occurs first. A line is a string of characters starting with
2141          the start character up to and including the character given in
2142          eol or until the length is exhausted, or, if turn != 0, until
2143          the line turnaround character (turn) is read. If turn is 0,
2144          ttinl() *should* use the packet length field to detect the end,
2145          to allow for the possibility that the eol character appears
2146          unprefixed in the packet data. (The turnaround character is for
2147          half-duplex linemode connections.)
2148         
2149          If timo is greater than zero, ttinl() times out if the eol
2150          character is not encountered within the given number of seconds
2151          and returns -1.
2152         
2153          The characters that were input are copied into "dest" with
2154          their parity bits stripped if parity is not none. The first
2155          character copied into dest should be the start character, and
2156          the last should be the final character of the packet (the last
2157          block check character). ttinl() should also absorb and discard
2158          the eol and turn characters, and any other characters that are
2159          waiting to be read, up until the next start character, so that
2160          subsequent calls to ttchk() will not succeed simply because
2161          there are some terminators still sitting in the buffer that
2162          ttinl() didn't read. This operation, if performed, MUST NOT
2163          BLOCK (so if it can't be performed in a guaranteed nonblocking
2164          way, don't do it).
2165         
2166          On success, ttinl() returns the number of characters read.
2167          Optionally, ttinl() can sense the parity of incoming packets.
2168          If it does this, then it should set the global variable ttprty
2169          accordingly. ttinl() should be coded to be as efficient as
2170          possible, since it is at the "inner loop" of packet reception.
2171          ttinl() returns:
2172           -1: Timeout or other possibly correctable error.
2173           -2: Interrupted from keyboard.
2174           -3: Uncorrectable i/o error -- connection lost, configuration
2175          problem, etc.
2176          >=0: on success, the number of characters that were actually
2177          read and placed in the dest buffer, not counting the trailing
2178          null.
2179         
2180   int
2181          ttoc(c) char c;
2182          Outputs the character c to the communication line. If the
2183          operation fails to complete within two seconds, this function
2184          returns -1. Otherwise it returns the number of characters
2185          actually written to the tty (0 or 1). This function should only
2186          be used for interactive, character-mode operations, like
2187          terminal connection, script execution, dialer i/o, where the
2188          overhead of the signals and alarms does not create a
2189          bottleneck. (THIS DESCRIPTION NEEDS IMPROVEMENT -- If the
2190          operation fails within a "certain amount of time"... which
2191          might be dependent on the communication method, speed, etc. In
2192          particular, flow-control deadlocks must be accounted for and
2193          broken out of to prevent the program from hanging indefinitely,
2194          etc.)
2195         
2196   int
2197          ttol(s,n) int n; char *s;
2198          Kermit's packet writer. Writes the n characters of the string
2199          pointed to to by s. NOTE: It is ttol's responsibility to write
2200          ALL of the characters, not just some of them. Returns:
2201           -1: on a possibly correctable error (so it can be retried).
2202           -3: on a fatal error, e.g. connection lost.
2203          >=0: on success, the actual number of characters written (the
2204          specific number is not actually used for anything).
2205         
2206   int
2207          ttopen(ttname,lcl,modem,timo) char *ttname; int *lcl, modem,
2208          timo;
2209          Opens a tty device, if it is not already open. ttopen must
2210          check to make sure the SAME device is not already open; if it
2211          is, ttopen returns successfully without doing anything. If a
2212          DIFFERENT device is currently open, ttopen() must call ttclos()
2213          to close it before opening the new one.
2214         
2215        Parameters:
2216               
2217              ttname:
2218                      character string - device name or network host
2219                      name.
2220                     
2221              lcl:
2222                      If called with lcl < 0, sets value of lcl as
2223                      follows:
2224                      0: the terminal named by ttname is the job's
2225                      controlling terminal.
2226                      1: the terminal named by ttname is not the job's
2227                      controlling terminal.
2228                      If the device is already open, or if the requested
2229                      device can't be opened, then lcl remains (and is
2230                      returned as) -1.
2231                     
2232              modem:
2233                      Less than zero: this is the negative of the network
2234                      type, and ttname is a network host name. Network
2235                      types (from [112]ckcnet.h:
2236                     
2237
2238  NET_TCPB 1   TCP/IP Berkeley (socket)  (implemented in [113]ckutio.c)
2239  NET_TCPA 2   TCP/IP AT&T (streams)     (not yet implemented)
2240  NET_DEC  3   DECnet                    (not yet implemented)
2241
2242              Zero or greater: ttname is a terminal device name. Zero
2243                      means a direct connection (don't use modem
2244                      signals). Positive means use modem signals
2245                      depending on the current setting of ttcarr (see
2246                      ttscarr()).
2247                     
2248              timo:
2249                      > 0: number of seconds to wait for open() to return
2250                      before timing out.
2251                      <=0: no timer, wait forever (e.g. for incoming
2252                      call).
2253                      For real tty devices, ttopen() attempts to gain
2254                      exclusive access to the tty device, for example in
2255                      UNIX by creating a "lockfile" (in other operating
2256                      systems, like VMS, exclusive access probably
2257                      requires no special action).
2258                     
2259        Side effects:
2260                Copies its arguments and the tty file descriptor to
2261                global variables that are available to the other
2262                tty-related functions, with the lcl value altered as
2263                described above. Gets all parameters and settings
2264                associated with the line and puts them in a global area,
2265                so that they can be restored by ttres(), e.g. when the
2266                device is closed.
2267               
2268        Returns:
2269                  0: on success
2270                 -5: if device is in use
2271                 -4: if access to device is denied
2272                 -3: if access to lock mechanism denied
2273                 -2: upon timeout waiting for device to open
2274                 -1: on other error
2275               
2276   int
2277          ttpkt(speed,flow,parity) long speed; int flow, parity;
2278          Puts the currently open tty device into the appropriate modes
2279          for transmitting and receiving Kermit packets.
2280         
2281        Arguments:
2282               
2283              speed:
2284                      if speed > -1, and the device is a true tty device,
2285                      and Kermit is in local mode, ttpkt also sets the
2286                      speed.
2287                     
2288              flow:
2289                      if in the range 0-3, ttpkt selects the
2290                      corresponding type of flow control. Currently 0 is
2291                      defined as no flow control, 1 is Xon/Xoff, and no
2292                      other types are defined. If (and this is a horrible
2293                      hack, but it goes back many years and will be hard
2294                      to eradicate) flow is 4, then the appropriate tty
2295                      modes are set for modem dialing, a special case in
2296                      which we talk to a modem-controlled line without
2297                      requiring carrier. If flow is 5, then we require
2298                      carrier.
2299                     
2300              parity:
2301                      This is simply copied into a global variable so
2302                      that other functions (like ttinl, ttinc, etc) can
2303                      use it.
2304                     
2305        Side effects:
2306                Copies its arguments to global variables, flushes the
2307                terminal device input buffer.
2308               
2309        Returns:
2310                 -1: on error.
2311                  0: on success.
2312               
2313   int
2314          ttsetflow(int)
2315          Enables the given type of flow control on the open serial
2316          communications device immediately. Arguments are the FLO_xxx
2317          values from ckcdeb.h, except FLO_DIAL, FLO_DIAX, or FLO_AUTO,
2318          which are not actual flow-control types. Returns 0 on success,
2319          -1 on failure.
2320         
2321   #ifdef TTSPDLIST
2322         
2323   long *
2324          ttspdlist()
2325          Returns a pointer to an array of longs, or NULL on failure. On
2326          success, element 0 of the array contains number, n, indicating
2327          how many follow. Elements 1-n are serial speeds, expressed in
2328          bits per second, that are legal on this platform. The user
2329          interface may use this list to construct a menu, keyword table,
2330          etc.
2331         
2332   #endif /* TTSPDLIST */
2333         
2334   int
2335          ttres()
2336          Restores the tty device to the modes and settings that were in
2337          effect at the time it was opened (see ttopen). Returns:
2338           -1: on error.
2339            0: on success.
2340         
2341   int
2342          ttruncmd(string) char * string;
2343          Runs the given command on the local system, but redirects its
2344          input and output to the communication (SET LINE, SET PORT, or
2345          SET HOST) device. Returns:
2346            0: on failure.
2347            1: on success.
2348         
2349   int
2350          ttscarr(carrier) int carrier;
2351          Copies its argument to a variable that is global to the other
2352          tty-related functions, and then returns it. The values for
2353          carrier are defined in ckcdeb.h: CAR_ON, CAR_OFF, CAR_AUTO.
2354          ttopen(), ttpkt(), and ttvt() use this variable when deciding
2355          how to open the tty device and what modes to select. The
2356          meanings are these:
2357         
2358          CAR_OFF: Ignore carrier at all times.
2359          CAR_ON: Require carrier at all times, except when dialing. This
2360          means, for example, that ttopen() could hang forever waiting
2361          for carrier if it is not present.
2362          CAR_AUTO: If the modem type is zero (i.e. the connection is
2363          direct), this is the same as CAR_OFF. If the modem type is
2364          positive, then heed carrier during CONNECT (ttvt mode), but
2365          ignore it at other times (packet mode, during SET LINE, etc).
2366          Compatible with pre-5A versions of C-Kermit. This should be the
2367          default carrier mode.
2368         
2369          Kermit's DIAL command ignores the carrier setting, but
2370          ttopen(), ttvt(), and ttpkt() all honor the carrier option in
2371          effect at the time they are called. None of this applies to
2372          remote mode (the tty device is the job's controlling terminal)
2373          or to network host connections (modem type is negative).
2374         
2375   int
2376          ttsndb()
2377          Sends a BREAK signal on the tty device. On a real tty device,
2378          send a real BREAK lasting approximately 275 milliseconds. If
2379          this is not possible, simulate a BREAK by (for example)
2380          dropping down some very low baud rate, like 50, and sending a
2381          bunch of null characters. On a network connection, do the
2382          appropriate network protocol for BREAK. Returns:
2383           -1: on error.
2384            0: on success.
2385         
2386   int
2387          ttsndlb()
2388          Like ttsndb(), but sends a "Long BREAK" (approx 1.5 seconds).
2389          For network connections, it is identical to ttsndb().
2390          Currently, this function is used only if CK_LBRK is defined (as
2391          it is for UNIX and VMS).
2392         
2393   int
2394          ttsspd(cps) int cps;
2395          For serial devices only, set the device transmission speed to
2396          (note carefully) TEN TIMES the argument. The argument is in
2397          characters per second, but transmission speeds are in bits per
2398          second. cps are used rather than bps because high speeds like
2399          38400 are not expressible in a 16-bit int but longs cannot be
2400          used because keyword-table values are ints and not longs. If
2401          the argument is 7, then the bps is 75, not 70. If the argument
2402          is 888, this is a special code for 75/1200 split-speed
2403          operation (75 bps out, 1200 bps in). Returns:
2404           -1: on error, meaning the requested speed is not valid or
2405          available.
2406          >=0: on success (don't try to use this value for anything).
2407         
2408   int
2409          ttvt(speed,flow) long speed; int flow;
2410          Puts the currently open tty device into the appropriate modes
2411          for terminal emulation. The arguments are interpreted as in
2412          ttpkt(). Side effects: ttvt() stores its arguments in global
2413          variables, and sets a flag that it has been called so that
2414          subsequent calls can be ignored so long as the arguments are
2415          the same as in the last effective call. Other functions, such
2416          as ttopen(), ttclose(), ttres(), ttvt(), etc, that change the
2417          tty device in any way must unset this flag. In UNIX Kermit,
2418          this flag is called tvtflg.
2419         
2420   int
2421          ttwmdm(mdmsig,timo) int mdmsig, timo;
2422          Waits up to timo seconds for all of the given modem signals to
2423          appear. mdmsig is a bit mask, in which a bit is on (1) or off
2424          (0) according to whether the corresponding signal is to be
2425          waited for. These symbols are defined in ckcdeb.h:
2426            BM_CTS (bit 0) means wait for Clear To Send
2427            BM_DSR (bit 1) means wait for Data Set Ready
2428            BM_DCD (bit 2) means wait for Carrier Detect
2429          Returns:
2430           -3: Not implemented.
2431           -2: This line does not have modem control.
2432           -1: Timeout: time limit exceeded before all signals were
2433          detected.
2434            1: Success.
2435         
2436   int
2437          ttxin(n,buf) int n; CHAR *buf;
2438          Reads x characters from the tty device into the specified buf,
2439          stripping parity if parity is not none. This call waits
2440          forever, there is no timeout. This function is designed to be
2441          called only when you know that at least x characters are
2442          waiting to be read (as determined, for example, by ttchk()).
2443          This function should use the same buffer as ttinc().
2444         
2445   int
2446          txbufr(timo) int timo;
2447          Reads characters into the internal communications input buffer.
2448          timo is a timeout interval, in seconds. 0 means no timeout,
2449          wait forever. Called by ttinc() (and possibly ttxin() and
2450          ttinl()) when the communications input buffer is empty. The
2451          buffer should be called ttxbuf[], its length is defined by the
2452          symbol TXBUFL. The global variable txbufn is the number of
2453          characters available to be read from ttxbuf[], and txbufp is
2454          the index of the next character to be read. Should not be
2455          called if txbufn > 0, in which case the buffer does not need
2456          refilling. This routine returns:
2457            -2: Communications disconnect
2458            -1: Timeout
2459          >=0: A character (0 - 255) On success, the first character that
2460          was read, with the variables txbufn and txbufp set
2461          appropriately for any remaining characters.
2462          NOTE: Currently this routine is used internally only by the
2463          UNIX and VMS versions. The aim is to make it available to all
2464          versions so there is one single coherent and efficient way of
2465          reading from the communications device or network.
2466         
2467    4.E.2.6. Miscellaneous system-dependent functions
2468   
2469   VOID
2470          ztime(s) char **s;
2471          Returns a pointer, s, to the current date-and-time string in s.
2472          This string must be in the fixed-field format associated with
2473          the C runtime asctime() function, like: "Sun Sep 16 13:23:45
2474          1973\n" so that callers of this function can extract the
2475          different fields. The pointer value is filled in by ztime, and
2476          the data it points to is not safe, so should be copied to a
2477          safe place before use. ztime() has no return value. As a side
2478          effect, this routine can also fill in the following two
2479          external variables (which must be defined in the
2480          system-dependendent modules for each platform):
2481            long ztusec: Fraction of seconds of clock time, microseconds.
2482            long ztmsec: Fraction of seconds of clock time, milliseconds.
2483          If these variables are not set by zstime(), they remain at
2484          their initial value of -1L.
2485         
2486   int
2487          gtimer()
2488          Returns the current value of the elapsed time counter in
2489          seconds (see rtimer), or 0 on any kind of error.
2490         
2491   #ifdef GFTIMER
2492          CKFLOAT
2493          gftimer()
2494          Returns the current value of the elapsed time counter in
2495          seconds, as a floating point number, capable of representing
2496          not only whole seconds, but also the fractional part, to the
2497          millisecond or microsecond level, whatever precision is
2498          available. Requires a function to get times at subsecond
2499          precision, as well as floating-point support. That's why it's
2500          #ifdef'd.
2501         
2502   #endif /* GFTIMER */
2503         
2504   int
2505          msleep(m) int m;
2506          Sleeps (pauses, does nothing) for m milliseconds (a millisecond
2507          is one thousandth of a second). Returns:
2508           -1: on failure.
2509            0: on success.
2510         
2511   VOID
2512          rtimer()
2513          Sets the elapsed time counter to zero. If you want to time how
2514          long an operation takes, call rtimer() when it starts and
2515          gtimer when it ends. rtimer() has no return value.
2516         
2517   #ifdef GFTIMER
2518          VOID
2519          rftimer()
2520          Sets the elapsed time counter to zero. If you want to time how
2521          long an operation takes, call rftimer() when it starts and
2522          gftimer when it ends. rftimer() has no return value. Note:
2523          rftimer() is to be used with gftimer() and rtimer() is to be
2524          used with gtimer(). See the rftimer() description.
2525         
2526   #endif /* GFTIMER */
2527         
2528   int
2529          sysinit()
2530          Does whatever needs doing upon program start. In particular, if
2531          the program is running in any kind of privileged mode, turns
2532          off the privileges (see priv_ini()). Returns:
2533           -1: on error.
2534            0: on success.
2535         
2536   int
2537          syscleanup()
2538          Does whatever needs doing upon program exit. Returns:
2539           -1: on error.
2540            0: on success.
2541         
2542   int
2543          psuspend()
2544          Suspends the Kermit process, puts it in the background so it
2545          can be continued ("foregrounded") later. Returns:
2546           -1: if this function is not supported.
2547            0: on success.
2548         
2549   [ [114]Contents ] [ [115]C-Kermit ] [ [116]Kermit Home ]
2550    ________________________________________________________________________
2551 
2552  4.F. Group F: Network Support
2553 
2554   As of version 5A, C-Kermit includes support for several networks.
2555   Originally, this was just worked into the ttopen(), ttclos(), ttinc(),
2556   ttinl(), and similar routines in [117]ckutio.c. But this made it
2557   impossible to share this code with non-UNIX versions, like VMS,
2558   AOS/VS, OS/2, etc. So as of edit 168, network code has been separated
2559   out into its own module and header file, ckcnet.c and ckcnet.h:
2560   
2561     [118]ckcnet.h: Network-related symbol definitions.
2562     [119]ckcnet.c: Network i/o (TCP/IP, X.25, etc), shared by most
2563   platforms.
2564     [120]cklnet.c: Network i/o (TCP/IP, X.25, etc) specific to Stratus
2565   VOS.
2566   
2567   The routines and variables in these modules fall into two categories:
2568   
2569    1. Support for specific network packages like SunLink X.25 and TGV
2570       MultiNet, and:
2571    2. support for specific network virtual terminal protocols like CCITT
2572       X.3 and TCP/IP Telnet.
2573       
2574   Category (1) functions are analogs to the tt*() functions, and have
2575   names like netopen, netclos, nettinc, etc. Group A-D modules do not
2576   (and must not) know anything about these functions -- they continue to
2577   call the old Group E functions (ttopen, ttinc, etc). Category (2)
2578   functions are protocol specific and have names prefixed by a protocol
2579   identifier, like tn for telnet x25 for X.25.
2580   
2581   ckcnet.h contains prototypes for all these functions, as well as
2582   symbol definitions for network types, protocols, and network- and
2583   protocol- specific symbols, as well as #includes for the header files
2584   necessary for each network and protocol.
2585   
2586   The following functions are to be provided for networks that do not
2587   use normal system i/o (open, read, write, close):
2588   
2589   int
2590          netopen()
2591          To be called from within ttopen() when a network connection is
2592          requested. Calling conventions and purpose same as Group E
2593          ttopen().
2594         
2595   int
2596          netclos()
2597          To be called from within ttclos() when a network connection is
2598          being closed. Calling conventions and purpose same as Group E
2599          ttclos().
2600         
2601   int
2602          nettchk()
2603          To be called from within ttchk(). Calling conventions and
2604          purpose same as Group E ttchk().
2605         
2606   int
2607          netflui()
2608          To be called from within ttflui(). Calling conventions and
2609          purpose same as Group E ttflui().
2610         
2611   int
2612          netbreak()
2613          To send a network break (attention) signal. Calling conventions
2614          and purpose same as Group E ttsndbrk().
2615         
2616   int
2617          netinc()
2618          To get a character from the network. Calling conventions same
2619          as Group E ttsndbrk().
2620         
2621   int
2622          nettoc()
2623          Send a "character" (byte) to the network. Calling conventions
2624          same as Group E ttoc().
2625         
2626   int
2627          nettol()
2628          Send a "line" (sequence of bytes) to the network. Calling
2629          conventions same as Group E ttol().
2630         
2631   Conceivably, some systems support network connections simply by
2632   letting you open a device of a certain name and letting you do i/o to
2633   it. Others (like the Berkeley sockets TCP/IP library on UNIX) require
2634   you to open the connection in a special way, but then do normal i/o
2635   (read, write). In such a case, you would use netopen(), but you would
2636   not use nettinc, nettoc, etc.
2637   
2638   VMS TCP/IP products have their own set of functions for all network
2639   operations, so in that case the full range of netxxx() functions is
2640   used.
2641   
2642   The technique is to put a test in each corresponding ttxxx() function
2643   to see if a network connection is active (or is being requested), test
2644   for which kind of network it is, and if necessary route the call to
2645   the corresponding netxxx() function. The netxxx() function must also
2646   contain code to test for the network type, which is available via the
2647   global variable ttnet.
2648   
2649   [ [121]Contents ] [ [122]C-Kermit ] [ [123]Kermit Home ]
2650      ______________________________________________________________________
2651   
2652    4.F.1. Telnet Protocol
2653   
2654   (This section needs a great deal of updating...)
2655   
2656   As of edit 195, Telnet protocol is split out into its own files, since
2657   it can be implemented in remote mode, which does not have a network
2658   connection:
2659   
2660      [124]ckctel.h: Telnet protocol symbol definitions.
2661      [125]ckctel.c: Telnet protocol.
2662   
2663   The Telnet protocol is supported by the following variables and
2664   routines:
2665   
2666   int tn_init
2667          Nonzero if telnet protocol initialized, zero otherwise.
2668         
2669   int
2670          tn_init()
2671          Initialize the telnet protocol (send initial options).
2672         
2673   int
2674          tn_sopt()
2675          Send a telnet option.
2676         
2677   int
2678          tn_doop()
2679          Receive and act on a telnet option from the remote.
2680         
2681   int
2682          tn_sttyp()
2683          Send terminal type using telnet protocol.
2684      ______________________________________________________________________
2685   
2686    4.F.2. FTP Protocol
2687   
2688   (To be filled in...)
2689      ______________________________________________________________________
2690   
2691    4.F.3. HTTP Protocol
2692   
2693   (To be filled in...)
2694      ______________________________________________________________________
2695   
2696    4.F.4. X.25 Networks
2697   
2698   These routines were written SunLink X.25 and have since been adapted
2699   to at least on one other: IBM AIXLink/X.25.
2700   
2701   int
2702          x25diag()
2703          Reads and prints X.25 diagnostics
2704         
2705   int
2706          x25oobh()
2707          X.25 out of band signal handler
2708         
2709   int
2710          x25intr()
2711          Sends X.25 interrupt packet
2712         
2713   int
2714          x25reset()
2715          Resets X.25 virtual circuit
2716         
2717   int
2718          x25clear()
2719          Clear X.25 virtual circuit
2720         
2721   int
2722          x25stat()
2723          X.25 status
2724         
2725   int
2726          setqbit()
2727          Sets X.25 Q-bit
2728         
2729   int
2730          resetqbit()
2731          Resets X.25 Q-bit
2732         
2733   int
2734          x25xin()
2735          Reads n characters from X.25 circuit.
2736         
2737   int
2738          x25inl()
2739          Read a Kermit packet from X.25 circuit.
2740         
2741   [ [126]Contents ] [ [127]C-Kermit ] [ [128]Kermit Home ]
2742      ______________________________________________________________________
2743   
2744    4.F.5. Adding New Network Types
2745   
2746   Example: Adding support for IBM X.25 and Hewlett Packard X.25. First,
2747   add new network type symbols for each one. There are already some
2748   network types defined for other X.25 packages:
2749   
2750  NET_SX25 is the network-type ID for SunLink X.25.
2751  NET_VX25 is the network-type ID for VOS X.25.
2752
2753   So first you should new symbols for the new network types, giving them
2754   the next numbers in the sequence, e.g.:
2755   
2756#define NET_HX25 11                     /* Hewlett-Packard X.25 */
2757#define NET_IX25 12                     /* IBM X.25 */
2758
2759   This is in ckcnet.h.
2760   
2761   Then we need symbols to say that we are actually compiling in the code
2762   for these platforms. These would be defined on the cc command line:
2763   
2764  -DIBMX25  (for IBM)
2765  -DHPX25   (for HP)
2766
2767   So we can build C-Kermit versions for AIX and HP-UX both with and
2768   without X.25 support (since not all AIX and IBM systems have the
2769   needed libraries, and so an executable that was linked with them might
2770   no load).
2771   
2772   Then in ckcnet.h:
2773   
2774#ifdef IBMX25
2775#define ANYX25
2776#endif /* IBMX25 */
2777
2778#ifdef HPX25
2779#define ANYX25
2780#endif /* HPX25 */
2781
2782   And then use ANYX25 for code that is common to all of them, and IBMX25
2783   or HPX25 for code specific to IBM or HP.
2784   
2785   It might also happen that some code can be shared between two or more
2786   of these, but not the others. Suppose, for example, that you write
2787   code that applies to both IBM and HP, but not Sun or VOS X.25. Then
2788   you add the following definition to ckcnet.h:
2789   
2790#ifndef HPORIBMX25
2791#ifdef HPX25
2792#define HPORIBMX25
2793#else
2794#ifdef IBMX25
2795#define HPORIBMX25
2796#endif /* IBMX25 */
2797#endif /* HPX25 */
2798#endif /* HPORIBMX25 */
2799
2800   You can NOT use constructions like "#if defined (HPX25 || IBMX25)";
2801   they are not portable.
2802   
2803   [ [129]Contents ] [ [130]C-Kermit ] [ [131]Kermit Home ]
2804    ________________________________________________________________________
2805 
2806  4.G. Group G: Formatted Screen Support
2807 
2808   So far, this is used only for the fullscreen local-mode file transfer
2809   display. In the future, it might be extended to other uses. The
2810   fullscreen display code is in and around the routine screenc() in
2811   [132]ckuusx.c.
2812   
2813   In the UNIX version, we use the curses library, plus one call from the
2814   termcap library. In other versions (OS/2, VMS, etc) we insert dummy
2815   routines that have the same names as curses routines. So far, there
2816   are two methods for simulating curses routines:
2817   
2818    1. In VMS, we use the Screen Management Library (SMG), and insert
2819       stubs to convert curses calls into SMG calls.
2820    2. In OS/2, we use the MYCURSES code, in which the stub routines
2821       actually emit the appropriate escape sequences themselves.
2822       
2823   Here are the stub routines:
2824   
2825   int
2826          tgetent(char *buf, char *term)
2827          Arguments are ignored. Returns 1 if the user has a supported
2828          terminal type, 0 otherwise. Sets a global variable (for
2829          example, "isvt52" or "isdasher") to indicate the terminal type.
2830         
2831   VOID
2832          move(int row, int col)
2833          Sends the escape sequence to position the cursor at the
2834          indicated row and column. The numbers are 0-based, e.g. the
2835          home position is 0,0.
2836         
2837   int
2838          clear()
2839          Sends the escape sequence to clear the screen.
2840         
2841   int
2842          clrtoeol()
2843          Sends the escape sequence to clear from the current cursor
2844          position to the end of the line.
2845         
2846   In the MYCURSES case, code must be added to each of the last three
2847   routines to emit the appropriate escape sequences for a new terminal
2848   type.
2849   
2850   clearok(curscr), wrefresh()
2851          In real curses, these two calls are required to refresh the
2852          screen, for example after it was fractured by a broadcast
2853          message. These are useful only if the underlying screen
2854          management service keeps a copy of the entire screen, as curses
2855          and SMG do. C-Kermit does not do this itself.
2856         
2857   [ [133]Contents ] [ [134]C-Kermit ] [ [135]Kermit Home ]
2858    ________________________________________________________________________
2859 
2860  4.H. Group H: Pseudoterminal Support
2861 
2862   (To be filled in...)
2863    ________________________________________________________________________
2864 
2865  4.I. Group I: Security
2866 
2867   (To be filled in...)
2868   
2869   [ [136]Contents ] [ [137]C-Kermit ] [ [138]Kermit Home ]
2870    ________________________________________________________________________
2871 
2872  APPENDIX I. FILE PERMISSIONS
2873 
2874  I.1. Format of System-Dependent File Permissions in A-Packets
2875 
2876   The format of this field (the "," attribute) is interpreted according
2877   to the System ID ("." Attribute).
2878   
2879   For UNIX (System ID = U1), it's the familiar 3-digit octal number, the
2880   low-order 9 bits of the filemode: Owner, Group, World, e.g. 660 =
2881   read/write access for owner and group, none for world, recorded as a
2882   3-digit octal string. High-order UNIX permission bits are not
2883   transmitted.
2884   
2885   For VMS (System ID = D7), it's a 4-digit hex string, representing the
2886   16-bit file protection WGOS fields (World,Group,Owner,System), in that
2887   order (which is the reverse of how they're shown in a directory
2888   listing); in each field, Bit 0 = Read, 1 = Write, 2 = Execute, 3 =
2889   Delete. A bit value of 0 means permission is granted, 1 means
2890   permission is denied. Sample:
2891   
2892  r-01-00-^A/!FWERMIT.EXE'"
2893  s-01-00-^AE!Y/amd/watsun/w/fdc/new/wermit.exe.DV
2894  r-02-01-^A]"A."D7""B8#119980101 18:14:05!#8531&872960,$A20B-!7(#512@ #.Y
2895  s-02-01-^A%"Y.5!
2896
2897   A VMS directory listing shows the file's protection as (E,RWED,RED,RE)
2898   which really means (S=E,O=RWED,G=RED,W=RE), which is reverse order
2899   from the internal storage, so (RE,RED,RWED,E). Now translate each
2900   letter to its corresponding bit:
2901   
2902  RE=0101, RED=1101, RWED=1111, E=0010
2903
2904   Now reverse the bits:
2905   
2906  RE=1010, RED=0010, RWED=0000, E=1101
2907
2908   This gives the 16-bit quantity:
2909   
2910  1010001000001101
2911
2912   This is the internal representation of the VMS file permission; in
2913   hex:
2914   
2915  A20B
2916
2917   as shown in the sample packet above.
2918   
2919   The VMS format probably would also apply to RSX or any other FILES-11
2920   system.
2921   
2922  I.2. Handling of Generic Protection
2923 
2924   To be used when the two systems are different (and/or do not recognize
2925   or understand each other's local protection codes).
2926   
2927   First of all, the book is wrong. This should not be the World
2928   protection, but the Owner protection. The other fields should be set
2929   according to system defaults (e.g. UNIX umask, VMS default protection,
2930   etc), except that no non-Owner field should give more permissions than
2931   the Owner field.
2932   
2933   [ [139]Top ] [ [140]Contents ] [ [141]C-Kermit Home ] [ [142]Kermit
2934   Home ]
2935     _________________________________________________________________
2936   
2937   
2938    C-Kermit Program Logic Manual / [143]The Kermit Project /
2939    [144]Columbia University / [145]kermit@columbia.edu / 17 March 2003
2940
2941References
2942
2943   1. http://www.columbia.edu/kermit/
2944   2. http://www.columbia.edu/
2945   3. http://www.columbia.edu/kermit/ckcplm.html
2946   4. http://www.columbia.edu/kermit/ckermit.html
2947   5. http://www.columbia.edu/kermit/index.html
2948   6. http://www.columbia.edu/kermit/ckcplm.html#x1
2949   7. http://www.columbia.edu/kermit/ckcplm.html#x2
2950   8. http://www.columbia.edu/kermit/ckcplm.html#x3
2951   9. http://www.columbia.edu/kermit/ckcplm.html#x4
2952  10. http://www.columbia.edu/kermit/ckcplm.html#x4.A
2953  11. http://www.columbia.edu/kermit/ckcplm.html#x4.B
2954  12. http://www.columbia.edu/kermit/ckcplm.html#x4.C
2955  13. http://www.columbia.edu/kermit/ckcplm.html#x4.D
2956  14. http://www.columbia.edu/kermit/ckcplm.html#x4.E
2957  15. http://www.columbia.edu/kermit/ckcplm.html#x4.F
2958  16. http://www.columbia.edu/kermit/ckcplm.html#x4.G
2959  17. http://www.columbia.edu/kermit/ckcplm.html#x4.H
2960  18. http://www.columbia.edu/kermit/ckcplm.html#x4.I
2961  19. http://www.columbia.edu/kermit/ckcplm.html#xa1
2962  20. http://www.columbia.edu/kermit/ckcplm.html#contents
2963  21. http://www.columbia.edu/kermit/ckcplm.html#contents
2964  22. http://www.columbia.edu/kermit/ckermit.html
2965  23. http://www.columbia.edu/kermit/index.html
2966  24. ftp://kermit.columbia.edu/kermit/c-kermit/ckcpro.w
2967  25. http://www.columbia.edu/kermit/ckcplm.html#contents
2968  26. http://www.columbia.edu/kermit/ckermit.html
2969  27. http://www.columbia.edu/kermit/index.html
2970  28. http://www.columbia.edu/kermit/ckcplm.html#x3.2
2971  29. http://www.columbia.edu/kermit/ckcplm.html#contents
2972  30. http://www.columbia.edu/kermit/ckermit.html
2973  31. http://www.columbia.edu/kermit/index.html
2974  32. http://www.columbia.edu/kermit/ckcplm.html#x4.A
2975  33. http://www.columbia.edu/kermit/ckcplm.html#contents
2976  34. http://www.columbia.edu/kermit/ckermit.html
2977  35. http://www.columbia.edu/kermit/index.html
2978  36. http://www.columbia.edu/kermit/ckcplm.html#contents
2979  37. http://www.columbia.edu/kermit/ckermit.html
2980  38. http://www.columbia.edu/kermit/index.html
2981  39. http://www.columbia.edu/kermit/ckcplm.html#contents
2982  40. http://www.columbia.edu/kermit/ckermit.html
2983  41. http://www.columbia.edu/kermit/index.html
2984  42. ftp://kermit.columbia.edu/kermit/c-kermit/ckclib.h
2985  43. ftp://kermit.columbia.edu/kermit/c-kermit/ckclib.c
2986  44. http://www.columbia.edu/kermit/ckcplm.html#x3.1
2987  45. http://www.columbia.edu/kermit/ckcplm.html#contents
2988  46. http://www.columbia.edu/kermit/ckermit.html
2989  47. http://www.columbia.edu/kermit/index.html
2990  48. ftp://kermit.columbia.edu/kermit/c-kermit/ckcsym.h
2991  49. ftp://kermit.columbia.edu/kermit/c-kermit/ckcasc.h
2992  50. ftp://kermit.columbia.edu/kermit/c-kermit/ckcsig.h
2993  51. ftp://kermit.columbia.edu/kermit/c-kermit/ckcdeb.h
2994  52. ftp://kermit.columbia.edu/kermit/c-kermit/ckcker.h
2995  53. ftp://kermit.columbia.edu/kermit/c-kermit/ckcxla.h
2996  54. ftp://kermit.columbia.edu/kermit/c-kermit/ckcmai.c
2997  55. ftp://kermit.columbia.edu/kermit/c-kermit/ckcpro.w
2998  56. ftp://kermit.columbia.edu/kermit/c-kermit/ckcfns.c
2999  57. ftp://kermit.columbia.edu/kermit/c-kermit/ckcfn2.c
3000  58. ftp://kermit.columbia.edu/kermit/c-kermit/ckcfn3.c
3001  59. http://www.columbia.edu/kermit/ckcplm.html#x4.B
3002  60. http://www.columbia.edu/kermit/ckcplm.html#x4.E
3003  61. http://www.columbia.edu/kermit/ckcplm.html#x4.D
3004  62. http://www.columbia.edu/kermit/ckcplm.html#contents
3005  63. http://www.columbia.edu/kermit/ckermit.html
3006  64. http://www.columbia.edu/kermit/index.html
3007  65. http://www.columbia.edu/kermit/ckcplm.html#x4.B
3008  66. ftp://kermit.columbia.edu/kermit/c-kermit/ckuxla.c
3009  67. ftp://kermit.columbia.edu/kermit/c-kermit/ckuxla.h
3010  68. ftp://kermit.columbia.edu/kermit/c-kermit/ckcxla.h
3011  69. ftp://kermit.columbia.edu/kermit/c-kermit/ckuxla.h
3012  70. ftp://kermit.columbia.edu/kermit/c-kermit/ckmxla.h
3013  71. ftp://kermit.columbia.edu/kermit/c-kermit/ck?xla
3014  72. ftp://kermit.columbia.edu/kermit/c-kermit/ckcuni.h
3015  73. ftp://kermit.columbia.edu/kermit/c-kermit/ckcuni.c
3016  74. http://www.columbia.edu/kermit/ckcplm.html#contents
3017  75. http://www.columbia.edu/kermit/ckermit.html
3018  76. http://www.columbia.edu/kermit/index.html
3019  77. http://www.columbia.edu/kermit/ckcplm.html#x4.B
3020  78. ftp://kermit.columbia.edu/kermit/c-kermit/ckucmd.h
3021  79. ftp://kermit.columbia.edu/kermit/c-kermit/ckucmd.c
3022  80. http://www.columbia.edu/kermit/ckcplm.html#x4.E
3023  81. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusr.h
3024  82. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusr.c
3025  83. ftp://kermit.columbia.edu/kermit/c-kermit/ckuus2.c
3026  84. ftp://kermit.columbia.edu/kermit/c-kermit/ckuus3.c
3027  85. ftp://kermit.columbia.edu/kermit/c-kermit/ckuus4.c
3028  86. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusy.c
3029  87. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusx.c
3030  88. ftp://kermit.columbia.edu/kermit/c-kermit/ckuver.h
3031  89. ftp://kermit.columbia.edu/kermit/c-kermit/ckuscr.c
3032  90. ftp://kermit.columbia.edu/kermit/c-kermit/ckudia.c
3033  91. ftp://kermit.columbia.edu/kermit/c-kermit/ckucon.c
3034  92. ftp://kermit.columbia.edu/kermit/c-kermit/ckucns.c
3035  93. http://www.columbia.edu/kermit/ckcplm.html#x4.E
3036  94. ftp://kermit.columbia.edu/kermit/c-kermit/ckcmai.c
3037  95. http://www.columbia.edu/kermit/ckcplm.html#contents
3038  96. http://www.columbia.edu/kermit/ckermit.html
3039  97. http://www.columbia.edu/kermit/index.html
3040  98. ftp://kermit.columbia.edu/kermit/c-kermit/ckufio.c
3041  99. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c
3042 100. ftp://kermit.columbia.edu/kermit/c-kermit/ckusig.c
3043 101. ftp://kermit.columbia.edu/kermit/c-kermit/ckvfio.c
3044 102. ftp://kermit.columbia.edu/kermit/c-kermit/ckusig.c
3045 103. ftp://kermit.columbia.edu/kermit/c-kermit/ckcmai.c
3046 104. http://www.columbia.edu/kermit/ckcplm.html#contents
3047 105. http://www.columbia.edu/kermit/ckermit.html
3048 106. http://www.columbia.edu/kermit/index.html
3049 107. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c
3050 108. ftp://kermit.columbia.edu/kermit/c-kermit/ckvtio.c
3051 109. http://www.columbia.edu/kermit/ckcplm.html#x2
3052 110. http://www.columbia.edu/kermit/ckcplm.html#xa1
3053 111. http://www.columbia.edu/kermit/ckuins.html
3054 112. ftp://kermit.columbia.edu/kermit/c-kermit/ckcnet.h
3055 113. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c
3056 114. http://www.columbia.edu/kermit/ckcplm.html#contents
3057 115. http://www.columbia.edu/kermit/ckermit.html
3058 116. http://www.columbia.edu/kermit/index.html
3059 117. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c
3060 118. ftp://kermit.columbia.edu/kermit/c-kermit/ckcnet.h
3061 119. ftp://kermit.columbia.edu/kermit/c-kermit/ckcnet.c
3062 120. ftp://kermit.columbia.edu/kermit/c-kermit/cklnet.c
3063 121. http://www.columbia.edu/kermit/ckcplm.html#contents
3064 122. http://www.columbia.edu/kermit/ckermit.html
3065 123. http://www.columbia.edu/kermit/index.html
3066 124. ftp://kermit.columbia.edu/kermit/c-kermit/ckctel.h
3067 125. ftp://kermit.columbia.edu/kermit/c-kermit/ckctel.c
3068 126. http://www.columbia.edu/kermit/ckcplm.html#contents
3069 127. http://www.columbia.edu/kermit/ckermit.html
3070 128. http://www.columbia.edu/kermit/index.html
3071 129. http://www.columbia.edu/kermit/ckcplm.html#contents
3072 130. http://www.columbia.edu/kermit/ckermit.html
3073 131. http://www.columbia.edu/kermit/index.html
3074 132. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusx.c
3075 133. http://www.columbia.edu/kermit/ckcplm.html#contents
3076 134. http://www.columbia.edu/kermit/ckermit.html
3077 135. http://www.columbia.edu/kermit/index.html
3078 136. http://www.columbia.edu/kermit/ckcplm.html#contents
3079 137. http://www.columbia.edu/kermit/ckermit.html
3080 138. http://www.columbia.edu/kermit/index.html
3081 139. http://www.columbia.edu/kermit/ckcplm.html#top
3082 140. http://www.columbia.edu/kermit/ckcplm.html#contents
3083 141. http://www.columbia.edu/kermit/ckermit.html
3084 142. http://www.columbia.edu/kermit/index.html
3085 143. http://www.columbia.edu/kermit/index.html
3086 144. http://www.columbia.edu/
3087 145. mailto:kermit@columbia.edu
Note: See TracBrowser for help on using the repository browser.