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