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