source: trunk/third/kermit/ckcdeb.h @ 20085

Revision 20085, 132.9 KB checked in by zacheiss, 21 years ago (diff)
Merge with kermit 8.0.
Line 
1/*  C K C D E B . H  */
2
3/*
4Wed Feb 26 12:57:57 2003
5
6  NOTE TO CONTRIBUTORS: This file, and all the other C-Kermit files, must be
7  compatible with C preprocessors that support only #ifdef, #else, #endif,
8  #define, and #undef.  Please do not use #if, logical operators, or other
9  later-model preprocessor features in any of the portable C-Kermit modules.
10  You can, of course, use these constructions in platform-specific modules
11  when you know they are supported.
12*/
13
14/*
15  This file is included by all C-Kermit modules, including the modules
16  that aren't specific to Kermit (like the command parser and the ck?tio and
17  ck?fio modules).  It should be included BEFORE any other C-Kermit header
18  files.  It specifies format codes for debug(), tlog(), and similar
19  functions, and includes any necessary definitions to be used by all C-Kermit
20  modules, and also includes some feature selection compile-time switches, and
21  also system- or compiler-dependent definitions, plus #includes and prototypes
22  required by all C-Kermit modules.
23*/
24
25/*
26  Author: Frank da Cruz <fdc@columbia.edu>,
27  Columbia University Academic Information Systems, New York City.
28
29  Copyright (C) 1985, 2002,
30    Trustees of Columbia University in the City of New York.
31    All rights reserved.  See the C-Kermit COPYING.TXT file or the
32    copyright text in the ckcmai.c module for disclaimer and permissions.
33*/
34
35/*
36  Etymology: The name of this file means "C-Kermit Common-C-Language Debugging
37  Header", because originally it contained only the formats (F000-F111) for
38  the debug() and tlog() functions.  See how it has grown...
39*/
40
41#ifndef CKCDEB_H                        /* Don't include me more than once. */
42#define CKCDEB_H
43
44#ifndef OS2
45/* Unsigned numbers */
46
47#ifndef USHORT
48#define USHORT unsigned short
49#endif /* USHORT */
50
51#ifndef UINT
52#define UINT unsigned int
53#endif /* UINT */
54
55#ifndef ULONG
56#define ULONG unsigned long
57#endif /* ULONG */
58#endif /* OS2 */
59
60/* Structure definitions for Kermit file attributes */
61/* All strings come as pointer and length combinations */
62/* Empty string (or for numeric variables, -1) = unused attribute. */
63
64struct zstr {             /* string format */
65    int len;              /* length */
66    char *val;            /* value */
67};
68struct zattr {            /* Kermit File Attribute structure */
69    long lengthk;         /* (!) file length in K */
70    struct zstr type;     /* (") file type (text or binary) */
71    struct zstr date;     /* (#) file creation date yyyymmdd[ hh:mm[:ss]] */
72    struct zstr creator;  /* ($) file creator id */
73    struct zstr account;  /* (%) file account */
74    struct zstr area;     /* (&) area (e.g. directory) for file */
75    struct zstr password; /* (') password for area */
76    long blksize;         /* (() file blocksize */
77    struct zstr xaccess;  /* ()) file access: new, supersede, append, warn */
78    struct zstr encoding; /* (*) encoding (transfer syntax) */
79    struct zstr disp;     /* (+) disposition (mail, message, print, etc) */
80    struct zstr lprotect; /* (,) protection (local syntax) */
81    struct zstr gprotect; /* (-) protection (generic syntax) */
82    struct zstr systemid; /* (.) ID for system of origin */
83    struct zstr recfm;    /* (/) record format */
84    struct zstr sysparam; /* (0) system-dependent parameter string */
85    long length;          /* (1) exact length on system of origin */
86    struct zstr charset;  /* (2) transfer syntax character set */
87#ifdef OS2
88    struct zstr longname; /* OS/2 longname if applicable */
89#endif /* OS2 */
90    struct zstr reply;    /* This goes last, used for attribute reply */
91};
92
93/* Kermit file information structure */
94
95struct filinfo {
96  int bs;                               /* Blocksize */
97  int cs;                               /* Character set */
98  long rl;                              /* Record length */
99  int org;                              /* Organization */
100  int fmt;                              /* Record format */
101  int cc;                               /* Carriage control */
102  int typ;                              /* Type (text/binary) */
103  int dsp;                              /* Disposition */
104  char *os_specific;                    /* OS-specific attributes */
105#ifdef OS2
106  unsigned long int lblopts;            /* LABELED FILE options bitmask */
107#else
108  int lblopts;
109#endif /* OS2 */
110};
111
112#ifdef MACOSX10                         /* Mac OS X 1.0 */
113#ifndef MACOSX                          /* implies Mac OS X */
114#define MACOSX
115#endif /* MACOSX */
116#endif /* MACOSX10 */
117
118#ifdef MACOSX                           /* Mac OS X */
119#ifndef BSD44                           /* implies 4.4 BSD */
120#define BSD44
121#endif /* BSD44 */
122#endif /* MACOSX */
123
124#ifdef SCO_OSR505                       /* SCO 3.2v5.0.5 */
125#ifndef SCO_OSR504                      /* implies SCO 3.2v5.0.4 */
126#define SCO_OSR504
127#endif /* SCO_OSR504 */
128#endif /* SCO_OSR505 */
129
130#ifdef SCO_OSR504                       /* SCO 3.2v5.0.4 */
131#ifndef CK_SCOV5                        /* implies SCO 3.2v5.0 */
132#define CK_SCOV5
133#endif /* CK_SCOV5 */
134#include <sys/types.h>                  /* To sidestep header-file mess */
135#endif /* SCO_OSR504 */
136
137#ifdef CK_SCOV5
138#ifndef ANYSCO
139#define ANYSCO
140#endif /* ANYSCO */
141#endif /* CK_SCOV5 */
142
143#ifdef UNIXWARE
144#ifndef ANYSCO
145#define ANYSCO
146#endif /* ANYSCO */
147#endif /* UNIXWARE */
148
149#ifdef CK_SCO32V4                       /* SCO 3.2v4 */
150#ifndef ANYSCO
151#define ANYSCO
152#endif /* ANYSCO */
153#ifndef XENIX
154#define XENIX
155#endif /* XENIX */
156#ifndef SVR3
157#define SVR3
158#endif /* SVR3 */
159#ifndef DIRENT
160#define DIRENT
161#endif /* DIRENT */
162#ifndef RENAME
163#define RENAME
164#endif /* RENAME */
165#ifndef SVR3JC
166#define SVR3JC
167#endif /* SVR3JC */
168#ifndef CK_RTSCTS
169#define CK_RTSCTS
170#endif /* CK_RTSCTS */
171#ifndef PID_T
172#define PID_T pid_t
173#endif /* PID_T */
174#ifndef PWID_T
175#define PWID_T int
176#endif /* PWID_T */
177#endif /* CK_SCO32V4 */
178
179#ifdef NOICP                            /* If no command parser */
180#ifndef NOSPL                           /* Then no script language either */
181#define NOSPL
182#endif /* NOSPL */
183#ifndef NOCSETS                         /* Or characer sets */
184#define NOCSETS
185#endif /* NOCSETS */
186#ifndef NOFTP                           /* Or FTP client */
187#define NOFTP
188#endif /* NOFTP */
189#endif /* NOICP */
190
191/* Built-in makefile entries */
192
193#ifdef SOLARIS9                         /* Solaris 9 implies 8 */
194#ifndef SOLARIS8
195#define SOLARIS8
196#endif /* SOLARIS8 */
197#endif /* SOLARIS9 */
198
199#ifdef SOLARIS8                         /* Solaris 8 implies 7 */
200#ifndef SOLARIS7
201#define SOLARIS7
202#endif /* SOLARIS7 */
203#endif /* SOLARIS8 */
204
205#ifdef SOLARIS7                         /* Solaris 7 implies 2.6 */
206#ifndef SOLARIS26
207#define SOLARIS26
208#endif /* SOLARIS26 */
209#endif /* SOLARIS7 */
210
211#ifdef SOLARIS26                        /* Solaris 2.6 implies 2.5 */
212#ifndef SOLARIS25
213#define SOLARIS25
214#endif /* SOLARIS25 */
215#endif /* SOLARIS26 */
216
217#ifdef SOLARIS25                        /* Solaris 2.5 implies Solaris */
218#ifndef SOLARIS
219#define SOLARIS
220#endif /* SOLARIS */
221#ifndef POSIX                           /* And POSIX */
222#define POSIX
223#endif /* POSIX */
224#ifndef CK_WREFRESH                     /* And this (curses) */
225#define CK_WREFRESH
226#endif /* CK_WREFRESH */
227#endif /* SOLARIS25 */
228
229#ifdef SOLARIS24                        /* Solaris 2.4 implies Solaris */
230#ifndef SOLARIS
231#define SOLARIS
232#endif /* SOLARIS */
233#endif /* SOLARIS24 */
234
235#ifdef SOLARIS                          /* Solaris gets "POSIX" RTS/CTS API */
236#ifdef POSIX
237#ifndef POSIX_CRTSCTS
238#define POSIX_CRTSCTS
239#endif /* POSIX_CRTSCTS */
240#endif /* POSIX */
241#endif /* SOLARIS */
242
243#ifdef SUN4S5                           /* Sun-4 System V environment */
244#ifndef SVR3                            /* implies System V R3 or later */
245#define SVR3
246#endif /* SVR3 */
247#endif /* SUN4S5 */
248#ifdef SUNOS41                          /* SUNOS41 implies SUNOS4 */
249#ifndef SUNOS4
250#define SUNOS4
251#endif /* SUNOS4 */
252#endif /* SUNOS41 */
253
254#ifdef SUN4S5                           /* Sun-4 System V environment */
255#ifndef SVR3                            /* implies System V R3 or later */
256#define SVR3
257#endif /* SVR3 */
258#endif /* SUN4S5 */
259
260#ifdef SUNOS41                          /* SUNOS41 implies SUNOS4 */
261#ifndef SUNOS4
262#define SUNOS4
263#endif /* SUNOS4 */
264#endif /* SUNOS41 */
265
266#ifdef SUNOS4                           /* Built-in SUNOS4 makefile entry */
267#ifndef UNIX
268#define UNIX
269#endif /* UNIX */
270#ifndef BSD4
271#define BSD4
272#endif /* BSD4 */
273#ifndef NOSETBUF
274#define NOSETBUF
275#endif /* NOSETBUF */
276#ifndef DIRENT
277#define DIRENT
278#endif /* DIRENT */
279#ifndef NONET
280#ifndef TCPSOCKET
281#define TCPSOCKET
282#endif /* TCPSOCKET */
283#endif /* NONET */
284#ifndef SAVEDUID
285#define SAVEDUID
286#endif /* SAVEDUID */
287#ifndef DYNAMIC
288#define DYNAMIC
289#endif /* DYNAMIC */
290#endif /* SUNOS4 */
291
292#ifdef SOLARIS                          /* Built in makefile entry */
293#ifndef NOSETBUF                        /* for Solaris 2.x */
294#define NOSETBUF
295#endif /* NOSETBUF */
296#ifndef NOCURSES
297#ifndef CK_CURSES
298#define CK_CURSES
299#endif /* CK_CURSES */
300#endif /* NOCURSES */
301#ifndef CK_NEWTERM
302#define CK_NEWTERM
303#endif /* CK_NEWTERM */
304#ifndef DIRENT
305#define DIRENT
306#endif /* DIRENT */
307#ifndef NONET
308#ifndef TCPSOCKET
309#define TCPSOCKET
310#endif /* TCPSOCKET */
311#endif /* NONET */
312#ifndef UNIX
313#define UNIX
314#endif /* UNIX */
315#ifndef SVR4
316#define SVR4
317#endif /* SVR4 */
318#ifndef HADDRLIST
319#define HADDRLIST
320#endif /* HADDRLIST */
321#ifndef STERMIOX
322#define STERMIOX
323#endif /* STERMIOX */
324#ifndef SELECT
325#define SELECT
326#endif /* SELECT */
327#ifndef DYNAMIC
328#define DYNAMIC
329#endif /* DYNAMIC */
330#ifndef NOUUCP
331#ifndef HDBUUCP
332#define HDBUUCP
333#endif /* HDBUUCP */
334#endif /* NOUUCP */
335#endif /* SOLARIS */
336
337/* Features that can be eliminated from a no-file-transfer version */
338
339#ifdef NOXFER
340#ifndef NOFTP
341#define NOFTP
342#endif /* NOFTP */
343#ifndef OS2
344#ifndef NOCURSES                        /* Fullscreen file-transfer display */
345#define NOCURSES
346#endif /* NOCURSES */
347#endif /* OS2 */
348#ifndef NOCKXYZ                         /* XYZMODEM support */
349#define NOCKXYZ
350#endif /* NOCKXYZ */
351#ifndef NOCKSPEED                       /* Ctrl-char unprefixing */
352#define NOCKSPEED
353#endif /* NOCKSPEED */
354#ifndef NOSERVER                        /* Server mode */
355#define NOSERVER
356#endif /* NOSERVER */
357#ifndef NOCKTIMERS                      /* Dynamic packet timers */
358#define NOCKTIMERS
359#endif /* NOCKTIMERS */
360#ifndef NOPATTERNS                      /* File-type patterns */
361#define NOPATTERNS
362#endif /* NOPATTERNS */
363#ifndef NOSTREAMING                     /* Streaming */
364#define NOSTREAMING
365#endif /* NOSTREAMING */
366#ifndef NOIKSD                          /* Internet Kermit Service */
367#define NOIKSD
368#endif /* NOIKSD */
369#ifndef NOPIPESEND                      /* Sending from pipes */
370#define NOPIPESEND
371#endif /* NOPIPESEND */
372#ifndef NOAUTODL                        /* Autodownload */
373#define NOAUTODL
374#endif /* NOAUTODL */
375#ifndef NOMSEND                         /* MSEND */
376#define NOMSEND
377#endif /* NOMSEND */
378#ifndef NOTLOG                          /* Transaction logging */
379#define NOTLOG
380#endif /* NOTLOG */
381#ifndef NOCKXXCHAR                      /* Packet character doubling */
382#define NOCKXXCHAR
383#endif /* NOCKXXCHAR */
384#endif /* NOXFER */
385
386#ifdef NOICP                            /* No Interactive Command Parser */
387#ifndef NODIAL                          /* Implies No DIAL command */
388#define NODIAL
389#endif /* NODIAL */
390#ifndef NOCKXYZ                         /* and no external protocols */
391#define NOCKXYZ
392#endif /* NOCKXYZ */
393#endif /* NOICP */
394
395#ifndef NOIKSD
396#ifdef IKSDONLY
397#ifndef IKSD
398#define IKSD
399#endif /* IKSD */
400#ifndef NOLOCAL
401#define NOLOCAL
402#endif /* NOLOCAL */
403#ifndef NOPUSH
404#define NOPUSH
405#endif /* NOPUSH */
406#ifndef TNCODE
407#define TNCODE
408#endif /* TNCODE */
409#ifndef TCPSOCKET
410#define TCPSOCKET
411#endif /* TCPSOCKET */
412#ifndef NETCONN
413#define NETCONN
414#endif /* NETCONN */
415#ifdef SUNX25
416#undef SUNX25
417#endif /* SUNX25 */
418#ifdef IBMX25
419#undef IBMX25
420#endif /* IBMX25 */
421#ifdef STRATUSX25
422#undef STRATUSX25
423#endif /* STRATUSX25 */
424#ifdef CK_NETBIOS
425#undef CK_NETBIOS
426#endif /* CK_NETBIOS */
427#ifdef SUPERLAT
428#undef SUPERLAT
429#endif /* SUPERLAT */
430#ifdef NPIPE
431#undef NPIPE
432#endif /* NPIPE */
433#ifdef NETFILE
434#undef NETFILE
435#endif /* NETFILE */
436#ifdef NETCMD
437#undef NETCMD
438#endif /* NETCMD */
439#ifdef NETPTY
440#undef NETPTY
441#endif /* NETPTY */
442#ifdef RLOGCODE
443#undef RLOGCODE
444#endif /* RLOGCODE */
445#ifdef NETDLL
446#undef NETDLL
447#endif /* NETDLL */
448#ifndef NOSSH
449#undef NOSSH
450#endif /* NOSSH */
451#ifndef NOFORWARDX
452#define NOFORWARDX
453#endif /* NOFORWARDX */
454#ifndef NOBROWSER
455#define NOBROWSER
456#endif /* NOBROWSER */
457#ifndef NOHTTP
458#define NOHTTP
459#endif /* NOHTTP */
460#ifndef NOFTP
461#define NOFTP
462#endif /* NOFTP */
463#ifndef NO_COMPORT
464#define NO_COMPORT
465#endif /* NO_COMPORT */
466#endif /* IKSDONLY */
467#endif /* NOIKSD */
468
469/* Features that can be eliminated from a remote-only version */
470
471#ifdef NOLOCAL
472#ifndef NOFTP
473#define NOFTP
474#endif /* NOFTP */
475#ifndef NOHTTP
476#define NOHTTP
477#endif /* NOHTTP */
478#ifndef NOSSH
479#define NOSSH
480#endif /* NOSSH */
481#ifndef NOTERM
482#define NOTERM
483#endif /* NOTERM */
484#ifndef NOCURSES                        /* Fullscreen file-transfer display */
485#define NOCURSES
486#endif /* NOCURSES */
487#ifndef NODIAL
488#define NODIAL
489#endif /* NODIAL */
490#ifndef NOSCRIPT
491#define NOSCRIPT
492#endif /* NOSCRIPT */
493#ifndef NOSETKEY
494#define NOSETKEY
495#endif /* NOSETKEY */
496#ifndef NOKVERBS
497#define NOKVERBS
498#endif /* NOKVERBS */
499#ifndef NOXMIT
500#define NOXMIT
501#endif /* NOXMIT */
502#ifdef CK_CURSES
503#undef CK_CURSES
504#endif /* CK_CURSES */
505#ifndef IKSDONLY
506#ifndef NOAPC
507#define NOAPC
508#endif /* NOAPC */
509#ifndef NONET
510#define NONET
511#endif /* NONET */
512#endif /* IKSDONLY */
513#endif /* NOLOCAL */
514
515#ifdef NONET
516#ifdef NETCONN
517#undef NETCONN
518#endif /* NETCONN */
519#ifdef TCPSOCKET
520#undef TCPSOCKET
521#endif /* TCPSOCKET */
522#ifndef NOTCPOPTS
523#define NOTCPOPTS
524#endif /* NOTCPOPTS */
525#ifdef SUNX25
526#undef SUNX25
527#endif /* SUNX25 */
528#ifdef IBMX25
529#undef IBMX25
530#endif /* IBMX25 */
531#ifdef STRATUSX25
532#undef STRATUSX25
533#endif /* STRATUSX25 */
534#ifdef CK_NETBIOS
535#undef CK_NETBIOS
536#endif /* CK_NETBIOS */
537#ifdef SUPERLAT
538#undef SUPERLAT
539#endif /* SUPERLAT */
540#ifdef NPIPE
541#undef NPIPE
542#endif /* NPIPE */
543#ifdef NETFILE
544#undef NETFILE
545#endif /* NETFILE */
546#ifdef NETCMD
547#undef NETCMD
548#endif /* NETCMD */
549#ifdef NETPTY
550#undef NETPTY
551#endif /* NETPTY */
552#ifdef RLOGCODE
553#undef RLOGCODE
554#endif /* RLOGCODE */
555#ifdef NETDLL
556#undef NETDLL
557#endif /* NETDLL */
558#ifndef NOSSH
559#define NOSSH
560#endif /* NOSSH */
561#ifndef NOFTP
562#define NOFTP
563#endif /* NOFTP */
564#ifndef NOHTTP
565#define NOHTTP
566#endif /* NOHTTP */
567#ifndef NOBROWSER
568#define NOBROWSER
569#endif /* NOBROWSER */
570#ifndef NOFORWARDX
571#define NOFORWARDX
572#endif /* NOFORWARDX */
573#endif /* NONET */
574
575#ifdef IKSDONLY
576#ifdef SUNX25
577#undef SUNX25
578#endif /* SUNX25 */
579#ifdef IBMX25
580#undef IBMX25
581#endif /* IBMX25 */
582#ifdef STRATUSX25
583#undef STRATUSX25
584#endif /* STRATUSX25 */
585#ifdef CK_NETBIOS
586#undef CK_NETBIOS
587#endif /* CK_NETBIOS */
588#ifdef SUPERLAT
589#undef SUPERLAT
590#endif /* SUPERLAT */
591#ifdef NPIPE
592#undef NPIPE
593#endif /* NPIPE */
594#ifdef NETFILE
595#undef NETFILE
596#endif /* NETFILE */
597#ifdef NETCMD
598#undef NETCMD
599#endif /* NETCMD */
600#ifdef NETPTY
601#undef NETPTY
602#endif /* NETPTY */
603#ifdef RLOGCODE
604#undef RLOGCODE
605#endif /* RLOGCODE */
606#ifdef NETDLL
607#undef NETDLL
608#endif /* NETDLL */
609#ifndef NOSSH
610#define NOSSH
611#endif /* NOSSH */
612#ifndef NOHTTP
613#define NOHTTP
614#endif /* NOHTTP */
615#ifndef NOBROWSER
616#define NOBROWSER
617#endif /* NOBROWSER */
618#endif /* IKSDONLY */
619/*
620  Note that none of the above precludes TNCODE, which can be defined in
621  the absence of TCPSOCKET, etc, to enable server-side Telnet negotation.
622*/
623#ifndef TNCODE                          /* This is for the benefit of */
624#ifdef TCPSOCKET                        /* modules that might need TNCODE */
625#define TNCODE                          /* not all of ckcnet.h... */
626#endif /* TCPSOCKET */
627#endif /* TNCODE */
628
629#ifndef NETCONN
630#ifdef TCPSOCKET
631#define NETCONN
632#endif /* TCPSOCKET */
633#endif /* NETCONN */
634
635#ifndef DEFPAR                          /* Default parity */
636#define DEFPAR 0                        /* Must be here because it is used */
637#endif /* DEFPAR */                     /* by all classes of modules */
638
639#ifdef NT
640#ifndef OS2ORWIN32
641#define OS2ORWIN32
642#endif /* OS2ORWIN32 */
643#ifndef OS2
644#define WIN32ONLY
645#endif /* OS2 */
646#endif /* NT */
647
648#ifdef OS2                              /* For OS/2 debugging */
649#ifndef OS2ORWIN32
650#define OS2ORWIN32
651#endif /* OS2ORWIN32 */
652#include "ckoker.h"
653#ifdef NT
654#define NOCRYPT
655#include <windows.h>
656#define NTSIG
657#else /* NT */
658#define OS2ONLY
659#include <os2def.h>
660#endif /* NT */
661#ifndef OS2ORUNIX
662#define OS2ORUNIX
663#endif /* OS2ORUNIX */
664#ifndef OS2ORVMS
665#define OS2ORVMS
666#endif /* OS2ORVMS */
667#endif /* OS2 */
668
669#include <stdio.h>                      /* Begin by including this. */
670#include <ctype.h>                      /* and this. */
671
672/* System-type compilation switches */
673
674#ifdef FT21                             /* Fortune For:Pro 2.1 implies 1.8 */
675#ifndef FT18
676#define FT18
677#endif /* FT18 */
678#endif /* FT21 */
679
680#ifdef __bsdi__
681#ifndef BSDI
682#define BSDI
683#endif /* BSDI */
684#endif /* __bsdi__ */
685
686#ifdef AIXPS2                           /* AIXPS2 implies AIX370 */
687#ifndef AIX370
688#define AIX370
689#endif /* AIX370 */
690#endif /* AIXPS2 */
691
692#ifdef AIX370                           /* AIX PS/2 or 370 implies BSD4 */
693#ifndef BSD4
694#define BSD4
695#endif /* BSD4 */
696#endif /* AIX370 */
697
698#ifdef AIXESA                           /* AIX/ESA implies BSD4.4 */
699#ifndef BSD44
700#define BSD44
701#endif /* BSD44 */
702#endif /* AIXESA */
703
704#ifdef AIX53                            /* AIX53 implies AIX52 */
705#ifndef AIX52
706#define AIX52
707#endif /* AIX52 */
708#endif /* AIX53 */
709
710#ifdef AIX52                            /* AIX52 implies AIX51 */
711#ifndef AIX51
712#define AIX51
713#endif /* AIX51 */
714#endif /* AIX52 */
715
716#ifdef AIX51                            /* AIX51 implies AIX50 */
717#ifndef AIX50
718#define AIX50
719#endif /* AIX50 */
720#endif /* AIX51 */
721
722#ifdef AIX50                            /* AIX50 implies AIX45 */
723#ifndef AIX45
724#define AIX45
725#endif /* AIX45 */
726#endif /* AIX50 */
727
728#ifdef AIX45                            /* AIX45 implies AIX44 */
729#ifndef AIX44
730#define AIX44
731#endif /* AIX44 */
732#endif /* AIX45 */
733
734#ifdef AIX44                            /* AIX44 implies AIX43 */
735#ifndef AIX43
736#define AIX43
737#endif /* AIX43 */
738#endif /* AIX44 */
739
740#ifdef AIX43                            /* AIX43 implies AIX42 */
741#ifndef AIX42
742#define AIX42
743#endif /* AIX42 */
744#endif /* AIX43 */
745
746#ifdef AIX42                            /* AIX42 implies AIX41 */
747#ifndef AIX41
748#define AIX41
749#endif /* AIX41 */
750#endif /* AIX42 */
751
752#ifdef SV68R3V6                         /* System V/68 R32V6 implies SVR3 */
753#ifndef SVR3
754#define SVR3
755#endif /* SVR3 */
756#endif /* SV68R3V6 */
757
758#ifdef SV88R32                          /* System V/88 R32 implies SVR3 */
759#ifndef SVR3
760#define SVR3
761#endif /* SVR3 */
762#endif /* SV88R32 */
763
764#ifdef DGUX540                          /* DG UX 5.40 implies Sys V R 4 */
765#ifndef SVR4
766#define SVR4
767#endif /* SVR4 */
768#endif /* DGUX540 */
769
770#ifndef DGUX
771#ifdef DGUX540                          /* DG/UX 5.40 implies DGUX */
772#define DGUX
773#else
774#ifdef DGUX430                          /* So does DG/UX 4.30 */
775#define DGUX
776#endif /* DGUX430 */
777#endif /* DGUX540 */
778#endif /* DGUX */
779
780#ifdef IRIX65                           /* IRIX 6.5 implies IRIX 6.4 */
781#ifndef IRIX64
782#define IRIX64
783#endif /* IRIX64 */
784#endif /* IRIX65 */
785
786#ifdef IRIX64                           /* IRIX 6.4 implies IRIX 6.2 */
787#ifndef BSD44ORPOSIX
788#define BSD44ORPOSIX                    /* for ckutio's benefit */
789#endif /* BSD44ORPOSIX */
790#ifndef IRIX62
791#define IRIX62
792#endif /* IRIX62 */
793#endif /* IRIX64 */
794
795#ifdef IRIX62                           /* IRIX 6.2 implies IRIX 6.0 */
796#ifndef IRIX60
797#define IRIX60
798#endif /* IRIX60 */
799#endif /* IRIX62 */
800
801#ifdef IRIX60                           /* IRIX 6.0 implies IRIX 5.1 */
802#ifndef IRIX51
803#define IRIX51
804#endif /* IRIX51 */
805#ifndef IRIX52                          /* And IRIX 5.2 (for hwfc) */
806#define IRIX52
807#endif /* IRIX52 */
808#endif /* IRIX60 */
809
810#ifndef IRIX                            /* IRIX 4.0 or greater implies IRIX */
811#ifdef IRIX64
812#define IRIX
813#else
814#ifdef IRIX62
815#define IRIX
816#else
817#ifdef IRIX60
818#define IRIX
819#else
820#ifdef IRIX51
821#define IRIX
822#else
823#ifdef IRIX40
824#define IRIX
825#endif /* IRIX40 */
826#endif /* IRIX51 */
827#endif /* IRIX60 */
828#endif /* IRIX62 */
829#endif /* IRIX64 */
830#endif /* IRIX */
831
832#ifdef MIPS                             /* MIPS System V environment */
833#ifndef SVR3                            /* implies System V R3 or later */
834#define SVR3
835#endif /* SVR3 */
836#endif /* MIPS */
837
838#ifdef HPUX9                            /* HP-UX 9.x */
839#ifndef SVR3
840#define SVR3
841#endif /* SVR3 */
842#ifndef HPUX
843#define HPUX
844#endif /* HPUX */
845#ifndef HPUX9PLUS
846#define HPUX9PLUS
847#endif /* HPUX9PLUS */
848#endif /* HPUX9 */
849
850#ifdef HPUX10                           /* HP-UX 10.x */
851#ifndef HPUX1010                        /* If anything higher is defined */
852#ifdef HPUX1020                         /* define HPUX1010 too. */
853#define HPUX1010
854#endif /* HPUX1020 */
855#ifdef HPUX1030
856#define HPUX1010
857#endif /* HPUX1030 */
858#endif /* HPUX1010 */
859
860#ifdef HPUX1100                         /* HP-UX 11.00 implies 10.10 */
861#ifndef HPUX1010
862#define HPUX1010
863#endif /* HPUX1010 */
864#endif /* HPUX1100 */
865
866#ifndef SVR4
867#define SVR4
868#endif /* SVR4 */
869#ifndef HPUX
870#define HPUX
871#endif /* HPUX */
872#ifndef HPUX9PLUS
873#define HPUX9PLUS
874#endif /* HPUX9PLUS */
875#endif /* HPUX10 */
876
877#ifdef QNX                              /* QNX Software Systems Inc */
878#ifndef POSIX                           /* QNX 4.0 or later is POSIX */
879#define POSIX
880#endif /* POSIX */
881#ifndef __386__                         /* Comes in 16-bit and 32-bit */
882#define __16BIT__
883#define CK_QNX16
884#else
885#define __32BIT__
886#define CK_QNX32
887#endif /* __386__ */
888#endif /* QNX */
889
890/*
891  4.4BSD is a mixture of System V R4, POSIX, and 4.3BSD.
892*/
893#ifdef BSD44                            /* 4.4 BSD */
894#ifndef SVR4                            /* BSD44 implies SVR4 */
895#define SVR4
896#endif /* SVR4 */
897#ifndef NOSETBUF                        /* NOSETBUF is safe */
898#define NOSETBUF
899#endif /* NOSETBUF */
900#ifndef DIRENT                          /* Uses <dirent.h> */
901#define DIRENT
902#endif /* DIRENT */
903#endif /* BSD44 */
904
905#ifdef OPENBSD                          /* OpenBSD might or might not */
906#ifndef __OpenBSD__                     /* have this defined... */
907#define __OpenBSD__
908#endif /* __OpenBSD__ */
909#endif /* OPENBSD */
910
911#ifdef SVR3                             /* SVR3 implies ATTSV */
912#ifndef ATTSV
913#define ATTSV
914#endif /* ATTSV */
915#endif /* SVR3 */
916
917#ifdef SVR4                             /* SVR4 implies ATTSV */
918#ifndef ATTSV
919#define ATTSV
920#endif /* ATTSV */
921#ifndef SVR3                            /* ...as well as SVR3 */
922#define SVR3
923#endif /* SVR3 */
924#endif /* SVR4 */
925
926#ifdef OXOS
927#ifndef ATTSV
928#define ATTSV                           /* OXOS implies ATTSV */
929#endif /* ! ATTSV */
930#define SW_ACC_ID                       /* access() wants privs on */
931#define kill priv_kill                  /* kill() wants privs on */
932#ifndef NOSETBUF
933#define NOSETBUF                        /* NOSETBUF is safe */
934#endif /* ! NOSETBUF */
935#endif /* OXOS */
936
937#ifdef UTSV                             /* UTSV implies ATTSV */
938#ifndef ATTSV
939#define ATTSV
940#endif /* ATTSV */
941#endif /* UTSV */
942
943#ifdef XENIX                            /* XENIX implies ATTSV */
944#ifndef ATTSV
945#define ATTSV
946#endif /* ATTSV */
947#endif /* XENIX */
948
949#ifdef AUX                              /* AUX implies ATTSV */
950#ifndef ATTSV
951#define ATTSV
952#endif /* ATTSV */
953#endif /* AUX */
954
955#ifdef ATT7300                          /* ATT7300 implies ATTSV */
956#ifndef ATTSV
957#define ATTSV
958#endif /* ATTSV */
959#endif /* ATT7300 */
960
961#ifdef ATT6300                          /* ATT6300 implies ATTSV */
962#ifndef ATTSV
963#define ATTSV
964#endif /* ATTSV */
965#endif /* ATT6300 */
966
967#ifdef HPUX                             /* HPUX implies ATTSV */
968#ifndef ATTSV
969#define ATTSV
970#endif /* ATTSV */
971#endif /* HPUX */
972
973#ifdef ISIII                            /* ISIII implies ATTSV */
974#ifndef ATTSV
975#define ATTSV
976#endif /* ATTSV */
977#endif /* ISIII */
978
979#ifdef NEXT33                           /* NEXT33 implies NEXT */
980#ifndef NEXT
981#define NEXT
982#endif /* NEXT */
983#endif /* NEXT33 */
984
985#ifdef NEXT                             /* NEXT implies BSD4 */
986#ifndef BSD4
987#define BSD4
988#endif /* BSD4 */
989#endif /* NEXT */
990
991#ifdef BSD41                            /* BSD41 implies BSD4 */
992#ifndef BSD4
993#define BSD4
994#endif /* BSD4 */
995#endif /* BSD41 */
996
997#ifdef BSD43                            /* BSD43 implies BSD4 */
998#ifndef BSD4
999#define BSD4
1000#endif /* BSD4 */
1001#endif /* BSD43 */
1002
1003#ifdef BSD4                             /* BSD4 implies ANYBSD */
1004#ifndef ANYBSD
1005#define ANYBSD
1006#endif /* ANYBSD */
1007#endif /* BSD4 */
1008
1009#ifdef BSD29                            /* BSD29 implies ANYBSD */
1010#ifndef ANYBSD
1011#define ANYBSD
1012#endif /* ANYBSD */
1013#endif /* BSD29 */
1014
1015#ifdef ATTSV                            /* ATTSV implies UNIX */
1016#ifndef UNIX
1017#define UNIX
1018#endif /* UNIX */
1019#endif /* ATTSV */
1020
1021#ifdef ANYBSD                           /* ANYBSD implies UNIX */
1022#ifndef UNIX
1023#define UNIX
1024#endif /* UNIX */
1025#endif /* ANYBSD */
1026
1027#ifdef POSIX                            /* POSIX implies UNIX */
1028#ifndef UNIX
1029#define UNIX
1030#endif /* UNIX */
1031#ifndef DIRENT                          /* and DIRENT, i.e. <dirent.h> */
1032#ifndef SDIRENT
1033#define DIRENT
1034#endif /* SDIRENT */
1035#endif /* DIRENT */
1036#ifndef NOFILEH                         /* POSIX doesn't use <sys/file.h> */
1037#define NOFILEH
1038#endif /* NOFILEH */
1039#endif /* POSIX */
1040
1041#ifdef V7
1042#ifndef UNIX
1043#define UNIX
1044#endif /* UNIX */
1045#endif /* V7 */
1046
1047#ifdef COHERENT
1048#ifndef UNIX
1049#define UNIX
1050#endif /* UNIX */
1051#ifdef COMMENT
1052#ifndef NOCURSES
1053#define NOCURSES
1054#endif /* NOCURSES */
1055#endif /* COMMENT */
1056#endif /* COHERENT */
1057
1058#ifdef MINIX
1059#ifndef UNIX
1060#define UNIX
1061#endif /* UNIX */
1062#endif /* MINIX */
1063/*
1064  The symbol SVORPOSIX is defined for both AT&T and POSIX compilations
1065  to make it easier to select items that System V and POSIX have in common,
1066  but which BSD, V7, etc, do not have.
1067*/
1068#ifdef ATTSV
1069#ifndef SVORPOSIX
1070#define SVORPOSIX
1071#endif /* SVORPOSIX */
1072#endif /* ATTSV */
1073
1074#ifdef POSIX
1075#ifndef SVORPOSIX
1076#define SVORPOSIX
1077#endif /* SVORPOSIX */
1078#endif /* POSIX */
1079
1080/*
1081  The symbol SVR4ORPOSIX is defined for both AT&T System V R4 and POSIX
1082  compilations to make it easier to select items that System V R4 and POSIX
1083  have in common, but which BSD, V7, and System V R3 and earlier, etc, do
1084  not have.
1085*/
1086#ifdef POSIX
1087#ifndef SVR4ORPOSIX
1088#define SVR4ORPOSIX
1089#endif /* SVR4ORPOSIX */
1090#endif /* POSIX */
1091#ifdef SVR4
1092#ifndef SVR4ORPOSIX
1093#define SVR4ORPOSIX
1094#endif /* SVR4ORPOSIX */
1095#endif /* SVR4 */
1096
1097/*
1098  The symbol BSD44ORPOSIX is defined for both 4.4BSD and POSIX compilations
1099  to make it easier to select items that 4.4BSD and POSIX have in common,
1100  but which System V, BSD, V7, etc, do not have.
1101*/
1102#ifdef BSD44
1103#ifndef BSD44ORPOSIX
1104#define BSD44ORPOSIX
1105#endif /* BSD44ORPOSIX */
1106#endif /* BSD44 */
1107
1108#ifdef POSIX
1109#ifndef BSD44ORPOSIX
1110#define BSD44ORPOSIX
1111#endif /* BSD44ORPOSIX */
1112#endif /* POSIX */
1113
1114#ifdef UNIX                             /* For items common to OS/2 and UNIX */
1115#ifndef OS2ORUNIX
1116#define OS2ORUNIX
1117#endif /* OS2ORUNIX */
1118#endif /* UNIX */
1119
1120#ifdef UNIX                             /* For items common to VMS and UNIX */
1121#define VMSORUNIX
1122#else
1123#ifdef VMS
1124#define VMSORUNIX
1125#ifndef OS2ORVMS
1126#define OS2ORVMS
1127#endif /* OS2ORVMS */
1128#endif /* VMS */
1129#endif /* UNIX */
1130
1131#ifndef UNIXOROSK                       /* UNIX or OS-9 (or OS-9000) */
1132#ifdef UNIX
1133#define UNIXOROSK
1134#else
1135#ifdef OSK
1136#define UNIXOROSK
1137#endif /* OSK */
1138#endif /* UNIX */
1139#endif /* UNIXOROSK */
1140
1141#ifndef OSKORUNIX
1142#ifdef UNIXOROSK
1143#define OSKORUNIX
1144#endif /* UNIXOROSK */
1145#endif /* OSKORUNIX */
1146
1147#ifdef OS2
1148#define CK_ANSIC            /* OS/2 supports ANSIC and more extensions */
1149#endif /* OS2 */
1150
1151#ifdef OSF50                /* Newer OSF/1 versions imply older ones */
1152#ifndef OSF40
1153#define OSF40
1154#endif /* OSF40 */
1155#endif /* OSF50 */
1156
1157#ifdef OSF40
1158#ifndef OSF32
1159#define OSF32
1160#endif /* OSF32 */
1161#endif /* OSF40 */
1162
1163#ifdef OSF32
1164#ifndef OSF30
1165#define OSF30
1166#endif /* OSF30 */
1167#endif /* OSF32 */
1168
1169#ifdef OSF30
1170#ifndef OSF20
1171#define OSF20
1172#endif /* OSF20 */
1173#endif /* OSF30 */
1174
1175#ifdef OSF20
1176#ifndef OSF10
1177#define OSF10
1178#endif /* OSF10 */
1179#endif /* OSF20 */
1180
1181#ifdef __DECC                           /* For DEC Alpha VMS or OSF/1 */
1182#ifndef CK_ANSIC
1183#define CK_ANSIC                        /* Even with /stand=vaxc, need ansi */
1184#endif /* CKANSIC */
1185#ifndef SIG_V
1186#define SIG_V                           /* and signal type is VOID */
1187#endif /* SIG_V */
1188#ifndef CK_ANSILIBS
1189#define CK_ANSILIBS                     /* (Martin Zinser, Feb 1995) */
1190#endif /* CK_ANSILIBS */
1191#ifndef _POSIX_C_SOURCE
1192#define _POSIX_C_SOURCE 1
1193#endif /* _POSIX_C_SOURCE */
1194#endif  /* __DECC */
1195
1196#ifdef apollo                           /* May be ANSI-C, check further */
1197#ifdef __STDCPP__
1198#define CK_ANSIC                        /* Yes, this is real ANSI-C */
1199#define SIG_V
1200#else
1201#define NOANSI                          /* Nope, not ANSI */
1202#undef __STDC__                         /* Even though it say it is! */
1203#define SIG_I
1204#endif /* __STDCPP__ */
1205#endif /* apollo */
1206
1207#ifdef POSIX                            /* -DPOSIX on cc command line */
1208#ifndef _POSIX_SOURCE                   /* Implies _POSIX_SOURCE */
1209#define _POSIX_SOURCE
1210#endif /* _POSIX_SOURCE */
1211#endif /* POSIX */
1212
1213/*
1214  ANSI C?  That is, do we have function prototypes, new-style
1215  function declarations, and parameter type checking and coercion?
1216*/
1217#ifdef MAC                              /* MPW C is ANSI */
1218#ifndef NOANSI
1219#ifndef CK_ANSIC
1220#define CK_ANSIC
1221#endif /* CK_ANSIC */
1222#endif /* NOANSI */
1223#endif /* MAC */
1224
1225#ifdef STRATUS                          /* Stratus VOS */
1226#ifndef CK_ANSIC
1227#define CK_ANSIC
1228#endif /* CK_ANSIC */
1229#ifndef NOSTAT
1230#define NOSTAT
1231#endif /* NOSTAT */
1232#endif /* STRATUS */
1233
1234#ifndef NOANSI
1235#ifdef __STDC__                         /* __STDC__ means ANSI C */
1236#ifndef CK_ANSIC
1237#define CK_ANSIC
1238#endif /* CK_ANSIC */
1239#endif /* __STDC__ */
1240#endif /* NOANSI */
1241/*
1242  _PROTOTYP() is used for forward declarations of functions so we can have
1243  parameter and return value type checking if the compiler offers it.
1244  __STDC__ should be defined by the compiler only if function prototypes are
1245  allowed.  Otherwise, we get old-style forward declarations.  Our own private
1246  CK_ANSIC symbol tells whether we use ANSI C prototypes.  To force use of
1247  ANSI prototypes, include -DCK_ANSIC on the cc command line.  To disable the
1248  use of ANSI prototypes, include -DNOANSI.
1249*/
1250#ifdef CK_ANSIC
1251#define _PROTOTYP( func, parms ) func parms
1252#else /* Not ANSI C */
1253#define _PROTOTYP( func, parms ) func()
1254#endif /* CK_ANSIC */
1255
1256#ifndef OS2
1257#ifdef NOLOGIN                          /* NOLOGIN implies NOIKSD */
1258#ifndef NOIKSD
1259#define NOIKSD
1260#endif /* NOIKSD */
1261#endif /* NOLOGIN */
1262#endif /* OS2 */
1263
1264#ifdef NOIKSD                           /* Internet Kermit Service Daemon */
1265#ifndef OS2
1266#ifndef NOPRINTFSUBST
1267#define NOPRINTFSUBST
1268#endif /* NOPRINTFSUBST */
1269#endif /* OS2 */
1270#ifndef NOLOGIN
1271#define NOLOGIN
1272#endif /* NOLOGIN */
1273#ifndef NOSYSLOG
1274#define NOSYSLOG
1275#endif /* NOSYSLOG */
1276#ifndef NOWTMP
1277#define NOWTMP
1278#endif /* NOWTMP */
1279#else
1280#ifndef IKSD
1281#ifdef OS2ORUNIX                        /* Platforms where IKSD is supported */
1282#define IKSD
1283#endif /* OS2ORUNIX */
1284#endif /* IKSD */
1285#endif /* NOIKSD */
1286
1287#ifdef IKSD                             /* IKSD options... */
1288#ifndef IKSDCONF                        /* IKSD configuration file */
1289#ifdef UNIX
1290#define IKSDCONF "/etc/iksd.conf"
1291#else
1292#ifdef OS2
1293#define IKSDCONF "iksd.ksc"
1294#endif /* OS2 */
1295#endif /* UNIX */
1296#endif /* IKSDCONF */
1297#ifndef NOIKSDB
1298#ifndef IKSDB                           /* IKSD database */
1299#ifdef UNIX
1300#define IKSDB
1301#define IK_LCKTRIES 16                  /* How many times to try to get lock */
1302#define IK_LCKSLEEP 1                   /* How long to sleep between tries */
1303#define IK_LOCKFILE "iksd.lck"          /* Database lockfilename */
1304#define IK_DBASEDIR "/var/log/"         /* Database directory */
1305#define IK_DBASEFIL "iksd.db"           /* Database filename */
1306#else /* UNIX */
1307#ifdef OS2
1308#define IKSDB
1309#ifndef NOFTRUNCATE                     /* ftruncate() not available */
1310#define NOFTRUNCATE
1311#endif /* NOFTRUNCATE */
1312#define IK_LCKTRIES 16                  /* How many times to try to get lock */
1313#define IK_LCKSLEEP 1                   /* How long to sleep between tries */
1314#define IK_LOCKFILE "iksd.lck"          /* DB lockfilename (in systemroot) */
1315#define IK_DBASEFIL "iksd.db"           /* Database filename */
1316#endif /* OS2 */
1317#endif /* UNIX */
1318#endif /* IKSDB */
1319#endif /* NOIKSDB */
1320#endif /* IKSD */
1321/*
1322  Substitutes for printf() and friends used in IKS to compensate for
1323  lack of a terminal driver, mainly to supply CR after LF.
1324*/
1325#ifndef NOPRINTFSUBST
1326#ifdef MAC
1327/*
1328 * The MAC doesn't use standard stdio routines.
1329 */
1330#undef getchar
1331#define getchar()   mac_getchar()
1332#undef putchar
1333#define putchar(c)      mac_putchar(c)
1334#define printf          mac_printf
1335#define perror          mac_perror
1336#define puts            mac_puts
1337extern int mac_putchar (int c);
1338extern int mac_puts (const char *string);
1339extern int mac_printf(const char *, ...);
1340extern int mac_getchar (void);
1341#endif /* MAC */
1342
1343#ifdef OS2
1344#define printf Vscrnprintf
1345#define fprintf Vscrnfprintf
1346extern int Vscrnprintf(const char *, ...);
1347extern int Vscrnprintw(const char *, ...);
1348extern int Vscrnfprintf(FILE *, const char *, ...);
1349#ifdef putchar
1350#undef putchar
1351#endif /* putchar */
1352#define putchar(x) Vscrnprintf("%c",x)
1353#define perror(x)  Vscrnperror(x)
1354#endif /* OS2 */
1355
1356#ifndef CKWART_C
1357#ifdef UNIX
1358#ifndef pdp11
1359#ifndef CKXPRINTF
1360#define CKXPRINTF
1361#endif /* CKXPRINTF */
1362#endif /* pdp11 */
1363#endif /* UNIX */
1364#endif /* CKWART_C */
1365#endif /* NOPRINTFSUBST */
1366
1367#ifdef CKXPRINTF
1368#define printf ckxprintf
1369#define fprintf ckxfprintf
1370#ifdef CK_ANSIC
1371_PROTOTYP(int ckxprintf,(const char *, ...));
1372#ifdef NEXT
1373_PROTOTYP(void ckxperror,(const char *));
1374#else
1375#ifdef CK_SCOV5
1376_PROTOTYP(void ckxperror,(const char *));
1377#else
1378_PROTOTYP(int ckxperror,(const char *));
1379#endif /* CK_SCOV5 */
1380#endif /* NEXT */
1381_PROTOTYP(int ckxfprintf,(FILE *, const char *, ...));
1382#endif /* CK_ANSIC */
1383#ifdef putchar
1384#undef putchar
1385#endif /* putchar */
1386#define putchar(x) ckxprintf("%c",x)
1387#ifdef putc
1388#undef putc
1389#endif /* putc */
1390#define putc(a,b) ckxfprintf(b,"%c",a)
1391#define perror(x)  ckxperror(x)
1392#endif /* CKXPRINTF */
1393
1394/*
1395  Altos-specific items: 486, 586, 986 models...
1396*/
1397#ifdef A986
1398#define M_VOID
1399#define void int
1400#define CHAR char
1401#define SIG_I
1402#endif /* A986 */
1403
1404/* Signal handling */
1405
1406#ifdef QNX
1407#ifndef CK_POSIX_SIG
1408#define CK_POSIX_SIG
1409#endif /* CK_POSIX_SIG */
1410#endif /* QNX */
1411
1412/* Void type */
1413
1414#ifndef VOID                            /* Used throughout all C-Kermit */
1415#ifdef CK_ANSIC                         /* modules... */
1416#define VOID void
1417#else
1418#define VOID int
1419#endif /* CK_ANSIC */
1420#endif /* VOID */
1421
1422/* Const type */
1423
1424#ifndef CONST
1425#ifdef OSK
1426#ifdef _UCC
1427#define CONST const
1428#else
1429#define CONST
1430#endif /* _UCC */
1431#else  /* !OSK */
1432#ifdef CK_SCO32V4
1433#define CONST
1434#else
1435#ifdef CK_ANSIC
1436#define CONST const
1437#else
1438#define CONST
1439#endif /* CK_ANSIC */
1440#endif /* CK_SCO32V4 */
1441#endif /* OSK */
1442#endif /* CONST */
1443
1444/* Signal type */
1445
1446#ifndef SIG_V                           /* signal() type, if not def'd yet */
1447#ifndef SIG_I
1448#ifdef OS2
1449#define SIG_V
1450#else
1451#ifdef POSIX
1452#define SIG_V
1453#else
1454#ifdef SVR3                             /* System V R3 and later */
1455#define SIG_V
1456#else
1457#ifdef SUNOS4                           /* SUNOS V 4.0 and later */
1458#ifndef sun386
1459#define SIG_V
1460#else
1461#define SIG_I
1462#endif /* sun386 */
1463#else
1464#ifdef NEXT                             /* NeXT */
1465#define SIG_V
1466#else
1467#ifdef AIX370
1468#include <signal.h>
1469#define SIG_V
1470#define SIGTYP __SIGVOID                /* AIX370 */
1471#else
1472#ifdef STRATUS                          /* Stratus VOS */
1473#define SIG_V
1474#else
1475#ifdef MAC
1476#define SIGTYP long
1477#define SIG_I
1478#ifndef MPW33
1479#define SIG_IGN 0
1480#endif /* MPW33 */
1481#define SIGALRM 1
1482#ifndef MPW33
1483#define SIGINT  2
1484#endif /* MPW33 */
1485#else /* Everything else */
1486#define SIG_I
1487#endif /* MAC */
1488#endif /* STRATUS */
1489#endif /* AIX370 */
1490#endif /* NEXT */
1491#endif /* SUNOS4 */
1492#endif /* SVR3 */
1493#endif /* POSIX */
1494#endif /* OS2 */
1495#endif /* SIG_I */
1496#endif /* SIG_V */
1497
1498#ifdef SIG_I
1499#define SIGRETURN return(0)
1500#ifndef SIGTYP
1501#define SIGTYP int
1502#endif /* SIGTYP */
1503#endif /* SIG_I */
1504
1505#ifdef SIG_V
1506#define SIGRETURN return
1507#ifndef SIGTYP
1508#define SIGTYP void
1509#endif /* SIGTYP */
1510#endif /* SIG_V */
1511
1512#ifdef NT
1513#ifndef SIGTYP
1514#define SIGTYP void
1515#endif /* SIGTYP */
1516
1517#define strdup _strdup
1518#endif /* NT */
1519
1520#ifndef SIGTYP
1521#define SIGTYP int
1522#endif /* SIGTYP */
1523
1524#ifndef SIGRETURN
1525#define SIGRETURN return(0)
1526#endif /* SIGRETURN */
1527
1528#ifdef CKNTSIG
1529/* This does not work, so don't use it. */
1530#define signal ckntsignal
1531SIGTYP (*ckntsignal(int type, SIGTYP (*)(int)))(int);
1532#endif /* CKNTSIG */
1533
1534/* We want all characters to be unsigned if the compiler supports it */
1535
1536#ifdef KUI
1537#ifdef CHAR
1538#undef CHAR
1539#endif /* CHAR */
1540#define CHAR unsigned char
1541#else
1542#ifdef PROVX1
1543typedef char CHAR;
1544/* typedef long LONG; */
1545typedef int void;
1546#else
1547#ifdef MINIX
1548typedef unsigned char CHAR;
1549#else
1550#ifdef V7
1551typedef char CHAR;
1552#else
1553#ifdef C70
1554typedef char CHAR;
1555/* typedef long LONG; */
1556#else
1557#ifdef BSD29
1558typedef char CHAR;
1559/* typedef long LONG; */
1560#else
1561#ifdef datageneral
1562#define CHAR unsigned char                      /* 3.22 compiler */
1563#else
1564#ifdef HPUX
1565#define CHAR unsigned char
1566#else
1567#ifdef OS2
1568#ifdef NT
1569#define CHAR unsigned char
1570#else /* NT */
1571#ifdef CHAR
1572#undef CHAR
1573#endif /* CHAR */
1574typedef unsigned char CHAR;
1575#endif /* NT */
1576#else /* OS2 */
1577#ifdef VMS
1578typedef unsigned char CHAR;
1579#else
1580#ifdef CHAR
1581#undef CHAR
1582#endif /* CHAR */
1583typedef unsigned char CHAR;
1584#endif /* VMS */
1585#endif /* OS2 */
1586#endif /* HPUX */
1587#endif /* datageneral */
1588#endif /* BSD29 */
1589#endif /* C70 */
1590#endif /* V7 */
1591#endif /* MINIX */
1592#endif /* PROVX1 */
1593#endif /* KUI */
1594
1595union ck_short {                        /* Mainly for Unicode */
1596    USHORT x_short;
1597    CHAR x_char[2];
1598};
1599
1600#ifdef MAC                              /* Macintosh file routines */
1601#ifndef CKWART_C                        /* But not in "wart"... */
1602#ifdef feof
1603#undef feof
1604#endif /* feof */
1605#define feof mac_feof
1606#define rewind mac_rewind
1607#define fgets mac_fgets
1608#define fopen mac_fopen
1609#define fclose mac_fclose
1610int mac_feof();
1611void mac_rewind();
1612char *mac_fgets();
1613FILE *mac_fopen();
1614int mac_fclose();
1615#endif /* CKCPRO_W */
1616#endif /* MAC */
1617/*
1618   Systems whose mainline modules have access to the communication-line
1619   file descriptor, ttyfd.
1620*/
1621#ifndef CK_TTYFD
1622#ifdef UNIX
1623#define CK_TTYFD
1624#else
1625#ifdef OS2
1626#define CK_TTYFD
1627#else
1628#ifdef VMS
1629#define CK_TTYFD
1630#endif /* VMS */
1631#endif /* OS2 */
1632#endif /* UNIX */
1633#endif /* CK_TTYFD */
1634
1635/* Systems where we can get our own process ID */
1636
1637#ifndef CK_PID
1638#ifdef UNIX
1639#define CK_PID
1640#endif /* UNIX */
1641#ifdef OS2
1642#define CK_PID
1643#endif /* OS2 */
1644#ifdef VMS
1645#define CK_PID
1646#endif /* VMS */
1647#endif /* CK_PID */
1648
1649/* Systems that support the Microsoft Telephony API (TAPI) */
1650
1651#ifndef NODIAL
1652#ifndef CK_TAPI
1653#ifdef NT
1654#define CK_TAPI
1655#endif /* NT */
1656#endif /* CK_TAPI */
1657#endif /* NODIAL */
1658
1659#ifndef NONZXPAND
1660#ifndef NZXPAND
1661#ifdef OS2ORUNIX
1662#define NZXPAND
1663#else
1664#ifdef VMS
1665#define NZXPAND
1666#else
1667#ifdef datageneral
1668#define NZXPAND
1669#else
1670#ifdef OSK
1671#define NZXPAND
1672#endif /* OSK */
1673#endif /* datageneral */
1674#endif /* VMS */
1675#endif /* OS2ORUNIX */
1676#endif /* NZXPAND */
1677#else
1678#ifdef NZXPAND
1679#undef NZXPAND
1680#endif /* NZXPAND */
1681#endif /* NONZXPAND */
1682
1683/* nzxpand() option flags */
1684
1685#define ZX_FILONLY   1                  /* Match only regular files */
1686#define ZX_DIRONLY   2                  /* Match only directories */
1687#define ZX_RECURSE   4                  /* Descend through directory tree */
1688#define ZX_MATCHDOT  8                  /* Match "dot files" */
1689#define ZX_NOBACKUP 16                  /* Don't match "backup files" */
1690#define ZX_NOLINKS  32                  /* Don't follow symlinks */
1691
1692#ifndef NZXPAND
1693#define nzxpand(a,b) zxpand(a)
1694#endif /* NZXPAND */
1695
1696#ifndef NOZXREWIND
1697#ifndef ZXREWIND                        /* Platforms that have zxrewind() */
1698#ifdef OS2ORUNIX
1699#define ZXREWIND
1700#else
1701#ifdef VMS
1702#define ZXREWIND
1703#else
1704#ifdef datageneral
1705#define ZXREWIND
1706#else
1707#ifdef OSK
1708#define ZXREWIND
1709#else
1710#ifdef STRATUS
1711#define ZXREWIND
1712#endif /* STRATUS */
1713#endif /* OSK */
1714#endif /* datageneral */
1715#endif /* VMS */
1716#endif /* OS2ORUNIX */
1717#endif /* ZXREWIND */
1718#else
1719#ifdef ZXREWIND
1720#undef ZXREWIND
1721#endif /* ZXREWIND */
1722#endif /* NOZXREWIND */
1723
1724/* Temporary-directory-for-RECEIVE feature ... */
1725/* This says whether we have the isdir() function defined. */
1726
1727#ifdef UNIX                             /* UNIX has it */
1728#ifndef CK_TMPDIR
1729#ifndef pdp11
1730#define CK_TMPDIR
1731#define TMPDIRLEN 256
1732#endif /* pdp11 */
1733#endif /* CK_TMPDIR */
1734#endif /* UNIX */
1735
1736#ifdef VMS                              /* VMS too */
1737#ifndef CK_TMPDIR
1738#define CK_TMPDIR
1739#define TMPDIRLEN 256
1740#endif /* CK_TMPDIR */
1741#endif /* VMS */
1742
1743#ifdef OS2                              /* OS two too */
1744#ifndef CK_TMPDIR
1745#define CK_TMPDIR
1746#define TMPDIRLEN 129
1747#endif /* CK_TMPDIR */
1748#endif /* OS2 */
1749
1750#ifdef STRATUS                          /* Stratus VOS too. */
1751#ifndef CK_TMPDIR
1752#define CK_TMPDIR
1753#define TMPDIRLEN 256
1754#endif /* CK_TMPDIR */
1755#endif /* STRATUS */
1756
1757#ifdef OSK                              /* OS-9 too */
1758#ifndef CK_TMPDIR
1759#define CK_TMPDIR
1760#define TMPDIRLEN 256
1761#endif /* CK_TMPDIR */
1762#endif /* OSK */
1763
1764#ifdef datageneral                      /* AOS/VS too */
1765#ifndef CK_TMPDIR
1766#define CK_TMPDIR
1767#define TMPDIRLEN 256
1768#endif /* CK_TMPDIR */
1769#endif /* datageneral */
1770
1771#ifdef CK_TMPDIR                        /* Needs command parser */
1772#ifdef NOICP
1773#undef CK_TMPDIR
1774#endif /* NOICP */
1775#endif /* CK_TMPDIR */
1776
1777/* Whether to include <sys/time.h> */
1778
1779#ifndef NOTIMEH                         /* <time.h> */
1780#ifndef TIMEH
1781#define TIMEH
1782#endif /* TIMEH */
1783#endif /* NOTIMEH */
1784
1785#ifndef NOSYSTIMEH                      /* <sys/time.h> */
1786#ifndef SYSTIMEH
1787#ifdef UNIX                             /* UNIX */
1788#ifdef SVORPOSIX                        /* System V or POSIX... */
1789#ifdef M_UNIX
1790#define SYSTIMEH
1791#else
1792#ifdef SCO_32V4
1793#define SYSTIMEH
1794#else
1795#ifdef OXOS
1796#define SYSTIMEH
1797#else
1798#ifdef BSD44
1799#define SYSTIMEH
1800#else
1801#ifdef __linux__
1802#define SYSTIMEH
1803#else
1804#ifdef AIXRS
1805#ifndef AIX41
1806#define SYSTIMEH
1807#endif /* AIX41 */
1808#else
1809#ifdef IRIX60
1810#define SYSTIMEH
1811#else
1812#ifdef I386IX
1813#define SYSTIMEH
1814#else
1815#ifdef SV68R3V6
1816#define SYSTIMEH
1817#endif /* SV68R3V6 */
1818#endif /* I386IX */
1819#endif /* IRIX60 */
1820#endif /* AIXRS */
1821#endif /* __linux__ */
1822#endif /* BSD44 */
1823#endif /* OXOS */
1824#endif /* SCO_32V4 */
1825#endif /* M_UNIX */
1826
1827#else  /* Not SVORPOSIX */
1828
1829#ifndef BELLV10                         /* All but these... */
1830#ifndef PROVX1
1831#ifndef V7
1832#ifndef BSD41
1833#ifndef COHERENT
1834#define SYSTIMEH
1835#endif /* COHERENT */
1836#endif /* BSD41 */
1837#endif /* V7 */
1838#endif /* PROVX1 */
1839#endif /* BELLV10 */
1840#endif /* SVORPOSIX */
1841#endif /* UNIX */
1842#endif /* SYSTIMEH */
1843#endif /* NOSYSTIMEH */
1844
1845#ifndef NOSYSTIMEBH                     /* <sys/timeb.h> */
1846#ifndef SYSTIMEBH
1847#ifdef OSF
1848#define SYSTIMEBH
1849#else
1850#ifdef COHERENT
1851#define SYSTIMEBH
1852#else
1853#ifdef BSD41
1854#define SYSTIMEBH
1855#else
1856#ifdef BSD29
1857#define SYSTIMEBH
1858#else
1859#ifdef TOWER1
1860#define SYSTIMEBH
1861#else
1862#ifdef FT21
1863#define SYSTIMEBH
1864#else
1865#ifdef BELLV10
1866#define SYSTIMEBH
1867#endif /* BELLV10 */
1868#endif /* FT21 */
1869#endif /* TOWER1 */
1870#endif /* BSD29 */
1871#endif /* BSD41 */
1872#endif /* COHERENT */
1873#endif /* OSF */
1874#endif /* SYSTIMEBH */
1875#endif /* NOSYSTIMEBH */
1876
1877/*
1878 Debug and transaction logging is included automatically unless you define
1879 NODEBUG or NOTLOG.  Do this if you want to save the space and overhead.
1880 (Note, in version 4F these definitions changed from "{}" to the null string
1881 to avoid problems with semicolons after braces, as in: "if (x) tlog(this);
1882 else tlog(that);"
1883*/
1884#ifndef NODEBUG
1885#ifndef DEBUG
1886#define DEBUG
1887#endif /* DEBUG */
1888#else
1889#ifdef DEBUG
1890#undef DEBUG
1891#endif /* DEBUG */
1892#endif /* NODEBUG */
1893
1894#ifdef NOTLOG
1895#ifdef TLOG
1896#undef TLOG
1897#endif /* TLOG */
1898#else  /* NOTLOG */
1899#ifndef TLOG
1900#define TLOG
1901#endif /* TLOG */
1902#endif /* NOTLOG */
1903
1904/* debug() macro style selection. */
1905
1906#ifdef VMS
1907#ifndef IFDEBUG
1908#define IFDEBUG
1909#endif /* IFDEBUG */
1910#endif /* VMS */
1911
1912#ifdef MAC
1913#ifndef IFDEBUG
1914#define IFDEBUG
1915#endif /* IFDEBUG */
1916#endif /* MAC */
1917
1918#ifdef OS2
1919#ifndef IFDEBUG
1920#define IFDEBUG
1921#endif /* IFDEBUG */
1922#endif /* OS2 */
1923
1924#ifdef OXOS                             /* tst is faster than jsr */
1925#ifndef IFDEBUG
1926#define IFDEBUG
1927#endif /* IFDEBUG */
1928#endif /* OXOS */
1929
1930#ifndef CKCMAI
1931extern int deblog;
1932extern int debok;
1933extern int debxlen;
1934extern int matchdot;
1935extern int tt_bell;
1936#endif /* CKCMAI */
1937
1938#ifdef OS2
1939_PROTOTYP( void bleep, (short) );
1940#else /* OS2 */
1941#define bleep(x) if(tt_bell)putchar('\07')
1942#endif /* OS2 */
1943
1944#ifndef BEOSORBEBOX
1945#ifdef BEBOX                            /* This was used only for DR7 */
1946#define BEOSORBEBOX
1947#else
1948#ifdef BEOS                             /* This is used for BeOS 4.x */
1949#define BEOSORBEBOX
1950#endif /* BEOS */
1951#endif /* BEBOX */
1952#endif /* BEOSORBEBOX */
1953
1954#ifdef NOICP
1955#ifdef TLOG
1956#undef TLOG
1957#endif /* TLOG */
1958#endif /* NOICP */
1959
1960#ifndef TLOG
1961#define tlog(a,b,c,d)
1962#else
1963#ifndef CKCMAI
1964/* Debugging included.  Declare debug log flag in main program only. */
1965extern int tralog, tlogfmt;
1966#endif /* CKCMAI */
1967_PROTOTYP(VOID dotlog,(int, char *, char *, long));
1968#define tlog(a,b,c,d) if (tralog && tlogfmt) dotlog(a,b,c,d)
1969_PROTOTYP(VOID doxlog,(int, char *, long, int, int, char *));
1970#endif /* TLOG */
1971
1972/* Formats for debug() and tlog() */
1973
1974#define F000 0
1975#define F001 1
1976#define F010 2
1977#define F011 3
1978#define F100 4
1979#define F101 5
1980#define F110 6
1981#define F111 7
1982
1983#ifdef __linux__
1984#ifndef LINUX
1985#define LINUX
1986#endif /* LINUX */
1987#endif /* __linux__ */
1988
1989/* Platforms where small size is needed */
1990
1991#ifdef pdp11
1992#define CK_SMALL
1993#endif /* pdp11 */
1994
1995/* Can we use realpath()? */
1996
1997#ifndef NOREALPATH
1998#ifdef pdp11
1999#define NOREALPATH
2000#endif /* pdp11 */
2001#endif /* NOREALPATH */
2002
2003#ifndef NOREALPATH
2004#ifdef UNIX
2005#ifdef HPUX5
2006#define NOREALPATH
2007#else
2008#ifdef HPUX6
2009#define NOREALPATH
2010#else
2011#ifdef HPUX7
2012#define NOREALPATH
2013#else
2014#ifdef HPUX8
2015#define NOREALPATH
2016#else
2017#ifdef SV68R3V6
2018#define NOREALPATH
2019#else
2020#ifdef XENIX
2021#define NOREALPATH
2022#else
2023#ifdef CK_SCO32V4
2024#define NOREALPATH
2025#else
2026#ifdef CK_SCOV5
2027#define NOREALPATH
2028#else
2029#ifdef OSF32
2030#define NOREALPATH
2031#else
2032#ifdef OSF30
2033#define NOREALPATH
2034#else
2035#ifdef ultrix
2036#define NOREALPATH
2037#else
2038#ifdef COHERENT
2039#define NOREALPATH
2040#endif /* COHERENT */
2041#endif /* ultrix */
2042#endif /* OSF30 */
2043#endif /* OSF32 */
2044#endif /* CK_SCOV5 */
2045#endif /* CK_SCO32V4 */
2046#endif /* XENIX */
2047#endif /* SV68R3V6 */
2048#endif /* HPUX8 */
2049#endif /* HPUX7 */
2050#endif /* HPUX6 */
2051#endif /* HPUX5 */
2052#endif /* NOREALPATH */
2053
2054#ifndef NOREALPATH
2055#ifndef CKREALPATH
2056#define CKREALPATH
2057#endif /* NOREALPATH */
2058#endif /* CKREALPATH */
2059#endif /* UNIX */
2060
2061#ifdef CKREALPATH
2062#ifdef OS2ORUNIX
2063#ifndef CKROOT
2064#define CKROOT
2065#endif /* CKROOT */
2066#endif /* OS2ORUNIX */
2067#endif /* CKREALPATH */
2068
2069/* CKSYMLINK should be set only if we can use readlink() */
2070
2071#ifdef UNIX
2072#ifndef NOSYMLINK
2073#ifndef CKSYMLINK
2074#define CKSYMLINK
2075#endif /* NOSYMLINK */
2076#endif /* CKSYMLINK */
2077#endif /* UNIX */
2078
2079/* Platforms where we can use lstat() instead of stat() (for symlinks) */
2080/* This should be set only if both lstat() and readlink() are available */
2081
2082#ifndef NOLSTAT
2083#ifndef NOSYMLINK
2084#ifndef USE_LSTAT
2085#ifdef UNIX
2086#ifdef CKSYMLINK
2087#ifdef SVR4                             /* SVR4 has lstat() */
2088#define USE_LSTAT
2089#else
2090#ifdef BSD42                            /* 4.2BSD and 4.3BSD have it */
2091#define USE_LSTAT                       /* This should include old HPUXs */
2092#else
2093#ifdef BSD44                            /* 4.4BSD has it */
2094#define USE_LSTAT
2095#else
2096#ifdef LINUX                            /* LINUX has it */
2097#define USE_LSTAT
2098#else
2099#ifdef SUNOS4                           /* SunOS has it */
2100#define USE_LSTAT
2101#endif /* SUNOS4 */
2102#endif /* LINUX */
2103#endif /* BSD44 */
2104#endif /* BSD42 */
2105#endif /* SVR4 */
2106#endif /* CKSYMLINK */
2107#endif /* UNIX */
2108#endif /* USE_LSTAT */
2109#endif /* NOSYMLINK */
2110#endif /* NOLSTAT */
2111
2112#ifdef NOLSTAT
2113#ifdef USE_LSTAT
2114#undef USE_LSTAT
2115#endif /* USE_LSTAT */
2116#endif /* NOLSTAT */
2117
2118#ifndef NOTTYLOCK                       /* UNIX systems that have ttylock() */
2119#ifndef USETTYLOCK
2120#ifdef AIXRS                            /* AIX 3.1 and later */
2121#define USETTYLOCK
2122#else
2123#ifdef USE_UU_LOCK                      /* FreeBSD or other with uu_lock() */
2124#define USETTYLOCK
2125#endif /* USE_UU_LOCK */
2126#endif /* AIXRS */
2127#endif /* USETTYLOCK */
2128#endif /* NOTTYLOCK */
2129
2130/* Kermit feature selection */
2131
2132#ifndef NOSPL
2133#ifndef NOCHANNELIO                     /* Channel-based file i/o package */
2134#ifndef CKCHANNELIO
2135#ifdef UNIX
2136#define CKCHANNELIO
2137#else
2138#ifdef OS2
2139#define CKCHANNELIO
2140#else
2141#ifdef VMS
2142#define CKCHANNELIO
2143#else
2144#ifdef STRATUS
2145#define CKCHANNELIO
2146#endif /* STRATUS */
2147#endif /* VMS */
2148#endif /* OS2 */
2149#endif /* UNIX */
2150#endif /* CKCHANNELIO */
2151#endif /* NOCHANNELIO */
2152#endif /* NOSPL */
2153
2154#ifndef NOCKEXEC                        /* EXEC command */
2155#ifndef NOPUSH
2156#ifndef CKEXEC
2157#ifdef UNIX                             /* UNIX can do it */
2158#define CKEXEC
2159#endif /* UNIX */
2160#endif /* CKEXEC */
2161#endif /* NOPUSH */
2162#endif /* NOCKEXEC */
2163
2164#ifndef NOFAST                          /* Fast Kermit protocol by default */
2165#ifndef CK_FAST
2166#ifdef UNIX
2167#define CK_FAST
2168#else
2169#ifdef VMS
2170#define CK_FAST
2171#else
2172#ifdef OS2
2173#define CK_FAST
2174#endif /* OS2 */
2175#endif /* VMS */
2176#endif /* UNIX */
2177#endif /* CK_FAST */
2178#endif /* NOFAST */
2179
2180#ifdef UNIX                             /* Transparent print */
2181#ifndef NOXPRINT
2182#ifndef XPRINT
2183#define XPRINT
2184#endif /* XPRINT */
2185#endif /* NOXPRINT */
2186#endif /* UNIX */
2187
2188#ifndef NOHWPARITY                      /* Hardware parity */
2189#ifndef HWPARITY
2190#ifdef SVORPOSIX                        /* System V or POSIX can have it */
2191#define HWPARITY
2192#else
2193#ifdef SUNOS41                          /* SunOS 4.1 can have it */
2194#define HWPARITY
2195#else
2196#ifdef OS2                              /* K95 can have it */
2197#define HWPARITY
2198#endif /* OS2 */
2199#endif /* SUNOS41 */
2200#endif /* SVORPOSIX */
2201#endif /* HWPARITY */
2202#endif /* NOHWPARITY */
2203
2204#ifndef NOSTOPBITS                      /* Stop-bit selection */
2205#ifndef STOPBITS
2206#ifdef OS2ORUNIX
2207/* In Unix really this should only be if CSTOPB is defined. */
2208/* But we don't know that yet. */
2209#define STOPBITS
2210#else
2211#ifdef TN_COMPORT
2212#define STOPBITS
2213#endif /* TN_COMPORT */
2214#endif /* OS2ORUNIX */
2215#endif /* STOPBITS */
2216#endif /* NOSTOPBITS */
2217
2218#ifdef UNIX
2219#ifndef NETCMD                          /* Can SET NETWORK TYPE COMMAND */
2220#define NETCMD
2221#endif /* NETCMD */
2222#endif /* UNIX */
2223
2224/* Pty support, nonportable, available on a case-by-case basis */
2225
2226#ifndef NOPTY
2227#ifdef NEXT                             /* NeXTSTEP (tested on 3.1)*/
2228#define NETPTY
2229#else
2230#ifdef CK_SCOV5                         /* SCO OSR5 (tested on 5.0.5)*/
2231#define NETPTY
2232#else
2233#ifdef QNX                              /* QNX (tested on 4.25) */
2234#define NETPTY
2235#else
2236#ifdef SINIX                            /* Sinix (tested on 5.42) */
2237#define NETPTY
2238#else
2239#ifdef DGUX540                          /* DG/UX 5.4++ (tested on 5.4R4.11) */
2240#define NETPTY
2241#else
2242#ifdef OSF32                            /* Digital Unix 3.2 */
2243#define NETPTY
2244#else
2245#ifdef OSF40                            /* Digital Unix 4.0 / Tru64 */
2246#define NETPTY
2247#else
2248#ifdef IRIX60                           /* IRIX 6.0 (not earlier) */
2249#define NETPTY
2250#else
2251#ifdef HPUX10                           /* HPUX 10.00 or later */
2252#define NETPTY
2253#ifndef HAVE_PTYTRAP
2254#define HAVE_PTYTRAP
2255#endif /* HAVE_PTYTRAP */
2256#else
2257#ifdef HPUX9                            /* HPUX 9.00 (not earlier) */
2258#define NETPTY
2259#ifndef HAVE_PTYTRAP
2260#define HAVE_PTYTRAP
2261#endif /* HAVE_PTYTRAP */
2262#else
2263#ifdef BSD44                            /* BSD44, {Net,Free,Open}BSD */
2264#define NETPTY
2265#else
2266#ifdef BSDI                             /* BSDI/OS (tested in 4) */
2267#define NETPTY
2268#else
2269#ifdef SOLARIS                          /* Solaris (tested in 2.5) */
2270#define NETPTY
2271#else
2272#ifdef UW7                              /* Unixware 7 */
2273#define NETPTY
2274#else
2275#ifdef SUNOS41                          /* SunOS (tested in 4.1.3) */
2276#define NETPTY
2277#else
2278#ifdef AIX41                            /* AIX 4.1 and later */
2279#define NETPTY
2280#else
2281#ifdef LINUX                            /* Linux */
2282#define NETPTY
2283#endif /* LINUX */
2284#endif /* AIX41 */
2285#endif /* SUNOS41 */
2286#endif /* UW7 */
2287#endif /* SOLARIS */
2288#endif /* BSDI */
2289#endif /* BSD44 */
2290#endif /* HPUX9 */
2291#endif /* HPUX10 */
2292#endif /* IRIX60 */
2293#endif /* OSF40 */
2294#endif /* OSF32 */
2295#endif /* DGUX540 */
2296#endif /* SINIX */
2297#endif /* QNX */
2298#endif /* CK_SCOV5 */
2299#endif /* NEXT */
2300
2301#else /* NOPTY */
2302
2303#ifdef NETPTY
2304#undef NETPTY
2305#endif /* NETPTY */
2306#endif /* NOPTY */
2307
2308#ifdef NETPTY                           /* NETCMD required for NETPTY */
2309#ifndef NETCMD
2310#define NETCMD
2311#endif /* NETCMD */
2312#endif /* NETPTY */
2313
2314#ifndef CK_UTSNAME                      /* Can we call uname()? */
2315#ifdef VMS
2316#define CK_UTSNAME
2317#else
2318#ifdef OS2
2319#define CK_UTSNAME
2320#else
2321#ifdef POSIX                            /* It's in POSIX.1 */
2322#define CK_UTSNAME
2323#else
2324#ifdef SUNOS41                          /* It's in SunOS 4.1 */
2325#define CK_UTSNAME
2326#else
2327#ifdef AIXRS                            /* It's in AIX */
2328#define CK_UTSNAME
2329#else
2330#ifdef SVR4                             /* It's in SVR4 (but not SVR3) */
2331#define CK_UTSNAME
2332#else
2333#ifdef HPUX                             /* It's in HP-UX 5.00 and later */
2334#define CK_UTSNAME
2335#else
2336#ifdef OSF                              /* It's in OSF/1 / Digital UNIX */
2337#define CK_UTSNAME
2338#else
2339#ifdef CK_SCOV5
2340#define CK_UTSNAME
2341#endif /* CK_SCOV5 */
2342#endif /* OSF */
2343#endif /* HPUX */
2344#endif /* SVR4 */
2345#endif /* AIXRS */
2346#endif /* SUNOS41 */
2347#endif /* POSIX */
2348#endif /* OS2 */
2349#endif /* VMS */
2350#endif /* CK_UTSNAME */
2351
2352/* This section for anything that might use floating-point */
2353
2354/* If the following causes trouble use -DFLOAT=float on the command line */
2355
2356#ifdef NOSPL
2357#ifdef FNFLOAT
2358#undef FNFLOAT
2359#endif /* FNFLOAT */
2360#ifdef CKFLOAT
2361#undef CKFLOAT
2362#endif /* CKFLOAT */
2363#endif /* NOSPL */
2364
2365#ifndef NOFLOAT
2366
2367#ifndef CKFLOAT
2368#ifdef __alpha
2369/* Don't use double on 64-bit platforms -- bad things happen */
2370#define CKFLOAT float
2371#define CKFLOAT_S "float"
2372#else
2373#define CKFLOAT double
2374#define CKFLOAT_S "double"
2375#endif /* __alpha */
2376#endif /* CKFLOAT */
2377
2378#ifndef NOGFTIMER                       /* Floating-point timers */
2379#ifndef GFTIMER
2380#ifdef UNIX                             /* For UNIX */
2381#define GFTIMER
2382#endif /* UNIX */
2383#ifdef VMS                              /* VMS */
2384#ifndef OLD_VMS                         /* 5.0 and later */
2385#define GFTIMER
2386#endif /* OLD_VMS */
2387#endif /* VMS */
2388#ifdef OS2                              /* And K95 */
2389#define GFTIMER
2390#endif /* OS2 */
2391#ifdef STRATUS                          /* And Stratus VOS */
2392#define GFTIMER
2393#endif /* STRATUS */
2394#endif /* GFTIMER */
2395#endif /* NOGFTIMER */
2396
2397#ifndef NOSPL
2398#ifndef FNFLOAT                         /* Floating-point math functions */
2399#ifdef VMS                              /* defined by default in VMS */
2400#define FNFLOAT
2401#else
2402#ifdef OS2                              /* and K95 */
2403#define FNFLOAT
2404#endif /* OS2 */
2405#endif /* VMS */
2406#endif /* FNFLOAT */
2407#endif /* NOSPL */
2408
2409#else  /* NOFLOAT is defined */
2410
2411#ifdef CKFLOAT
2412#undef CKFLOAT
2413#endif /* CKFLOAT */
2414
2415#ifdef GFTIMER
2416#undef GFTIMER
2417#endif /* GFTIMER */
2418
2419#ifdef FNFLOAT
2420#undef FNFLOAT
2421#endif /* FNFLOAT */
2422
2423#endif /* NOFLOAT */
2424
2425#ifdef GFTIMER                          /* Fraction of second to use when */
2426#ifndef GFMINTIME                       /* elapsed time is <= 0 */
2427#define GFMINTIME 0.005
2428#endif /* GFMINTIME */
2429#endif /* GFTIMER */
2430
2431#ifndef CKCMAI
2432extern long ztmsec, ztusec;             /* Fraction of sec of current time */
2433#endif /* CKCMAI */
2434
2435#ifndef NOUNPREFIXZERO                  /* Allow unprefixing of  NUL (0) */
2436#ifndef UNPREFIXZERO                    /* in file-transfer packets */
2437#define UNPREFIXZERO
2438#endif /* UNPREFIXZERO */
2439#endif /* NOUNPREFIXZERO */
2440
2441#ifdef CK_SMALL
2442#define NOCAL                           /* Calibrate */
2443#endif /* CK_SMALL */
2444
2445#ifndef NOPATTERNS                      /* Filetype matching patterns */
2446#ifndef PATTERNS
2447#ifndef VMS
2448#ifndef CK_SMALL
2449#define PATTERNS
2450#endif /* CK_SMALL */
2451#endif /* VMS */
2452#endif /* PATTERNS */
2453#endif /* NOPATTERNS */
2454
2455#ifndef NOCAL
2456#ifndef CALIBRATE
2457#define CALIBRATE
2458#endif /* CALIBRATE */
2459#else
2460#ifdef CALIBRATE
2461#undef CALIBRATE
2462#endif /* CALIBRATE */
2463#endif /* NOCAL */
2464
2465#ifndef NORECURSE                       /* Recursive directory traversal */
2466#ifndef RECURSIVE
2467#ifdef VMS
2468#define RECURSIVE
2469#else
2470#ifdef OS2ORUNIX
2471#ifndef CK_SMALL
2472#define RECURSIVE
2473#endif /* CK_SMALL */
2474#else
2475#ifdef STRATUS
2476#define RECURSIVE
2477#else
2478#ifdef OSK
2479#define RECURSIVE
2480#endif /* OSK */
2481#endif /* STRATUS */
2482#endif /* OS2ORUNIX */
2483#endif /* VMS */
2484#endif /* RECURSIVE */
2485#endif /* NORECURSE */
2486
2487#ifndef CK_SMALL                        /* Enable file-transfer tuning code */
2488#ifndef CKTUNING                        /* in which more code is added */
2489#ifndef NOTUNING                        /* to avoid function calls, etc */
2490#define CKTUNING
2491#endif /* NOTUNING */
2492#endif /* CKTUNING */
2493#endif /* CK_SMALL */
2494
2495#ifndef NOURL                           /* Parse URLs in SET HOST, etc */
2496#define CK_URL
2497#define NO_FTP_AUTH                     /* No auth "ftp" / "anonymous" */
2498#endif /* NOURL */
2499
2500#ifndef NOTRIGGER
2501#ifndef CK_TRIGGER                      /* Trigger string to exit CONNECT */
2502#ifdef OS2ORUNIX                        /* OK for UNIX and K95 */
2503#define CK_TRIGGER
2504#else
2505#ifdef VMS                              /* and VMS */
2506#define CK_TRIGGER
2507#else
2508#ifdef datageneral                      /* and AOS/VS */
2509#define CK_TRIGGER
2510#endif /* datageneral */
2511#endif /* OS2ORUNIX */
2512#endif /* VMS */
2513#endif /* CK_TRIGGER */
2514#endif /* NOTRIGGER */
2515
2516#ifdef CK_TRIGGER
2517#define TRIGGERS 8                      /* How many triggers allowed */
2518#endif /* CK_TRIGGER */
2519
2520#ifndef XLIMITS                         /* CONNECT limits */
2521#ifdef OS2
2522#define XLIMITS
2523#endif /* OS2 */
2524#endif /* XLIMITS */
2525
2526#ifdef NOFRILLS
2527#ifndef NOBROWSER
2528#define NOBROWSER
2529#endif /* NOBROWSER */
2530#ifndef NOFTP
2531#define NOFTP
2532#endif /* NOFTP */
2533#endif /* NOFRILLS */
2534
2535#ifndef NOHTTP                          /* HTTP features need... */
2536#ifdef NOICP                            /* an interactive command parser */
2537#define NOHTTP
2538#endif /* NOICP */
2539#ifndef OS2ORUNIX                       /* K95 or UNIX (because of */
2540#define NOHTTP                          /* time functions, time_t, etc) */
2541#endif /* OS2ORUNIX */
2542#endif /* NOHTTP */
2543
2544
2545#ifndef NONET
2546#ifdef TCPSOCKET
2547
2548/* The HTTP code is not very portable, so it must be asked for with -DCKHTTP */
2549
2550#ifndef NOHTTP
2551#ifndef CKHTTP
2552#ifdef SUNOS4                           /* We can use it in SunOS */
2553#define CKHTTP
2554#endif /* SUNOS4 */
2555#ifdef SOLARIS                          /* And in Solaris */
2556#define CKHTTP
2557#endif /* SOLARIS */
2558#ifdef LINUX                            /* And Linux */
2559#define CKHTTP
2560#endif /* LINUX */
2561#ifdef HPUX10                           /* And HP-UX 10 and above */
2562#define CKHTTP
2563#endif /* HPUX10 */
2564#ifdef OS2                              /* And in K-95 */
2565#define CKHTTP
2566#endif /* OS2 */
2567#ifdef AIX41                            /* In AIX 4.1 and higher */
2568#define CKHTTP
2569#endif /* AIX41 */
2570#ifdef UNIXWARE                         /* In Unixware 2.1 and higher */
2571#define CKHTTP                          /* and probably also in 1.x and 2.0 */
2572#endif /* UNIXWARE */
2573#ifdef CK_SCOV5
2574#define CKHTTP
2575#endif /* CK_SCOV5 */
2576#ifdef OSF                              /* And in OSF Digital UNIX/True 64 */
2577#define CKHTTP
2578#endif /* OSF */
2579#ifdef ultrix                           /* And in Ultrix Mips */
2580#ifdef mips
2581#define CKHTTP
2582#endif /* mips */
2583#endif /* ultrix */
2584/* Add more here... */
2585#endif /* CKHTTP */
2586#ifndef CKHTTP                          /* If CKHTTP not defined yet */
2587#define NOHTTP                          /* then define HOHTTP */
2588#endif /* CKHTTP */
2589#endif /* NOHTTP */
2590
2591#ifdef NETCONN                          /* Special "network" types... */
2592#ifndef NOLOCAL
2593#ifdef OS2
2594#ifndef NETFILE
2595#define NETFILE
2596#endif /* NETFILE */
2597#ifndef NOPUSH
2598#ifndef NETCMD
2599#define NETCMD
2600#endif /* NETCMD */
2601#endif /* NOPUSH */
2602#ifdef NT
2603#ifndef NETDLL
2604#define NETDLL
2605#endif /* NETDLL */
2606#endif /* NT */
2607#endif /* OS2 */
2608#endif /* NOLOCAL */
2609#endif /* NETCONN */
2610
2611#ifndef NOFTP
2612#ifndef SYSFTP
2613#ifndef NEWFTP
2614#ifdef OS2ORUNIX
2615#define NEWFTP
2616#endif /* OS2ORUNIX */
2617#endif /* NEWFTP */
2618#endif /* SYSFTP */
2619#endif /* NOFTP */
2620
2621#ifndef NOFTP
2622#ifdef NEWFTP
2623#ifdef SYSFTP
2624#undef SYSFTP
2625#endif /* SYSFTP */
2626#else /* NEWFTP */
2627#ifndef SYSFTP
2628#define SYSFTP
2629#endif /* SYSFTP */
2630#endif /* NEWFTP */
2631#else /* NOFTP */
2632#ifdef NEWFTP
2633#undef NEWFTP
2634#endif /* NEWFTP */
2635#ifdef SYSFTP
2636#undef SYSFTP
2637#endif /* SYSFTP */
2638#endif /* NOFTP */
2639
2640#ifndef NOBROWSER
2641#ifdef UNIX
2642#ifndef BROWSER
2643#ifndef NOPUSH
2644#define BROWSER
2645#endif /* NOPUSH */
2646#endif /* BROWSER */
2647#endif /* UNIX */
2648#ifdef OS2
2649#ifndef BROWSER
2650#ifndef NOPUSH
2651#define BROWSER
2652#endif /* NOPUSH */
2653#endif /* BROWSER */
2654#endif /* OS2 */
2655#else
2656#ifdef BROWSER
2657#undef BROWSER
2658#endif /* BROWSER */
2659#endif /* NOBROWSER */
2660
2661#else /* TCPSOCKET */
2662#ifndef NOHTTP                          /* HTTP requires TCPSOCKET */
2663#define NOHTTP
2664#endif /* NOHTTP */
2665#endif /* TCPSOCKET */
2666#endif /* NONET */
2667
2668#ifdef TCPSOCKET
2669#ifndef NOCKGETFQHOST
2670#ifdef __ia64__
2671#define NOCKGETFQHOST
2672#else  /* __ia64__ */
2673#ifdef SV68
2674#define NOCKGETFQHOST
2675#else
2676#ifdef HPUXPRE65
2677#define NOCKGETFQHOST
2678#endif /* HPUXPRE65 */
2679#endif /* SV68 */
2680#endif /* __ia64 */
2681#endif /* NOCKGETFQHOST */
2682/*
2683  Regarding System V/68 (SV68) (from Gerry Belanger, Oct 2002):
2684
2685    1) The gethostbyname() appears to return the actual host IP
2686       address in the hostent struct, instead of the expected pointer
2687       to the address. Hence the bogus address in the bcopy/memcopy.
2688       This is despite the header agreeing with our expectations.
2689
2690    2) the expected argument swap between bcopy and memcopy
2691       did not happen.  What grief this might cause, I know not.
2692*/
2693#endif /* TCPSOCKET */
2694
2695#ifdef TCPSOCKET
2696#ifdef OS2ONLY
2697#ifndef NOSOCKS
2698#define NOSOCKS
2699#endif /* NOSOCKS */
2700#endif /* OS2ONLY */
2701#ifdef NOSOCKS
2702#ifdef CK_SOCKS
2703#undef CK_SOCKS
2704#endif /* CK_SOCKS */
2705#ifdef CK_SOCKS5
2706#undef CK_SOCKS5
2707#endif /* CK_SOCKS5 */
2708#else /* NOSOCKS */
2709#ifdef NT
2710#ifndef CK_SOCKS
2711#define CK_SOCKS
2712#endif /* CK_SOCKS */
2713#endif /* NT */
2714#ifdef CK_SOCKS5                        /* CK_SOCKS5 implies CK_SOCKS */
2715#ifndef CK_SOCKS
2716#define CK_SOCKS
2717#endif /* CK_SOCKS */
2718#endif /* CK_SOCKS5 */
2719#endif /* NOSOCKS */
2720#endif /* TCPSOCKET */
2721
2722#ifdef TNCODE
2723#ifndef CK_AUTHENTICATION
2724#ifdef OS2
2725#ifdef NT
2726#ifndef _M_PPC
2727#ifndef _M_ALPHA
2728#define SSL_KRB5
2729#endif /* _M_ALPHA */
2730#endif /* _M_PPC */
2731#endif /* NT */
2732#ifdef _M_PPC
2733#define NO_KERBEROS
2734#define NO_SRP
2735#else
2736#ifndef NO_ENCRYPTION
2737#ifndef NO_SSL
2738#define CK_SSL
2739#define SSLDLL
2740#endif /* NO_SSL */
2741#endif /* NO_ENCRYPTION */
2742#endif /* _M_PPC */
2743#ifndef NO_KERBEROS
2744#define CK_KERBEROS
2745#define KRB4
2746#define KRB5
2747#define KRB524
2748#endif /* NO_KERBEROS */
2749#ifndef NO_SRP
2750#define CK_SRP
2751#endif /* NO_SRP */
2752#define CK_AUTHENTICATION
2753#endif /* OS2 */
2754#endif /* CK_AUTHENTICATION */
2755
2756#ifdef CK_AUTHENTICATION                /* Encryption must have Auth */
2757#ifndef CK_ENCRYPTION
2758#ifndef NO_ENCRYPTION
2759#ifdef OS2
2760#define CK_ENCRYPTION
2761#endif /* OS2 */
2762#endif /* NO_ENCRYPTION */
2763#endif /* CK_ENCRYPTION */
2764#endif /* CK_AUTHENTICATION */
2765
2766#ifdef NO_AUTHENTICATION                /* Allow authentication to be */
2767#ifdef CK_AUTHENTICATION                /* disabled in NT and OS/2    */
2768#undef CK_AUTHENTICATION
2769#endif /* CK_AUTHENTICATION */
2770#ifdef CK_KERBEROS
2771#undef CK_KERBEROS
2772#endif /* CK_KERBEROS */
2773#ifdef CK_SRP
2774#undef CK_SRP
2775#endif /* CK_SRP */
2776#ifdef CK_ENCRYPTION
2777#undef CK_ENCRYPTION
2778#endif /* CK_ENCRYPTION */
2779#endif /* NO_AUTHENTICATION */
2780
2781#ifdef NO_ENCRYPTION                    /* Allow encryption to be */
2782#ifdef CK_ENCRYPTION                    /* disabled in NT and OS/2 */
2783#undef CK_ENCRYPTION
2784#endif /* CK_ENCRYPTION */
2785#endif /* NO_ENCRYPTION */
2786
2787#ifdef CK_KERBEROS      /* Disable funcs not yet supported with Heimdal */
2788#ifdef KRB5
2789#ifndef HEIMDAL
2790#define KRB5_U2U
2791#endif /* HEIMDAL */
2792#endif /* KRB5 */
2793#endif /* CK_KERBEROS */
2794
2795/*
2796  SSH section.  NOSSH disables any form of SSH support.
2797  If NOSSH is not defined (or implied by NONET, NOLOCAL, etc)
2798  then SSHBUILTIN is defined for K95 and SSHCMD is defined for UNIX.
2799  Then, if either SSHBUILTIN or SSHCMD is defined, ANYSSH is also defined.
2800*/
2801
2802#ifndef NOSSH
2803#ifndef NO_SSL
2804#ifdef OS2ONLY
2805#define NOSSH
2806#endif /* OS2ONLY */
2807#ifdef NT
2808#ifndef CK_SSL
2809#define NOSSH
2810#endif /* CK_SSL */
2811#endif /* NT */
2812#else /* NO_SSL */
2813#define NOSSH
2814#endif /* NO_SSL */
2815#endif /* NOSSH */
2816
2817#ifdef NOSSH                            /* NOSSH */
2818#ifdef SSHBUILTIN                       /* undefines any SSH selctors */
2819#undef SSHBUILTIN
2820#endif /* SSHBUILTIN */
2821#ifdef SSHCMD
2822#undef SSHCMD
2823#endif /* SSHCMD */
2824#ifdef ANYSSH
2825#undef ANYSSH
2826#endif /* ANYSSH */
2827#else  /* Not NOSSH */
2828#ifndef NOLOCAL
2829#ifdef OS2
2830#ifndef SSHBUILTIN
2831#define SSHBUILTIN
2832#endif /* SSHBUILTIN */
2833#else  /* Not OS2 */
2834#ifdef UNIX
2835#ifndef SSHCMD
2836#ifdef NETPTY
2837#ifndef NOPUSH
2838#define SSHCMD
2839#endif /* NOPUSH */
2840#endif /* NETPTY */
2841#endif /* SSHCMD */
2842#endif /* UNIX */
2843#endif /* OS2 */
2844#ifndef ANYSSH
2845#ifdef SSHBUILTIN
2846#define ANYSSH
2847#ifdef SSHCMD
2848#undef SSHCMD
2849#endif /* SSHCMD */
2850#else  /* SSHBUILTIN */
2851#ifdef SSHCMD
2852#define ANYSSH
2853#endif /* SSHCMD */
2854#endif /* SSHBUILTIN */
2855#endif /* ANYSSH */
2856#endif /* NOLOCAL */
2857#endif /* NOSSH */
2858
2859/* This is in case #ifdef SSH is used anywhere in the K95 modules */
2860
2861#ifdef OS2
2862#ifdef SSHBUILTIN
2863#ifndef SSH
2864#define SSH
2865#endif /* SSH */
2866#endif /* SSHBUILTIN */
2867#endif /* OS2 */
2868
2869#ifdef CK_AUTHENTICATION
2870#define CK_SECURITY
2871#else
2872#ifdef CK_SSL
2873#define CK_AUTHENTICATION
2874#define CK_SECURITY
2875#endif /* CK_SSL */
2876#endif /* CK_AUTHENTICATION */
2877
2878/* Environment stuff */
2879
2880#ifndef OS2ORUNIX
2881#ifndef NOPUTENV
2882#define NOPUTENV
2883#endif /* NOPUTENV */
2884#endif /* OS2ORUNIX */
2885
2886#ifndef CK_ENVIRONMENT
2887#ifdef OS2
2888#define CK_ENVIRONMENT
2889#else
2890#ifdef UNIX
2891#define CK_ENVIRONMENT
2892#else
2893#ifdef STRATUS
2894#define CK_ENVIRONMENT
2895#else
2896#ifdef VMS
2897#define CK_ENVIRONMENT
2898#endif /* VMS */
2899#endif /* STRATUS */
2900#endif /* UNIX */
2901#endif /* OS2 */
2902#endif /* CK_ENVIRONMENT */
2903#ifndef NOSNDLOC                        /* RFC 779 SEND LOCATION */
2904#ifndef CK_SNDLOC
2905#define CK_SNDLOC
2906#endif /* CK_SNDLOC */
2907#endif /* NOSNDLOC */
2908#ifndef NOXDISPLOC                      /* RFC 1096 XDISPLOC */
2909#ifndef CK_XDISPLOC
2910#define CK_XDISPLOC
2911#endif /* CK_XDISPLOC */
2912#endif /* NOXDISPLOC */
2913#ifndef NOFORWARDX
2914#ifndef NOPUTENV
2915#ifndef NOSELECT
2916#ifndef CK_FORWARD_X
2917#ifdef CK_AUTHENTICATION
2918#ifndef OS2ONLY
2919#define CK_FORWARD_X
2920#endif /* OS2ONLY */
2921#endif /* CK_AUTHENTICATION */
2922#endif /* CK_FORWARD_X */
2923#endif /* NOSELECT */
2924#endif /* NOPUTENV */
2925#endif /* NOFORWARDX */
2926#ifndef NO_COMPORT
2927#ifdef TCPSOCKET
2928#ifndef TN_COMPORT
2929#define TN_COMPORT
2930#endif /* TN_COMPORT */
2931#endif /* TCPSOCKET */
2932#endif /* NO_COMPORT */
2933#endif /* TNCODE */
2934
2935#ifndef NOXFER
2936#ifndef NOCTRLZ                         /* Allow SET FILE EOF CTRL-Z */
2937#ifndef CK_CTRLZ
2938#ifdef OS2ORUNIX
2939#define CK_CTRLZ
2940#endif /* OS2ORUNIX */
2941#endif /* CK_CTRLZ */
2942#endif /* NOCTRLZ */
2943#endif /* NOXFER */
2944
2945#ifndef NOPERMS                         /* File permissions in A packets */
2946#ifndef CK_PERMS
2947#ifdef UNIX
2948#define CK_PERMS
2949#else
2950#ifdef VMS
2951#define CK_PERMS
2952#endif /* VMS */
2953#endif /* UNIX */
2954#endif /* CK_PERMS */
2955#endif /* NOPERMS */
2956#ifdef CK_PERMS
2957#define CK_PERMLEN 24                   /* Max length of sys-dependent perms */
2958#endif /* CK_PERMS */
2959
2960#ifdef UNIX                             /* NOSETBUF for everybody */
2961#ifndef NOSETBUF
2962#ifndef USE_SETBUF                      /* This is the escape clause */
2963#define NOSETBUF
2964#endif /* USE_SETBUF */
2965#endif /* NOSETBUF */
2966#endif /* UNIX */
2967
2968#ifndef USE_STRERROR                    /* Whether to use strerror() */
2969#ifdef pdp11
2970#define USE_STRERROR
2971#endif /* pdp11 */
2972#endif /* USE_STRERROR */
2973
2974#ifdef VMS                              /* Features for all VMS builds */
2975#ifndef NOJC
2976#define NOJC
2977#endif /* NOJC */
2978#ifndef NOSETBUF
2979#define NOSETBUF
2980#endif /* NOSETBUF */
2981#ifndef DYNAMIC
2982#define DYNAMIC
2983#endif /* DYNAMIC */
2984#ifndef NOCURSES
2985#ifndef CK_CURSES
2986#define CK_CURSES
2987#endif /* CK_CURSES */
2988#endif /* NOCURSES */
2989#endif /* VMS */
2990
2991#ifndef NOCKTIMERS                      /* Dynamic timeouts */
2992#ifndef CK_TIMERS
2993#define CK_TIMERS
2994#endif /* CK_TIMERS */
2995#endif /* NOCKTIMERS */
2996
2997#define CK_SPEED                        /* Control-prefix removal */
2998#ifdef NOCKSPEED
2999#undef CK_SPEED
3000#endif /* NOCKSPEED */
3001
3002#ifndef NOCKXXCHAR
3003#ifndef CKXXCHAR
3004#ifdef UNIX
3005#define CKXXCHAR
3006#else
3007#ifdef OS2
3008#define CKXXCHAR
3009#endif /* OS2 */
3010#endif /* UNIX */
3011#endif /* CKXXCHAR */
3012#endif /* NOCKXXCHAR */
3013
3014#ifdef MAC                              /* For Macintosh, no escape */
3015#define NOPUSH                          /* to operating system */
3016#endif /* MAC */
3017
3018/* Systems where we can call zmkdir() to create directories. */
3019
3020#ifndef CK_MKDIR
3021#ifndef NOMKDIR
3022
3023#ifdef UNIX
3024#ifndef pdp11
3025#define CK_MKDIR
3026#endif /* pdp11 */
3027#endif /* UNIX */
3028
3029#ifdef OS2
3030#define CK_MKDIR
3031#endif /* OS2 */
3032
3033#ifdef VMS
3034#define CK_MKDIR
3035#endif /* VMS */
3036
3037#ifdef STRATUS
3038#define CK_MKDIR
3039#endif /* STRATUS */
3040
3041#ifdef OSK
3042#define CK_MKDIR
3043#endif /* OSK */
3044
3045#ifdef datageneral
3046#define CK_MKDIR
3047#endif /* datageneral */
3048
3049#endif /* CK_MKDIR */
3050#endif /* NOMKDIR */
3051
3052#ifdef NOMKDIR                          /* Allow for command-line override */
3053#ifdef CK_MKDIR
3054#undef CK_MKDIR
3055#endif /* CK_MKDIR */
3056#endif /* NOMKDIR */
3057
3058/* Systems for which we can enable the REDIRECT command automatically */
3059/*   As of 6.0.193, it should work for all UNIX... */
3060
3061#ifndef NOREDIRECT
3062#ifndef CK_REDIR
3063#ifdef UNIX
3064#define CK_REDIR
3065#endif /* UNIX */
3066#ifdef OS2                              /* As well as OS/2 and friends... */
3067#define CK_REDIR
3068#endif /* OS2 */
3069#endif /* CK_REDIR */
3070#endif /* NOREDIRECT */
3071
3072#ifdef NOPUSH                           /* But... REDIRECT command is not */
3073#ifdef CK_REDIR                         /*  allowed if NOPUSH is defined. */
3074#undef CK_REDIR
3075#endif /* CK_REDIR */
3076#ifdef NETCMD                           /* Nor is SET NET COMMAND */
3077#undef NETCMD
3078#endif /* NETCMD */
3079#ifdef NETPTY
3080#undef NETPTY
3081#endif /* NETPTY */
3082#endif /* NOPUSH */
3083
3084#ifndef PEXITSTAT                       /* \v(pexitstat) variable defined */
3085#ifdef OS2ORUNIX
3086#define PEXITSTAT
3087#else
3088#ifdef VMS
3089#define PEXITSTAT
3090#endif /* VMS */
3091#endif /* OS2ORUNIX */
3092#endif /* PEXITSTAT */
3093
3094/* The following allows automatic enabling of REDIRECT to be overridden... */
3095
3096#ifdef NOREDIRECT
3097#ifdef NETCMD
3098#undef NETCMD
3099#endif /* NETCMD */
3100#ifdef NETPTY
3101#undef NETPTY
3102#endif /* NETPTY */
3103#ifdef CK_REDIR
3104#undef CK_REDIR
3105#endif /* CK_REDIR */
3106#endif /* NOREDIRECT */
3107
3108#ifdef NONETCMD
3109#ifdef NETCMD
3110#undef NETCMD
3111#endif /* NETCMD */
3112#ifdef NETPTY
3113#undef NETPTY
3114#endif /* NETPTY */
3115#endif /* NONETCMD */
3116
3117#ifdef CK_REDIR
3118_PROTOTYP( int ttruncmd, (char *) );
3119#endif /* CK_REDIR */
3120
3121/* Use built-in DIRECTORY command */
3122
3123#ifndef NOMYDIR
3124#ifndef DOMYDIR
3125#ifdef UNIXOROSK
3126#define DOMYDIR
3127#else
3128#ifdef OS2
3129#define DOMYDIR
3130#else
3131#ifdef VMS
3132#define DOMYDIR
3133#endif /* VMS */
3134#endif /* OS2 */
3135#endif /* UNIXOROSK */
3136#endif /* DOMYDIR */
3137#endif /* NOMYDIR */
3138
3139/* Sending from and receiving to commands/pipes */
3140
3141#ifndef PIPESEND
3142#ifdef UNIX
3143#define PIPESEND
3144#endif /* UNIX */
3145#ifdef OS2
3146#define PIPESEND
3147#endif /* OS2 */
3148#endif /* PIPESEND */
3149
3150#ifdef PIPESEND
3151#ifdef NOPIPESEND
3152#undef PIPESEND
3153#endif /* NOPIPESEND */
3154#ifdef NOPUSH
3155#undef PIPESEND
3156#endif /* NOPUSH */
3157#endif /* PIPESEND */
3158
3159#ifdef NOPUSH
3160#ifdef BROWSER
3161#undef BROWSER
3162#endif /* BROWSER */
3163#endif /* NOPUSH */
3164
3165/* Versions where we support the RESEND command */
3166
3167#ifndef NOXFER
3168#ifndef NORESEND
3169#ifndef CK_RESEND
3170#ifdef UNIX
3171#ifndef pdp11
3172#define CK_RESEND
3173#endif /* pdp11 */
3174#endif /* UNIX */
3175
3176#ifdef VMS
3177#define CK_RESEND
3178#endif /* VMS */
3179
3180#ifdef OS2
3181#define CK_RESEND
3182#endif /* OS2 */
3183
3184#ifdef AMIGA
3185#define CK_RESEND
3186#endif /* AMIGA */
3187
3188#ifdef datageneral
3189#define CK_RESEND
3190#endif /* datageneral */
3191
3192#ifdef STRATUS
3193#define CK_RESEND
3194#endif /* STRATUS */
3195
3196#ifdef OSK
3197#define CK_RESEND
3198#endif /* OSK */
3199
3200#endif /* CK_RESEND */
3201#endif /* NORESEND */
3202#endif /* NOXFER */
3203
3204/* Systems implementing "Doomsday Kermit" protocol ... */
3205
3206#ifndef DOOMSDAY
3207#ifdef UNIX
3208#define DOOMSDAY
3209#else
3210#ifdef VMS
3211#define DOOMSDAY
3212#else
3213#ifdef OS2
3214#define DOOMSDAY
3215#else
3216#ifdef STRATUS
3217#define DOOMSDAY
3218#endif /* STRATUS */
3219#endif /* OS2 */
3220#endif /* VMS */
3221#endif /* UNIX */
3222#endif /* DOOMSDAY */
3223
3224/* Systems where we want the Thermometer to be used for fullscreen */
3225
3226#ifdef OS2
3227#ifndef CK_PCT_BAR
3228#define CK_PCT_BAR
3229#endif /* CK_PCT_BAR */
3230#endif /* OS2 */
3231
3232/* Systems where we have a REXX command */
3233
3234#ifdef OS2
3235#ifdef __32BIT__
3236#ifndef NOREXX
3237#define CK_REXX
3238#endif /* NOREXX */
3239#endif /* __32BIT__ */
3240#endif /* OS2 */
3241
3242/* Platforms that have a ZCHKPID function */
3243
3244#ifdef OS2ORUNIX
3245#define ZCHKPID
3246#endif /* OS2ORUNIX */
3247
3248#ifndef ZCHKPID
3249/* If we can't check pids then we have treat all pids as active & valid. */
3250#define zchkpid(x) 1
3251#endif /* ZCHKPID */
3252
3253/* Systems that have a ZRENAME function */
3254
3255#define ZRENAME                         /* They all do */
3256
3257/* Systems that have a ZCOPY function */
3258
3259#ifndef ZCOPY
3260#ifdef VMS
3261#define ZCOPY
3262#else
3263#ifdef OS2
3264#define ZCOPY
3265#else
3266#ifdef UNIX
3267#define ZCOPY
3268#else
3269#ifdef STRATUS
3270#define ZCOPY
3271#endif /* STRATUS */
3272#endif /* UNIX */
3273#endif /* OS2 */
3274#endif /* VMS */
3275#endif /* ZCOPY */
3276
3277/* Systems that have ttgwsiz() (they all should but they don't) */
3278
3279#ifndef NOTTGWSIZ
3280#ifndef CK_TTGWSIZ
3281#ifdef UNIX
3282#define CK_TTGWSIZ
3283#else
3284#ifdef VMS
3285#define CK_TTGWSIZ
3286#else
3287#ifdef OS2
3288#define CK_TTGWSIZ
3289#else
3290#ifdef OSK
3291#define CK_TTGWSIZ
3292#endif /* OSK */
3293#endif /* OS2 */
3294#endif /* VMS */
3295#endif /* UNIX */
3296#endif /* CK_TTGWSIZ */
3297#endif /* NOTTGWSIZ */
3298
3299#ifdef NOTTGWSIZ
3300#ifdef CK_TTGWSIZ
3301#undef CK_TTGWSIZ
3302#endif /* CK_TTGWSIZ */
3303#endif /* NOTTGWSIZ */
3304
3305/* OS/2 C-Kermit features not available in 16-bit version... */
3306
3307#ifdef OS2ONLY
3308#ifndef __32BIT__
3309#ifndef NOLOCAL
3310#ifdef PCFONTS                          /* PC Font support */
3311#undef PCFONTS
3312#endif /* PCFONTS */
3313#ifdef NPIPE                            /* Named Pipes communication */
3314#undef NPIPE
3315#endif /* NPIPE */
3316#ifdef CK_NETBIOS                       /* NETBIOS communication */
3317#undef CK_NETBIOS
3318#endif /* CK_NETBIOS */
3319#ifdef OS2MOUSE                         /* Mouse */
3320#undef OS2MOUSE
3321#endif /* OS2MOUSE */
3322#ifdef OS2PM                            /* Presentation Manager */
3323#undef OS2PM
3324#endif /* OS2PM */
3325#endif /* NOLOCAL */
3326#ifdef CK_REXX                          /* Rexx */
3327#undef CK_REXX
3328#endif /* CK_REXX */
3329#endif /* __32BIT__ */
3330#endif /* OS2ONLY */
3331
3332/* OS/2 C-Kermit features not available in Windows NT version... */
3333
3334#ifdef OS2
3335#ifdef NT
3336#ifdef PCFONTS                          /* PC Font support */
3337#undef PCFONTS
3338#endif /* PCFONTS */
3339#ifdef NPIPE                            /* Named Pipes communication */
3340#undef NPIPE
3341#endif /* NPIPE */
3342#ifdef OS2PM                            /* Presentation Manager */
3343#undef OS2PM
3344#endif /* OS2PM */
3345#ifdef CK_REXX                          /* Rexx */
3346#undef CK_REXX
3347#endif /* CK_REXX */
3348#endif /* NT */
3349#endif /* OS2 */
3350
3351/*
3352  Systems that have select().
3353  This is used for both msleep() and for read-buffer checking in in_chk().
3354*/
3355#define CK_SLEEPINT 250 /* milliseconds - set this to something that
3356                           divides evenly into 1000 */
3357#ifndef SELECT
3358#ifndef NOSELECT
3359#ifdef __linux__
3360#define SELECT
3361#else
3362#ifdef SUNOS4
3363#define SELECT
3364#else
3365#ifdef NEXT
3366#define SELECT
3367#else
3368#ifdef RTAIX
3369#define SELECT
3370#else
3371#ifdef HPUX
3372/*
3373  Not really.  I think it's only in HP-UX 7.0 and later, except it's also
3374  in earlier versions that have TCP/IP installed.  Override this default
3375  in particular HP-UX makefile entries by adding -DNOSELECT, as in (e.g.)
3376  the HP-UX 6.5 ones.
3377*/
3378#define SELECT
3379#else
3380#ifdef AIXRS
3381#define SELECT
3382#else
3383#ifdef BSD44
3384#define SELECT
3385#else
3386#ifdef BSD4
3387#define SELECT
3388#else
3389#ifdef OXOS
3390#define SELECT
3391#else
3392#ifdef OS2
3393#define SELECT
3394#else
3395#ifdef BEBOX
3396#define SELECT
3397#endif /* BEBOX */
3398#endif /* OS2 */
3399#endif /* OXOS */
3400#endif /* BSD4 */
3401#endif /* BSD44 */
3402#endif /* AIXRS */
3403#endif /* HPUX */
3404#endif /* RTAIX */
3405#endif /* NEXT */
3406#endif /* __linux__ */
3407#endif /* SUNOS4 */
3408#endif /* NOSELECT */
3409#endif /* SELECT */
3410
3411/*
3412  The following section moved here from ckcnet.h in 6.1 because select()
3413  is now used for non-networking purposes.
3414*/
3415
3416/* On HP-9000/500 HP-UX 5.21 this stuff is not defined in any header file */
3417
3418#ifdef hp9000s500
3419#ifndef NEEDSELECTDEFS
3420#define NEEDSELECTDEFS
3421#endif /* NEEDSELECTDEFS */
3422#endif /* hp9000s500 */
3423
3424#ifdef NEEDSELECTDEFS
3425typedef long fd_mask;
3426#ifndef NBBY
3427#define NBBY 8
3428#endif /* NBBY */
3429#ifndef FD_SETSIZE
3430#define FD_SETSIZE 32
3431#endif /* FD_SETSIZE */
3432#ifndef NFDBITS
3433#define NFDBITS (sizeof(fd_mask) * NBBY)
3434#endif /* NFDBITS */
3435#ifndef howmany
3436#define howmany(x,y) (((x)+((y)-1))/(y))
3437#endif /* howmany */
3438typedef struct fd_set {
3439    fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
3440} fd_set;
3441#ifndef FD_SET
3442#define FD_SET(n,p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
3443#endif /* FD_SET */
3444#ifndef FD_CLR
3445#define FD_CLR(n,p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
3446#endif /* FD_CLR */
3447#ifndef FD_ISSET
3448#define FD_ISSET(n,p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
3449#endif /* FD_ISSET */
3450#ifndef FD_COPY
3451#define FD_COPY(f,t) (bcopy(f,t,sizeof(*(f)))
3452#endif /* FD_COPY */
3453#ifndef FD_ZERO
3454#define FD_ZERO(p) bzero((char *)(p),sizeof(*(p)))
3455#endif /* FD_ZERO */
3456#endif /* NEEDSELECTDEFS */
3457
3458/*
3459  CK_NEED_SIG is defined if the system cannot check the console to
3460  to see if characters are waiting.  This is used during local-mode file
3461  transfer to interrupt the transfer, refresh the screen display, etc.
3462  If CK_NEED_SIG is defined, then file-transfer interruption characters
3463  have to be preceded a special character, e.g. the SIGQUIT character.
3464  CK_NEED_SIG should be defined if the conchk() function is not operational.
3465*/
3466#ifdef NOPOLL                           /* For overriding CK_POLL definition */
3467#ifdef CK_POLL
3468#undef CK_POLL
3469#endif /* CK_POLL */
3470#endif /* NOPOLL */
3471
3472#ifndef CK_POLL                         /* If we don't have poll() */
3473#ifndef RDCHK                           /* And we don't have rdchk() */
3474#ifndef SELECT                          /* And we don't have select() */
3475#ifdef ATTSV
3476#ifndef aegis
3477#ifndef datageneral
3478#ifndef OXOS
3479#define CK_NEED_SIG
3480#endif /* OXOS */
3481#endif /* datageneral */
3482#endif /* aegis */
3483#endif /* ATTSV */
3484#ifdef POSIX
3485#ifndef CK_NEED_SIG
3486#define CK_NEED_SIG
3487#endif /* CK_NEED_SIG */
3488#endif /* POSIX */
3489#endif /* SELECT */
3490#endif /* RDCHK */
3491#endif /* CK_POLL */
3492
3493#ifdef HPUX                             /* HP-UX has select() */
3494#ifdef CK_NEED_SIG
3495#undef CK_NEED_SIG
3496#endif /* CK_NEED_SIG */
3497#endif /* HPUX */
3498
3499#ifdef AIXRS                            /* AIX has select() */
3500#ifdef CK_NEED_SIG
3501#undef CK_NEED_SIG
3502#endif /* CK_NEED_SIG */
3503#endif /* AIXRS */
3504
3505#ifdef BSD44                            /* 4.4BSD has FIONREAD */
3506#ifdef CK_NEED_SIG
3507#undef CK_NEED_SIG
3508#endif /* CK_NEED_SIG */
3509#endif /* BSD44 */
3510
3511#ifdef QNX                              /* QNX has FIONREAD and select() */
3512#ifdef CK_NEED_SIG
3513#undef CK_NEED_SIG
3514#endif /* CK_NEED_SIG */
3515#endif /* QNX */
3516
3517#ifdef COHERENT
3518#ifndef NOTIMEZONE
3519#define NOTIMEZONE
3520#endif /* NOTIMEZONE */
3521#endif /* COHERENT */
3522
3523#ifdef UNIX
3524#ifndef HAVE_TZ                         /* Can we use struct timezone? */
3525#ifndef NOTIMEZONE
3526#ifdef PTX
3527#define NOTIMEZONE
3528#else
3529#ifndef SELECT
3530#ifdef COHERENT
3531#define NOTIMEZONE
3532#else
3533#ifdef BELLV10
3534#define NOTIMEZONE
3535#endif /* BELLV10 */
3536#endif /* COHERENT */
3537#endif /* SELECT */
3538#endif /* PTX */
3539#endif /* NOTIMEZONE */
3540#endif /* HAVE_TZ */
3541#ifndef NOTIMEVAL                       /* Can we use struct timeval? */
3542#ifndef HAVE_TV
3543#define HAVE_TV
3544#endif /* HAVE_TV */
3545#endif /* NOTIMEVAL */
3546#ifndef NOTIMEZONE
3547#ifndef HAVE_TZ
3548#define HAVE_TZ
3549#endif /* HAVE_TZ */
3550#endif /* NOTIMEZONE */
3551#endif /* UNIX */
3552
3553#ifdef SCO32
3554#ifdef HAVE_TV
3555#undef HAVE_TV
3556#endif /* HAVE_TV */
3557#ifdef HAVE_TZ
3558#undef HAVE_TZ
3559#endif /* HAVE_TZ */
3560#ifndef NOTIMEVAL
3561#define NOTIMEVAL
3562#endif /* NOTIMEVAL */
3563#ifndef NOTIMEZONE
3564#define NOTIMEZONE
3565#endif /* NOTIMEZONE */
3566#endif /* SCO32 */
3567
3568#ifdef ATT7300
3569#ifdef HAVE_TV
3570#undef HAVE_TV
3571#endif /* HAVE_TV */
3572#ifdef HAVE_TZ
3573#undef HAVE_TZ
3574#endif /* HAVE_TZ */
3575#ifndef NOTIMEVAL
3576#define NOTIMEVAL
3577#endif /* NOTIMEVAL */
3578#ifndef NOTIMEZONE
3579#define NOTIMEZONE
3580#endif /* NOTIMEZONE */
3581#endif /* ATT7300 */
3582
3583/*
3584  Automatic parity detection.
3585  This actually implies a lot more now: length-driven packet reading,
3586  "Doomsday Kermit" IBM Mainframe file transfer through 3270 data streams, etc.
3587*/
3588#ifdef UNIX                             /* For Unix */
3589#ifndef NOPARSEN
3590#define PARSENSE
3591#endif /* NOPARSEN */
3592#endif /* UNIX */
3593
3594#ifdef VMS                              /* ... and VMS */
3595#ifndef NOPARSEN
3596#define PARSENSE
3597#endif /* NOPARSEN */
3598#ifdef __GNUC__
3599#define VMSGCC
3600#endif /* __GNUC__ */
3601#endif /* VMS */
3602
3603#ifdef MAC                              /* and Macintosh */
3604#ifndef NOPARSEN
3605#define PARSENSE
3606#endif /* NOPARSEN */
3607#endif /* MAC */
3608
3609#ifdef STRATUS                          /* and Stratus VOS */
3610#ifndef NOPARSEN
3611#define PARSENSE
3612#endif /* NOPARSEN */
3613#endif /* STRATUS */
3614
3615#ifdef OS2                              /* and OS/2, finally */
3616#ifndef NOPARSEN
3617#define PARSENSE
3618#endif /* NOPARSEN */
3619#endif /* OS2 */
3620
3621#ifndef NODYNAMIC                       /* DYNAMIC is default for UNIX */
3622#ifndef DYNAMIC                         /* as of C-Kermit 7.0 */
3623#ifdef UNIX
3624#define DYNAMIC
3625#endif /* UNIX */
3626#endif /* DYNAMIC */
3627#endif /* NODYNAMIC */
3628
3629#ifdef DYNAMIC                          /* If DYNAMIC is defined */
3630#define DCMDBUF                         /* then also define this. */
3631#endif /* DYNAMIC */
3632
3633#ifndef CK_LBRK                         /* Can send Long BREAK */
3634
3635#ifdef UNIX                             /* (everybody but OS-9) */
3636#define CK_LBRK
3637#endif /* UNIX */
3638#ifdef VMS
3639#define CK_LBRK
3640#endif /* VMS */
3641#ifdef datageneral
3642#define CK_LBRK
3643#endif /* datageneral */
3644#ifdef GEMDOS
3645#define CK_LBRK
3646#endif /* GEMDOS */
3647#ifdef OS2
3648#define CK_LBRK
3649#endif /* OS2 */
3650#ifdef AMIGA
3651#define CK_LBRK
3652#endif /* AMIGA */
3653#ifdef STRATUS
3654#define CK_LBRK
3655#endif /* STRATUS */
3656
3657#endif /* CK_LBRK */
3658
3659/* Carrier treatment */
3660/* These are defined here because they are shared by the system dependent */
3661/* and the system independent modules. */
3662
3663#define  CAR_OFF 0      /* Off: ignore carrier always. */
3664#define  CAR_ON  1      /* On: heed carrier always, except during DIAL. */
3665#define  CAR_AUT 2      /* Auto: heed carrier, but only if line is declared */
3666                        /* to be a modem line, and only during CONNECT. */
3667
3668/* And more generically (for use with any ON/OFF/AUTO feature) */
3669#define  CK_OFF  0
3670#define  CK_ON   1
3671#define  CK_AUTO 2
3672
3673#ifndef NOLOCAL
3674/*
3675  Serial interface speeds available.
3676
3677  As of C-Kermit 6.1 there is a new method to get the supported
3678  speeds, which obviates the need for all the craziness below.  At runtime,
3679  just call the new ttspdlist() routine to get a list of supported speeds.
3680  Then the user interface module can build a keyword table or menu from it.
3681*/
3682#ifndef TTSPDLIST
3683#ifdef UNIX                             /* For now, only for UNIX */
3684#ifndef OLINUXHISPEED                   /* But not systems with hacks for */
3685#ifndef MINIX                           /* high speeds, like 110 = 115200 */
3686#define TTSPDLIST
3687#endif /* MINIX */
3688#endif /* OLINUXHISPEED */
3689#else
3690#ifdef VMS
3691#define TTSPDLIST                       /* VMS gets it too */
3692#endif /* VMS */
3693#endif /* UNIX */
3694#endif /* TTSPDLIST */
3695
3696#ifndef NODIAL                          /* Hangup by modem command */
3697#ifndef NOMDMHUP
3698#ifndef MDMHUP
3699#define MDMHUP
3700#endif /* MDMHUP */
3701#endif /* NOMDMHUP */
3702#endif /* NODIAL */
3703
3704#ifdef NOSPL
3705#ifndef NOLOGDIAL                       /* Connection log needs mjd(), etc. */
3706#define NOLOGDIAL
3707#endif /* NOLOGDIAL */
3708#endif /* NOSPL */
3709
3710#ifdef pdp11
3711#define NOLOGDIAL
3712#endif /* pdp11 */
3713
3714#ifndef NOLOGDIAL                       /* Connection log */
3715#ifndef CXLOGFILE
3716#define CXLOGFILE "CX.LOG"              /* Default connection log file name */
3717#endif /* CXLOGFILE */
3718#ifndef CKLOGDIAL
3719#ifndef CK_SMALL
3720#define CKLOGDIAL
3721#define CXLOGBUFL 1024                  /* Connection log record buffer size */
3722#endif /* CK_SMALL */
3723#endif /* NOLOGDIAL */
3724#endif /* CKLOGDIAL */
3725
3726#endif /* NOLOCAL */
3727
3728#ifdef NOTTSPDLIST                      /* Except if NOTTSPDLIST is defined */
3729#ifdef TTSPDLIST
3730#undef TTSPDLIST
3731#endif /* TTSPDLIST */
3732#endif /* NOTTSPDLIST */
3733
3734#ifdef TTSPDLIST
3735
3736_PROTOTYP( long * ttspdlist, (void) );
3737
3738#else /* TTSPDLIST not defined */
3739/*
3740  We must use a long and convoluted series of #ifdefs that have to be kept in
3741  sync with the code in the ck?tio.c module.
3742
3743  We assume that everybody supports: 0, 110, 300, 600, 1200, 2400, 4800, and
3744  9600 bps.  Symbols for other speeds are defined here.  You can also add
3745  definitions on the CC command lines.  These definitions affect the SET SPEED
3746  keyword table, and are not necessarily usable in the system-dependent
3747  speed-setting code in the ck?tio.c modules, which depends on system-specific
3748  symbols like (in UNIX) B19200.  In other words, just defining it doesn't
3749  mean it'll work -- you also have to supply the supporting code in ttsspd()
3750  and ttgspd() in ck?tio.c.
3751
3752  The symbols have the form BPS_xxxx, where xxxx is the speed in bits per
3753  second, or (for bps values larger than 9999) thousands of bps followed by K.
3754  The total symbol length should be 8 characters or less.  Some values are
3755  enabled automatically below.  You can disable a particular value by defining
3756  NOB_xxxx on the CC command line.
3757
3758*/
3759
3760#ifndef NOB_50
3761#define BPS_50                          /* 50 bps */
3762#endif
3763
3764#ifndef NOB_75
3765#define BPS_75                          /* 75 bps */
3766#endif
3767
3768#ifndef NOB7512
3769#ifdef ANYBSD
3770#define BPS_7512                        /* 75/1200 Split Speed */
3771#endif /* ANYBSD */
3772#endif /* NOB7512 */
3773
3774#ifndef NOB134
3775#ifdef SOLARIS25
3776#define BPS_134
3777#else
3778#undef BPS_134                          /* 134.5 bps (IBM 2741) */
3779#endif /* BPS_134 */
3780#endif /* NOB134 */
3781
3782#ifndef NOB_150
3783#define BPS_150                         /* 150 bps */
3784#endif
3785
3786#ifndef NOB_200
3787#define BPS_200                         /* 200 bps */
3788#endif
3789
3790#ifndef NOB_1800
3791#ifdef MAC
3792#define BPS_1800                        /* 1800 bps */
3793#else
3794#ifdef SOLARIS25
3795#define BPS_1800
3796#endif
3797#endif
3798#endif
3799
3800#ifndef NOB_3600
3801#ifndef SOLARIS25
3802#define BPS_3600                        /* 3600 bps */
3803#endif
3804#endif
3805
3806#ifndef NOB_7200
3807#ifndef SOLARIS25
3808#define BPS_7200                        /* 7200 bps */
3809#endif /* SOLARIS25 */
3810#endif
3811
3812#ifndef NOB_14K
3813#ifdef BSD44
3814#define BPS_14K                         /* 14400 bps */
3815#else
3816#ifdef OS2
3817#define BPS_14K
3818#else
3819#ifdef NEXT
3820#define BPS_14K
3821#else
3822#ifdef MAC
3823#define BPS_14K
3824#else
3825#ifdef AMIGA
3826#define BPS_14K
3827#endif /* AMIGA */
3828#endif /* MAC */
3829#endif /* NEXT */
3830#endif /* OS2 */
3831#endif /* BSD44 */
3832#endif /* NOB_14K */
3833
3834#ifndef NOB_19K
3835#define BPS_19K                         /* 19200 bps */
3836#endif
3837
3838#ifndef NOB_28K
3839#ifdef BSD44
3840#define BPS_28K
3841#else
3842#ifdef OS2
3843#define BPS_28K
3844#else
3845#ifdef NEXT
3846#define BPS_28K                         /* 28800 bps */
3847#else
3848#ifdef MAC
3849#define BPS_28K                         /* 28800 bps */
3850#endif /* MAC */
3851#endif /* NEXT */
3852#endif /* OS2 */
3853#endif /* BSD44 */
3854#endif /* NOB_28K */
3855
3856#ifndef NOB_38K
3857#define BPS_38K                         /* 38400 bps */
3858#endif
3859
3860#ifndef NOB_57K
3861#ifdef Plan9
3862#define BPS_57K
3863#else
3864#ifdef SOLARIS25
3865#define BPS_57K
3866#else
3867#ifdef VMS
3868#define BPS_57K                         /* 57600 bps */
3869#else
3870#ifdef OS2
3871#define BPS_57K
3872#else
3873#ifdef __linux__
3874#define BPS_57K
3875#else
3876#ifdef HPUX
3877#define BPS_57K
3878#else
3879#ifdef NEXT
3880#define BPS_57K
3881#else
3882#ifdef __386BSD__
3883#define BPS_57K
3884#else
3885#ifdef __FreeBSD__
3886#define BPS_57K
3887#else
3888#ifdef __NetBSD__
3889#define BPS_57K
3890#else
3891#ifdef MAC
3892#define BPS_57K
3893#else
3894#ifdef QNX
3895#define BPS_57K
3896#else
3897#ifdef BEOSORBEBOX
3898#define BPS_57K
3899#else
3900#ifdef IRIX62
3901#define BPS_57K
3902#else
3903#ifdef SCO_OSR504
3904#define BPS_57K
3905#else
3906#ifdef BSDI2
3907#define BPS_57K
3908#endif /* BSDI2 */
3909#endif /* SCO_OSR504 */
3910#endif /* IRIX62 */
3911#endif /* BEOSORBEBOX */
3912#endif /* QNX */
3913#endif /* MAC */
3914#endif /* __NetBSD__ */
3915#endif /* __FreeBSD__ */
3916#endif /* __386BSD__ */
3917#endif /* NEXT */
3918#endif /* HPUX */
3919#endif /* __linux__ */
3920#endif /* OS2 */
3921#endif /* VMS */
3922#endif /* SOLARIS25 */
3923#endif /* Plan9 */
3924#endif /* NOB_57K */
3925
3926#ifndef NOB_76K
3927#ifdef BSDI2
3928#define BPS_76K
3929#endif /* BSDI2 */
3930#ifdef Plan9
3931#define BPS_76K
3932#endif /* Plan9 */
3933#ifdef SOLARIS25
3934#define BPS_76K
3935#endif /* SOLARIS25 */
3936#ifdef VMS
3937#define BPS_76K                         /* 76800 bps */
3938#endif /* VMS */
3939#ifdef OS2
3940#ifdef __32BIT__
3941#define BPS_76K
3942#endif /* __32BIT__ */
3943#endif /* OS2 */
3944#ifdef QNX
3945#define BPS_76K
3946#endif /* QNX */
3947#ifdef IRIX62
3948#define BPS_76K
3949#endif /* IRIX62 */
3950#ifdef SCO_OSR504
3951#define BPS_76K
3952#endif /* SCO_OSR504 */
3953#endif /* NOB_76K */
3954
3955#ifndef NOB_115K
3956#ifdef BSDI2
3957#define BPS_115K
3958#endif /* BSDI2 */
3959#ifdef Plan9
3960#define BPS_115K
3961#endif /* Plan9 */
3962#ifdef SOLARIS25
3963#define BPS_115K
3964#endif /* SOLARIS25 */
3965#ifdef VMS
3966#define BPS_115K                        /* 115200 bps */
3967#else
3968#ifdef QNX
3969#define BPS_115K
3970#else
3971#ifdef HPUX
3972#define BPS_115K
3973#else
3974#ifdef __linux__
3975#define BPS_115K
3976#else
3977#ifdef __386BSD__
3978#define BPS_115K
3979#else
3980#ifdef __FreeBSD__
3981#define BPS_115K
3982#else
3983#ifdef __NetBSD__
3984#define BPS_115K
3985#else
3986#ifdef OS2
3987#ifdef __32BIT__
3988#define BPS_115K
3989#endif /* __32BIT__ */
3990#else
3991#ifdef BEOSORBEBOX
3992#define BPS_115K
3993#else
3994#ifdef IRIX62
3995#define BPS_115K
3996#else
3997#ifdef SCO_OSR504
3998#define BPS_115K
3999#endif /* SCO_OSR504 */
4000#endif /* IRIX62 */
4001#endif /* BEOSORBEBOX */
4002#endif /* OS2 */
4003#endif /* __NetBSD__ */
4004#endif /* __FreeBSD__ */
4005#endif /* __386BSD__ */
4006#endif /* __linux__ */
4007#endif /* HPUX */
4008#endif /* QNX */
4009#endif /* VMS */
4010#endif /* NOB_115K */
4011
4012#ifndef NOB_230K                        /* 230400 bps */
4013#ifdef BSDI2
4014#define BPS_230K
4015#else
4016#ifdef SCO_OSR504
4017#define BPS_230K
4018#else
4019#ifdef __linux__
4020#define BPS_230K
4021#else
4022#ifdef SOLARIS25
4023#define BPS_230K
4024#else
4025#ifdef OS2
4026#ifdef __32BIT__
4027#define BPS_230K
4028#endif /* __32BIT__ */
4029#else
4030#undef BPS_230K
4031#endif /* OS2 */
4032#endif /* SOLARIS25 */
4033#endif /* __linux__ */
4034#endif /* SCO_OSR504 */
4035#endif /* BSDI2 */
4036#endif /* NOB_230K */
4037
4038#ifndef NOB_460K                        /* 460800 bps */
4039#ifdef SCO_OSR504
4040#define BPS_460K
4041#else
4042#ifdef __linux__
4043#define BPS_460K
4044#else
4045#ifdef OS2
4046#ifdef __32BIT__
4047#define BPS_460K
4048#endif /* __32BIT__ */
4049#else
4050#undef BPS_460K
4051#endif /* __linux__ */
4052#endif /* SCO_OSR504 */
4053#endif /* OS2 */
4054#endif /* NOB_460K */
4055
4056#ifndef NOB_921K                        /* 921600 bps */
4057#ifdef SCO_OSR504
4058#define BPS_921K
4059#endif /* SCO_OSR504 */
4060#endif /* NOB_921K */
4061
4062#ifdef BPS_921K                         /* Maximum speed defined */
4063#define MAX_SPD 921600L
4064#else
4065#ifdef BPS_460K
4066#define MAX_SPD 460800L
4067#else
4068#ifdef BPS_230K
4069#define MAX_SPD 230400L
4070#else
4071#ifdef BPS_115K
4072#define MAX_SPD 115200L
4073#else
4074#ifdef BPS_76K
4075#define MAX_SPD 76800L
4076#else
4077#ifdef BPS_57K
4078#define MAX_SPD 57600L
4079#else
4080#ifdef BPS_38K
4081#define MAX_SPD 38400L
4082#else
4083#ifdef BPS_28K
4084#define MAX_SPD 28800L
4085#else
4086#ifdef BPS_19K
4087#define MAX_SPD 19200L
4088#else
4089#ifdef BPS_14K
4090#define MAX_SPD 14400L
4091#else
4092#define MAX_SPD 9600L
4093#endif
4094#endif
4095#endif
4096#endif
4097#endif
4098#endif
4099#endif
4100#endif
4101#endif
4102#endif
4103#endif /* TTSPDLIST */
4104
4105#ifndef CONGSPD                         /* Systems that can call congspd() */
4106#ifdef UNIX
4107#define CONGSPD
4108#endif /* UNIX */
4109#ifdef VMS
4110#define CONGSPD
4111#endif /* VMS */
4112#ifdef STRATUS
4113#define CONGSPD
4114#endif /* STRATUS */
4115#endif /* CONGSPD */
4116
4117/* Types of flow control available */
4118
4119#define CK_XONXOFF                      /* Everybody can do this, right? */
4120
4121#ifdef AMIGA                            /* Commodore Amiga */
4122#define CK_RTSCTS                       /* has RTS/CTS */
4123#endif /* AMIGA */
4124
4125#ifdef SUN4S5                           /* SunOS in System V environment */
4126#define CK_RTSCTS
4127#else                                   /* SunOS 4.0/4.1 in BSD environment */
4128#ifdef SUNOS4                           /* SunOS 4.0+later supports RTS/CTS */
4129#ifdef SUNOS41                          /* Easy in 4.1 and later */
4130#define CK_RTSCTS
4131#else                                   /* Harder in 4.0 */
4132#ifndef __GNUC__                        /* (see tthflow() in ckutio.c) */
4133#ifndef GNUC
4134#define CK_RTSCTS                       /* Only if not using GNU gcc */
4135#endif /* __GNUC__ */
4136#endif /* GNUC */
4137#endif /* SUNOS41 */
4138#endif /* SUNOS4 */
4139#endif /* SUN4S5 */
4140
4141#ifdef BSD44                            /* And in 4.4 BSD, including BSDI */
4142#define CK_RTSCTS
4143#endif /* BSD44 */
4144
4145#ifdef TERMIOX                          /* Sys V R4 <termiox.h> */
4146#ifndef CK_RTSCTS
4147#define CK_RTSCTS
4148#endif /* CK_RTSCTS */
4149#ifndef CK_DTRCD
4150#define CK_DTRCD
4151#endif /* CK_DTRCD */
4152#else
4153#ifdef STERMIOX                         /* Sys V R4 <sys/termiox.h> */
4154#ifndef CK_RTSCTS
4155#define CK_RTSCTS
4156#endif /* CK_RTSCTS */
4157#ifndef CK_DTRCD
4158#define CK_DTRCD
4159#endif /* CK_DTRCD */
4160#endif /* STERMIOX */
4161#endif /* TERMIOX */
4162
4163#ifdef OXOS                             /* Olivetti X/OS R2 struct termios */
4164#define CK_RTSCTS                       /* Ditto. */
4165#define CK_DTRCD
4166#endif /* OXOS */
4167
4168#ifdef AIXRS                            /* RS/6000 with AIX 3.x */
4169#define CK_RTSCTS                       /* Has its own peculiar method... */
4170#endif /* AIXRS */
4171
4172#ifdef __linux__                        /* Linux */
4173#define CK_RTSCTS
4174#endif /* __linux__ */
4175/*
4176  Hardware flow control is not defined in POSIX.1.  Nevertheless, a certain
4177  style API for hardware flow control, using tcsetattr() and the CRTSCTS
4178  bit(s), seems to be gaining currency on POSIX-based UNIX systems.  The
4179  following code defines the symbol POSIX_CRTSCTS for such systems.
4180*/
4181#ifdef CK_RTSCTS
4182#ifdef __bsdi__                         /* BSDI, a.k.a. BSD/386 */
4183#define POSIX_CRTSCTS
4184#endif /* __bsdi__ */
4185#ifdef __linux__                        /* Linux */
4186#define POSIX_CRTSCTS
4187#endif /* __linux__ */
4188#ifdef __NetBSD__                       /* NetBSD */
4189#define POSIX_CRTSCTS
4190#endif /* __NetBSD__ */
4191#ifdef __OpenBSD__
4192#define POSIX_CRTSCTS
4193#endif /* __OpenBSD__ */
4194#ifdef BEOSORBEBOX                      /* BeBOX */
4195#define POSIX_CRTSCTS
4196/* BEBOX defines CRTSFL as (CTSFLOW & RTSFLOW) */
4197#define CRTSCTS CRTSFL
4198#endif /* BEOSORBEBOX */
4199#ifdef IRIX52                           /* IRIX 5.2 and later */
4200#define POSIX_CRTSCTS
4201#define CRTSCTS CNEW_RTSCTS             /* See <sys/termios.h> */
4202#endif /* IRIX52 */
4203#endif /* CK_RTSCTS */
4204
4205/* Implementations that have implemented the ttsetflow() function. */
4206
4207#ifndef CK_TTSETFLOW
4208#ifdef UNIX
4209#define CK_TTSETFLOW
4210#endif /* UNIX */
4211#ifdef OS2
4212#define CK_TTSETFLOW
4213#endif /* OS2 */
4214#endif /* CK_TTSETFLOW */
4215
4216#ifdef CK_TTSETFLOW
4217_PROTOTYP( int ttsetflow, (int) );
4218#endif /* CK_TTSETFLOW */
4219/*
4220 Systems where we can expand tilde at the beginning of file or directory names
4221*/
4222#ifdef POSIX
4223#ifndef DTILDE
4224#define DTILDE
4225#endif /* DTILDE */
4226#endif /* POSIX */
4227#ifdef BSD4
4228#ifndef DTILDE
4229#define DTILDE
4230#endif /* DTILDE */
4231#endif /* BSD4 */
4232#ifdef ATTSV
4233#ifndef DTILDE
4234#define DTILDE
4235#endif /* DTILDE */
4236#endif /* ATTSV */
4237#ifdef OSK
4238#ifndef DTILDE
4239#define DTILDE
4240#endif /* DTILDE */
4241#endif /* OSK */
4242#ifdef HPUX                             /* I don't know why this is */
4243#ifndef DTILDE                          /* necessary, since -DHPUX */
4244#define DTILDE                          /* automatically defines ATTSV */
4245#endif /* DTILDE */                     /* (see above) ... */
4246#endif /* HPUX */
4247
4248/*
4249  This is mainly for the benefit of ckufio.c (UNIX and OS/2 file support).
4250  Systems that have an atomic rename() function, so we don't have to use
4251  link() and unlink().
4252*/
4253#ifdef POSIX
4254#ifndef RENAME
4255#define RENAME
4256#endif /* RENAME */
4257#endif /* POSIX */
4258
4259#ifdef OS2
4260#ifndef RENAME
4261#define RENAME
4262#endif /* RENAME */
4263#endif /* OS2 */
4264
4265#ifdef SUNOS41
4266#ifndef RENAME
4267#define RENAME
4268#endif /* RENAME */
4269#endif /* SUNOS41 */
4270
4271#ifdef SVR4
4272#ifndef RENAME
4273#define RENAME
4274#endif /* RENAME */
4275#endif /* SVR4 */
4276
4277#ifdef AIXRS
4278#ifndef RENAME
4279#define RENAME
4280#endif /* RENAME */
4281#endif /* AIXRS */
4282
4283#ifdef BSD44
4284#ifndef RENAME
4285#define RENAME
4286#endif /* RENAME */
4287#endif /* BSD44 */
4288
4289#ifdef NORENAME                         /* Allow for compile-time override */
4290#ifdef RENAME
4291#undef RENAME
4292#endif /* RENAME */
4293#endif /* NORENAME */
4294
4295#ifdef STRATUS                          /* Stratus VOS */
4296#ifndef RENAME
4297#define RENAME
4298#endif /* RENAME */
4299#endif /* STRATUS */
4300
4301/* Line delimiter for text files */
4302
4303/*
4304 If the system uses a single character for text file line delimitation,
4305 define NLCHAR to the value of that character.  For text files, that
4306 character will be converted to CRLF upon output, and CRLF will be converted
4307 to that character on input during text-mode (default) packet operations.
4308*/
4309#ifdef MAC                              /* Macintosh */
4310#define NLCHAR 015
4311#else
4312#ifdef OSK                              /* OS-9/68K */
4313#define NLCHAR 015
4314#else                                   /* All Unix-like systems */
4315#define NLCHAR 012
4316#endif /* OSK */
4317#endif /* MAC */
4318
4319/*
4320 At this point, if there's a system that uses ordinary CRLF line
4321 delimitation AND the C compiler actually returns both the CR and
4322 the LF when doing input from a file, then #undef NLCHAR.
4323*/
4324#ifdef OS2                              /* OS/2 */
4325#undef NLCHAR
4326#endif /* OS2 */
4327
4328#ifdef GEMDOS                           /* Atari ST */
4329#undef NLCHAR
4330#endif /* GEMDOS */
4331
4332/*
4333  VMS file formats are so complicated we need to do all the conversion
4334  work in the CKVFIO module, so we tell the rest of C-Kermit not to fiddle
4335  with the bytes.
4336*/
4337
4338#ifdef vms
4339#undef NLCHAR
4340#endif /* vms */
4341
4342/* The device name of a job's controlling terminal */
4343/* Special for VMS, same for all Unixes (?), not used by Macintosh */
4344
4345#ifdef BEOS
4346#define CTTNAM dftty
4347#else
4348#ifdef vms
4349#define CTTNAM "SYS$INPUT:"             /* (4 Jan 2002) Was TT: */
4350#else
4351#ifdef datageneral
4352#define CTTNAM "@output"
4353#else
4354#ifdef OSK
4355extern char myttystr[];
4356#define CTTNAM myttystr
4357#else
4358#ifdef OS2
4359#define CTTNAM "con"
4360#else
4361#ifdef UNIX
4362#define CTTNAM "/dev/tty"
4363#else
4364#ifdef GEMDOS
4365#define CTTNAM "aux:"
4366#else
4367#ifdef STRATUS
4368extern char myttystr[];
4369#define CTTNAM myttystr
4370#else /* Anyone else... */
4371#define CTTNAM "stdout"                 /* This is a kludge used by Mac */
4372#endif /* STRATUS */
4373#endif /* GEMDOS */
4374#endif /* UNIX */
4375#endif /* OS2 */
4376#endif /* OSK */
4377#endif /* datageneral */
4378#endif /* vms */
4379#endif /* BEOS */
4380
4381#ifndef HAVECTTNAM
4382#ifdef UNIX
4383#define HAVECTTNAM
4384#else
4385#ifdef VMS
4386#define HAVECTTNAM
4387#endif /* VMS */
4388#endif /* UNIX */
4389#endif /* HAVECTTNAM */
4390
4391#ifndef ZFCDAT                          /* zfcdat() function available? */
4392#ifdef UNIX
4393#define  ZFCDAT
4394#else
4395#ifdef STRATUS
4396#define  ZFCDAT
4397#else
4398#ifdef GEMDOS
4399#define  ZFCDAT
4400#else
4401#ifdef AMIGA
4402#define  ZFCDAT
4403#else
4404#ifdef OS2
4405#define  ZFCDAT
4406#else
4407#ifdef datageneral
4408#define  ZFCDAT
4409#else
4410#ifdef VMS
4411#define  ZFCDAT
4412#endif /* VMS */
4413#endif /* datageneral */
4414#endif /* OS2 */
4415#endif /* AMIGA */
4416#endif /* GEMDOS */
4417#endif /* STRATUS */
4418#endif /* UNIX */
4419#endif /* ZFCDAT */
4420
4421#ifdef SUNS4S5
4422#define tolower _tolower
4423#define toupper _toupper
4424#endif /* SUNS4S5 */
4425
4426/* Error number */
4427
4428#ifdef _CRAY
4429#ifdef _CRAYCOM                         /* Cray Computer Corp. */
4430extern int errno;
4431#else /* _CRAYCOM */
4432#include <errno.h>                      /* Cray Research UNICOS defines */
4433                                        /* errno as a function. */
4434#endif /* _CRAYCOM */                   /* OK for UNICOS 6.1 and 7.0. */
4435#else /* _CRAY */
4436#ifdef STRATUS                          /* Stratus VOS */
4437#include <errno.h>
4438#else /* not STRATUS */
4439#ifndef VMS
4440#ifndef OS2
4441#ifdef __GLIBC__
4442/*
4443  "glibc uses threads, kermit uses glibc; errno access is in Thread Local
4444  Storage (TLS) from glibc-3.2.2.  ...a thread specific errno is being run in
4445  thread local storage relative to the %gs segment register, so some means to
4446  revector gets/puts needs to be done." - Jeff Johnson, Red Hat, Feb 2003.
4447*/
4448#include <errno.h>
4449#else
4450/*
4451  The following declaration would cause problems for VMS and OS/2, in which
4452  errno is an "extern volatile int noshare"...
4453*/
4454#include <errno.h>
4455#endif /* __GLIBC__ */
4456#endif /* OS2 */
4457#endif /* VMS */
4458#endif /* STRATUS */
4459#endif /* _CRAY */
4460
4461#ifdef pdp11                            /* Try to make some space on PDP-11 */
4462#ifndef NODIAL
4463#define NODIAL
4464#endif /* NODIAL */
4465#ifndef NOCURSES
4466#define NOCURSES
4467#endif /* NOCURSES */
4468#ifndef NOBIGBUF
4469#define NOBIGBUF
4470#endif /* NOBIGBUF */
4471#endif /* pdp11 */
4472
4473#ifndef NOBIGBUF
4474#ifndef BIGBUFOK                        /* Platforms with lots of memory */
4475
4476#ifdef QNX                              /* QNX */
4477#ifndef QNX16                           /* But not 16-bit versions */
4478#define BIGBUFOK
4479#endif /* QNX16 */
4480#endif /* QNX */
4481
4482#ifdef BSD44
4483#define BIGBUFOK
4484#endif /* BSD44 */
4485
4486#ifdef STRATUS                          /* Stratus VOS */
4487#define BIGBUFOK
4488#endif /* STRATUS */
4489
4490#ifdef sparc                            /* SPARC processors */
4491#define BIGBUFOK
4492#endif /* sparc */
4493
4494#ifdef mips                             /* MIPS processors */
4495#define BIGBUFOK
4496#endif /* mips */
4497
4498#ifdef HPUX9                            /* HP-UX 9.x */
4499#define BIGBUFOK
4500#endif /* HPUX9 */
4501
4502#ifdef HPUX10                           /* HP-UX 10.0 PA-RISC */
4503#define BIGBUFOK
4504#endif /* HPUX10 */
4505
4506#ifdef NEXT                             /* NeXTSTEP */
4507#ifdef mc68000                          /* on NEXT platforms... */
4508#define BIGBUFOK
4509#endif /* mc68000 */
4510#endif /* NEXT */
4511
4512#ifdef LINUX                            /* Linux in 1998 should be OK */
4513#ifndef BIGBUFOK
4514#define BIGBUFOK
4515#endif /* BIGBUFOK */
4516#endif /* LINUX */
4517
4518#ifdef OS2                              /* 32-bit OS/2 2.x and above */
4519#ifdef __32BIT__
4520#define BIGBUFOK
4521#endif /* __32BIT__ */
4522#ifdef NT
4523#define BIGBUFOK
4524#endif /* NT */
4525#endif /* OS2 */
4526
4527#ifdef Plan9                            /* Plan 9 is OK */
4528#define BIGBUFOK
4529#endif /* Plan9 */
4530
4531#ifdef VMS                              /* Any VMS is OK */
4532#ifndef BIGBUFOK
4533#define BIGBUFOK
4534#endif /* BIGBUFOK */
4535#endif /* VMS */
4536
4537#ifdef __alpha                          /* DEC 64-bit Alpha, e.g. OSF/1 */
4538#ifndef BIGBUFOK                        /* Might already be defined for VMS */
4539#define BIGBUFOK
4540#endif /* BIGBUFOK */
4541#endif /* __alpha */
4542
4543#ifdef sgi                              /* SGI with IRIX 4.0 or later */
4544#ifndef BIGBUFOK
4545#define BIGBUFOK
4546#endif /* BIGBUFOK */
4547#endif /* sgi */
4548
4549#ifdef AIXRS                            /* AIX on RISC */
4550#define BIGBUFOK
4551#endif /* AIXRS */
4552
4553#ifdef CK_SCOV5                         /* SCO OSR5 */
4554#ifndef BIGBUFOK
4555#define BIGBUFOK
4556#endif /* BIGBUFOK */
4557#endif /* CK_SCOV5 */
4558
4559#ifdef SOLARIS                          /* Solaris x86 */
4560#ifndef BIGBUFOK
4561#define BIGBUFOK
4562#endif /* BIGBUFOK */
4563#endif /* SOLARIS */
4564
4565#endif /* BIGBUFOK */
4566#endif /* NOBIGBUF */
4567
4568#ifdef CK_SMALL
4569#ifdef BIGBUFOK
4570#undef BIGBUFOK
4571#endif /* BIGBUFOK */
4572#endif /* CK_SMALL */
4573
4574/* If "memory is no problem" then this improves performance */
4575
4576#ifdef DEBUG
4577#ifdef BIGBUFOK
4578#ifndef IFDEBUG
4579#define IFDEBUG
4580#endif /* IFDEBUG */
4581#endif /* BIGBUFOK */
4582#endif /* DEBUG */
4583
4584#ifndef DEBUG
4585/* Compile all the debug() statements away.  Saves a lot of space and time. */
4586#define debug(a,b,c,d)
4587#define hexdump(a,b,c)
4588/* Now define the debug() macro. */
4589#else /* DEBUG */
4590_PROTOTYP(int dodebug,(int,char *,char *,long));
4591_PROTOTYP(int dohexdump,(CHAR *,CHAR *,int));
4592#ifdef IFDEBUG
4593/* Use this form to avoid function calls: */
4594#ifdef COMMENT
4595#define debug(a,b,c,d) if (deblog) dodebug(a,b,(char *)(c),(long)d)
4596#define hexdump(a,b,c) if (deblog) dohexdump((CHAR *)(a),(CHAR *)(b),c)
4597#else
4598#ifdef CK_ANSIC
4599#define debug(a,b,c,d) ((void)(deblog?dodebug(a,b,(char *)(c),(long)d):0))
4600#define hexdump(a,b,c) ((void)(deblog?dohexdump((CHAR *)(a),(CHAR *)(b),c):0))
4601#else
4602#define debug(a,b,c,d) (deblog?dodebug(a,b,(char *)(c),(long)d):0)
4603#define hexdump(a,b,c) (deblog?dohexdump((CHAR *)(a),(CHAR *)(b),c):0)
4604#endif /* CK_ANSIC */
4605#endif /* COMMENT */
4606#else /* IFDEBUG */
4607/* Use this form to save space: */
4608#define debug(a,b,c,d) dodebug(a,b,(char *)(c),(long)d)
4609#define hexdump(a,b,c) dohexdump((CHAR *)(a),(CHAR *)(b),c)
4610#endif /* IFDEBUG */
4611#endif /* DEBUG */
4612
4613/* File System Defaults */
4614
4615#ifndef UIDBUFLEN                       /* Length of User ID */
4616#ifdef OS2
4617#define UIDBUFLEN 256
4618#else /* OS2 */
4619#ifdef BIGBUFOK
4620#define UIDBUFLEN 256
4621#else
4622#define UIDBUFLEN 64
4623#endif /* BIGBUFOK */
4624#endif /* OS2 */
4625#endif /* UIDBUFLEN */
4626
4627#ifdef UNIX
4628#ifdef PROVX1
4629#define MAXWLD 50
4630#else
4631#ifdef pdp11
4632#define MAXWLD 50
4633#else
4634#ifdef BIGBUFOK
4635#define MAXWLD 102400
4636#else
4637#define MAXWLD 1024
4638#endif /* BIGBUFOK */
4639#endif /* pdp11 */
4640#endif /* PROVX1 */
4641#else
4642#ifdef VMS
4643#define MAXWLD 102400                   /* Maximum wildcard filenames */
4644#else
4645#ifdef datageneral
4646#define MAXWLD 500
4647#else
4648#ifdef STRATUS
4649#define MAXWLD 5000
4650#endif /* STRATUS */
4651#endif /* datageneral */
4652#endif /* VMS */
4653#endif /* UNIX */
4654
4655#ifdef VMS
4656#define DBLKSIZ 512
4657#define DLRECL 512
4658#else
4659#define DBLKSIZ 0
4660#define DLRECL 0
4661#endif /* VMS */
4662
4663/* Communication device / network host name length */
4664
4665#ifdef BIGBUFOK
4666#define TTNAMLEN 512
4667#else
4668#ifdef MAC
4669#define TTNAMLEN 256
4670#else
4671#ifndef CK_SMALL
4672#define TTNAMLEN 128
4673#else
4674#define TTNAMLEN 80
4675#endif /* CK_SMALL */
4676#endif /* MAC */
4677#endif /* BIGBUFOK */
4678
4679/* Program return codes for DECUS C and UNIX (VMS uses UNIX codes) */
4680
4681#ifdef decus
4682#define GOOD_EXIT   IO_NORMAL
4683#define BAD_EXIT    IO_ERROR
4684#else
4685#define GOOD_EXIT   0
4686#define BAD_EXIT    1
4687#endif /* decus */
4688
4689/* Special hack for Fortune, which doesn't have <sys/file.h>... */
4690
4691#ifdef FT18
4692#define FREAD 0x01
4693#define FWRITE 0x10
4694#endif /* FT18 */
4695
4696/* Special hack for OS-9/68k */
4697#ifdef OSK
4698#ifndef _UCC
4699#define SIGALRM 30                      /* May always cancel I/O */
4700#endif /* _UCC */
4701#define SIGARB  1234                    /* Arbitrary for I/O */
4702SIGTYP (*signal())();
4703#endif /* OSK */
4704
4705#ifdef MINIX
4706#ifdef putchar
4707#undef putchar
4708#endif /* putchar */
4709#define putchar(c) (putc(c,stdout)!=EOF)&&fflush(stdout)
4710#endif /* MINIX */
4711
4712#ifdef datageneral                      /* Data General AOS/VS */
4713#ifdef putchar
4714#undef putchar
4715#endif /* putchar */
4716#define putchar(c) conoc(c)
4717#endif /* datageneral */
4718
4719/* Escape/quote character used by the command parser */
4720
4721#define CMDQ '\\'
4722
4723/* Symbols for RS-232 modem signals */
4724
4725#define KM_FG    1                      /* Frame ground */
4726#define KM_TXD   2                      /* Transmit */
4727#define KM_RXD   3                      /* Receive */
4728#define KM_RTS   4                      /* Request to Send */
4729#define KM_CTS   5                      /* Clear to Send */
4730#define KM_DSR   6                      /* Data Set Ready */
4731#define KM_SG    7                      /* Signal ground */
4732#define KM_DCD   8                      /* Carrier Detect */
4733#define KM_DTR  20                      /* Data Terminal Ready */
4734#define KM_RI   22                      /* Ring Indication */
4735
4736/* Bit mask values for modem signals */
4737
4738#define BM_CTS   0001                   /* Clear to send       (From DCE) */
4739#define BM_DSR   0002                   /* Dataset ready       (From DCE) */
4740#define BM_DCD   0004                   /* Carrier             (From DCE) */
4741#define BM_RNG   0010                   /* Ring Indicator      (From DCE) */
4742#define BM_DTR   0020                   /* Data Terminal Ready (From DTE) */
4743#define BM_RTS   0040                   /* Request to Send     (From DTE) */
4744
4745/* Codes for full duplex flow control */
4746
4747#define FLO_NONE 0                      /* None */
4748#define FLO_XONX 1                      /* Xon/Xoff (soft) */
4749#define FLO_RTSC 2                      /* RTS/CTS (hard) */
4750#define FLO_DTRC 3                      /* DTR/CD (hard) */
4751#define FLO_ETXA 4                      /* ETX/ACK (soft) */
4752#define FLO_STRG 5                      /* String-based (soft) */
4753#define FLO_DIAL 6                      /* DIALing kludge */
4754#define FLO_DIAX 7                      /* Cancel dialing kludge */
4755#define FLO_DTRT 8                      /* DTR/CTS (hard) */
4756#define FLO_KEEP 9                      /* Keep, i.e. don't touch or change */
4757#define FLO_AUTO 10                     /* Figure out automatically */
4758
4759/* Types of connections */
4760
4761#define CXT_REMOTE  0                   /* Remote mode - no connection */
4762#define CXT_DIRECT  1                   /* Direct serial connection */
4763#define CXT_MODEM   2                   /* Modem dialout */
4764#define CXT_TCPIP   3                   /* TCP/IP - Telnet, Rlogin, etc */
4765#define CXT_X25     4                   /* X.25 peer-to-peer */
4766#define CXT_DECNET  5                   /* DECnet (CTERM, etc) */
4767#define CXT_LAT     6                   /* LAT */
4768#define CXT_NETBIOS 7                   /* NETBIOS */
4769#define CXT_NPIPE   8                   /* Named Pipe */
4770#define CXT_PIPE    9                   /* Pipe, Command, PTY, DLL, etc */
4771#define CXT_SSH     10                  /* SSH */
4772#define CXT_MAX     10                  /* Highest connection type */
4773
4774/* Autodownload Detection Options */
4775
4776#define ADL_PACK 0                      /* Auto-Download detect packet */
4777#define ADL_STR  1                      /* Auto-Download detect string */
4778
4779/* And finally... */
4780
4781#ifdef COMMENT                          /* Make sure this is NOT defined! */
4782#undef COMMENT
4783#endif /* COMMENT */
4784
4785/* zstr zattr filinfo were here (moved to top for DECC 5 Jun 2000) */
4786
4787#ifndef ZFNQFP                          /* Versions that have zfnqfp() */
4788#ifdef UNIX
4789#define ZFNQFP
4790#else
4791#ifdef VMS
4792#define ZFNQFP
4793#else
4794#ifdef OS2
4795#define ZFNQFP
4796#else
4797#ifdef datageneral
4798#define ZFNQFP
4799#else
4800#ifdef STRATUS
4801#define ZFNQFP
4802#endif /* STRATUS */
4803#endif /* datageneral */
4804#endif /* OS2 */
4805#endif /* VMS */
4806#endif /* UNIX */
4807struct zfnfp {
4808   int len;                             /* Length of full pathname */
4809   char * fpath;                        /* Pointer to full pathname */
4810   char * fname;                        /* Pointer to name part */
4811};
4812#endif /* ZFNQFP */
4813
4814/* Systems that support FILE TYPE LABELED */
4815
4816#ifdef VMS
4817#define CK_LABELED
4818#else
4819#ifdef OS2
4820#ifdef __32BIT__
4821#ifndef NT
4822#define CK_LABELED
4823#endif /* NT */
4824#endif /* __32BIT__ */
4825#endif /* OS2 */
4826#endif /* VMS */
4827
4828/* LABELED FILE options bitmask */
4829
4830#ifdef VMS                              /* For VMS */
4831#define LBL_NAM  1                      /* Ignore incoming name if set */
4832#define LBL_PTH  2                      /* Use complete path if set */
4833#define LBL_ACL  4                      /* Preserve ACLs if set */
4834#define LBL_BCK  8                      /* Preserve backup date if set */
4835#define LBL_OWN 16                      /* Preserve ownership if set */
4836
4837#else
4838
4839#ifdef OS2                              /* Ditto for OS/2 */
4840#define LBL_NOR  0x0000                 /* Normal file */
4841#define LBL_ARC  0x0020                 /* Archive */
4842#define LBL_DIR  0x0010                 /* Directory */
4843#define LBL_HID  0x0002                 /* Hidden file */
4844#define LBL_RO   0x0001                 /* Read only file */
4845#define LBL_SYS  0x0004                 /* System file */
4846#define LBL_EXT  0x0040                 /* Extended */
4847#endif /* OS2 */
4848#endif /* VMS */
4849
4850/*
4851  Data types.  First the header file for data types so we can pick up the
4852  types used for pids, uids, and gids.  Override this section by putting
4853  -DCKTYP_H=xxx on the command line to specify the header file where your
4854  system defines these types.
4855*/
4856#ifndef STRATUS
4857#ifdef __ALPHA
4858#ifdef MULTINET
4859#define CK_TGV_AXP
4860#endif /* MULTINET */
4861#endif /* __ALPHA */
4862
4863#ifdef CK_TGV_AXP                       /* Alpha, VMS, MultiNet */
4864/*
4865  Starting in DECC 5.0, <stdlib.h> no longer includes <types.h>.
4866  But before that an elaborate workaround is required, which results in
4867  including <types.h> sometimes but not others, evidently depending on whether
4868  <types.h> protects itself against multiple inclusion, which in turn probably
4869  differentiates between DECC <types.h> and TGV <types.h>.  Unfortunately I
4870  don't remember the details.  (fdc, 25 Oct 96)
4871*/
4872#ifdef COMMENT
4873/*
4874  Previously the test here was for DEC version prior to 4.0, but since the
4875  test involved an "#if" statement, it was not portable and broke some non-VMS
4876  builds.  In any case, condition was never satisfied, so the result of
4877  commenting this section out is the same as the previous "#if" condition.
4878*/
4879#ifndef __TYPES_LOADED
4880#define __TYPES_LOADED                  /* Work around bug in .h files */
4881#endif /* __TYPES_LOADED */
4882#endif /* COMMENT */
4883#include <sys/types.h>
4884#ifdef IF_DOT_H
4885#ifndef MULTINET
4886#include <if.h>                         /* Needed to put up u_int typedef */
4887#endif /* MULTINET */
4888#else /* IF_DOT_H */
4889#ifdef NEEDUINT
4890typedef unsigned int u_int;
4891#endif /* NEEDUINT */
4892#endif /* IF_DOT_H */
4893#else                                   /* !CK_TGV_AXP */
4894#ifdef OSK                              /* OS-9 */
4895#include <types.h>
4896#else                                   /* General case, not OS-9 */
4897#ifndef CKTYP_H
4898#ifndef VMS
4899#ifndef MAC
4900#ifndef AMIGA
4901#define CKTYP_H <sys/types.h>
4902#endif /* AMIGA */
4903#endif /* MAC */
4904#endif /* VMS */
4905#endif /* CKTYP_H */
4906
4907#ifdef GEMDOS
4908#undef CKTYP_H
4909#include <types.h>
4910#endif /* GEMDOS */
4911
4912#ifdef OS2
4913#undef CKTYP_H
4914#include <sys/types.h>
4915#endif /* OS2 */
4916
4917#ifdef CKTYP_H                          /* Include it. */
4918#ifdef COHERENT                         /* Except for COHERENT */
4919#include <unistd.h>
4920#include <sys/types.h>
4921#else
4922#ifdef datageneral                      /* AOS/VS */
4923#include <sys/types.h>
4924#else  /* All others */
4925#ifdef __bsdi__                         /* BSDI */
4926#ifdef POSIX
4927#undef _POSIX_SOURCE
4928#endif /* POSIX */
4929#endif /* __bsdi__ */
4930#include CKTYP_H
4931#ifdef __bsdi__
4932#ifdef POSIX
4933#define _POSIX_SOURCE
4934#endif /* POSIX */
4935#endif /* __bsdi__ */
4936#endif /* datageneral */
4937#endif /* COHERENT */
4938#endif /* CKTYP_H */
4939
4940#endif /* OSK */
4941#endif /* CK_TGV_AXP */
4942#endif /* STRATUS */                    /* End of types.h section */
4943
4944/*
4945  Data type for pids.  If your system uses a different type, put something
4946  like -DPID_T=pid_t on command line, or override here.
4947*/
4948#ifndef PID_T
4949#define PID_T int
4950#endif /* PID_T */
4951/*
4952  Data types for uids and gids.  Same deal as for pids.
4953  Wouldn't be nice if there was a preprocessor test to find out if a
4954  typedef existed?
4955*/
4956#ifdef VMS
4957/* Not used in VMS so who cares */
4958#define UID_T int
4959#define GID_T int
4960#endif /* VMS */
4961
4962#ifdef POSIX
4963/* Or would it be better (or worse?) to use _POSIX_SOURCE here? */
4964#ifndef UID_T
4965#define UID_T uid_t
4966#endif /* UID_T */
4967#ifndef GID_T
4968#define GID_T gid_t
4969#endif /* GID_T */
4970#else /* Not POSIX */
4971#ifdef SVR4
4972/* SVR4 and later have uid_t and gid_t. */
4973/* SVR3 and earlier use int, or unsigned short, or.... */
4974#ifndef UID_T
4975#define UID_T uid_t
4976#endif /* UID_T */
4977#ifndef GID_T
4978#define GID_T gid_t
4979#endif /* GID_T */
4980#else /* Not SVR4 */
4981#ifdef BSD43
4982#ifndef UID_T
4983#define UID_T uid_t
4984#endif /* UID_T */
4985#ifndef GID_T
4986#define GID_T gid_t
4987#endif /* GID_T */
4988#else /* Not BSD43 */
4989/* Default these to int for older UNIX versions */
4990#ifndef UID_T
4991#define UID_T int
4992#endif /* UID_T */
4993#ifndef GID_T
4994#define GID_T int
4995#endif /* GID_T */
4996#endif /* BSD43 */
4997#endif /* SVR4  */
4998#endif /* POSIX */
4999
5000/*
5001  getpwuid() arg type, which is not necessarily the same as UID_T,
5002  e.g. in SCO UNIX SVR3, it's int.
5003*/
5004#ifndef PWID_T
5005#define PWID_T UID_T
5006#endif /* PWID_T */
5007
5008#ifdef CK_REDIR
5009#ifdef NEXT
5010#define MACHWAIT
5011#else
5012#ifdef MACH
5013#define MACHWAIT
5014#endif /* MACH */
5015#endif /* NEXT */
5016
5017#ifdef MACHWAIT                         /* WAIT_T argument for wait() */
5018#include <sys/wait.h>
5019#define CK_WAIT_H
5020typedef union wait WAIT_T;
5021#else
5022#ifdef POSIX
5023#ifdef OSF
5024/* OSF wait.h defines BSD wait if _BSD is defined so  hide _BSD from wait.h */
5025#ifdef _BSD
5026#define CK_OSF_BSD
5027#undef  _BSD
5028#endif /* _BSD */
5029#endif /* OSF */
5030#include <sys/wait.h>
5031#define CK_WAIT_H
5032#ifndef WAIT_T
5033typedef int WAIT_T;
5034#endif /* WAIT_T */
5035#ifdef CK_OSF_BSD                       /* OSF/1: Restore  _BSD definition */
5036#define _BSD
5037#undef CK_OSF_BSD
5038#endif /* CK_OSF_BSD */
5039#else /* !POSIX */
5040typedef int WAIT_T;
5041#endif /* POSIX */
5042#endif /* MACHWAIT */
5043#else
5044typedef int WAIT_T;
5045#endif /* CK_REDIR */
5046
5047/* Assorted other blah_t's handled here... */
5048
5049#ifndef SIZE_T
5050#define SIZE_T size_t
5051#endif /* SIZE_T */
5052
5053/* Forward declarations of system-dependent functions callable from all */
5054/* C-Kermit modules. */
5055
5056/* File-related functions from system-dependent file i/o module */
5057
5058#ifndef CKVFIO_C
5059/* For some reason, this does not agree with DEC C */
5060_PROTOTYP( int zkself, (void) );
5061#endif /* CKVFIO_C */
5062_PROTOTYP( int zopeni, (int, char *) );
5063_PROTOTYP( int zopeno, (int, char *, struct zattr *, struct filinfo *) );
5064_PROTOTYP( int zclose, (int) );
5065#ifndef MAC
5066_PROTOTYP( int zchin, (int, int *) );
5067#endif /* MAC */
5068_PROTOTYP( int zxin, (int, char *, int) );
5069_PROTOTYP( int zsinl, (int, char *, int) );
5070_PROTOTYP( int zinfill, (void) );
5071_PROTOTYP( int zsout, (int, char*) );
5072_PROTOTYP( int zsoutl, (int, char*) );
5073_PROTOTYP( int zsoutx, (int, char*, int) );
5074_PROTOTYP( int zchout, (int, char) );
5075_PROTOTYP( int zoutdump, (void) );
5076_PROTOTYP( int zsyscmd, (char *) );
5077_PROTOTYP( int zshcmd, (char *) );
5078#ifdef CKEXEC
5079_PROTOTYP( VOID z_exec, (char *, char **, int) );
5080#endif /* CKEXEC */
5081_PROTOTYP( int chkfn, (int) );
5082_PROTOTYP( long zchki, (char *) );
5083#ifdef VMSORUNIX
5084_PROTOTYP( long zgetfs, (char *) );
5085#else
5086#ifdef OS2
5087_PROTOTYP( long zgetfs, (char *) );
5088#else
5089#define zgetfs(a) zchki(a)
5090#endif /* OS2 */
5091#endif /* VMSORUNIX */
5092_PROTOTYP( int iswild, (char *) );
5093_PROTOTYP( int isdir, (char *) );
5094_PROTOTYP( int zchko, (char *) );
5095_PROTOTYP( int zdelet, (char *) );
5096_PROTOTYP( VOID zrtol, (char *,char *) );
5097_PROTOTYP( VOID zltor, (char *,char *) );
5098_PROTOTYP( VOID zstrip, (char *,char **) );
5099#ifdef VMS
5100_PROTOTYP( char * zrelname, (char *, char *) );
5101#endif /* VMS */
5102_PROTOTYP( int zchdir, (char *) );
5103_PROTOTYP( char * zhome, (void) );
5104_PROTOTYP( char * zgtdir, (void) );
5105_PROTOTYP( int zxcmd, (int, char *) );
5106#ifndef MAC
5107_PROTOTYP( int zclosf, (int) );
5108#endif /* MAC */
5109#ifdef NZXPAND
5110_PROTOTYP( int nzxpand, (char *, int) );
5111#else /* NZXPAND */
5112_PROTOTYP( int zxpand, (char *) );
5113#endif /* NZXPAND */
5114_PROTOTYP( int znext, (char *) );
5115#ifdef ZXREWIND
5116_PROTOTYP( int zxrewind, (void) );
5117#endif /* ZXREWIND */
5118_PROTOTYP( int zchkspa, (char *, long) );
5119_PROTOTYP( VOID znewn, (char *, char **) );
5120_PROTOTYP( int zrename, (char *, char *) );
5121_PROTOTYP( int zcopy, (char *, char *) );
5122_PROTOTYP( int zsattr, (struct zattr *) );
5123_PROTOTYP( int zfree, (char *) );
5124_PROTOTYP( char * zfcdat, (char *) );
5125_PROTOTYP( int zstime, (char *, struct zattr *, int) );
5126#ifdef CK_PERMS
5127_PROTOTYP( char * zgperm, (char *) );
5128_PROTOTYP( char * ziperm, (char *) );
5129#endif /* CK_PERMS */
5130_PROTOTYP( int zmail, (char *, char *) );
5131_PROTOTYP( int zprint, (char *, char *) );
5132_PROTOTYP( char * tilde_expand, (char *) );
5133_PROTOTYP( int zmkdir, (char *) ) ;
5134_PROTOTYP( int zfseek, (long) ) ;
5135#ifdef ZFNQFP
5136_PROTOTYP( struct zfnfp * zfnqfp, (char *, int, char * ) ) ;
5137#else
5138#define zfnqfp(a,b,c) ckstrncpy(c,a,b)
5139#endif /* ZFNQFP */
5140_PROTOTYP( int zvuser, (char *) ) ;
5141_PROTOTYP( int zvpass, (char *) ) ;
5142_PROTOTYP( VOID zvlogout, (void) ) ;
5143#ifdef OS2
5144_PROTOTYP( int os2setlongname, ( char * fn, char * ln ) ) ;
5145_PROTOTYP( int os2getlongname, ( char * fn, char ** ln ) ) ;
5146_PROTOTYP( int os2rexx, ( char *, char *, int ) ) ;
5147_PROTOTYP( int os2rexxfile, ( char *, char *, char *, int) ) ;
5148_PROTOTYP( int os2geteas, (char *) ) ;
5149_PROTOTYP( int os2seteas, (char *) ) ;
5150_PROTOTYP( char * get_os2_vers, (void) ) ;
5151_PROTOTYP( int do_label_send, (char *) ) ;
5152_PROTOTYP( int do_label_recv, (void) ) ;
5153#ifdef OS2MOUSE
5154_PROTOTYP( unsigned long os2_mouseon, (void) );
5155_PROTOTYP( unsigned long os2_mousehide, (void) );
5156_PROTOTYP( unsigned long os2_mouseshow, (void) );
5157_PROTOTYP( unsigned long os2_mouseoff, (void) );
5158_PROTOTYP( void os2_mouseevt, (void *) );
5159_PROTOTYP( int mousebuttoncount, (void));
5160#endif /* OS2MOUSE */
5161#endif /* OS2 */
5162
5163/* Functions from system-dependent terminal i/o module */
5164
5165_PROTOTYP( int ttopen, (char *, int *, int, int) );  /* tty functions */
5166#ifndef MAC
5167_PROTOTYP( int ttclos, (int) );
5168#endif /* MAC */
5169_PROTOTYP( int tthang, (void) );
5170_PROTOTYP( int ttres, (void) );
5171_PROTOTYP( int ttpkt, (long, int, int) );
5172#ifndef MAC
5173_PROTOTYP( int ttvt, (long, int) );
5174#endif /* MAC */
5175_PROTOTYP( int ttsspd, (int) );
5176_PROTOTYP( long ttgspd, (void) );
5177_PROTOTYP( int ttflui, (void) );
5178_PROTOTYP( int ttfluo, (void) );
5179_PROTOTYP( int ttpushback, (CHAR *, int) );
5180_PROTOTYP( int ttpeek, (void) );
5181_PROTOTYP( int ttgwsiz, (void) );
5182_PROTOTYP( int ttchk, (void) );
5183_PROTOTYP( int ttxin, (int, CHAR *) );
5184_PROTOTYP( int ttxout, (CHAR *, int) );
5185_PROTOTYP( int ttol, (CHAR *, int) );
5186_PROTOTYP( int ttoc, (char) );
5187_PROTOTYP( int ttinc, (int) );
5188_PROTOTYP( int ttscarr, (int) );
5189_PROTOTYP( int ttgmdm, (void) );
5190_PROTOTYP( int ttsndb, (void) );
5191_PROTOTYP( int ttsndlb, (void) );
5192#ifdef UNIX
5193_PROTOTYP( char * ttglckdir, (void) );
5194#endif /* UNIX */
5195#ifdef PARSENSE
5196#ifdef UNIX
5197_PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
5198#else
5199#ifdef VMS
5200_PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
5201#else
5202#ifdef STRATUS
5203_PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
5204#else
5205#ifdef OS2
5206_PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
5207#else
5208#ifdef OSK
5209_PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
5210#else
5211_PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR) );
5212#endif /* OSK */
5213#endif /* OS2 */
5214#endif /* STRATUS */
5215#endif /* VMS */
5216#endif /* UNIX */
5217#else /* ! PARSENSE */
5218_PROTOTYP( int ttinl, (CHAR *, int, int, CHAR) );
5219#endif /* PARSENSE */
5220
5221/* XYZMODEM support */
5222
5223/*
5224  CK_XYZ enables the various commands and data structures.
5225  XYZ_INTERNAL means these protocols are built-in; if not defined,
5226  then they are external.  XYZ_DLL is used to indicate a separate
5227  loadable library containing the XYZmodem protocol code.
5228*/
5229#ifdef pdp11                            /* No room for this in PDP-11 */
5230#define NOCKXYZ
5231#endif /* pdp11 */
5232
5233#ifndef NOCKXYZ                         /* Alternative protocols */
5234#ifndef CK_XYZ
5235#ifdef UNIX
5236#define CK_XYZ
5237#else
5238#ifdef OS2
5239#define CK_XYZ
5240#ifndef NOXYZDLL
5241#define XYZ_INTERNAL                    /* Internal and DLL */
5242#define XYZ_DLL
5243#endif /* NOXYZDLL */
5244#endif /* OS2 */
5245#endif /* UNIX */
5246#endif /* CK_XYZ */
5247#endif /* NOCKXYZ */
5248
5249#ifdef XYZ_INTERNAL                     /* This ensures that XYZ_INTERNAL */
5250#ifndef CK_XYZ                          /* is defined only if CK_XYZ is too */
5251#undef XYZ_INTERNAL
5252#endif /* CK_XYZ */
5253#endif /* XYZ_INTERNAL */
5254#ifdef XYZ_DLL                          /* This ensures XYZ_DLL is defined */
5255#ifndef XYZ_INTERNAL                    /* only if XYZ_INTERNAL is too */
5256#undef XYZ_DLL
5257#endif /* XYZ_INTERNAL */
5258#endif /* XYZ_DLL */
5259
5260/* Console functions */
5261
5262_PROTOTYP( int congm, (void) );
5263#ifdef COMMENT
5264_PROTOTYP( VOID conint, (SIGTYP (*)(int, int), SIGTYP (*)(int, int)) );
5265#else
5266_PROTOTYP( VOID conint, (SIGTYP (*)(int), SIGTYP (*)(int)) );
5267#endif /* COMMENT */
5268_PROTOTYP( VOID connoi, (void) );
5269_PROTOTYP( int concb, (char) );
5270#ifdef CONGSPD
5271_PROTOTYP( long congspd, (void) );
5272#endif /* CONGSPD */
5273_PROTOTYP( int conbin, (char) );
5274_PROTOTYP( int conres, (void) );
5275_PROTOTYP( int conoc, (char) );
5276_PROTOTYP( int conxo, (int, char *) );
5277_PROTOTYP( int conol, (char *) );
5278_PROTOTYP( int conola, (char *[]) );
5279_PROTOTYP( int conoll, (char *) );
5280_PROTOTYP( int conchk, (void) );
5281_PROTOTYP( int coninc, (int) );
5282_PROTOTYP( char * conkbg, (void) );
5283_PROTOTYP( int psuspend, (int) );
5284_PROTOTYP( int priv_ini, (void) );
5285_PROTOTYP( int priv_on, (void) );
5286_PROTOTYP( int priv_off, (void) );
5287_PROTOTYP( int priv_can, (void) );
5288_PROTOTYP( int priv_chk, (void) );
5289_PROTOTYP( int priv_opn, (char *, int) );
5290
5291_PROTOTYP( int sysinit, (void) );       /* Misc Kermit functions */
5292_PROTOTYP( int syscleanup, (void) );
5293_PROTOTYP( int msleep, (int) );
5294_PROTOTYP( VOID rtimer, (void) );
5295_PROTOTYP( int gtimer, (void) );
5296#ifdef GFTIMER
5297_PROTOTYP( VOID rftimer, (void) );
5298_PROTOTYP( CKFLOAT gftimer, (void) );
5299#endif /* GFTIMER */
5300_PROTOTYP( VOID ttimoff, (void) );
5301_PROTOTYP( VOID ztime, (char **) );
5302_PROTOTYP( int parchk, (CHAR *, CHAR, int) );
5303_PROTOTYP( VOID doexit, (int, int) );
5304_PROTOTYP( int askmore, (void) );
5305_PROTOTYP( VOID fatal, (char *) );
5306_PROTOTYP( VOID fatal2, (char *, char *) );
5307#ifdef VMS
5308_PROTOTYP( int ck_cancio, (void) );
5309#endif /* VMS */
5310
5311/* Key mapping support */
5312
5313#ifdef NOICP
5314#ifndef NOSETKEY
5315#define NOSETKEY
5316#endif /* NOSETKEY */
5317#endif /* NOICP */
5318
5319#ifdef MAC
5320#ifndef NOSETKEY
5321#define NOSETKEY
5322#endif /* NOSETKEY */
5323#endif /* MAC */
5324
5325_PROTOTYP( int congks, (int) );
5326#ifdef OS2
5327/* OS2 requires these definitions even if SET KEY is not being supported */
5328#define KMSIZE 8916
5329typedef ULONG KEY;
5330typedef CHAR *MACRO;
5331extern int wideresult;
5332#else /* Not OS2 */
5333#ifndef NOSETKEY
5334/*
5335  Catch-all for systems where we don't know how to read keyboard scan
5336  codes > 255.
5337*/
5338#define KMSIZE 256
5339/* Note: CHAR (i.e. unsigned char) is very important here. */
5340typedef CHAR KEY;
5341typedef CHAR * MACRO;
5342#define congks coninc
5343#endif /* NOSETKEY */
5344#endif /* OS2 */
5345
5346#ifndef OS2
5347#ifndef NOKVERBS                        /* No \Kverbs unless... */
5348#define NOKVERBS
5349#endif /* NOKVERBS */
5350#endif /* OS2 */
5351
5352#ifndef NOKVERBS
5353#ifdef OS2
5354/*
5355  Note: this value chosen to be bigger than PC BIOS key modifier bits,
5356  but still fit in 16 bits without affecting sign.
5357
5358  As of K95 1.1.5, this no longer fits in 16 bits, good thing we are 32 bit.
5359*/
5360#define F_MACRO 0x2000          /* Bit indicating a macro indice */
5361#define IS_MACRO(x) (x & F_MACRO)
5362#define F_KVERB 0x4000                  /* Bit indicating a keyboard verb */
5363#define IS_KVERB(x) (x & F_KVERB)       /* Test this bit */
5364#endif /* OS2 */
5365#endif /* NOKVERBS */
5366
5367#define F_ESC   0x8000          /* Bit indicating ESC char combination */
5368#define IS_ESC(x) (x & F_ESC)
5369#define F_CSI   0x10000         /* Bit indicating CSI char combination */
5370#define IS_CSI(x) (x & F_CSI)
5371
5372#ifdef NOSPL                            /* This might be overkill.. */
5373#ifndef NOKVERBS                        /* Not all \Kverbs require */
5374#define NOKVERBS                        /* the script programming language. */
5375#endif /* NOKVERBS */
5376#ifndef NOTAKEARGS
5377#define NOTAKEARGS
5378#endif /* NOTAKEARGS */
5379#endif /* NOSPL */
5380
5381/*
5382  Function prototypes for system and library functions.
5383*/
5384#ifdef _POSIX_SOURCE
5385#ifndef VMS
5386#ifndef MAC
5387#define CK_ANSILIBS
5388#endif /* MAC */
5389#endif /* VMS */
5390#endif /* _POSIX_SOURCE */
5391
5392#ifdef NEXT
5393#define CK_ANSILIBS
5394#endif /* NEXT */
5395
5396#ifdef SVR4
5397#define CK_ANSILIBS
5398#endif /* SVR4 */
5399
5400#ifdef STRATUS                          /* Stratus VOS uses ANSI libraries */
5401#define CK_ANSILIBS
5402#endif /* STRATUS */
5403
5404#ifdef OS2
5405#define CK_ANSILIBS
5406#ifndef NOCURSES
5407#define MYCURSES
5408#endif /* NOCURSES */
5409#define CK_RTSCTS
5410#ifdef __IBMC__
5411#define S_IFMT 0xF000
5412#define timezone _timezone
5413#endif /* __IBMC__ */
5414#include <fcntl.h>
5415#include <io.h>
5416#ifdef __EMX__
5417#ifndef __32BIT__
5418#define __32BIT__
5419#endif /* __32BIT__ */
5420#include <sys/timeb.h>
5421#else /* __EMX__ */
5422#include <direct.h>
5423#undef SIGALRM
5424#ifndef SIGUSR1
5425#define SIGUSR1 7
5426#endif /* SIGUSR1 */
5427#define SIGALRM SIGUSR1
5428_PROTOTYP( unsigned alarm, (unsigned) );
5429_PROTOTYP( unsigned sleep, (unsigned) );
5430#endif /* __EMX__ */
5431_PROTOTYP( unsigned long zdskspace, (int) );
5432_PROTOTYP( int zchdsk, (int) );
5433_PROTOTYP( int conincraw, (int) );
5434_PROTOTYP( int ttiscom, (int f) );
5435_PROTOTYP( int IsFileNameValid, (char *) );
5436_PROTOTYP( void ChangeNameForFAT, (char *) );
5437_PROTOTYP( char *GetLoadPath, (void) );
5438#endif /* OS2 */
5439
5440/* Fullscreen file transfer display items... */
5441
5442#ifndef NOCURSES
5443#ifdef CK_NCURSES                       /* CK_NCURSES implies CK_CURSES */
5444#ifndef CK_CURSES
5445#define CK_CURSES
5446#endif /* CK_CURSES */
5447#endif /* CK_NCURSES */
5448
5449#ifdef MYCURSES                         /* MYCURSES implies CK_CURSES */
5450#ifndef CK_CURSES
5451#define CK_CURSES
5452#endif /* CK_CURSES */
5453#endif /* MYCURSES */
5454#endif /* NOCURSES */
5455
5456#ifdef NOCURSES
5457#ifdef CK_CURSES
5458#undef CK_CURSES
5459#endif /* CK_CURSES */
5460#ifndef NODISPLAY
5461#define NODISPLAY
5462#endif /* NODISPLAY */
5463#endif /* NOCURSES */
5464
5465#ifdef CK_CURSES
5466/*
5467  The CK_WREFRESH symbol is defined if the curses library provides
5468  clearok() and wrefresh() functions, which are used in repainting
5469  the screen.
5470*/
5471#ifdef NOWREFRESH                       /* Override CK_WREFRESH */
5472
5473#ifdef CK_WREFRESH                      /* If this is defined, */
5474#undef CK_WREFRESH                      /* undefine it. */
5475#endif /* CK_WREFRESH */
5476
5477#else /* !NOWREFRESH */                 /* No override... */
5478
5479#ifndef CK_WREFRESH                     /* If CK_WREFRESH not defined */
5480/*
5481  Automatically define it for systems known to have it ...
5482*/
5483#ifdef VMS                              /* DEC (Open)VMS has it */
5484#define CK_WREFRESH
5485#else
5486#ifdef ultrix                           /* DEC ULTRIX has it */
5487#else
5488#ifdef SVR3                             /* System V has it */
5489#define CK_WREFRESH
5490#else
5491#ifdef BSD44                            /* 4.4 BSD has it */
5492#define CK_WREFRESH
5493#else
5494#ifdef NEXT                             /* Define it for NeXTSTEP */
5495#define CK_WREFRESH
5496#else
5497#ifdef SUNOS4                           /* SunOS 4.x... */
5498#define CK_WREFRESH
5499#else
5500#ifdef SOLARIS25                        /* Solaris 2.5 and later */
5501#define CK_WREFRESH
5502#else
5503#ifdef AIXRS                            /* RS/6000 AIX ... */
5504#define CK_WREFRESH
5505#else
5506#ifdef RTAIX                            /* RT PC AIX ... */
5507#define CK_WREFRESH
5508#else
5509#ifdef OSF                              /* DEC OSF/1 ... */
5510#define CK_WREFRESH
5511
5512/* Add more here, or just define CK_WREFRESH on the CC command line... */
5513
5514#endif /* OSF */
5515#endif /* RTAIX */
5516#endif /* AIXRS */
5517#endif /* SOLARIS25 */
5518#endif /* SUNOS4 */
5519#endif /* NEXT */
5520#endif /* BSD44 */
5521#endif /* SVR3 */
5522#endif /* ultrix */
5523#endif /* VMS */
5524
5525#else /* CK_WREFRESH is defined */
5526
5527/* This is within an ifdef CK_CURSES block.  The following is not needed */
5528
5529#ifndef CK_CURSES                       /* CK_WREFRESH implies CK_CURSES */
5530#define CK_CURSES
5531#endif /* CK_CURSES */
5532
5533#endif /* CK_WREFRESH */
5534#endif /* NOWREFRESH */
5535
5536#ifndef TRMBUFL
5537#ifdef BIGBUFOK
5538#define TRMBUFL 16384
5539#else
5540#ifdef DYNAMIC
5541#define TRMBUFL 8192
5542#else
5543#define TRMBUFL 1024
5544#endif /* BIGBUFOK */
5545#endif /* DYNAMIC */
5546#endif /* TRMBUFL */
5547#endif /* CK_CURSES */
5548
5549/*
5550  Whether to use ckmatch() in all its glory for C-Shell-like patterns.
5551  If CKREGEX is NOT defined, all but * and ? matching are removed from
5552  ckmatch().  NOTE: Defining CKREGEX does not necessarily mean that ckmatch()
5553  regexes are used for filename matching.  That depends on whether zxpand()
5554  in ck?fio.c calls ckmatch().  NOTE 2: REGEX is a misnomer -- these are not
5555  regular expressions in the computer-science sense (in which, e.g. "a*b"
5556  matches 0 or more 'a' characters followed by 'b') but patterns (in which
5557  "a*b" matches 'a' followed by 0 or more non-b characters, followed by b).
5558*/
5559#ifndef NOCKREGEX
5560#ifndef CKREGEX
5561#define CKREGEX
5562#endif /* CKREGEX */
5563#endif /* NOCKREGEX */
5564
5565/* Learned-script feature */
5566
5567#ifndef NOLEARN
5568#ifdef NOSPL
5569#define NOLEARN
5570#else
5571#ifdef NOLOCAL
5572#define NOLEARN
5573#endif /* NOLOCAL */
5574#endif /* NOSPL */
5575#endif /* NOLEARN */
5576
5577#ifdef NOLEARN
5578#ifdef CKLEARN
5579#undef CKLEARN
5580#endif /* CKLEARN */
5581#else  /* !NOLEARN */
5582#ifndef CKLEARN
5583#ifdef OS2ORUNIX
5584/* In UNIX this can work only with ckucns.c builds */
5585#define CKLEARN
5586#else
5587#ifdef VMS
5588#define CKLEARN
5589#endif /* VMS */
5590#endif /* OS2ORUNIX */
5591#endif /* CKLEARN */
5592#endif /* NOLEARN */
5593
5594#ifdef CKLEARN
5595#ifndef LEARNBUFSIZ
5596#define LEARNBUFSIZ 128
5597#endif /* LEARNBUFSIZ */
5598#endif /* CKLEARN */
5599
5600#ifndef IKSDONLY
5601#ifndef CKTIDLE                         /* Pseudo-keepalive in CONNECT */
5602#ifdef OS2                              /* In K95 */
5603#define CKTIDLE
5604#else
5605#ifdef UNIX                             /* In UNIX but only ckucns versions */
5606#ifndef NOLEARN
5607#ifndef NOSELECT
5608#define CKTIDLE
5609#endif /* NOSELECT */
5610#endif /* NOLEARN */
5611#endif /* UNIX */
5612#endif /* OS2 */
5613#endif /* CKTIDLE */
5614#endif /* IKSDONLY */
5615
5616#ifdef CK_ANSILIBS
5617/*
5618  String library functions.
5619  For ANSI C, get prototypes from <string.h>.
5620  Otherwise, skip the prototypes.
5621*/
5622#include <string.h>
5623
5624/*
5625  Prototypes for other commonly used library functions, such as
5626  malloc, free, getenv, atol, atoi, and exit.  Otherwise, no prototypes.
5627*/
5628#include <stdlib.h>
5629#ifdef DIAB /* DIAB DS90 */
5630/* #include <commonC.h>  */
5631#include <sys/wait.h>
5632#define CK_WAIT_H
5633#ifdef COMMENT
5634extern void exit(int status);
5635extern void _exit(int status);
5636extern int uname(struct utsname *name);
5637#endif /* COMMENT */
5638extern int chmod(char *path, int mode);
5639extern int ioctl(int fildes, int request, ...);
5640extern int rdchk(int ttyfd);
5641extern int nap(int m);
5642#ifdef COMMENT
5643extern int getppid(void);
5644#endif /* COMMENT */
5645extern int _filbuf(FILE *stream);
5646extern int _flsbuf(char c,FILE *stream);
5647#endif /* DIAB */
5648
5649/*
5650  Prototypes for UNIX functions like access, alarm, chdir, sleep, fork,
5651  and pause.  Otherwise, no prototypes.
5652*/
5653#ifdef VMS
5654#include <unixio.h>
5655#endif /* VMS */
5656
5657#ifdef NEXT
5658#ifndef NEXT33
5659#include <libc.h>
5660#endif /* NEXT33 */
5661#else  /* NoT NeXT */
5662#ifndef AMIGA
5663#ifndef OS2
5664#ifdef STRATUS
5665#include <c_utilities.h>
5666#else /* !STRATUS */
5667#ifndef OSKXXC
5668#include <unistd.h>
5669#endif /* OSKXXC */
5670#ifdef HAVE_CRYPT_H
5671#include <crypt.h>
5672#endif /* HAVE_CRYPT_H */
5673#endif /* STRATUS */
5674#endif /* OS2 */
5675#endif /* AMIGA */
5676#endif /* NEXT */
5677
5678#else /* Not ANSI libs... */
5679
5680#ifdef MAC
5681#include <String.h>
5682#include <StdLib.h>
5683#endif /* MAC */
5684
5685#ifdef HPUX
5686#ifndef HPUXPRE65
5687#include <unistd.h>
5688#endif /* HPUXPRE65 */
5689#endif /* HPUX */
5690
5691#ifdef SUNOS41
5692#include <unistd.h>
5693#include <stdlib.h>
5694#else
5695#ifndef MAC
5696/*
5697  It is essential that these are declared correctly!
5698  Which is not always easy.  Take malloc() for instance ...
5699*/
5700#ifdef PYRAMID
5701#ifdef SVR4
5702#ifdef __STDC__
5703#define SIZE_T_MALLOC
5704#endif /* __STDC__ */
5705#endif /* SVR4 */
5706#endif /* PYRAMID */
5707/*
5708  Maybe some other environments need the same treatment for malloc.
5709  If so, define SIZE_T_MALLOC for them here or in compiler CFLAGS.
5710*/
5711#ifdef SIZE_T_MALLOC
5712_PROTOTYP( void * malloc, (size_t) );
5713#else
5714_PROTOTYP( char * malloc, (unsigned int) );
5715#endif /* SIZE_T_MALLOC */
5716
5717_PROTOTYP( char * getenv, (char *) );
5718_PROTOTYP( long atol, (char *) );
5719#endif /* !MAC */
5720#endif /* SUNOS41 */
5721#endif /* CK_ANSILIBS */
5722
5723/*
5724  <sys/param.h> generally picks up NULL, MAXPATHLEN, and MAXNAMLEN
5725  and seems to present on all Unixes going back at least to SCO Xenix
5726  with the exception(s) noted.
5727*/
5728#ifndef NO_PARAM_H                      /* 2001-11-03 */
5729#ifndef UNIX                            /* Non-Unixes don't have it */
5730#define NO_PARAM_H
5731#else
5732#ifdef TRS16                            /* Tandy Xenix doesn't have it */
5733#define NO_PARAM_H
5734#endif /* TRS16 */
5735#endif /* UNIX */
5736#endif /* NO_PARAM_H */
5737
5738#ifndef NO_PARAM_H
5739#ifndef INCL_PARAM_H
5740#define INCL_PARAM_H
5741#endif /* INCL_PARAM_H */
5742#include <sys/param.h>
5743#endif /* NO_PARAM_H */
5744
5745#ifndef NULL                            /* In case NULL is still not defined */
5746#define NULL 0L
5747/* or #define NULL 0 */
5748/* or #define NULL ((char *) 0) */
5749/* or #define NULL ((void *) 0) */
5750#endif /* NULL */
5751
5752/* Maximum length for a fully qualified filename, not counting \0 at end. */
5753/*
5754  This is a rough cut, and errs on the side of being too big.  We don't
5755  want to pull in hundreds of header files looking for many and varied
5756  symbols, for fear of introducing unnecessary conflicts.
5757*/
5758#ifndef CKMAXPATH
5759#ifdef MAXPATHLEN                       /* (it probably isn't) */
5760#define CKMAXPATH MAXPATHLEN
5761#else
5762#ifdef PATH_MAX                         /* POSIX */
5763#define CKMAXPATH PATH_MAX
5764#else
5765#ifdef MAC
5766#define CKMAXPATH 63
5767#else
5768#ifdef pdp11
5769#define CKMAXPATH 255
5770#else
5771#ifdef UNIX                             /* Even though some are way less... */
5772#define CKMAXPATH 1024
5773#else
5774#ifdef VMS
5775#define CKMAXPATH 675                   /* (derivation is complicated...) */
5776#else
5777#ifdef STRATUS
5778#define CKMAXPATH 256                   /* == $MXPL from PARU.H */
5779#else
5780#ifdef datageneral
5781#define CKMAXPATH 256                   /* == $MXPL from PARU.H */
5782#else
5783#define CKMAXPATH 255
5784#endif /* STRATUS */
5785#endif /* datageneral */
5786#endif /* VMS */
5787#endif /* UNIX */
5788#endif /* pdp11 */
5789#endif /* MAC */
5790#endif /* PATH_MAX */
5791#endif /* MAXPATHLEN */
5792#endif /* CKMAXPATH */
5793
5794/* Maximum length for the name of a tty device */
5795
5796#ifndef DEVNAMLEN
5797#define DEVNAMLEN CKMAXPATH
5798#endif /* DEVNAMLEN */
5799
5800/* Directory (path segment) separator */
5801/* Not fully general - Tricky for VMS, Amiga, ... */
5802
5803#ifndef DIRSEP
5804#ifdef UNIX
5805#define DIRSEP '/'
5806#define ISDIRSEP(c) ((c)=='/')
5807#else
5808#ifdef OS2
5809#define DIRSEP '/'
5810#define ISDIRSEP(c) ((c)=='/'||(c)=='\\')
5811#else
5812#ifdef datageneral
5813#define DIRSEP ':'
5814#define ISDIRSEP(c) (((c)==':')||((c)=='^')||((c)=='='))
5815#else
5816#ifdef STRATUS
5817#define DIRSEP '>'
5818#define ISDIRSEP(c) ((c)=='>')
5819#else
5820#ifdef VMS
5821#define DIRSEP ']'                      /* (not really) */
5822#define ISDIRSEP(c) ((c)==']'||(c)==':')
5823#else
5824#ifdef MAC
5825#define DIRSEP ':'
5826#define ISDIRSEP(c) ((c)==':')
5827#else
5828#ifdef AMIGA
5829#define DIRSEP '/'
5830#define ISDIRSEP(c) ((c)=='/'||(c)==':')
5831#else
5832#ifdef GEMDOS
5833#define DIRSEP '\\'
5834#define ISDIRSEP(c) ((c)=='\\'||(c)==':')
5835#else
5836#define DIRSEP '/'
5837#define ISDIRSEP(c) ((c)=='/')
5838#endif /* GEMDOS */
5839#endif /* AMIGA */
5840#endif /* MAC */
5841#endif /* VMS */
5842#endif /* STRATUS */
5843#endif /* datageneral */
5844#endif /* OS2 */
5845#endif /* UNIX */
5846#endif /* DIRSEP */
5847
5848/* FILE package parameters */
5849
5850#ifdef pdp11
5851#define NOCHANNELIO
5852#else
5853
5854#ifndef CKMAXOPEN
5855#ifdef QNX
5856#define CKMAXOPEN 390
5857#else
5858#ifdef VMS
5859#define CKMAXOPEN 64
5860#else
5861#ifdef OPEN_MAX
5862#define CKMAXOPEN OPEN_MAX
5863#else
5864#ifdef FOPEN_MAX
5865#define CKMAXOPEN FOPEN_MAX
5866#else
5867#define CKMAXOPEN 64
5868#endif /* FOPEN_MAX */
5869#endif /* OPEN_MAX */
5870#endif /* VMS */
5871#endif /* QNX */
5872#endif /* CKMAXOPEN */
5873
5874/* Maximum channels for FOPEN = CKMAXOPEN minus logs, stdio, etc */
5875
5876#ifndef Z_MINCHAN
5877#define Z_MINCHAN 16
5878#endif /* Z_MINCHAN */
5879
5880#ifndef Z_MAXCHAN
5881#define Z_MAXCHAN (CKMAXOPEN-ZNFILS-5)
5882#endif /* Z_MAXCHAN */
5883#endif /* pdp11 */
5884
5885/* New-format nzltor() and nzrtol() functions that handle pathnames */
5886
5887#ifndef NZLTOR
5888#ifdef UNIX
5889#define NZLTOR
5890#else
5891#ifdef VMS
5892#define NZLTOR
5893#else
5894#ifdef OS2
5895#define NZLTOR
5896#else
5897#ifdef STRATUS
5898#define NZLTOR
5899#endif /* STRATUS */
5900#endif /* OS2 */
5901#endif /* VMS */
5902#endif /* UNIX */
5903#endif /* NZLTOR */
5904
5905#ifdef NZLTOR
5906_PROTOTYP( VOID nzltor, (char *, char *, int, int, int) );
5907_PROTOTYP( VOID nzrtol, (char *, char *, int, int, int) );
5908#endif /* NZLTOR */
5909
5910/* Implementations with a zrmdir() function */
5911
5912#ifndef ZRMDIR
5913#ifdef OS2
5914#define ZRMDIR
5915#else /* OS2 */
5916#ifdef UNIX
5917#define ZRMDIR
5918#else
5919#ifdef VMS
5920#define ZRMDIR
5921#else /* VMS */
5922#ifdef STRATUS
5923#define ZRMDIR
5924#endif /* STRATUS */
5925#endif /* VMS */
5926#endif /* UNIX */
5927#endif /* OS2 */
5928#endif /* ZRMDIR */
5929
5930#ifdef ZRMDIR
5931_PROTOTYP( int zrmdir, (char *) );
5932#endif /* ZRMDIR */
5933
5934#ifndef FILECASE
5935#ifdef UNIXOROSK
5936#define FILECASE 1
5937#else
5938#define FILECASE 0
5939#endif /* UNIXOROSK */
5940#ifndef CKCMAI
5941extern int filecase;
5942#endif /* CKCMAI */
5943#endif /* FILECASE */
5944
5945/* Funny names for library functions department... */
5946
5947#ifdef ZILOG
5948#define setjmp setret
5949#define longjmp longret
5950#define jmp_buf ret_buf
5951#define getcwd curdir
5952#endif /* ZILOG */
5953
5954#ifdef STRATUS
5955/* The C-runtime conflicts with things we do in Stratus VOS ckltio.c ... */
5956#define printf vosprtf
5957_PROTOTYP( int vosprtf, (char *fmt, ...) );
5958#define perror(txt) printf("%s\n", txt)
5959/* char_varying is a string type from PL/I that VOS uses extensively */
5960#define CV char_varying
5961#endif /* STRATUS */
5962
5963#ifdef NT
5964extern int OSVer;
5965#define isWin95() (OSVer==VER_PLATFORM_WIN32_WINDOWS)
5966#else
5967#define isWin95() (0)
5968#endif /* NT */
5969
5970#ifndef BPRINT
5971#ifdef OS2
5972#define BPRINT
5973#endif /* OS2 */
5974#endif /* BPRINT */
5975
5976#ifndef SESLIMIT
5977#ifdef OS2
5978#define SESLIMIT
5979#endif /* OS2 */
5980#endif /* SESLIMIT */
5981
5982#ifndef NOTERM
5983#ifndef PCTERM
5984#ifdef NT
5985#define PCTERM
5986#endif /* NT */
5987#endif /* PCTERM */
5988#endif /* NOTERM */
5989
5990#ifdef BEOSORBEBOX
5991#define query ckquery
5992#endif /* BEOSORBEBOX */
5993
5994#ifndef PTYORPIPE                       /* NETCMD and/or NETPTY defined */
5995#ifdef NETCMD
5996#define PTYORPIPE
5997#else
5998#ifdef NETPTY
5999#define PTYORPIPE
6000#endif /* NETPTY */
6001#endif /* NETCMD */
6002#endif /* PTYORPIPE */
6003
6004/* mktemp() and mkstemp() */
6005
6006#ifndef NOMKTEMP
6007#ifndef MKTEMP
6008#ifdef OS2ORUNIX
6009#define MKTEMP
6010#endif /* OS2ORUNIX */
6011#endif /* MKTEMP */
6012
6013#ifdef MKTEMP
6014#ifndef NOMKSTEMP
6015#ifndef MKSTEMP
6016#ifdef BSD44
6017#define MKSTEMP
6018#else
6019#ifdef __linux__
6020#define MKSTEMP
6021#endif /* __linux__ */
6022#endif /* BSD44 */
6023#endif /* MKSTEMP */
6024#endif /* NOMKSTEMP */
6025#endif /* MKTEMP */
6026#endif /* NOMKTEMP */
6027
6028/* Platforms that have memcpy() -- only after all headers included */
6029
6030#ifndef USE_MEMCPY
6031#ifdef VMS
6032#define USE_MEMCPY
6033#else
6034#ifdef NEXT
6035#define USE_MEMCPY
6036#else
6037#ifdef OS2
6038#define USE_MEMCPY
6039#else
6040#ifdef __linux__
6041#define USE_MEMCPY
6042#else
6043#ifdef SOLARIS
6044#define USE_MEMCPY
6045#else
6046#ifdef SUNOS4
6047#define USE_MEMCPY
6048#else
6049#ifdef AIXRS
6050#define USE_MEMCPY
6051#else
6052#ifdef HPUX
6053#define USE_MEMCPY
6054#else
6055#ifdef POSIX
6056#define USE_MEMCPY
6057#else
6058#ifdef SVR4
6059#define USE_MEMCPY
6060#else
6061#ifdef OSF
6062#define USE_MEMCPY
6063#else
6064#ifdef datageneral
6065#define USE_MEMCPY
6066#else
6067#ifdef STRATUS
6068#define USE_MEMCPY
6069#endif /* STRATUS */
6070#endif /* datageneral */
6071#endif /* OSF */
6072#endif /* SVR4 */
6073#endif /* POSIX */
6074#endif /* HPUX */
6075#endif /* AIXRS */
6076#endif /* SUNOS4 */
6077#endif /* SOLARIS */
6078#endif /* __linux__ */
6079#endif /* OS2 */
6080#endif /* NEXT */
6081#endif /* VMS */
6082#endif /* USE_MEMCPY */
6083
6084#ifndef USE_MEMCPY
6085#define memcpy(a,b,c) ckmemcpy((a),(b),(c))
6086#else
6087#ifdef CK_SCO32V4
6088/* Because the prototype isn't picked up in the normal header files */
6089_PROTOTYP( void *memcpy, (void *, const void *, size_t));
6090#endif /* CK_SCO32V4 */
6091#endif /* USE_MEMCPY */
6092
6093/* User authentication for IKS -- So far K95 and UNIX only */
6094
6095#ifdef NOICP
6096#ifndef NOLOGIN
6097#define NOLOGIN
6098#endif /* NOLOGIN */
6099#endif /* NOICP */
6100
6101#ifndef NOLOGIN
6102#ifdef OS2ORUNIX
6103#ifndef CK_LOGIN
6104#define CK_LOGIN
6105#ifndef NOSHADOW
6106#ifdef CK_SCOV5
6107#define CK_SHADOW
6108#endif /* CK_SCOV5 */
6109#endif /* NOSHADOW */
6110#endif /* CK_LOGIN */
6111#ifdef NT
6112#define NTCREATETOKEN
6113#endif /* NT */
6114#endif /* OS2ORUNIX */
6115#else /* NOLOGIN */
6116#ifdef CK_LOGIN
6117#undef CK_LOGIN
6118#endif /* CK_LOGIN */
6119#endif /* NOLOGIN */
6120
6121#ifdef OS2
6122#define CKSPINNER
6123#endif /* OS2 */
6124
6125#ifdef CK_LOGIN                         /* Telnet protocol required */
6126#ifndef TNCODE                          /* for login to IKSD. */
6127#define TNCODE
6128#endif /* TNCODE */
6129#endif /* CK_LOGIN */
6130
6131#ifdef CK_AUTHENTICATION
6132#ifdef NOSENDUID
6133#undef NOSENDUID
6134#endif /* NOSENDUID */
6135#endif /* CK_AUTHENTICATION */
6136
6137#ifdef TNCODE                           /* Should TELNET send user ID? */
6138#ifndef NOSENDUID
6139#ifndef CKSENDUID
6140#define CKSENDUID
6141#endif /* CKSENDUID */
6142#endif /* NOSENDUID */
6143#endif /* TNCODE */
6144
6145/* UNIX platforms that don't have getusershell() */
6146
6147#ifdef UNIX
6148#ifndef NOGETUSERSHELL
6149#ifdef IRIX
6150#define NOGETUSERSHELL
6151#else
6152#ifdef PTX
6153#define NOGETUSERSHELL
6154#else
6155#ifdef AIXRS
6156#define NOGETUSERSHELL
6157#else
6158#ifdef SINIX
6159#define NOGETUSERSHELL
6160#else
6161#ifdef UNIXWARE
6162#define NOGETUSERSHELL
6163#else
6164#ifdef COHERENT
6165#define NOGETUSERSHELL
6166#endif /* COHERENT */
6167#endif /* UNIXWARE */
6168#endif /* SINIX */
6169#endif /* AIXRS */
6170#endif /* PTX */
6171#endif /* IRIX */
6172#endif /* NOGETUSERSHELL */
6173#endif /* UNIX */
6174
6175#ifdef CK_LOGIN
6176#ifdef NT
6177#ifndef NOSYSLOG
6178#ifndef CKSYSLOG
6179#define CKSYSLOG
6180#endif /* CKSYSLOG */
6181#endif /* NOSYSLOG */
6182#endif /* NT */
6183#ifdef UNIX
6184#ifndef NOSYSLOG
6185#ifndef CKSYSLOG
6186#define CKSYSLOG
6187#endif /* CKSYSLOG */
6188#endif /* NOSYSLOG */
6189#ifndef NOWTMP
6190#ifndef CKWTMP
6191#define CKWTMP
6192#endif /* CKWTMP */
6193#endif /* NOWTMP */
6194#ifndef NOGETUSERSHELL
6195#ifndef GETUSERSHELL
6196#define GETUSERSHELL
6197#endif /* GETUSERSHELL */
6198#endif /* NOGETUSERSHELL */
6199#endif /* UNIX */
6200_PROTOTYP( int ckxlogin, (CHAR *, CHAR *, CHAR *, int));
6201_PROTOTYP( int ckxlogout, (VOID));
6202#endif /* CK_LOGIN */
6203
6204#ifndef NOZLOCALTIME                    /* zlocaltime() available. */
6205#ifdef OS2ORUNIX
6206#define ZLOCALTIME
6207_PROTOTYP( char * zlocaltime, (char *) );
6208#endif /* OS2ORUNIX */
6209#endif /* NOZLOCALTIME */
6210
6211#ifdef CKSYSLOG                         /* Syslogging levels */
6212#define SYSLG_NO 0                      /* No logging */
6213#define SYSLG_LI 1                      /* Login/out */
6214#define SYSLG_DI 2                      /* Dialing out */
6215#define SYSLG_AC 3                      /* Making any kind of connection */
6216#define SYSLG_PR 4                      /* Protocol Operations */
6217#define SYSLG_FC 5                      /* File creation */
6218#define SYSLG_FA 6                      /* File reading */
6219#define SYSLG_CM 7                      /* Top-level commands */
6220#define SYSLG_CX 8                      /* All commands */
6221#define SYSLG_DB 9                      /* Debug */
6222#define SYSLGMAX 9                      /* Highest level */
6223#define SYSLG_DF SYSLG_FA               /* Default level */
6224/* Logging function */
6225_PROTOTYP(VOID cksyslog,(int, int, char *, char *, char *));
6226#endif /* CKSYSLOG */
6227#ifndef CKCMAI
6228extern int ckxlogging, ckxsyslog, ikdbopen;
6229#endif /* CKCMAI */
6230
6231#ifndef CK_KEYTAB
6232#define CK_KEYTAB
6233/* Keyword Table Template */
6234
6235/* Note: formerly defined in ckucmd.h but now more widely used */
6236
6237struct keytab {                         /* Keyword table */
6238    char *kwd;                          /* Pointer to keyword string */
6239    int kwval;                          /* Associated value */
6240    int flgs;                           /* Flags (as defined above) */
6241};
6242#endif /* CK_KEYTAB */
6243
6244#ifdef NETPTY
6245_PROTOTYP( int do_pty, (char *));
6246_PROTOTYP( VOID end_pty, (void));
6247#endif /* NETPTY */
6248
6249#ifdef CKROOT
6250_PROTOTYP( int zsetroot, (char *) );
6251_PROTOTYP( char * zgetroot, (void) );
6252_PROTOTYP( int zinroot, (char *) );
6253#endif /* CKROOT */
6254
6255/* Local Echo Buffer prototypes */
6256_PROTOTYP( VOID le_init, (void) );
6257_PROTOTYP( VOID le_clean, (void));
6258_PROTOTYP( int le_inbuf, (void));
6259_PROTOTYP( int le_putstr, (CHAR *));
6260_PROTOTYP( int le_puts, (CHAR *, int));
6261_PROTOTYP( int le_putchar, (CHAR));
6262_PROTOTYP( int le_getchar, (CHAR *));
6263
6264/* #ifndef NOHTTP */
6265#ifndef NOCMDATE2TM
6266#ifndef CMDATE2TM
6267#ifdef OS2ORUNIX
6268#define CMDATE2TM
6269#endif /* OS2ORUNIX */
6270#endif /* CMDATE2TM */
6271#endif /* NOCMDATE2TM */
6272
6273#ifdef CMDATE2TM
6274_PROTOTYP( struct tm * cmdate2tm, (char *,int));
6275#endif /* CMDATE2TM */
6276/* #endif */ /* NOHTTP */
6277
6278#ifndef NOSETTIME                       /* This would be set in CFLAGS */
6279#ifdef SVR4ORPOSIX                      /* Defined in IEEE 1003.1-1996 */
6280#ifndef UTIMEH                          /* and in SVID for SVR4 */
6281#define UTIMEH
6282#endif /* UTIMEH */
6283#else  /* SVR4ORPOSIX */
6284#ifdef OSF                              /* Verified by Lucas Hart */
6285#ifndef UTIMEH
6286#define UTIMEH
6287#endif /* UTIMEH */
6288#else  /* OSF */
6289#ifdef SUNOS41                          /* Verified by Lucas Hart */
6290#ifndef UTIMEH
6291#define UTIMEH
6292#endif /* UTIMEH */
6293#else  /* SUNOS41 */
6294#ifdef OS2
6295#ifndef SYSUTIMEH
6296#define SYSUTIMEH
6297#endif /* SYSUTIMEH */
6298#endif /* OS2 */
6299#endif /* SUNOS41 */
6300#endif /* OSF */
6301#endif /* SVR4ORPOSIX */
6302#endif /* NOSETTIME */
6303
6304#ifdef NEWFTP
6305_PROTOTYP( int ftpisconnected, (void));
6306_PROTOTYP( int ftpisloggedin, (void));
6307_PROTOTYP( int ftpissecure, (void));
6308#endif /* NEWFTP */
6309
6310_PROTOTYP( int readpass, (char *, char *, int));
6311_PROTOTYP( int readtext, (char *, char *, int));
6312
6313#ifdef OS2
6314_PROTOTYP(int ck_auth_loaddll, (VOID));
6315_PROTOTYP(int ck_auth_unloaddll, (VOID));
6316#endif /* OS2 */
6317
6318#ifdef NT
6319_PROTOTYP(DWORD ckGetLongPathname,(LPCSTR lpFileName,
6320                                   LPSTR lpBuffer, DWORD cchBuffer));
6321#endif /* NT */
6322
6323#include "ckclib.h"
6324
6325#ifdef NT
6326#ifdef __STDC__
6327#define stricmp _stricmp
6328#define putenv _putenv
6329#define sopen _sopen
6330#define strupr _strupr
6331#define close _close
6332#define stat _stat
6333#define fileno _fileno
6334#define sys_errlist _sys_errlist
6335#define unlink _unlink
6336#define write _write
6337#define creat _creat
6338#define getpid _getpid
6339#define isascii __isascii
6340#define utime _utime
6341#define mktemp _mktemp
6342#define strnicmp _strnicmp
6343#define read _read
6344#define open _open
6345#define access _access
6346#define wcsdup _wcsdup
6347#define chmod _chmod
6348#define fstat _fstat
6349#define ftime _ftime
6350#endif /* __STDC__ */
6351#endif /* NT */
6352#endif /* CKCDEB_H */
6353
6354/* End of ckcdeb.h */
Note: See TracBrowser for help on using the repository browser.