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