home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / old / ckermit60 / ckcdeb.h < prev    next >
C/C++ Source or Header  |  2020-01-01  |  68KB  |  3,008 lines

  1. /*  C K C D E B . H  */
  2.  
  3. /*
  4.   Fri Sep  6 23:23:05 1996
  5.  
  6.   NOTE TO CONTRIBUTORS: This file, and all the other C-Kermit files, must be
  7.   compatible with C preprocessors that support only #ifdef, #else, #endif,
  8.   #define, and #undef.  Please do not use #if, logical operators, or other
  9.   preprocessor features in any of the portable C-Kermit modules.  You can,
  10.   of course, use these constructions in system-specific modules when you they
  11.   are supported.
  12. */
  13.  
  14. /*
  15.   This file is included by all C-Kermit modules, including the modules
  16.   that aren't specific to Kermit (like the command parser and the ck?tio and
  17.   ck?fio modules).  It should be include BEFORE any other C-Kermit header
  18.   files.  It specifies format codes for debug(), tlog(), and similar
  19.   functions, and includes any necessary definitions to be used by all C-Kermit
  20.   modules, and also includes some feature selection compile-time switches, and
  21.   also system- or compiler-dependent definitions, plus #includes and prototypes
  22.   required by all C-Kermit modules.
  23. */
  24.  
  25. /*
  26.   Author: Frank da Cruz <fdc@columbia.edu>,
  27.   Columbia University Academic Information Systems, New York City.
  28.  
  29.   Copyright (C) 1985, 1996, Trustees of Columbia University in the City of New
  30.   York.  All rights reserved.
  31. */
  32.  
  33. /*
  34.   Etymology: The name of this file means "C-Kermit Common-C-Language Debugging
  35.   Header", because originally it contained only the formats (F000-F111) for
  36.   the debug() and tlog() functions.  See how it has grown...
  37. */
  38.  
  39. #ifndef CKCDEB_H            /* Don't include me more than once. */
  40. #define CKCDEB_H
  41.  
  42. #ifdef NOLOCAL               /* Things not needed for a remote-only version */
  43. #ifndef NODIAL
  44. #define NODIAL
  45. #endif /* NODIAL */
  46. #ifndef NOSCRIPT
  47. #define NOSCRIPT
  48. #endif /* NOSCRIPT */
  49. #ifndef NOAPC
  50. #define NOAPC
  51. #endif /* NOAPC */
  52. #ifndef NOSETKEY
  53. #define NOSETKEY
  54. #endif /* NOSETKEY */
  55. #ifndef NOXMIT
  56. #define NOXMIT
  57. #endif /* NOXMIT */
  58. #ifdef CK_CURSES
  59. #undef CK_CURSES
  60. #endif /* CK_CURSES */
  61. #ifdef NETCONN
  62. #undef NETCONN
  63. #endif /* NETCONN */
  64. #ifdef TCPSOCKET
  65. #undef TCPSOCKET
  66. #endif /* TCPSOCKET */
  67. #endif /* NOLOCAL */
  68.  
  69. #ifdef NONET
  70. #ifdef NETCONN
  71. #undef NETCONN
  72. #endif /* NETCONN */
  73. #ifdef TCPSOCKET
  74. #undef TCPSOCKET
  75. #endif /* TCPSOCKET */
  76. #ifdef SUNX25
  77. #undef SUNX25
  78. #endif /* SUNX25 */
  79. #ifdef STRATUSX25
  80. #undef STRATUSX25
  81. #endif /* STRATUSX25 */
  82. #ifdef CK_NETBIOS
  83. #undef CK_NETBIOS
  84. #endif /* CK_NETBIOS */
  85. #ifdef SUPERLAT
  86. #undef SUPERLAT
  87. #endif /* SUPERLAT */
  88. #ifdef NPIPE
  89. #undef NPIPE
  90. #endif /* NPIPE */
  91. #ifdef SUNX25
  92. #undef SUNX25
  93. #endif /* SUNX25 */
  94. #ifdef SUNX25
  95. #undef SUNX25
  96. #endif /* SUNX25 */
  97. #ifdef SUNX25
  98. #undef SUNX25
  99. #endif /* SUNX25 */
  100. #ifdef SUNX25
  101. #undef SUNX25
  102. #endif /* SUNX25 */
  103.  
  104.  
  105. #endif /* NONET */
  106.  
  107. #ifndef DEFPAR                /* Default parity */
  108. #define DEFPAR 0            /* Must be here because it is used */
  109. #endif /* DEFPAR */            /* by all classes of modules */
  110.  
  111. #ifdef NT
  112. #ifndef OS2ORWIN32
  113. #define OS2ORWIN32
  114. #endif /* OS2ORWIN32 */
  115. #ifndef OS2
  116. #define WIN32ONLY
  117. #endif /* OS2 */
  118. #endif /* NT */
  119.  
  120. #ifdef OS2                /* For OS/2 debugging */
  121. #ifndef OS2ORWIN32
  122. #define OS2ORWIN32
  123. #endif /* OS2ORWIN32 */
  124. #include "ckoker.h"
  125. #ifdef NT
  126. #include <windows.h>
  127. #define NTSIG   
  128. #else /* NT */
  129. #define OS2ONLY
  130. #include <os2def.h> 
  131. #endif /* NT */
  132. #ifndef OS2ORUNIX
  133. #define OS2ORUNIX
  134. #endif /* OS2ORUNIX */
  135. #endif /* OS2 */
  136.  
  137. #include <stdio.h>            /* Begin by including this. */
  138. #include <ctype.h>            /* and this. */
  139.  
  140. #ifdef MAC
  141. /*
  142.  * The MAC doesn't use standard stdio routines.
  143.  */
  144. #undef getchar
  145. #define getchar()   mac_getchar()
  146. #undef putchar
  147. #define putchar(c)    mac_putchar(c)
  148. #define printf        mac_printf
  149. #define perror        mac_perror
  150. #define puts        mac_puts
  151. extern int mac_putchar (int c);
  152. extern int mac_puts (const char *string);
  153. extern int mac_printf(const char *, ...);
  154. extern int mac_getchar (void);
  155. #endif /* MAC */
  156.  
  157. #ifdef OS2
  158. #define printf Vscrnprintf
  159. #define fprintf Vscrnfprintf
  160. extern int Vscrnprintf(const char *, ...);
  161. extern int Vscrnfprintf(FILE *, const char *, ...);
  162. #ifdef putchar
  163. #undef putchar
  164. #endif /* putchar */
  165. #define putchar(x) Vscrnprintf("%c",x)
  166. #define puts(x)    Vscrnprintf(x)
  167. #define perror(x)  Vscrnperror(x)
  168. #endif /* OS2 */
  169.  
  170. /* System-type compilation switches */
  171.  
  172. #ifdef FT21                /* Fortune For:Pro 2.1 implies 1.8 */
  173. #ifndef FT18
  174. #define FT18
  175. #endif /* FT18 */
  176. #endif /* FT21 */
  177.  
  178. #ifdef AIXPS2                /* AIXPS2 implies AIX370 */
  179. #ifndef AIX370
  180. #define AIX370
  181. #endif /* AIX370 */
  182. #endif /* AIXPS2 */
  183.  
  184. #ifdef AIX370                /* AIX PS/2 or 370 implies BSD4 */
  185. #ifndef BSD4
  186. #define BSD4
  187. #endif /* BSD4 */
  188. #endif /* AIX370 */
  189.  
  190. #ifdef AIXESA                /* AIX/ESA implies BSD4.4 */
  191. #ifndef BSD44
  192. #define BSD44
  193. #endif /* BSD44 */
  194. #endif /* AIXESA */
  195.  
  196. #ifdef DGUX540                /* DG UX 5.40 implies Sys V R 4 */
  197. #ifndef SVR4
  198. #define SVR4
  199. #endif /* SVR4 */
  200. #endif /* DGUX540 */
  201.  
  202. #ifdef SUNOS41                /* SUNOS41 implies SUNOS4 */
  203. #ifndef SUNOS4
  204. #define SUNOS4
  205. #endif /* SUNOS4 */
  206. #endif /* SUNOS41 */
  207.  
  208. #ifdef SUN4S5                /* Sun-4 System V environment */
  209. #ifndef SVR3                /* implies System V R3 or later */
  210. #define SVR3
  211. #endif /* SVR3 */
  212. #endif /* SUN4S5 */
  213.  
  214. #ifdef MIPS                /* MIPS System V environment */
  215. #ifndef SVR3                /* implies System V R3 or later */
  216. #define SVR3
  217. #endif /* SVR3 */
  218. #endif /* MIPS */
  219.  
  220. #ifdef HPUX9                /* HP-UX 9.x */
  221. #ifndef SVR3
  222. #define SVR3
  223. #endif /* SVR3 */
  224. #ifndef HPUX
  225. #define HPUX
  226. #endif /* HPUX */
  227. #endif /* HPUX9 */
  228.  
  229. #ifdef HPUX10                /* HP-UX 10.x */
  230. #ifndef HPUX1010            /* If anything higher is defined */
  231. #ifdef HPUX1020                /* define HPUX1010 too. */
  232. #define HPUX1010
  233. #endif /* HPUX1020 */
  234. #ifdef HPUX1030
  235. #define HPUX1010
  236. #endif /* HPUX1030 */
  237. #endif /* HPUX1010 */
  238.  
  239. #ifndef SVR4
  240. #define SVR4
  241. #endif /* SVR4 */
  242. #ifndef HPUX
  243. #define HPUX
  244. #endif /* HPUX */
  245. #endif /* HPUX10 */
  246.  
  247. #ifdef QNX                /* QNX Software Systems Inc */
  248. #ifndef POSIX                /* QNX 4.0 or later is POSIX */
  249. #define POSIX
  250. #endif /* POSIX */
  251. #ifndef __386__                /* Comes in 16-bit and 32-bit */
  252. #define __16BIT__
  253. #define CK_QNX16
  254. #else
  255. #define __32BIT__
  256. #define CK_QNX32
  257. #endif /* __386__ */
  258. #endif /* QNX */
  259.  
  260. /*
  261.   4.4BSD is a mixture of System V R4, POSIX, and 4.3BSD.
  262. */
  263. #ifdef BSD44                /* 4.4 BSD */
  264. #ifndef SVR4                /* BSD44 implies SVR4 */
  265. #define SVR4
  266. #endif /* SVR4 */
  267. #ifndef NOSETBUF            /* NOSETBUF is safe */
  268. #define NOSETBUF
  269. #endif /* NOSETBUF */
  270. #ifndef DIRENT                /* Uses <dirent.h> */
  271. #define DIRENT
  272. #endif /* DIRENT */
  273. #endif /* BSD44 */
  274.  
  275. #ifdef SVR3                /* SVR3 implies ATTSV */
  276. #ifndef ATTSV
  277. #define ATTSV
  278. #endif /* ATTSV */
  279. #endif /* SVR3 */
  280.  
  281. #ifdef SVR4                /* SVR4 implies ATTSV */
  282. #ifndef ATTSV
  283. #define ATTSV
  284. #endif /* ATTSV */
  285. #ifndef SVR3                /* ...as well as SVR3 */
  286. #define SVR3
  287. #endif /* SVR3 */
  288. #endif /* SVR4 */
  289.  
  290. #ifdef OXOS
  291. #ifndef ATTSV
  292. #define ATTSV                /* OXOS implies ATTSV */
  293. #endif /* ! ATTSV */
  294. #define SW_ACC_ID            /* access() wants privs on */
  295. #define kill priv_kill            /* kill() wants privs on */
  296. #ifndef NOSETBUF
  297. #define NOSETBUF            /* NOSETBUF is safe */
  298. #endif /* ! NOSETBUF */
  299. #endif /* OXOS */
  300.  
  301. #ifdef UTSV                /* UTSV implies ATTSV */
  302. #ifndef ATTSV
  303. #define ATTSV
  304. #endif /* ATTSV */
  305. #endif /* UTSV */
  306.  
  307. #ifdef XENIX                /* XENIX implies ATTSV */
  308. #ifndef ATTSV
  309. #define ATTSV
  310. #endif /* ATTSV */
  311. #endif /* XENIX */
  312.  
  313. #ifdef AUX                /* AUX implies ATTSV */
  314. #ifndef ATTSV
  315. #define ATTSV
  316. #endif /* ATTSV */
  317. #endif /* AUX */
  318.  
  319. #ifdef ATT7300                /* ATT7300 implies ATTSV */
  320. #ifndef ATTSV
  321. #define ATTSV
  322. #endif /* ATTSV */
  323. #endif /* ATT7300 */
  324.  
  325. #ifdef ATT6300                /* ATT6300 implies ATTSV */
  326. #ifndef ATTSV
  327. #define ATTSV
  328. #endif /* ATTSV */
  329. #endif /* ATT6300 */
  330.  
  331. #ifdef HPUX                /* HPUX implies ATTSV */
  332. #ifndef ATTSV
  333. #define ATTSV
  334. #endif /* ATTSV */
  335. #endif /* HPUX */
  336.  
  337. #ifdef ISIII                /* ISIII implies ATTSV */
  338. #ifndef ATTSV
  339. #define ATTSV
  340. #endif /* ATTSV */
  341. #endif /* ISIII */
  342.  
  343. #ifdef NEXT33                /* NEXT33 implies NEXT */
  344. #ifndef NEXT
  345. #define NEXT
  346. #endif /* NEXT */
  347. #endif /* NEXT33 */
  348.  
  349. #ifdef NEXT                /* NEXT implies BSD4 */
  350. #ifndef BSD4
  351. #define BSD4
  352. #endif /* BSD4 */
  353. #endif /* NEXT */
  354.  
  355. #ifdef SUNOS4                /* SUNOS4 implies BSD4 */
  356. #ifndef BSD4
  357. #define BSD4
  358. #endif /* BSD4 */
  359. #endif /* SUNOS4 */
  360.  
  361. #ifdef BSD41                /* BSD41 implies BSD4 */
  362. #ifndef BSD4
  363. #define BSD4
  364. #endif /* BSD4 */
  365. #endif /* BSD41 */
  366.  
  367. #ifdef BSD43                /* BSD43 implies BSD4 */
  368. #ifndef BSD4
  369. #define BSD4
  370. #endif /* BSD4 */
  371. #endif /* BSD43 */
  372.  
  373. #ifdef BSD4                /* BSD4 implies ANYBSD */
  374. #ifndef ANYBSD
  375. #define ANYBSD
  376. #endif /* ANYBSD */
  377. #endif /* BSD4 */
  378.  
  379. #ifdef BSD29                /* BSD29 implies ANYBSD */
  380. #ifndef ANYBSD
  381. #define ANYBSD
  382. #endif /* ANYBSD */
  383. #endif /* BSD29 */
  384.  
  385. #ifdef ATTSV                /* ATTSV implies UNIX */
  386. #ifndef UNIX
  387. #define UNIX
  388. #endif /* UNIX */
  389. #endif /* ATTSV */
  390.  
  391. #ifdef ANYBSD                /* ANYBSD implies UNIX */
  392. #ifndef UNIX
  393. #define UNIX
  394. #endif /* UNIX */
  395. #endif /* ANYBSD */
  396.  
  397. #ifdef POSIX                /* POSIX implies UNIX */
  398. #ifndef UNIX
  399. #define UNIX
  400. #endif /* UNIX */
  401. #ifndef DIRENT                /* and DIRENT, i.e. <dirent.h> */
  402. #ifndef SDIRENT
  403. #define DIRENT
  404. #endif /* SDIRENT */
  405. #endif /* DIRENT */
  406. #ifndef NOFILEH                /* POSIX doesn't use <sys/file.h> */
  407. #define NOFILEH
  408. #endif /* NOFILEH */
  409. #endif /* POSIX */
  410.  
  411. #ifdef V7
  412. #ifndef UNIX
  413. #define UNIX
  414. #endif /* UNIX */
  415. #endif /* V7 */
  416.  
  417. #ifdef COHERENT
  418. #ifndef UNIX
  419. #define UNIX
  420. #endif /* UNIX */
  421. #endif /* COHERENT */
  422.  
  423. #ifdef MINIX
  424. #ifndef UNIX
  425. #define UNIX
  426. #endif /* UNIX */
  427. #endif /* MINIX */
  428. /*
  429.   The symbol SVORPOSIX is defined for both AT&T and POSIX compilations
  430.   to make it easier to select items that System V and POSIX have in common,
  431.   but which BSD, V7, etc, do not have.
  432. */
  433. #ifdef ATTSV
  434. #ifndef SVORPOSIX
  435. #define SVORPOSIX
  436. #endif /* SVORPOSIX */
  437. #endif /* ATTSV */
  438.  
  439. #ifdef POSIX
  440. #ifndef SVORPOSIX
  441. #define SVORPOSIX
  442. #endif /* SVORPOSIX */
  443. #endif /* POSIX */
  444.  
  445. /*
  446.   The symbol SVR4ORPOSIX is defined for both AT&T System V R4 and POSIX 
  447.   compilations to make it easier to select items that System V R4 and POSIX 
  448.   have in common, but which BSD, V7, and System V R3 and earlier, etc, do
  449.   not have.
  450. */
  451. #ifdef POSIX
  452. #ifndef SVR4ORPOSIX
  453. #define SVR4ORPOSIX
  454. #endif /* SVR4ORPOSIX */
  455. #endif /* POSIX */
  456. #ifdef SVR4
  457. #ifndef SVR4ORPOSIX
  458. #define SVR4ORPOSIX
  459. #endif /* SVR4ORPOSIX */
  460. #endif /* SVR4 */
  461.  
  462. /*
  463.   The symbol BSD44ORPOSIX is defined for both 4.4BSD and POSIX compilations
  464.   to make it easier to select items that 4.4BSD and POSIX have in common,
  465.   but which System V, BSD, V7, etc, do not have.
  466. */
  467. #ifdef BSD44
  468. #ifndef BSD44ORPOSIX
  469. #define BSD44ORPOSIX
  470. #endif /* BSD44ORPOSIX */
  471. #endif /* BSD44 */
  472.  
  473. #ifdef POSIX
  474. #ifndef BSD44ORPOSIX
  475. #define BSD44ORPOSIX
  476. #endif /* BSD44ORPOSIX */
  477. #endif /* POSIX */
  478.  
  479. #ifdef UNIX                /* For items common to OS/2 and UNIX */
  480. #ifndef OS2ORUNIX
  481. #define OS2ORUNIX
  482. #endif /* OS2ORUNIX */
  483. #endif /* UNIX */
  484.  
  485. #ifdef OS2
  486. #define CK_ANSIC            /* OS/2 supports ANSIC and more extensions */
  487. #endif /* OS2 */
  488.  
  489. #ifdef OSF40        /* Newer OSF/1 versions imply older ones */
  490. #ifndef OSF32
  491. #define OSF32
  492. #endif /* OSF32 */
  493. #endif /* OSF40 */
  494.  
  495. #ifdef OSF32
  496. #ifndef OSF30
  497. #define OSF30
  498. #endif /* OSF30 */
  499. #endif /* OSF32 */
  500.  
  501. #ifdef OSF30
  502. #ifndef OSF20
  503. #define OSF20
  504. #endif /* OSF20 */
  505. #endif /* OSF30 */
  506.  
  507. #ifdef OSF20
  508. #ifndef OSF10
  509. #define OSF10
  510. #endif /* OSF10 */
  511. #endif /* OSF20 */
  512.  
  513. #ifdef __DECC                /* For DEC Alpha AXP VMS or OSF/1 */
  514. #ifndef CK_ANSIC
  515. #define CK_ANSIC            /* Even with /stand=vaxc, need ansi */
  516. #endif /* CKANSIC */
  517. #ifndef SIG_V
  518. #define SIG_V                /* and signal type is VOID */
  519. #endif /* SIG_V */
  520. #ifndef CK_ANSILIBS
  521. #define CK_ANSILIBS            /* (Martin Zinser, Feb 1995) */
  522. #endif /* CK_ANSILIBS */
  523. #ifndef _POSIX_C_SOURCE
  524. #define _POSIX_C_SOURCE
  525. #endif /* _POSIX_C_SOURCE */
  526. #endif    /* __DECC */
  527.  
  528. #ifdef apollo                /* May be ANSI-C, check further */
  529. #ifdef __STDCPP__
  530. #define CK_ANSIC            /* Yes, this is real ANSI-C */
  531. #define SIG_V
  532. #else
  533. #define NOANSI                /* Nope, not ANSI */
  534. #undef __STDC__                /* Even though it say it is! */
  535. #define SIG_I
  536. #endif /* __STDCPP__ */
  537. #endif /* apollo */
  538.  
  539. #ifdef POSIX                /* -DPOSIX on cc command line */
  540. #ifndef _POSIX_SOURCE            /* Implies _POSIX_SOURCE */
  541. #define _POSIX_SOURCE
  542. #endif /* _POSIX_SOURCE */
  543. #endif /* POSIX */
  544.  
  545. /*
  546.   ANSI C?  That is, do we have function prototypes, new-style
  547.   function declarations, and parameter type checking and coercion?
  548. */
  549. #ifdef MAC                /* MPW C is ANSI */
  550. #ifndef NOANSI
  551. #ifndef CK_ANSIC
  552. #define CK_ANSIC
  553. #endif /* CK_ANSIC */
  554. #endif /* NOANSI */
  555. #endif /* MAC */
  556.  
  557. #ifdef STRATUS                /* Stratus VOS */
  558. #ifndef CK_ANSIC
  559. #define CK_ANSIC
  560. #endif /* CK_ANSIC */
  561. #endif /* STRATUS */
  562.  
  563. #ifndef NOANSI
  564. #ifdef __STDC__                /* __STDC__ means ANSI C */
  565. #ifndef CK_ANSIC
  566. #define CK_ANSIC
  567. #endif /* CK_ANSIC */
  568. #endif /* __STDC__ */
  569. #endif /* NOANSI */
  570. /*
  571.   _PROTOTYP() is used for forward declarations of functions so we can have
  572.   parameter and return value type checking if the compiler offers it.
  573.   __STDC__ should be defined by the compiler only if function prototypes are
  574.   allowed.  Otherwise, we get old-style forward declarations.  Our own private
  575.   CK_ANSIC symbol tells whether we use ANSI C prototypes.  To force use of
  576.   ANSI prototypes, include -DCK_ANSIC on the cc command line.  To disable the
  577.   use of ANSI prototypes, include -DNOANSI.
  578. */
  579. #ifdef CK_ANSIC
  580. #define _PROTOTYP( func, parms ) func parms
  581. #else /* Not ANSI C */
  582. #define _PROTOTYP( func, parms ) func()
  583. #endif /* CK_ANSIC */
  584.  
  585. /*
  586.   Altos-specific items: 486, 586, 986 models...
  587. */
  588. #ifdef A986
  589. #define M_VOID
  590. #define void int
  591. #define CHAR char
  592. #define SIG_I
  593. #endif /* A986 */
  594.  
  595. /* Signal handling */
  596.  
  597. #ifdef QNX
  598. #ifndef CK_POSIX_SIG
  599. #define CK_POSIX_SIG
  600. #endif /* CK_POSIX_SIG */
  601. #endif /* QNX */
  602.  
  603. /* Void type */
  604.  
  605. #ifndef VOID                /* Used throughout all C-Kermit */
  606. #ifdef CK_ANSIC                /* modules... */
  607. #define VOID void
  608. #else
  609. #define VOID int
  610. #endif /* CK_ANSIC */
  611. #endif /* VOID */
  612.  
  613. /* Signal type */
  614.  
  615. #ifndef SIG_V                /* signal() type, if not def'd yet */
  616. #ifndef SIG_I
  617. #ifdef OS2
  618. #define SIG_V
  619. #else
  620. #ifdef POSIX
  621. #define SIG_V
  622. #else
  623. #ifdef SVR3                /* System V R3 and later */
  624. #define SIG_V
  625. #else
  626. #ifdef SUNOS4                /* SUNOS V 4.0 and later */
  627. #ifndef sun386
  628. #define SIG_V 
  629. #else
  630. #define SIG_I
  631. #endif /* sun386 */
  632. #else
  633. #ifdef NEXT                /* NeXT */
  634. #define SIG_V
  635. #else
  636. #ifdef AIX370
  637. #include <signal.h>
  638. #define SIG_V
  639. #define SIGTYP __SIGVOID        /* AIX370 */
  640. #else
  641. #ifdef STRATUS                /* Stratus VOS */
  642. #define SIG_V
  643. #else
  644. #ifdef MAC
  645. #define SIGTYP long
  646. #define SIG_I
  647. #ifndef MPW33
  648. #define SIG_IGN 0
  649. #endif /* MPW33 */
  650. #define SIGALRM 1
  651. #ifndef MPW33
  652. #define SIGINT  2
  653. #endif /* MPW33 */
  654. #else /* Everything else */
  655. #define SIG_I
  656. #endif /* MAC */
  657. #endif /* STRATUS */
  658. #endif /* AIX370 */
  659. #endif /* NEXT */
  660. #endif /* SUNOS4 */
  661. #endif /* SVR3 */
  662. #endif /* POSIX */
  663. #endif /* OS2 */
  664. #endif /* SIG_I */
  665. #endif /* SIG_V */
  666.  
  667. #ifdef SIG_I
  668. #define SIGRETURN return(0)
  669. #ifndef SIGTYP
  670. #define SIGTYP int
  671. #endif /* SIGTYP */
  672. #endif /* SIG_I */
  673.  
  674. #ifdef SIG_V
  675. #define SIGRETURN return
  676. #ifndef SIGTYP
  677. #define SIGTYP void
  678. #endif /* SIGTYP */
  679. #endif /* SIG_V */
  680.  
  681. #ifdef NT
  682. #ifndef SIGTYP
  683. #define SIGTYP void
  684. #endif /* SIGTYP */
  685.  
  686. #define strdup _strdup
  687. #endif /* NT */
  688.  
  689. #ifndef SIGTYP
  690. #define SIGTYP int
  691. #endif /* SIGTYP */
  692.  
  693. #ifndef SIGRETURN
  694. #define SIGRETURN return(0)
  695. #endif /* SIGRETURN */
  696.  
  697. #ifdef CKNTSIG
  698. /* This does not work, so don't use it. */
  699. #define signal ckntsignal
  700. SIGTYP (*ckntsignal(int type, SIGTYP (*)(int)))(int);
  701. #endif /* CKNTSIG */
  702.  
  703. /* We want all characters to be unsigned if the compiler supports it */
  704.  
  705. #ifdef KUI
  706. #ifdef CHAR
  707. #undef CHAR
  708. #endif /* CHAR */
  709. #define CHAR unsigned char
  710. #else
  711. #ifdef PROVX1
  712. typedef char CHAR;
  713. /* typedef long LONG; */
  714. typedef int void;
  715. #else
  716. #ifdef MINIX
  717. typedef unsigned char CHAR;
  718. #else
  719. #ifdef V7
  720. typedef char CHAR;
  721. #else
  722. #ifdef C70
  723. typedef char CHAR;
  724. /* typedef long LONG; */
  725. #else
  726. #ifdef BSD29
  727. typedef char CHAR;
  728. /* typedef long LONG; */
  729. #else
  730. #ifdef datageneral
  731. #define CHAR unsigned char            /* 3.22 compiler */ 
  732. #else
  733. #ifdef HPUX
  734. #define CHAR unsigned char
  735. #else
  736. #ifdef OS2
  737. #ifdef NT     
  738. #define CHAR unsigned char
  739. #else /* NT */
  740. #ifdef CHAR
  741. #undef CHAR
  742. #endif /* CHAR */
  743. typedef unsigned char CHAR;
  744. #endif /* NT */
  745. #else /* OS2 */
  746. #ifdef VMS
  747. typedef char CHAR;
  748. #else
  749. #ifdef CHAR
  750. #undef CHAR
  751. #endif /* CHAR */
  752. typedef unsigned char CHAR;
  753. #endif /* VMS */
  754. #endif /* OS2 */
  755. #endif /* HPUX */
  756. #endif /* datageneral */
  757. #endif /* BSD29 */
  758. #endif /* C70 */
  759. #endif /* V7 */
  760. #endif /* MINIX */
  761. #endif /* PROVX1 */
  762. #endif /* KUI */
  763.  
  764. #ifdef OS2
  765. _PROTOTYP( void bleep, (short) );
  766. #else /* OS2 */
  767. #define bleep(x) putchar('\07')
  768. #endif /* OS2 */
  769.  
  770. #ifdef MAC                /* Macintosh file routines */
  771. #ifndef CKWART_C            /* But not in "wart"... */
  772. #ifdef feof
  773. #undef feof
  774. #endif /* feof */
  775. #define feof mac_feof
  776. #define rewind mac_rewind
  777. #define fgets mac_fgets
  778. #define fopen mac_fopen
  779. #define fclose mac_fclose
  780. int mac_feof();
  781. void mac_rewind();
  782. char *mac_fgets();
  783. FILE *mac_fopen();
  784. int mac_fclose();
  785. #endif /* CKCPRO_W */
  786. #endif /* MAC */
  787. /*
  788.    Systems whose mainline modules have access to the communication-line
  789.    file descriptor, ttyfd.
  790. */
  791. #ifndef CK_TTYFD
  792. #ifdef UNIX
  793. #define CK_TTYFD
  794. #else
  795. #ifdef OS2
  796. #define CK_TTYFD
  797. #else
  798. #ifdef VMS
  799. #define CK_TTYFD
  800. #endif /* VMS */
  801. #endif /* OS2 */
  802. #endif /* UNIX */
  803. #endif /* CK_TTYFD */
  804.  
  805. /* Temporary-directory-for-RECEIVE feature ... */
  806. /* This says whether we have the isdir() function defined. */
  807.  
  808. #ifdef UNIX                /* UNIX has it */
  809. #ifndef CK_TMPDIR
  810. #ifndef pdp11
  811. #define CK_TMPDIR
  812. #define TMPDIRLEN 256
  813. #endif /* pdp11 */
  814. #endif /* CK_TMPDIR */
  815. #endif /* UNIX */
  816.  
  817. #ifdef VMS                /* VMS too */
  818. #ifndef CK_TMPDIR
  819. #define CK_TMPDIR
  820. #define TMPDIRLEN 256
  821. #endif /* CK_TMPDIR */
  822. #endif /* VMS */
  823.  
  824. #ifdef OS2                /* OS two too */
  825. #ifndef CK_TMPDIR
  826. #define CK_TMPDIR
  827. #define TMPDIRLEN 129
  828. #endif /* CK_TMPDIR */
  829. #endif /* OS2 */
  830.  
  831. #ifdef STRATUS                /* Stratus VOS too. */
  832. #ifndef CK_TMPDIR
  833. #define CK_TMPDIR
  834. #define TMPDIRLEN 256
  835. #endif /* CK_TMPDIR */
  836. #endif /* STRATUS */
  837.  
  838. #ifdef OSK                /* OS-9 too */
  839. #ifndef CK_TMPDIR
  840. #define CK_TMPDIR
  841. #define TMPDIRLEN 256
  842. #endif /* CK_TMPDIR */
  843. #endif /* OSK */
  844.  
  845. #ifdef CK_TMPDIR            /* Needs command parser */
  846. #ifdef NOICP
  847. #undef CK_TMPDIR
  848. #endif /* NOICP */
  849. #endif /* CK_TMPDIR */
  850.  
  851. /*
  852.  Debug and transaction logging is included automatically unless you define
  853.  NODEBUG or NOTLOG.  Do this if you want to save the space and overhead.
  854.  (Note, in version 4F these definitions changed from "{}" to the null string
  855.  to avoid problems with semicolons after braces, as in: "if (x) tlog(this);
  856.  else tlog(that);"
  857. */
  858. #ifndef NODEBUG
  859. #ifndef DEBUG
  860. #define DEBUG
  861. #endif /* DEBUG */
  862. #else
  863. #ifdef DEBUG
  864. #undef DEBUG
  865. #endif /* DEBUG */
  866. #endif /* NODEBUG */
  867.  
  868. #ifndef NOTLOG
  869. #ifndef TLOG
  870. #define TLOG
  871. #endif /* TLOG */
  872. #endif /* NOTLOG */
  873.  
  874. /* debug() macro style selection. */
  875.  
  876. #ifdef VMS
  877. #ifndef IFDEBUG
  878. #define IFDEBUG
  879. #endif /* IFDEBUG */
  880. #endif /* VMS */
  881.  
  882. #ifdef MAC
  883. #ifndef IFDEBUG
  884. #define IFDEBUG
  885. #endif /* IFDEBUG */
  886. #endif /* MAC */
  887.  
  888. #ifdef OS2
  889. #ifndef IFDEBUG
  890. #define IFDEBUG
  891. #endif /* IFDEBUG */
  892. #endif /* OS2 */
  893.  
  894. #ifdef OXOS                /* tst is faster than jsr */
  895. #ifndef IFDEBUG
  896. #define IFDEBUG
  897. #endif /* IFDEBUG */
  898. #endif /* OXOS */
  899.  
  900. #ifndef DEBUG
  901. /* Compile all the debug() statements away.  Saves a lot of space and time. */
  902. #define debug(a,b,c,d)
  903. #else
  904. #ifndef CKCMAI
  905. /* Debugging included.  Declare debug log flag in main program only. */
  906. extern int deblog;
  907. #endif /* CKCMAI */
  908. /* Now define the debug() macro. */
  909. #ifdef IFDEBUG
  910. /* Use this form to avoid function calls: */
  911. #define debug(a,b,c,d) if (deblog) dodebug(a,b,(char *)c,(long)d)
  912. #else
  913. /* Use this form to save space: */
  914. #define debug(a,b,c,d) dodebug(a,b,(char *)c,(long)d)
  915. #endif /* MAC */
  916.  
  917. #ifdef COMMENT
  918. #ifdef BEBOX
  919. #undef debug
  920. #define debug(a,b,c,d) if (deblog) printf("a=%1.1x:b=%s,c=%s,d=%0d\n",a,b,c,d)
  921. #endif /* BEBOX */
  922. #endif /* COMMENT */
  923.  
  924. _PROTOTYP(int dodebug,(int, char *, char *, long));
  925. #endif /* DEBUG */
  926.  
  927. #ifndef TLOG
  928. #define tlog(a,b,c,d)
  929. #else
  930. _PROTOTYP(VOID tlog,(int, char *, char *, long));
  931. #endif /* TLOG */
  932.  
  933. /* Formats for debug() and tlog() */
  934.  
  935. #define F000 0
  936. #define F001 1
  937. #define F010 2
  938. #define F011 3
  939. #define F100 4
  940. #define F101 5
  941. #define F110 6
  942. #define F111 7
  943.  
  944. /* Kermit feature selection */
  945.  
  946. #ifdef VMS                /* Features for all VMS builds */
  947. #ifndef NOJC
  948. #define NOJC
  949. #endif /* NOJC */
  950. #ifndef NOSETBUF
  951. #define NOSETBUF
  952. #endif /* NOSETBUF */
  953. #ifndef DYNAMIC
  954. #define DYNAMIC
  955. #endif /* DYNAMIC */
  956. #ifndef KANJI
  957. #define KANJI
  958. #endif /* KANJI */
  959. #ifndef CK_CURSES
  960. #define CK_CURSES
  961. #endif /* CK_CURSES */
  962.  
  963. #endif /* VMS */
  964.  
  965. /*
  966.   GETMSEC means getmsec() is available, which tells elapsed time in
  967.   milliseconds.  Added in 6.0.192 - used only in debug log, to see how
  968.   long a packet read or write takes.  Results are sometimes surprising.
  969. */
  970. #ifdef DEBUG
  971. #ifdef SUNOS41                
  972. #ifndef GETMSEC
  973. #define GETMSEC
  974. #endif /*  GETMSEC */
  975. #else
  976. #ifdef NT
  977. #ifndef GETMSEC
  978. #define GETMSEC
  979. #endif /*  GETMSEC */
  980. #endif /* NT */
  981. #endif /* SUNOS41 */
  982. #endif /* DEBUG */
  983.  
  984. #ifdef GETMSEC
  985. _PROTOTYP( long getmsec, (void) );
  986. #endif /* GETMSEC */
  987.  
  988. #ifndef NOCKTIMERS            /* Dynamic timeouts */
  989. #ifndef CK_TIMERS
  990. #define CK_TIMERS
  991. #endif /* CK_TIMERS */
  992. #endif /* NOCKTIMERS */
  993.  
  994. #define CK_SPEED            /* Control-prefix removal */
  995. #ifdef NOCKSPEED
  996. #undef CK_SPEED
  997. #endif /* NOCKSPEED */
  998.  
  999. #ifdef MAC                /* For Macintosh, no escape */
  1000. #define NOPUSH                /* to operating system */
  1001. #endif /* MAC */
  1002.  
  1003. /* Systems where we can call zmkdir() to create directories. */
  1004.  
  1005. #ifndef CK_MKDIR
  1006. #ifndef NOMKDIR
  1007.  
  1008. #ifdef UNIX
  1009. #ifndef pdp11
  1010. #define CK_MKDIR
  1011. #endif /* pdp11 */
  1012. #endif /* UNIX */
  1013.  
  1014. #ifdef OS2
  1015. #define CK_MKDIR
  1016. #endif /* OS2 */
  1017.  
  1018. #ifdef VMS
  1019. #define CK_MKDIR
  1020. #endif /* VMS */
  1021.  
  1022. #ifdef STRATUS
  1023. #define CK_MKDIR
  1024. #endif /* STRATUS */
  1025.  
  1026. #ifdef OSK
  1027. #define CK_MKDIR
  1028. #endif /* OSK */
  1029.  
  1030. #endif /* CK_MKDIR */
  1031. #endif /* NOMKDIR */
  1032.  
  1033. #ifdef NOMKDIR                /* Allow for command-line override */
  1034. #ifdef CK_MKDIR
  1035. #undef CK_MKDIR
  1036. #endif /* CK_MKDIR */
  1037. #endif /* NOMKDIR */
  1038.  
  1039. /* Systems for which we can enable the REDIRECT command automatically */
  1040.  
  1041. #ifndef CK_REDIR
  1042. #ifdef __linux__            /* Linux */
  1043. #define CK_REDIR
  1044. #else
  1045. #ifdef SUNOS41                /* SunOS 4.1 */
  1046. #define CK_REDIR
  1047. #else
  1048. #ifdef __bsdi__                /* BSD/386 */
  1049. #define CK_REDIR
  1050. #else
  1051. #ifdef SVR4                /* System V R4 */
  1052. #define CK_REDIR
  1053. #else
  1054. #ifdef ultrix                /* DEC ULTRIX */
  1055. #define CK_REDIR
  1056. #else
  1057. #ifdef AIXRS                /* RS/6000 AIX */
  1058. #define CK_REDIR
  1059. #else
  1060. #ifdef OSF                /* OSF/1 */
  1061. #define CK_REDIR
  1062. #else
  1063. #ifdef OS2                /* OS/2 */
  1064. #define CK_REDIR
  1065. #else
  1066. #ifdef NEXT                /* NEXT */
  1067. #define CK_REDIR
  1068. #endif /* NEXT */
  1069. #endif /* OS2 */
  1070. #endif /* OSF */
  1071. #endif /* AIXRS */
  1072. #endif /* ultrix */
  1073. #endif /* SVR4 */
  1074. #endif /* __bsdi__ */
  1075. #endif /* SUNOS41 */
  1076. #endif /* __linux__ */
  1077. #endif /* CK_REDIR */
  1078.  
  1079. #ifdef NOPUSH                /* But... REDIRECT command is not */
  1080. #ifdef CK_REDIR                /*  allowed if NOPUSH is defined. */
  1081. #undef CK_REDIR
  1082. #endif /* CK_REDIR */
  1083. #endif /* NOPUSH */
  1084.  
  1085. /* The following allows automatic enabling of REDIRECT to be overridden... */
  1086.  
  1087. #ifdef NOREDIRECT
  1088. #ifdef CK_REDIR
  1089. #undef CK_REDIR
  1090. #endif /* CK_REDIR */
  1091. #endif /* NOREDIRECT */
  1092.  
  1093. /* Versions where we support the RESEND command */
  1094.  
  1095. #ifndef NORESEND
  1096. #ifndef CK_RESEND
  1097. #ifdef UNIX
  1098. #ifndef pdp11
  1099. #define CK_RESEND
  1100. #endif /* pdp11 */
  1101. #endif /* UNIX */
  1102.  
  1103. #ifdef VMS
  1104. #define CK_RESEND
  1105. #endif /* VMS */
  1106.  
  1107. #ifdef OS2
  1108. #define CK_RESEND
  1109. #endif /* OS2 */
  1110.  
  1111. #ifdef AMIGA
  1112. #define CK_RESEND
  1113. #endif /* AMIGA */
  1114.  
  1115. #ifdef datageneral
  1116. #define CK_RESEND
  1117. #endif /* datageneral */
  1118.  
  1119. #ifdef STRATUS
  1120. #define CK_RESEND
  1121. #endif /* STRATUS */
  1122.  
  1123. #ifdef OSK
  1124. #define CK_RESEND
  1125. #endif /* OSK */
  1126.  
  1127. #endif /* CK_RESEND */
  1128. #endif /* NORESEND */
  1129.  
  1130. /* Systems implementing "Doomsday Kermit" protocol ... */
  1131.  
  1132. #ifndef DOOMSDAY
  1133. #ifdef UNIX
  1134. #define DOOMSDAY
  1135. #else
  1136. #ifdef VMS
  1137. #define DOOMSDAY
  1138. #else
  1139. #ifdef OS2
  1140. #define DOOMSDAY
  1141. #endif /* OS2 */
  1142. #endif /* VMS */
  1143. #endif /* UNIX */
  1144. #endif /* DOOMSDAY */
  1145.  
  1146. /* Systems where we want the Thermometer to be used for fullscreen */
  1147.  
  1148. #ifdef OS2
  1149. #ifndef CK_PCT_BAR
  1150. #define CK_PCT_BAR
  1151. #endif /* CK_PCT_BAR */
  1152. #endif /* OS2 */
  1153.  
  1154. /* Systems where we have a REXX command */
  1155.  
  1156. #ifdef OS2
  1157. #ifdef __32BIT__
  1158. #ifndef NOREXX
  1159. #define CK_REXX
  1160. #endif /* NOREXX */
  1161. #endif /* __32BIT__ */
  1162. #endif /* OS2 */
  1163.  
  1164. /* Systems that have a ZRENAME function */
  1165.  
  1166. #define ZRENAME                /* They all do */
  1167.  
  1168. /* Systems that have a ZCOPY function */
  1169.  
  1170. #ifdef OS2
  1171. #define ZCOPY
  1172. #endif /* OS2 */
  1173.  
  1174. /* Systems that have ttgwsiz() (they all should but they don't) */
  1175.  
  1176. #ifndef CK_TTGWSIZ
  1177. #ifdef UNIX
  1178. #define CK_TTGWSIZ
  1179. #else
  1180. #ifdef VMS
  1181. #define CK_TTGWSIZ
  1182. #else
  1183. #ifdef OS2
  1184. #define CK_TTGWSIZ
  1185. #endif /* OS2 */
  1186. #endif /* VMS */
  1187. #endif /* UNIX */
  1188. #endif /* CK_TTGWSIZ */
  1189.  
  1190. /* OS/2 C-Kermit features not available in 16-bit version... */
  1191.  
  1192. #ifdef OS2
  1193. #ifndef __32BIT__
  1194. #ifdef PCFONTS                /* PC Font support */
  1195. #undef PCFONTS
  1196. #endif /* PCFONTS */
  1197. #ifdef NPIPE                /* Named Pipes communication */
  1198. #undef NPIPE
  1199. #endif /* NPIPE */
  1200. #ifdef CK_NETBIOS            /* NETBIOS communication */
  1201. #undef CK_NETBIOS
  1202. #endif /* CK_NETBIOS */
  1203. #ifdef OS2MOUSE                /* Mouse */
  1204. #undef OS2MOUSE
  1205. #endif /* OS2MOUSE */
  1206. #ifdef OS2PM                /* Presentation Manager */
  1207. #undef OS2PM
  1208. #endif /* OS2PM */
  1209. #ifdef CK_REXX                /* Rexx */
  1210. #undef CK_REXX
  1211. #endif /* CK_REXX */
  1212. #endif /* __32BIT__ */
  1213. #endif /* OS2 */
  1214.  
  1215. /* OS/2 C-Kermit features not available in Windows NT version... */
  1216.  
  1217. #ifdef OS2
  1218. #ifdef NT
  1219. #ifdef PCFONTS                /* PC Font support */
  1220. #undef PCFONTS
  1221. #endif /* PCFONTS */
  1222. #ifdef NPIPE                /* Named Pipes communication */
  1223. #undef NPIPE
  1224. #endif /* NPIPE */
  1225. #ifdef CK_NETBIOS            /* NETBIOS communication */
  1226. #undef CK_NETBIOS
  1227. #endif /* CK_NETBIOS */
  1228. #ifdef OS2PM                /* Presentation Manager */
  1229. #undef OS2PM
  1230. #endif /* OS2PM */
  1231. #ifdef CK_REXX                /* Rexx */
  1232. #undef CK_REXX
  1233. #endif /* CK_REXX */
  1234. #endif /* NT */
  1235. #endif /* OS2 */
  1236.  
  1237. /*
  1238.   Systems that have select().
  1239.   This is used for both msleep() and for read-buffer checking in in_chk().
  1240. */
  1241. #define CK_SLEEPINT 250 /* milliseconds - set this to something that 
  1242.                            divides evenly into 1000 */
  1243. #ifndef SELECT
  1244. #ifndef NOSELECT
  1245. #ifdef __linux__
  1246. #define SELECT
  1247. #else
  1248. #ifdef SUNOS4
  1249. #define SELECT
  1250. #else
  1251. #ifdef NEXT
  1252. #define SELECT
  1253. #else
  1254. #ifdef HPUX
  1255. #define SELECT
  1256. #else
  1257. #ifdef AIXRS
  1258. #define SELECT
  1259. #else
  1260. #ifdef BSD44
  1261. #define SELECT
  1262. #else
  1263. #ifdef BSD4
  1264. #define SELECT
  1265. #else
  1266. #ifdef OXOS
  1267. #define SELECT
  1268. #else
  1269. #ifdef OS2
  1270. #define SELECT
  1271. #endif /* OS2 */
  1272. #endif /* OXOS */
  1273. #endif /* BSD4 */
  1274. #endif /* BSD44 */
  1275. #endif /* AIXRS */
  1276. #endif /* HPUX */
  1277. #endif /* NEXT */
  1278. #endif /* __linux__ */
  1279. #endif /* SUNOS4 */
  1280. #endif /* NOSELECT */
  1281. #endif /* SELECT */
  1282.  
  1283. /*
  1284.   CK_NEED_SIG is defined if the system cannot check the console to
  1285.   to see if characters are waiting.  This is used during local-mode file
  1286.   transfer to interrupt the transfer, refresh the screen display, etc.
  1287.   If CK_NEED_SIG is defined, then file-transfer interruption characters
  1288.   have to be preceded a special character, e.g. the SIGQUIT character.
  1289.   CK_NEED_SIG should be defined if the conchk() function is not operational.
  1290. */
  1291. #ifdef NOPOLL                /* For overriding CK_POLL definition */
  1292. #ifdef CK_POLL
  1293. #undef CK_POLL
  1294. #endif /* CK_POLL */
  1295. #endif /* NOPOLL */
  1296.  
  1297. #ifndef CK_POLL                /* If we don't have poll() */
  1298. #ifndef RDCHK                /* And we don't have rdchk() */
  1299. #ifndef SELECT                /* And we don't have select() */
  1300. #ifdef ATTSV
  1301. #ifndef aegis
  1302. #ifndef datageneral
  1303. #ifndef OXOS
  1304. #define CK_NEED_SIG
  1305. #endif /* OXOS */
  1306. #endif /* datageneral */
  1307. #endif /* aegis */
  1308. #endif /* ATTSV */
  1309. #ifdef POSIX
  1310. #ifndef CK_NEED_SIG
  1311. #define CK_NEED_SIG
  1312. #endif /* CK_NEED_SIG */
  1313. #endif /* POSIX */
  1314. #endif /* SELECT */
  1315. #endif /* RDCHK */
  1316. #endif /* CK_POLL */
  1317.  
  1318. #ifdef HPUX                /* HP-UX has select() */
  1319. #ifdef CK_NEED_SIG
  1320. #undef CK_NEED_SIG
  1321. #endif /* CK_NEED_SIG */
  1322. #endif /* HPUX */
  1323.  
  1324. #ifdef AIXRS                /* AIX has select() */
  1325. #ifdef CK_NEED_SIG
  1326. #undef CK_NEED_SIG
  1327. #endif /* CK_NEED_SIG */
  1328. #endif /* AIXRS */
  1329.  
  1330. #ifdef BSD44                /* 4.4BSD has FIONREAD */
  1331. #ifdef CK_NEED_SIG
  1332. #undef CK_NEED_SIG
  1333. #endif /* CK_NEED_SIG */
  1334. #endif /* BSD44 */
  1335.  
  1336. #ifdef QNX                /* QNX has FIONREAD and select() */
  1337. #ifdef CK_NEED_SIG
  1338. #undef CK_NEED_SIG
  1339. #endif /* CK_NEED_SIG */
  1340. #endif /* QNX */
  1341.  
  1342. /*
  1343.   Automatic parity detection.
  1344.   This actually implies a lot more now: length-driven packet reading,
  1345.   "Doomsday Kermit" IBM Mainframe file transfer through 3270 data streams, etc.
  1346. */
  1347. #ifdef UNIX                /* For Unix */
  1348. #ifndef NOPARSEN
  1349. #define PARSENSE
  1350. #endif /* NOPARSEN */
  1351. #endif /* UNIX */
  1352.  
  1353. #ifdef VMS                /* ... and VMS */
  1354. #ifndef NOPARSEN
  1355. #define PARSENSE
  1356. #endif /* NOPARSEN */
  1357. #ifdef __GNUC__
  1358. #define VMSGCC
  1359. #endif /* __GNUC__ */
  1360. #endif /* VMS */
  1361.  
  1362. #ifdef MAC                /* and Macintosh */
  1363. #ifndef NOPARSEN
  1364. #define PARSENSE
  1365. #endif /* NOPARSEN */
  1366. #endif /* MAC */
  1367.  
  1368. #ifdef STRATUS                /* and Stratus VOS */
  1369. #ifndef NOPARSEN
  1370. #define PARSENSE
  1371. #endif /* NOPARSEN */
  1372. #endif /* STRATUS */
  1373.  
  1374. #ifdef OS2                /* and OS/2, finally */
  1375. #ifndef NOPARSEN
  1376. #define PARSENSE
  1377. #endif /* NOPARSEN */
  1378. #endif /* OS2 */
  1379.  
  1380. #ifdef DYNAMIC                /* If DYNAMIC is defined */
  1381. #define DCMDBUF                /* then also define this. */
  1382. #endif /* DYNAMIC */
  1383.  
  1384. #ifndef CK_LBRK                /* Can send Long BREAK */
  1385.  
  1386. #ifdef UNIX                /* (everybody but OS-9) */
  1387. #define CK_LBRK
  1388. #endif /* UNIX */
  1389. #ifdef VMS
  1390. #define CK_LBRK
  1391. #endif /* VMS */
  1392. #ifdef datageneral
  1393. #define CK_LBRK
  1394. #endif /* datageneral */
  1395. #ifdef GEMDOS
  1396. #define CK_LBRK
  1397. #endif /* GEMDOS */
  1398. #ifdef OS2
  1399. #define CK_LBRK
  1400. #endif /* OS2 */
  1401. #ifdef AMIGA
  1402. #define CK_LBRK
  1403. #endif /* AMIGA */
  1404.  
  1405. #endif /* CK_LBRK */
  1406.  
  1407. /* Carrier treatment */
  1408. /* These are defined here because they are shared by the system dependent */
  1409. /* and the system independent modules. */
  1410.  
  1411. #define  CAR_OFF 0    /* Off: ignore carrier always. */
  1412. #define  CAR_ON  1      /* On: heed carrier always, except during DIAL. */
  1413. #define  CAR_AUT 2      /* Auto: heed carrier, but only if line is declared */
  1414.             /* to be a modem line, and only during CONNECT. */
  1415.  
  1416. /* Hangup by modem command supported by default */
  1417.  
  1418. #ifndef NODIAL
  1419. #ifndef NOMDMHUP
  1420. #ifndef MDMHUP
  1421. #define MDMHUP 
  1422. #endif /* MDMHUP */
  1423. #endif /* NOMDMHUP */
  1424. #endif /* NODIAL */
  1425.  
  1426. /*
  1427.   Serial interface speeds available.  We assume that everybody supports:
  1428.   0, 110, 300, 600, 1200, 2400, 4800, and 9600 bps.  Symbols for other speeds
  1429.   are defined here.  You can also add definitions on the CC command lines.
  1430.   These definitions affect the SET SPEED keyword table, and are not necessarily
  1431.   usable in the system-dependent speed-setting code in the ck?tio.c modules,
  1432.   which depends on system-specific symbols like (in UNIX) B19200.  In other
  1433.   words, just defining it doesn't mean it'll work -- you also have to supply
  1434.   the supporting code in ttsspd() and ttgspd() in ck?tio.c.
  1435.  
  1436.   The symbols have the form BPS_xxxx, where xxxx is the speed in bits per
  1437.   second, or (for bps values larger than 9999) thousands of bps followed by K.
  1438.   The total symbol length should be 8 characters or less.  Some values are
  1439.   enabled automatically below.  You can disable a particular value by defining
  1440.   NOB_xxxx on the CC command line.
  1441. */
  1442. #ifndef NOB_50
  1443. #define BPS_50                /* 50 bps */
  1444. #endif
  1445.  
  1446. #ifndef NOB_75
  1447. #define BPS_75                /* 75 bps */
  1448. #endif
  1449.  
  1450. #ifndef NOB7512
  1451. #ifdef ANYBSD
  1452. #define BPS_7512            /* 75/1200 Split Speed */
  1453. #endif /* ANYBSD */
  1454. #endif /* NOB7512 */
  1455.  
  1456. #undef BPS_134                /* 134.5 bps (IBM 2741) */
  1457.  
  1458. #ifndef NOB_150
  1459. #define BPS_150                /* 150 bps */
  1460. #endif
  1461.  
  1462. #ifndef NOB_200
  1463. #define BPS_200                /* 200 bps */
  1464. #endif
  1465.  
  1466. #ifndef NOB_1800
  1467. #ifdef MAC
  1468. #define BPS_1800            /* 1800 bps */
  1469. #endif
  1470. #endif
  1471.  
  1472. #ifndef NOB_3600
  1473. #define BPS_3600            /* 3600 bps */
  1474. #endif
  1475.  
  1476. #ifndef NOB_7200
  1477. #define BPS_7200            /* 7200 bps */
  1478. #endif
  1479.  
  1480. #ifndef NOB_14K
  1481. #ifdef OS2
  1482. #define BPS_14K                /* 14400 bps */
  1483. #else
  1484. #ifdef NEXT
  1485. #define BPS_14K
  1486. #else
  1487. #ifdef MAC
  1488. #define BPS_14K
  1489. #else
  1490. #ifdef AMIGA
  1491. #define BPS_14K
  1492. #endif /* AMIGA */
  1493. #endif /* MAC */
  1494. #endif /* NEXT */
  1495. #endif /* OS2 */
  1496. #endif /* NOB_14K */
  1497.  
  1498. #ifndef NOB_19K
  1499. #define BPS_19K                /* 19200 bps */
  1500. #endif
  1501.  
  1502. #ifndef NOB_28K
  1503. #ifdef NEXT
  1504. #define BPS_28K                /* 28800 bps */
  1505. #else
  1506. #ifdef MAC
  1507. #define BPS_28K                /* 28800 bps */
  1508. #endif /* MAC */
  1509. #endif /* NEXT */
  1510. #endif /* NOB_28K */
  1511.  
  1512. #ifndef NOB_38K
  1513. #define BPS_38K                /* 38400 bps */
  1514. #endif
  1515.  
  1516. /*
  1517.   Speeds of 57600 and higher are supported in Linux 0.99.15 and later, but
  1518.   it seems to do no harm to enable them for earlier releases too, in which
  1519.   case commands like "set speed 57600" simply fail with an "Unsupported line
  1520.   speed" message.
  1521. */
  1522. #ifndef NOHISPEED
  1523. #ifdef __linux__
  1524. #define LINUXHISPEED
  1525. #endif /* __linux__ */
  1526. #endif /* NOHISPEED */
  1527.  
  1528. #ifndef NOB_57K
  1529. #ifdef Plan9
  1530. #define BPS_57K
  1531. #endif /* Plan9 */
  1532. #ifdef VMS
  1533. #define BPS_57K                /* 57600 bps */
  1534. #else
  1535. #ifdef OS2
  1536. #define BPS_57K
  1537. #else
  1538. #ifdef __linux__
  1539. #ifdef LINUXHISPEED
  1540. #define BPS_57K
  1541. #endif /* LINUXHISPEED */
  1542. #else
  1543. #ifdef HPUX
  1544. #define BPS_57K
  1545. #else
  1546. #ifdef NEXT
  1547. #define BPS_57K
  1548. #else
  1549. #ifdef __386BSD__
  1550. #define BPS_57K
  1551. #else
  1552. #ifdef __FreeBSD__
  1553. #define BPS_57K
  1554. #else
  1555. #ifdef __NetBSD__
  1556. #define BPS_57K
  1557. #else
  1558. #ifdef MAC
  1559. #define BPS_57K
  1560. #else
  1561. #ifdef QNX
  1562. #define BPS_57K
  1563. #else
  1564. #ifdef BEBOX
  1565. #define BPS_57K
  1566. #endif /* BEBOX */
  1567. #endif /* QNX */
  1568. #endif /* MAC */
  1569. #endif /* __NetBSD__ */
  1570. #endif /* __FreeBSD__ */
  1571. #endif /* __386BSD__ */
  1572. #endif /* NEXT */
  1573. #endif /* HPUX */
  1574. #endif /* __linux__ */
  1575. #endif /* OS2 */
  1576. #endif /* VMS */
  1577. #endif /* NOB_57K */
  1578.  
  1579. #ifndef NOB_76K
  1580. #ifdef Plan9
  1581. #define BPS_76K
  1582. #endif /* Plan9 */
  1583. #ifdef VMS
  1584. #define BPS_76K                /* 76800 bps */
  1585. #endif /* VMS */
  1586. #ifdef OS2
  1587. #ifdef __32BIT__
  1588. #define BPS_76K
  1589. #endif /* __32BIT__ */
  1590. #endif /* OS2 */
  1591. #ifdef QNX
  1592. #define BPS_76K
  1593. #endif /* QNX */
  1594. #endif /* NOB_76K */
  1595.  
  1596. #ifndef NOB_115K
  1597. #ifdef Plan9
  1598. #define BPS_115K
  1599. #endif /* Plan9 */
  1600. #ifdef VMS
  1601. #define BPS_115K            /* 115200 bps */
  1602. #else
  1603. #ifdef QNX
  1604. #define BPS_115K
  1605. #else
  1606. #ifdef HPUX
  1607. #define BPS_115K
  1608. #else
  1609. #ifdef __linux__
  1610. #ifdef LINUXHISPEED
  1611. #define BPS_115K
  1612. #endif /* LINUXHISPEED */
  1613. #else
  1614. #ifdef __386BSD__
  1615. #define BPS_115K
  1616. #else
  1617. #ifdef __FreeBSD__
  1618. #define BPS_115K
  1619. #else
  1620. #ifdef __NetBSD__
  1621. #define BPS_115K
  1622. #else
  1623. #ifdef OS2
  1624. #ifdef __32BIT__
  1625. #define BPS_115K
  1626. #endif /* __32BIT__ */
  1627. #else
  1628. #ifdef BEBOX
  1629. #define BPS_115K
  1630. #endif /* BEBOX */
  1631. #endif /* OS2 */
  1632. #endif /* __NetBSD__ */
  1633. #endif /* __FreeBSD__ */
  1634. #endif /* __386BSD__ */
  1635. #endif /* __linux__ */
  1636. #endif /* HPUX */
  1637. #endif /* QNX */
  1638. #endif /* VMS */
  1639. #endif /* NOB_115K */
  1640.  
  1641. #ifndef NOB_230K            /* 230400 bps */
  1642. #ifdef OS2
  1643. #ifdef __32BIT__            
  1644. #define BPS_230K
  1645. #endif /* __32BIT__ */
  1646. #else 
  1647. #undef BPS_230K
  1648. #endif /* OS2 */
  1649. #endif /* NOB_230K */
  1650.  
  1651. #ifdef BPS_230K                /* Maximum speed defined */
  1652. #define MAX_SPD 230400L
  1653. #else
  1654. #ifdef BPS_115K
  1655. #define MAX_SPD 115200L
  1656. #else
  1657. #ifdef BPS_76K
  1658. #define MAX_SPD 76800L
  1659. #else
  1660. #ifdef BPS_57K
  1661. #define MAX_SPD 57600L
  1662. #else
  1663. #ifdef BPS_38K
  1664. #define MAX_SPD 38400L
  1665. #else
  1666. #ifdef BPS_28K
  1667. #define MAX_SPD 28800L
  1668. #else
  1669. #ifdef BPS_19K
  1670. #define MAX_SPD 19200L
  1671. #else
  1672. #ifdef BPS_14K
  1673. #define MAX_SPD 14400L
  1674. #else
  1675. #define MAX_SPD 9600L
  1676. #endif
  1677. #endif
  1678. #endif
  1679. #endif
  1680. #endif
  1681. #endif
  1682. #endif
  1683. #endif
  1684.  
  1685. #ifndef CONGSPD                /* Systems that can call congspd() */
  1686. #ifdef UNIX
  1687. #define CONGSPD
  1688. #endif /* UNIX */
  1689. #ifdef VMS
  1690. #define CONGSPD
  1691. #endif /* VMS */
  1692. #endif /* CONGSPD */
  1693.  
  1694. /* Types of flow control available */
  1695.  
  1696. #define CK_XONXOFF            /* Everybody can do this, right? */
  1697.  
  1698. #ifdef AMIGA                /* Commodore Amiga */
  1699. #define CK_RTSCTS            /* has RTS/CTS */
  1700. #endif /* AMIGA */
  1701.  
  1702. #ifdef SUN4S5                /* SunOS in System V environment */
  1703. #define CK_RTSCTS
  1704. #else                    /* SunOS 4.0/4.1 in BSD environment */
  1705. #ifdef SUNOS4                /* SunOS 4.0+later supports RTS/CTS */
  1706. #ifdef SUNOS41                /* Easy in 4.1 and later */
  1707. #define CK_RTSCTS
  1708. #else                    /* Harder in 4.0 */
  1709. #ifndef __GNUC__            /* (see tthflow() in ckutio.c) */
  1710. #ifndef GNUC
  1711. #define CK_RTSCTS            /* Only if not using GNU gcc */
  1712. #endif /* __GNUC__ */
  1713. #endif /* GNUC */
  1714. #endif /* SUNOS41 */
  1715. #endif /* SUNOS4 */
  1716. #endif /* SUN4S5 */
  1717.  
  1718. #ifdef BSD44                /* And in 4.4 BSD, including BSDI */
  1719. #define CK_RTSCTS
  1720. #endif /* BSD44 */
  1721.  
  1722. #ifdef TERMIOX                /* Sys V R4 <termiox.h> */
  1723. #define CK_RTSCTS            /* has RTS/CTS */
  1724. #define CK_DTRCD            /* and DTR/CD */
  1725. #endif /* TERMIOX */
  1726. #ifdef STERMIOX                /* Sys V R4 <sys/termiox.h> */
  1727. #define CK_RTSCTS            /* Ditto. */
  1728. #define CK_DTRCD
  1729. #endif /* STERMIOX */
  1730.  
  1731. #ifdef OXOS                /* Olivetti X/OS R2 struct termios */
  1732. #define CK_RTSCTS            /* Ditto. */
  1733. #define CK_DTRCD
  1734. #endif /* OXOS */
  1735.  
  1736. #ifdef AIXRS                /* RS/6000 with AIX 3.x */
  1737. #define CK_RTSCTS            /* Has its own peculiar method... */
  1738. #endif /* AIXRS */
  1739.  
  1740. #ifdef __linux__            /* Linux */
  1741. #define CK_RTSCTS
  1742. #endif /* __linux__ */
  1743. /*
  1744.   Hardware flow control is not defined in POSIX.1.  Nevertheless, a certain
  1745.   style API for hardware flow control, using tcsetattr() and the CRTSCTS
  1746.   bit(s), seems to be gaining currency on POSIX-based UNIX systems.  The
  1747.   following code defines the symbol POSIX_CRTSCTS for such systems.
  1748. */
  1749. #ifdef __bsdi__                /* BSDI, a.k.a. BSD/386 */
  1750. #define POSIX_CRTSCTS
  1751. #endif /* __bsdi__ */
  1752. #ifdef __linux__            /* Linux */
  1753. #define POSIX_CRTSCTS
  1754. #endif /* __linux__ */
  1755. #ifdef __NetBSD__            /* NetBSD */
  1756. #define POSIX_CRTSCTS
  1757. #endif /* __NetBSD__ */
  1758. #ifdef BEBOX
  1759. #define POSIX_CRTSCTS
  1760. /* BEBOX defines CRTSFL as (CTSFLOW & RTSFLOW) */
  1761. #define CRTSCTS CRTSFL
  1762. #endif /* BEBOX */
  1763.  
  1764. /* Implementations that have implemented the ttsetflow() function. */
  1765.  
  1766. #ifndef CK_TTSETFLOW
  1767. #ifdef UNIX
  1768. #define CK_TTSETFLOW
  1769. #endif /* UNIX */
  1770. #endif /* CK_TTSETFLOW */
  1771.  
  1772. /*
  1773.  Systems where we can expand tilde at the beginning of file or directory names
  1774. */
  1775. #ifdef POSIX
  1776. #ifndef DTILDE
  1777. #define DTILDE
  1778. #endif /* DTILDE */
  1779. #endif /* POSIX */
  1780. #ifdef BSD4
  1781. #ifndef DTILDE
  1782. #define DTILDE
  1783. #endif /* DTILDE */
  1784. #endif /* BSD4 */
  1785. #ifdef ATTSV
  1786. #ifndef DTILDE
  1787. #define DTILDE
  1788. #endif /* DTILDE */
  1789. #endif /* ATTSV */
  1790. #ifdef OSK
  1791. #ifndef DTILDE
  1792. #define DTILDE
  1793. #endif /* DTILDE */
  1794. #endif /* OSK */
  1795. #ifdef HPUX                /* I don't know why this is */
  1796. #ifndef DTILDE                /* necessary, since -DHPUX */
  1797. #define DTILDE                /* automatically defines ATTSV */
  1798. #endif /* DTILDE */            /* (see above) ... */
  1799. #endif /* HPUX */
  1800.  
  1801. /*
  1802.   This is mainly for the benefit of ckufio.c (UNIX and OS/2 file support).
  1803.   Systems that have an atomic rename() function, so we don't have to use
  1804.   link() and unlink().
  1805. */
  1806. #ifdef POSIX
  1807. #ifndef RENAME
  1808. #define RENAME
  1809. #endif /* RENAME */
  1810. #endif /* POSIX */
  1811.  
  1812. #ifdef OS2
  1813. #ifndef RENAME
  1814. #define RENAME
  1815. #endif /* RENAME */
  1816. #endif /* OS2 */
  1817.  
  1818. #ifdef SUNOS41
  1819. #ifndef RENAME
  1820. #define RENAME
  1821. #endif /* RENAME */
  1822. #endif /* SUNOS41 */
  1823.  
  1824. #ifdef SVR4
  1825. #ifndef RENAME
  1826. #define RENAME
  1827. #endif /* RENAME */
  1828. #endif /* SVR4 */
  1829.  
  1830. #ifdef AIXRS
  1831. #ifndef RENAME
  1832. #define RENAME
  1833. #endif /* RENAME */
  1834. #endif /* AIXRS */
  1835.  
  1836. #ifdef BSD44
  1837. #ifndef RENAME
  1838. #define RENAME
  1839. #endif /* RENAME */
  1840. #endif /* BSD44 */
  1841.  
  1842. #ifdef NORENAME                /* Allow for compile-time override */
  1843. #ifdef RENAME
  1844. #undef RENAME
  1845. #endif /* RENAME */
  1846. #endif /* NORENAME */
  1847.  
  1848. #ifdef STRATUS                /* Stratus VOS */
  1849. #ifndef RENAME
  1850. #define RENAME
  1851. #endif /* RENAME */
  1852. #endif /* STRATUS */
  1853.  
  1854. /* Line delimiter for text files */
  1855.  
  1856. /*
  1857.  If the system uses a single character for text file line delimitation,
  1858.  define NLCHAR to the value of that character.  For text files, that
  1859.  character will be converted to CRLF upon output, and CRLF will be converted
  1860.  to that character on input during text-mode (default) packet operations.
  1861. */
  1862. #ifdef MAC                              /* Macintosh */
  1863. #define NLCHAR 015
  1864. #else
  1865. #ifdef OSK                /* OS-9/68K */
  1866. #define NLCHAR 015
  1867. #else                                   /* All Unix-like systems */
  1868. #define NLCHAR 012
  1869. #endif /* OSK */
  1870. #endif /* MAC */
  1871.  
  1872. /*
  1873.  At this point, if there's a system that uses ordinary CRLF line
  1874.  delimitation AND the C compiler actually returns both the CR and
  1875.  the LF when doing input from a file, then #undef NLCHAR.
  1876. */
  1877. #ifdef OS2                /* OS/2 */
  1878. #undef NLCHAR
  1879. #endif /* OS2 */
  1880.  
  1881. #ifdef GEMDOS                /* Atari ST */
  1882. #undef NLCHAR
  1883. #endif /* GEMDOS */
  1884.  
  1885. /*
  1886.   VMS file formats are so complicated we need to do all the conversion 
  1887.   work in the CKVFIO module, so we tell the rest of C-Kermit not to fiddle
  1888.   with the bytes.
  1889. */
  1890.  
  1891. #ifdef vms
  1892. #undef NLCHAR
  1893. #endif /* vms */
  1894.  
  1895. /* The device name of a job's controlling terminal */
  1896. /* Special for VMS, same for all Unixes (?), not used by Macintosh */
  1897.  
  1898. #ifdef vms
  1899. #define CTTNAM "TT:"
  1900. #else
  1901. #ifdef datageneral
  1902. #define CTTNAM "@output"
  1903. #else
  1904. #ifdef OSK
  1905. extern char myttystr[];
  1906. #define CTTNAM myttystr
  1907. #else
  1908. #ifdef OS2
  1909. #define CTTNAM "con"
  1910. #else
  1911. #ifdef UNIX
  1912. #define CTTNAM "/dev/tty"
  1913. #else
  1914. #ifdef GEMDOS
  1915. #define CTTNAM "aux:"
  1916. #else
  1917. #ifdef STRATUS
  1918. extern char myttystr[];
  1919. #define CTTNAM myttystr
  1920. #else /* Anyone else... */
  1921. #define CTTNAM "stdout"            /* This is a kludge used by Mac */
  1922. #endif /* STRATUS */
  1923. #endif /* GEMDOS */
  1924. #endif /* UNIX */
  1925. #endif /* OS2 */
  1926. #endif /* OSK */
  1927. #endif /* datageneral */
  1928. #endif /* vms */
  1929.  
  1930. #ifndef ZFCDAT                /* zfcdat() function available? */
  1931. #ifdef UNIX
  1932. #define  ZFCDAT
  1933. #else
  1934. #ifdef STRATUS
  1935. #define  ZFCDAT
  1936. #else
  1937. #ifdef GEMDOS
  1938. #define  ZFCDAT
  1939. #else
  1940. #ifdef AMIGA
  1941. #define  ZFCDAT
  1942. #else
  1943. #ifdef OS2
  1944. #define  ZFCDAT
  1945. #else
  1946. #ifdef datageneral
  1947. #define  ZFCDAT
  1948. #else
  1949. #ifdef VMS
  1950. #define  ZFCDAT
  1951. #endif /* VMS */
  1952. #endif /* datageneral */
  1953. #endif /* OS2 */
  1954. #endif /* AMIGA */
  1955. #endif /* GEMDOS */
  1956. #endif /* STRATUS */
  1957. #endif /* UNIX */
  1958. #endif /* ZFCDAT */
  1959.  
  1960. #ifdef SUNS4S5
  1961. #define tolower _tolower
  1962. #define toupper _toupper
  1963. #endif /* SUNS4S5 */
  1964.  
  1965. /* Error number */
  1966.  
  1967. #ifdef _CRAY                
  1968. #ifdef _CRAYCOM                /* Cray Computer Corp. */
  1969. extern int errno;
  1970. #else /* _CRAYCOM */
  1971. #include <errno.h>            /* Cray Research UNICOS defines */
  1972.                     /* errno as a function. */
  1973. #endif /* _CRAYCOM */            /* OK for UNICOS 6.1 and 7.0. */
  1974. #else /* _CRAY */
  1975. #ifdef STRATUS                /* Stratus VOS */
  1976. #include <errno.h>
  1977. #else /* not STRATUS */
  1978. #ifndef VMS
  1979. #ifndef OS2
  1980. /*
  1981.   The following declaration causes problems for VMS and OS/2, in which
  1982.   errno is an "extern volatile int noshare"...
  1983. */
  1984. extern int errno;            /* Needed by most modules. */
  1985. #endif /* OS2 */
  1986. #endif /* VMS */
  1987. #endif /* STRATUS */
  1988. #endif /* _CRAY */
  1989.  
  1990. #ifndef BIGBUFOK            /* Platforms with lots of memory */
  1991.  
  1992. #ifdef sparc                /* SPARC processors */
  1993. #define BIGBUFOK
  1994. #endif /* sparc */
  1995.  
  1996. #ifdef mips                /* MIPS processors */
  1997. #define BIGBUFOK
  1998. #endif /* mips */
  1999.  
  2000. #ifdef HPUX10                /* HP-UX 10.0 PA-RISC */
  2001. #define BIGBUFOK
  2002. #endif /* HPUX10 */
  2003.  
  2004. #ifdef NEXT                /* NeXTSTEP */
  2005. #ifdef mc68000                /* on NEXT platforms... */
  2006. #define BIGBUFOK
  2007. #endif /* mc68000 */
  2008. #endif /* NEXT */
  2009.  
  2010. #ifdef OS2                /* 32-bit OS/2 2.x */
  2011. #ifdef __32BIT__
  2012. #define BIGBUFOK
  2013. #endif /* __32BIT__ */
  2014. #ifdef NT
  2015. #define BIGBUFOK
  2016. #endif /* NT */
  2017. #endif /* OS2 */
  2018.  
  2019. #ifdef Plan9                /* Plan 9 is OK */
  2020. #define BIGBUFOK
  2021. #endif /* Plan9 */
  2022.  
  2023. #ifdef VMS                /* Any VMS is OK */
  2024. #define BIGBUFOK
  2025. #endif /* VMS */
  2026.  
  2027. #ifdef __alpha                /* DEC 64-bit Alpha AXP, e.g. OSF/1 */
  2028. #ifndef BIGBUFOK            /* Might already be defined for VMS */
  2029. #define BIGBUFOK
  2030. #endif /* BIGBUFOK */
  2031. #endif /* __alpha */
  2032.  
  2033. #ifdef sgi                /* SGI with IRIX 4.0 or later */
  2034. #define BIGBUFOK
  2035. #endif /* sgi */
  2036.  
  2037. #endif /* BIGBUFOK */
  2038.  
  2039. /* File System Defaults */
  2040.  
  2041. #ifdef VMS
  2042. #define DBLKSIZ 512
  2043. #define DLRECL 512
  2044. #else
  2045. #define DBLKSIZ 0
  2046. #define DLRECL 0
  2047. #endif
  2048.  
  2049. /* Program return codes for DECUS C and UNIX (VMS uses UNIX codes) */
  2050.  
  2051. #ifdef decus
  2052. #define GOOD_EXIT   IO_NORMAL
  2053. #define BAD_EXIT    IO_ERROR
  2054. #else
  2055. #define GOOD_EXIT   0
  2056. #define BAD_EXIT    1
  2057. #endif /* decus */
  2058.  
  2059. /* Special hack for Fortune, which doesn't have <sys/file.h>... */
  2060.  
  2061. #ifdef FT18
  2062. #define FREAD 0x01
  2063. #define FWRITE 0x10
  2064. #endif /* FT18 */
  2065.  
  2066. /* Special hack for OS-9/68k */
  2067. #ifdef OSK
  2068. #ifndef _UCC
  2069. #define SIGALRM 30            /* May always cancel I/O */
  2070. #endif /* _UCC */
  2071. #define SIGARB    1234            /* Arbitrary for I/O */
  2072. SIGTYP (*signal())();
  2073. #endif /* OSK */
  2074.  
  2075. #ifdef OS2
  2076. #ifdef putchar                  /* MSC 5.1 simply uses a macro which causes */
  2077. #undef putchar                  /* no problems. */
  2078. #endif /* putchar */
  2079. #endif /* OS2 */
  2080.  
  2081. #ifdef MINIX
  2082. #ifdef putchar
  2083. #undef putchar
  2084. #endif /* putchar */
  2085. #define putchar(c) {putc(c,stdout);fflush(stdout);}
  2086. #endif /* MINIX */
  2087.  
  2088. #ifdef datageneral            /* Data General AOS/VS */
  2089. #ifdef putchar
  2090. #undef putchar
  2091. #endif /* putchar */
  2092. #define putchar(c) conoc(c)
  2093. #endif /* datageneral */
  2094.  
  2095. /* Escape/quote character used by the command parser */
  2096.  
  2097. #define CMDQ '\\' 
  2098.  
  2099. /* Symbols for RS-232 modem signals */
  2100.  
  2101. #define KM_FG    1            /* Frame ground */
  2102. #define KM_TXD   2            /* Transmit */
  2103. #define KM_RXD   3            /* Receive */
  2104. #define KM_RTS   4            /* Request to Send */
  2105. #define KM_CTS   5            /* Clear to Send */
  2106. #define KM_DSR   6            /* Data Set Ready */
  2107. #define KM_SG    7            /* Signal ground */
  2108. #define KM_DCD   8            /* Carrier Detect */
  2109. #define KM_DTR  20            /* Data Terminal Ready */
  2110. #define KM_RI   22            /* Ring Indication */
  2111.  
  2112. /* Bit mask values for modem signals */
  2113.  
  2114. #define BM_CTS   0001            /* Clear to send       (From DCE) */
  2115. #define BM_DSR   0002            /* Dataset ready       (From DCE) */
  2116. #define BM_DCD   0004            /* Carrier             (From DCE) */
  2117. #define BM_RNG   0010            /* Ring Indicator      (From DCE) */
  2118. #define BM_DTR   0020            /* Data Terminal Ready (From DTE) */
  2119. #define BM_RTS   0040            /* Request to Send     (From DTE) */
  2120.  
  2121. /* Codes for full duplex flow control */
  2122.  
  2123. #define FLO_NONE 0            /* None */
  2124. #define FLO_XONX 1            /* Xon/Xoff (soft) */
  2125. #define FLO_RTSC 2            /* RTS/CTS (hard) */
  2126. #define FLO_DTRC 3            /* DTR/CD (hard) */
  2127. #define FLO_ETXA 4            /* ETX/ACK (soft) */
  2128. #define FLO_STRG 5            /* String-based (soft) */
  2129. #define FLO_DIAL 6            /* DIALing kludge */
  2130. #define FLO_DIAX 7            /* Cancel dialing kludge */
  2131. #define FLO_DTRT 8            /* DTR/CTS (hard) */
  2132. #define FLO_KEEP 9            /* Keep, i.e. don't touch or change */
  2133. #define FLO_AUTO 10            /* Figure out automatically */
  2134.  
  2135. /* And finally... */
  2136.  
  2137. #ifdef COMMENT                /* Make sure this is NOT defined! */
  2138. #undef COMMENT
  2139. #endif /* COMMENT */
  2140.  
  2141. /* Structure definitions for Kermit file attributes */
  2142. /* All strings come as pointer and length combinations */
  2143. /* Empty string (or for numeric variables, -1) = unused attribute. */
  2144.  
  2145. struct zstr {             /* string format */
  2146.     int len;              /* length */
  2147.     char *val;            /* value */
  2148. };
  2149. struct zattr {            /* Kermit File Attribute structure */
  2150.     long lengthk;         /* (!) file length in K */
  2151.     struct zstr type;     /* (") file type (text or binary) */
  2152.     struct zstr date;     /* (#) file creation date yyyymmdd[ hh:mm[:ss]] */
  2153.     struct zstr creator;  /* ($) file creator id */
  2154.     struct zstr account;  /* (%) file account */
  2155.     struct zstr area;     /* (&) area (e.g. directory) for file */
  2156.     struct zstr password; /* (') password for area */
  2157.     long blksize;         /* (() file blocksize */
  2158.     struct zstr xaccess;  /* ()) file access: new, supersede, append, warn */
  2159.     struct zstr encoding; /* (*) encoding (transfer syntax) */
  2160.     struct zstr disp;     /* (+) disposition (mail, message, print, etc) */
  2161.     struct zstr lprotect; /* (,) protection (local syntax) */
  2162.     struct zstr gprotect; /* (-) protection (generic syntax) */
  2163.     struct zstr systemid; /* (.) ID for system of origin */
  2164.     struct zstr recfm;    /* (/) record format */
  2165.     struct zstr sysparam; /* (0) system-dependent parameter string */
  2166.     long length;          /* (1) exact length on system of origin */
  2167.     struct zstr charset;  /* (2) transfer syntax character set */
  2168. #ifdef OS2
  2169.     struct zstr longname; /* OS/2 longname if applicable */
  2170. #endif /* OS2 */ 
  2171.     struct zstr reply;    /* This goes last, used for attribute reply */
  2172. };
  2173.  
  2174. /* Kermit file information structure */
  2175.  
  2176. struct filinfo {
  2177.   int bs;                /* Blocksize */
  2178.   int cs;                /* Character set */
  2179.   long rl;                /* Record length */
  2180.   int org;                /* Organization */
  2181.   int fmt;                /* Record format */
  2182.   int cc;                /* Carriage control */
  2183.   int typ;                /* Type (text/binary) */
  2184.   int dsp;                /* Disposition */
  2185.   char *os_specific;            /* OS-specific attributes */
  2186. #ifdef OS2
  2187.   unsigned long int lblopts; /* LABELED FILE options bitmask */
  2188. #else
  2189.   int lblopts; 
  2190. #endif /* OS2 */
  2191. };
  2192.  
  2193. #ifndef ZFNQFP                /* Versions that have zfnqfp() */
  2194. #ifdef UNIX
  2195. #define ZFNQFP
  2196. #else
  2197. #ifdef VMS
  2198. #define ZFNQFP
  2199. #else
  2200. #ifdef OS2
  2201. #define ZFNQFP
  2202. #endif /* OS2 */
  2203. #endif /* VMS */
  2204. #endif /* UNIX */
  2205. struct zfnfp {
  2206.    int len;
  2207.    char * fpath;
  2208.    char * fname;
  2209. };
  2210. #endif /* ZFNQFP */
  2211.  
  2212. /* Systems that support FILE TYPE LABELED */
  2213.  
  2214. #ifdef VMS
  2215. #define CK_LABELED
  2216. #else
  2217. #ifdef OS2
  2218. #ifdef __32BIT__
  2219. #ifndef NT
  2220. #define CK_LABELED
  2221. #endif /* NT */
  2222. #endif /* __32BIT__ */
  2223. #endif /* OS2 */
  2224. #endif /* VMS */
  2225.  
  2226. /* LABELED FILE options bitmask */
  2227.  
  2228. #ifdef VMS                /* For VMS */
  2229. #define LBL_NAM  1            /* Ignore incoming name if set */
  2230. #define LBL_PTH  2            /* Use complete path if set */
  2231. #define LBL_ACL  4            /* Preserve ACLs if set */
  2232. #define LBL_BCK  8            /* Preserve backup date if set */
  2233. #define LBL_OWN 16            /* Preserve ownership if set */
  2234.  
  2235. #else
  2236.  
  2237. #ifdef OS2                /* Ditto for OS/2 */
  2238. #define LBL_NOR  0x0000            /* Normal file */
  2239. #define LBL_ARC  0x0020            /* Archive */
  2240. #define LBL_DIR  0x0010            /* Directory */
  2241. #define LBL_HID  0x0002            /* Hidden file */
  2242. #define LBL_RO   0x0001            /* Read only file */
  2243. #define LBL_SYS  0x0004            /* System file */
  2244. #define LBL_EXT  0x0040            /* Extended */
  2245. #endif /* OS2 */
  2246. #endif /* VMS */
  2247.  
  2248. /*
  2249.   Data types.  First the header file for data types so we can pick up the
  2250.   types used for pids, uids, and gids.  Override this section by putting
  2251.   -DCKTYP_H=xxx on the command line to specify the header file where your
  2252.   system defines these types.
  2253. */
  2254. #ifndef STRATUS
  2255. #ifdef __ALPHA
  2256. #ifdef MULTINET
  2257. #define CK_TGV_AXP
  2258. #endif /* MULTINET */
  2259. #endif /* __ALPHA */
  2260.  
  2261. #ifdef CK_TGV_AXP            /* Alpha, VMS, MultiNet */
  2262. /*
  2263.   Starting in DECC 5.0, <stdlib.h> no longer includes <types.h>.
  2264.   But before that an elaborate workaround is required, which results in
  2265.   including <types.h> sometimes but not others, evidently depending on whether
  2266.   <types.h> protects itself against multiple inclusion, which in turn probably
  2267.   differentiates between DECC <types.h> and TGV <types.h>.  Unfortunately I
  2268.   don't remember the details.  (fdc, 25 Oct 96)
  2269. */
  2270. #ifdef COMMENT
  2271. /*
  2272.   Previously the test here was for DEC version prior to 4.0, but since the
  2273.   test involved an "#if" statement, it was not portable and broke some non-VMS
  2274.   builds.  In any case, condition was never satisfied, so the result of
  2275.   commenting this section out is the same as the previous "#if" condition.
  2276. */
  2277. #ifndef __TYPES_LOADED
  2278. #define __TYPES_LOADED            /* Work around bug in .h files */
  2279. #endif /* __TYPES_LOADED */
  2280. #endif /* COMMENT */
  2281. #include <sys/types.h>
  2282. #else                    /* !CK_TGV_AXP */
  2283. #ifdef OSK                /* OS-9 */
  2284. #include <types.h>
  2285. #else                    /* General case, not OS-9 */
  2286. #ifndef CKTYP_H
  2287. #ifndef VMS
  2288. #ifndef MAC
  2289. #ifndef AMIGA
  2290. #define CKTYP_H <sys/types.h>
  2291. #endif /* AMIGA */
  2292. #endif /* MAC */
  2293. #endif /* VMS */
  2294. #endif /* CKTYP_H */
  2295.  
  2296. #ifdef GEMDOS
  2297. #undef CKTYP_H
  2298. #include <types.h>
  2299. #endif /* GEMDOS */
  2300.  
  2301. #ifdef OS2
  2302. #undef CKTYP_H
  2303. #include <sys/types.h>
  2304. #endif /* OS2 */
  2305.  
  2306. #ifdef CKTYP_H                /* Include it. */
  2307. #ifdef COHERENT                /* Except for COHERENT */
  2308. #include <sys/types.h>
  2309. #else
  2310. #ifdef datageneral            /* AOS/VS */
  2311. #include <sys/types.h>
  2312. #else
  2313. #ifdef __bsdi__                /* BSDI */
  2314. #ifdef POSIX
  2315. #undef _POSIX_SOURCE
  2316. #endif /* POSIX */
  2317. #endif /* __bsdi__ */
  2318. #include CKTYP_H
  2319. #ifdef __bsdi__
  2320. #ifdef POSIX
  2321. #define _POSIX_SOURCE
  2322. #endif /* POSIX */
  2323. #endif /* __bsdi__ */
  2324. #endif /* datageneral */
  2325. #endif /* COHERENT */
  2326. #endif /* CKTYP_H */
  2327.  
  2328. #endif /* OSK */
  2329. #endif /* CK_TGV_AXP */
  2330. #endif /* STRATUS */            /* End of types.h section */
  2331.  
  2332. /*
  2333.   Data type for pids.  If your system uses a different type, put something
  2334.   like -DPID_T=pid_t on command line, or override here.
  2335. */
  2336. #ifndef PID_T
  2337. #define PID_T int
  2338. #endif /* PID_T */
  2339. /*
  2340.   Data types for uids and gids.  Same deal as for pids.
  2341.   Wouldn't be nice if there was a preprocessor test to find out if a
  2342.   typedef existed?
  2343. */
  2344. #ifdef VMS
  2345. /* Not used in VMS so who cares */
  2346. #define UID_T int
  2347. #define GID_T int
  2348. #endif /* VMS */
  2349.  
  2350. #ifdef POSIX
  2351. /* Or would it be better (or worse?) to use _POSIX_SOURCE here? */
  2352. #ifndef UID_T
  2353. #define UID_T uid_t
  2354. #endif /* UID_T */
  2355. #ifndef GID_T
  2356. #define GID_T gid_t
  2357. #endif /* GID_T */
  2358. #else /* Not POSIX */
  2359. #ifdef SVR4
  2360. /* SVR4 and later have uid_t and gid_t. */
  2361. /* SVR3 and earlier use int, or unsigned short, or.... */
  2362. #ifndef UID_T
  2363. #define UID_T uid_t
  2364. #endif /* UID_T */
  2365. #ifndef GID_T
  2366. #define GID_T gid_t
  2367. #endif /* GID_T */
  2368. #else /* Not SVR4 */
  2369. #ifdef BSD43
  2370. #ifndef UID_T
  2371. #define UID_T uid_t
  2372. #endif /* UID_T */
  2373. #ifndef GID_T
  2374. #define GID_T gid_t
  2375. #endif /* GID_T */
  2376. #else /* Not BSD43 */
  2377. /* Default these to int for older UNIX versions */
  2378. #ifndef UID_T
  2379. #define UID_T int
  2380. #endif /* UID_T */
  2381. #ifndef GID_T
  2382. #define GID_T int
  2383. #endif /* GID_T */
  2384. #endif /* BSD43 */
  2385. #endif /* SVR4  */
  2386. #endif /* POSIX */
  2387.  
  2388. /* 
  2389.   getpwuid() arg type, which is not necessarily the same as UID_T,
  2390.   e.g. in SCO UNIX SVR3, it's int.
  2391. */
  2392. #ifndef PWID_T
  2393. #define PWID_T UID_T
  2394. #endif /* PWID_T */
  2395.  
  2396. #ifdef NEXT
  2397. #define MACHWAIT
  2398. #else
  2399. #ifdef MACH
  2400. #define MACHWAIT
  2401. #endif /* MACH */
  2402. #endif /* NEXT */
  2403.  
  2404. #ifdef MACHWAIT                /* WAIT_T argument for wait() */
  2405. #include <sys/wait.h>
  2406. #define CK_WAIT_H
  2407. typedef union wait WAIT_T;
  2408. #else
  2409. #ifdef POSIX
  2410. #include <sys/wait.h>
  2411. #define CK_WAIT_H
  2412. #ifndef WAIT_T
  2413. typedef int WAIT_T;
  2414. #endif /* WAIT_T */
  2415. #else /* !POSIX */
  2416. typedef int WAIT_T;
  2417. #endif /* POSIX */
  2418. #endif /* MACHWAIT */
  2419.  
  2420. /* Forward declarations of system-dependent functions callable from all */
  2421. /* C-Kermit modules. */
  2422.  
  2423. /* File-related functions from system-dependent file i/o module */
  2424.  
  2425. #ifndef CKVFIO_C
  2426. /* For some reason, this does not agree with DEC C */
  2427. _PROTOTYP( int zkself, (void) );
  2428. #endif /* CKVFIO_C */
  2429. _PROTOTYP( int zopeni, (int, char *) );
  2430. _PROTOTYP( int zopeno, (int, char *, struct zattr *, struct filinfo *) );
  2431. _PROTOTYP( int zclose, (int) );
  2432. #ifndef MAC
  2433. _PROTOTYP( int zchin, (int, int *) );
  2434. #endif /* MAC */
  2435. _PROTOTYP( int zsinl, (int, char *, int) );
  2436. _PROTOTYP( int zinfill, (void) );
  2437. _PROTOTYP( int zsout, (int, char*) );
  2438. _PROTOTYP( int zsoutl, (int, char*) );
  2439. _PROTOTYP( int zsoutx, (int, char*, int) );
  2440. _PROTOTYP( int zchout, (int, char) );
  2441. _PROTOTYP( int zoutdump, (void) );
  2442. _PROTOTYP( int zsyscmd, (char *) );
  2443. _PROTOTYP( int zshcmd, (char *) );
  2444. _PROTOTYP( int chkfn, (int) );
  2445. _PROTOTYP( long zchki, (char *) );
  2446. _PROTOTYP( int iswild, (char *) );
  2447. _PROTOTYP( int isdir, (char *) );
  2448. _PROTOTYP( int zchko, (char *) );
  2449. _PROTOTYP( int zdelet, (char *) );
  2450. _PROTOTYP( VOID zrtol, (char *,char *) );
  2451. _PROTOTYP( VOID zltor, (char *,char *) );
  2452. _PROTOTYP( VOID zstrip, (char *,char **) );
  2453. _PROTOTYP( int zchdir, (char *) );
  2454. _PROTOTYP( char * zhome, (void) );
  2455. _PROTOTYP( char * zgtdir, (void) );
  2456. _PROTOTYP( int zxcmd, (int, char *) );
  2457. #ifndef MAC
  2458. _PROTOTYP( int zclosf, (int) );
  2459. #endif /* MAC */
  2460. _PROTOTYP( int zxpand, (char *) );
  2461. _PROTOTYP( int znext, (char *) );
  2462. _PROTOTYP( int zchkspa, (char *, long) );
  2463. _PROTOTYP( VOID znewn, (char *, char **) );
  2464. _PROTOTYP( int zrename, (char *, char *) );
  2465. _PROTOTYP( int zcopy, (char *, char *) );
  2466. _PROTOTYP( int zsattr, (struct zattr *) );
  2467. _PROTOTYP( int zfree, (char *) );
  2468. _PROTOTYP( char * zfcdat, (char *) );
  2469. _PROTOTYP( int zstime, (char *, struct zattr *, int) );
  2470. _PROTOTYP( int zmail, (char *, char *) ); 
  2471. _PROTOTYP( int zprint, (char *, char *) ); 
  2472. _PROTOTYP( char * tilde_expand, (char *) ); 
  2473. _PROTOTYP( int zmkdir, (char *) ) ;
  2474. _PROTOTYP( int zfseek, (long) ) ;
  2475. _PROTOTYP( struct zfnfp * zfnqfp, (char *, int, char * ) ) ;
  2476. #ifdef OS2
  2477. _PROTOTYP( int os2setlongname, ( char * fn, char * ln ) ) ;
  2478. _PROTOTYP( int os2getlongname, ( char * fn, char ** ln ) ) ;
  2479. _PROTOTYP( int os2rexx, ( char *, char *, int ) ) ;
  2480. _PROTOTYP( int os2rexxfile, ( char *, char *, char *, int) ) ;
  2481. _PROTOTYP( int os2geteas, (char *) ) ;
  2482. _PROTOTYP( int os2seteas, (char *) ) ;
  2483. _PROTOTYP( char * get_os2_vers, (void) ) ;
  2484. _PROTOTYP( int do_label_send, (char *) ) ;
  2485. _PROTOTYP( int do_label_recv, (void) ) ;
  2486. #ifdef OS2MOUSE
  2487. _PROTOTYP( unsigned long os2_mouseon, (void) );
  2488. _PROTOTYP( unsigned long os2_mousehide, (void) );
  2489. _PROTOTYP( unsigned long os2_mouseshow, (void) );
  2490. _PROTOTYP( unsigned long os2_mouseoff, (void) );
  2491. _PROTOTYP( void os2_mouseevt, (void *) );
  2492. #endif /* OS2MOUSE */
  2493. #endif /* OS2 */
  2494.  
  2495. /* Functions from system-dependent terminal i/o module */
  2496.  
  2497. _PROTOTYP( int ttopen, (char *, int *, int, int) );  /* tty functions */
  2498. #ifndef MAC
  2499. _PROTOTYP( int ttclos, (int) );
  2500. #endif /* MAC */
  2501. _PROTOTYP( int tthang, (void) );
  2502. _PROTOTYP( int ttres, (void) );
  2503. _PROTOTYP( int ttpkt, (long, int, int) );
  2504. #ifndef MAC
  2505. _PROTOTYP( int ttvt, (long, int) );
  2506. #endif /* MAC */
  2507. _PROTOTYP( int ttsspd, (int) );
  2508. _PROTOTYP( long ttgspd, (void) );
  2509. _PROTOTYP( int ttflui, (void) );
  2510. _PROTOTYP( int ttfluo, (void) );
  2511. _PROTOTYP( int ttgwsiz, (void) );
  2512. _PROTOTYP( int ttchk, (void) );
  2513. _PROTOTYP( int ttxin, (int, CHAR *) );
  2514. _PROTOTYP( int ttxout, (CHAR *, int) );
  2515. _PROTOTYP( int ttol, (CHAR *, int) );
  2516. _PROTOTYP( int ttoc, (char) );
  2517. _PROTOTYP( int ttinc, (int) );
  2518. _PROTOTYP( int ttscarr, (int) );
  2519. _PROTOTYP( int ttgmdm, (void) );
  2520. _PROTOTYP( int ttsndb, (void) );
  2521. _PROTOTYP( int ttsndlb, (void) );
  2522. #ifdef PARSENSE
  2523. #ifdef UNIX
  2524. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
  2525. #else
  2526. #ifdef VMS
  2527. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
  2528. #else
  2529. #ifdef STRATUS
  2530. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
  2531. #else
  2532. #ifdef OS2
  2533. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
  2534. #else
  2535. #ifdef OSK
  2536. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
  2537. #else
  2538. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR) );
  2539. #endif /* OSK */
  2540. #endif /* OS2 */
  2541. #endif /* STRATUS */
  2542. #endif /* VMS */
  2543. #endif /* UNIX */
  2544. #else /* ! PARSENSE */
  2545. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR) );
  2546. #endif /* PARSENSE */
  2547.  
  2548. /* XYZMODEM support */
  2549.  
  2550. /*
  2551.   CK_XYZ enables the various commands and data structures.
  2552.   XYZ_INTERNAL means these protocols are built-in; if not defined,
  2553.   then they are external.  XYZ_DLL is used to indicate a separate
  2554.   loadable library containing the XYZmodem protocol code.
  2555. */
  2556. #ifndef NOCKXYZ
  2557.  
  2558. #ifdef pdp11                /* No room for this in PDP-11 */
  2559. #define NOCKXYZ
  2560. #endif /* pdp11 */
  2561.  
  2562. #ifndef CK_XYZ
  2563. #ifdef UNIX
  2564. #define CK_XYZ
  2565. #else
  2566. #ifdef OS2
  2567. #define CK_XYZ
  2568. #define XYZ_INTERNAL            /* Internal and DLL */
  2569. #ifndef NOXYZDLL
  2570. #define XYZ_DLL
  2571. #endif /* NOXYZDLL */
  2572. #endif /* OS2 */
  2573. #endif /* UNIX */
  2574. #endif /* CK_XYZ */
  2575. #endif /* NOCKXYZ */
  2576.  
  2577. #ifdef XYZ_INTERNAL            /* This ensures that XYZ_INTERNAL */
  2578. #ifndef CK_XYZ                /* is defined only if CK_XYZ is too */
  2579. #undef XYZ_INTERNAL
  2580. #endif /* CK_XYZ */
  2581. #endif /* XYZ_INTERNAL */
  2582. #ifdef XYZ_DLL                /* This ensures XYZ_DLL is defined */
  2583. #ifndef XYZ_INTERNAL            /* only if XYZ_INTERNAL is too */
  2584. #undef XYZ_DLL
  2585. #endif /* XYZ_INTERNAL */
  2586. #endif /* XYZ_DLL */
  2587.  
  2588. /* Console functions */
  2589.  
  2590. _PROTOTYP( int congm, (void) );
  2591. #ifdef COMMENT
  2592. _PROTOTYP( VOID conint, (SIGTYP (*)(int, int), SIGTYP (*)(int, int)) );
  2593. #else
  2594. _PROTOTYP( VOID conint, (SIGTYP (*)(int), SIGTYP (*)(int)) );
  2595. #endif /* COMMENT */
  2596. _PROTOTYP( VOID connoi, (void) );
  2597. _PROTOTYP( int concb, (char) );
  2598. #ifdef CONGSPD
  2599. _PROTOTYP( long congspd, (void) );
  2600. #endif /* CONGSPD */
  2601. _PROTOTYP( int conbin, (char) );
  2602. _PROTOTYP( int conres, (void) );
  2603. _PROTOTYP( int conoc, (char) );
  2604. _PROTOTYP( int conxo, (int, char *) );
  2605. _PROTOTYP( int conol, (char *) );
  2606. _PROTOTYP( int conola, (char *[]) );
  2607. _PROTOTYP( int conoll, (char *) );
  2608. _PROTOTYP( int conchk, (void) );
  2609. _PROTOTYP( int coninc, (int) );
  2610. _PROTOTYP( char * conkbg, (void) );
  2611. _PROTOTYP( int psuspend, (int) );
  2612. _PROTOTYP( int priv_ini, (void) );
  2613. _PROTOTYP( int priv_on, (void) );
  2614. _PROTOTYP( int priv_off, (void) );
  2615. _PROTOTYP( int priv_can, (void) );
  2616. _PROTOTYP( int priv_chk, (void) );
  2617. _PROTOTYP( int priv_opn, (char *, int) );
  2618.  
  2619. _PROTOTYP( int sysinit, (void) );    /* Misc Kermit functions */
  2620. _PROTOTYP( int syscleanup, (void) );
  2621. _PROTOTYP( int msleep, (int) );
  2622. _PROTOTYP( VOID rtimer, (void) );
  2623. _PROTOTYP( int gtimer, (void) );
  2624. _PROTOTYP( VOID ttimoff, (void) );
  2625. _PROTOTYP( VOID ztime, (char **) );
  2626. _PROTOTYP( int parchk, (CHAR *, CHAR, int) );
  2627. _PROTOTYP( VOID doexit, (int, int) );
  2628. _PROTOTYP( int askmore, (void) );
  2629. _PROTOTYP( VOID fatal, (char *) );
  2630. _PROTOTYP( VOID fatal2, (char *, char *) );
  2631. _PROTOTYP( int ckindex, (char *, char *, int, int, int) );
  2632. #ifdef VMS
  2633. _PROTOTYP( int ck_cancio, (void) );
  2634. #endif /* VMS */
  2635.  
  2636. /* Key mapping support */
  2637.  
  2638. #ifdef NOICP
  2639. #ifndef NOSETKEY
  2640. #define NOSETKEY
  2641. #endif /* NOSETKEY */
  2642. #endif /* NOICP */
  2643.  
  2644. #ifdef MAC
  2645. #ifndef NOSETKEY
  2646. #define NOSETKEY
  2647. #endif /* NOSETKEY */
  2648. #endif /* MAC */
  2649.  
  2650. _PROTOTYP( int congks, (int) );
  2651. #ifndef NOSETKEY
  2652. #ifdef OS2
  2653. #define KMSIZE 8916
  2654. typedef ULONG KEY;
  2655. typedef CHAR *MACRO;
  2656. extern int wideresult;
  2657. #else /* Not OS2 */
  2658. /*
  2659.   Catch-all for systems where we don't know how to read keyboard scan
  2660.   codes > 255.  Note: CHAR (i.e. unsigned char) is very important here.
  2661. */
  2662. #define KMSIZE 256
  2663. typedef CHAR KEY;
  2664. typedef CHAR * MACRO;
  2665. #define congks coninc
  2666. #endif /* OS2 */
  2667. #endif /* NOSETKEY */
  2668.  
  2669. #ifndef NOKVERBS            /* No \Kverbs unless... */
  2670. #define NOKVERBS
  2671. #endif /* NOKVERBS */
  2672.  
  2673. #ifdef OS2                /* \Kverbs are supported in OS/2 */
  2674. #undef NOKVERBS
  2675. /*
  2676.   Note: this value chosen to be bigger than PC BIOS key modifier bits,
  2677.   but still fit in 16 bits without affecting sign.
  2678.  
  2679.   As of K95 1.1.5, this no longer fits in 16 bits, good thing we are 32 bit.
  2680. */
  2681. #define F_MACRO 0x2000          /* Bit indicating a macro indice */
  2682. #define IS_MACRO(x) (x & F_MACRO)
  2683. #define F_KVERB 0x4000            /* Bit indicating a keyboard verb */
  2684. #define IS_KVERB(x) (x & F_KVERB)    /* Test this bit */
  2685. #endif /* OS2 */
  2686.  
  2687. #define F_ESC   0x8000        /* Bit indicating ESC char combination */
  2688. #define IS_ESC(x) (x & F_ESC)
  2689. #define F_CSI   0x10000        /* Bit indicating CSI char combination */
  2690. #define IS_CSI(x) (x & F_CSI)
  2691.  
  2692. #ifdef NOSPL                /* This might be overkill.. */
  2693. #ifndef NOKVERBS            /* Not all \Kverbs require */
  2694. #define NOKVERBS            /* the script programming language. */
  2695. #endif /* NOKVERBS */
  2696. #endif /* NOSPL */
  2697.  
  2698. /*
  2699.   Function prototypes for system and library functions.
  2700. */
  2701. #ifdef _POSIX_SOURCE
  2702. #ifndef VMS
  2703. #ifndef MAC
  2704. #define CK_ANSILIBS
  2705. #endif /* MAC */
  2706. #endif /* VMS */
  2707. #endif /* _POSIX_SOURCE */
  2708.  
  2709. #ifdef NEXT
  2710. #define CK_ANSILIBS
  2711. #endif /* NEXT */
  2712.  
  2713. #ifdef SVR4
  2714. #define CK_ANSILIBS
  2715. #endif /* SVR4 */
  2716.  
  2717. #ifdef STRATUS                /* Stratus VOS uses ANSI libraries */
  2718. #define CK_ANSILIBS
  2719. #endif /* STRATUS */
  2720.  
  2721. #ifdef OS2
  2722. #define CK_ANSILIBS
  2723. #define MYCURSES
  2724. #define CK_RTSCTS
  2725. #ifdef __IBMC__
  2726. #define S_IFMT 0xF000
  2727. #define timezone _timezone
  2728. #endif /* __IBMC__ */
  2729. #include <fcntl.h>
  2730. #include <io.h>
  2731. #ifdef __EMX__
  2732. #ifndef __32BIT__
  2733. #define __32BIT__
  2734. #endif /* __32BIT__ */
  2735. #include <sys/timeb.h>
  2736. #else
  2737. #include <direct.h>
  2738. #ifdef OS2
  2739. #undef SIGALRM
  2740. #endif /* OS2 */
  2741. #ifndef SIGUSR1
  2742. #define SIGUSR1 7
  2743. #endif /* SIGUSR1 */
  2744. #define SIGALRM SIGUSR1
  2745. _PROTOTYP( unsigned alarm, (unsigned) );
  2746. _PROTOTYP( unsigned sleep, (unsigned) );
  2747. #endif /* __EMX__ */
  2748. #ifdef OS2
  2749. _PROTOTYP( unsigned long zdskspace, (int) );
  2750. #else
  2751. _PROTOTYP( long zdskspace, (int) );
  2752. #endif /* OS2 */
  2753. _PROTOTYP( int zchdsk, (int) );
  2754. _PROTOTYP( int conincraw, (int) );
  2755. _PROTOTYP( int ttiscom, (int f) );
  2756. _PROTOTYP( int IsFileNameValid, (char *) );
  2757. _PROTOTYP( void ChangeNameForFAT, (char *) );
  2758. _PROTOTYP( char *GetLoadPath, (void) );
  2759. #endif /* OS2 */
  2760.  
  2761. /* Fullscreen file transfer display items... */
  2762.  
  2763. #ifdef MYCURSES                /* MYCURSES implies CK_CURSES */
  2764. #ifndef CK_CURSES
  2765. #define CK_CURSES
  2766. #endif /* CK_CURSES */
  2767. #endif /* MYCURSES */
  2768.  
  2769. /*
  2770.   The CK_WREFRESH symbol is defined if the curses library provides
  2771.   clearok() and wrefresh() functions, which are used in repainting
  2772.   the screen.
  2773. */
  2774. #ifdef NOWREFRESH            /* Override CK_WREFRESH */
  2775.  
  2776. #ifdef CK_WREFRESH            /* If this is defined, */
  2777. #undef CK_WREFRESH            /* undefine it. */
  2778. #endif /* CK_WREFRESH */
  2779.  
  2780. #else /* !NOWREFRESH */            /* No override... */
  2781.  
  2782. #ifndef CK_WREFRESH            /* If CK_WREFRESH not defined */
  2783. /*
  2784.   Automatically define it for systems known to have it ...
  2785. */
  2786. #ifdef VMS                /* DEC (Open)VMS has it */
  2787. #define CK_WREFRESH
  2788. #else
  2789. #ifdef ultrix                /* DEC ULTRIX has it */
  2790. #else
  2791. #ifdef SVR3                /* System V has it */
  2792. #define CK_WREFRESH
  2793. #else
  2794. #ifdef BSD44                /* 4.4 BSD has it */
  2795. #define CK_WREFRESH
  2796. #else
  2797. #ifdef NEXT                /* Define it for NeXTSTEP */
  2798. #define CK_WREFRESH
  2799. #else
  2800. #ifdef SUNOS4                /* SunOS 4.x... */
  2801. #define CK_WREFRESH
  2802. #else
  2803. #ifdef AIXRS                /* RS/6000 AIX ... */
  2804. #define CK_WREFRESH
  2805. #else
  2806. #ifdef RTAIX                /* RT PC AIX ... */
  2807. #define CK_WREFRESH
  2808. #else
  2809. #ifdef OSF                /* DEC OSF/1 ... */
  2810. #define CK_WREFRESH
  2811.  
  2812. /* Add more here, or just define CK_WREFRESH on the CC command line... */
  2813.  
  2814. #endif /* OSF */
  2815. #endif /* RTAIX */
  2816. #endif /* AIXRS */
  2817. #endif /* SUNOS4 */
  2818. #endif /* NEXT */
  2819. #endif /* BSD44 */
  2820. #endif /* SVR3 */
  2821. #endif /* ultrix */
  2822. #endif /* VMS */
  2823.  
  2824. #else /* CK_WREFRESH is defined */
  2825.  
  2826. #ifndef CK_CURSES            /* CK_WREFRESH implies CK_CURSES */
  2827. #define CK_CURSES
  2828. #endif /* CK_CURSES */
  2829.  
  2830. #endif /* CK_WREFRESH */
  2831. #endif /* NOWREFRESH */
  2832.  
  2833. #ifdef CK_CURSES            /* Termcap buffer size for curses */
  2834. #ifndef TRMBUFL
  2835. #define TRMBUFL 1024
  2836. #endif /* TRMBUFL */
  2837. #endif /* CK_CURSES */
  2838.  
  2839. #ifdef CK_ANSILIBS
  2840. /*
  2841.   String library functions.
  2842.   For ANSI C, get prototypes from <string.h>.
  2843.   Otherwise, skip the prototypes.
  2844. */
  2845. #include <string.h>
  2846.  
  2847. /*
  2848.   Prototypes for other commonly used library functions, such as
  2849.   malloc, free, getenv, atol, atoi, and exit.  Otherwise, no prototypes.
  2850. */
  2851. #include <stdlib.h>
  2852. #ifdef DIAB /* DIAB DS90 */
  2853. /* #include <commonC.h>  */
  2854. #include <sys/wait.h>
  2855. #define CK_WAIT_H
  2856. #ifdef COMMENT
  2857. extern void exit(int status);
  2858. extern void _exit(int status);
  2859. extern int uname(struct utsname *name);
  2860. #endif /* COMMENT */
  2861. extern int chmod(char *path, int mode);
  2862. extern int ioctl(int fildes, int request, ...);
  2863. extern int rdchk(int ttyfd);
  2864. extern int nap(int m);
  2865. #ifdef COMMENT
  2866. extern int getppid(void);
  2867. #endif /* COMMENT */
  2868. extern int _filbuf(FILE *stream);
  2869. extern int _flsbuf(char c,FILE *stream);
  2870. #endif /* DIAB */
  2871.  
  2872. /*
  2873.   Prototypes for UNIX functions like access, alarm, chdir, sleep, fork,
  2874.   and pause.  Otherwise, no prototypes.
  2875. */
  2876. #ifdef VMS
  2877. #include <unixio.h>
  2878. #endif /* VMS */
  2879.  
  2880. #ifdef NEXT
  2881. #ifndef NEXT33
  2882. #include <libc.h>
  2883. #endif /* NEXT33 */
  2884. #else
  2885. #ifndef AMIGA
  2886. #ifndef OS2
  2887. #ifdef STRATUS
  2888. #include <c_utilities.h>
  2889. #else /* !STRATUS */
  2890. #include <unistd.h>
  2891. #endif /* STRATUS */
  2892. #endif /* OS2 */
  2893. #endif /* AMIGA */
  2894. #endif /* NEXT */
  2895.  
  2896. #else /* Not ANSI libs... */
  2897.  
  2898. #ifdef MAC
  2899. #include <String.h>
  2900. #include <StdLib.h>
  2901. #endif /* MAC */
  2902.  
  2903. #ifdef SUNOS41
  2904. #include <unistd.h>
  2905. #include <stdlib.h>
  2906. #else
  2907. #ifndef MAC
  2908. /*
  2909.   It is essential that these are declared correctly!
  2910.   Which is not always easy.  Take malloc() for instance ...
  2911. */
  2912. #ifdef PYRAMID
  2913. #ifdef SVR4
  2914. #ifdef __STDC__
  2915. #define SIZE_T_MALLOC
  2916. #endif /* __STDC__ */
  2917. #endif /* SVR4 */
  2918. #endif /* PYRAMID */
  2919. /*
  2920.   Maybe some other environments need the same treatment for malloc.
  2921.   If so, define SIZE_T_MALLOC for them here or in compiler CFLAGS.
  2922. */
  2923. #ifdef SIZE_T_MALLOC
  2924. _PROTOTYP( void * malloc, (size_t) );
  2925. #else
  2926. _PROTOTYP( char * malloc, (unsigned int) );
  2927. #endif /* SIZE_T_MALLOC */
  2928.  
  2929. _PROTOTYP( char * getenv, (char *) );
  2930. _PROTOTYP( long atol, (char *) );
  2931. #endif /* !MAC */
  2932. #endif /* SUNOS41 */
  2933. #endif /* CK_ANSILIBS */
  2934.  
  2935. #ifndef NULL                /* In case NULL is still not defined */
  2936. #define NULL 0L
  2937. /* or #define NULL 0 */
  2938. /* or #define NULL ((char *) 0) */
  2939. /* or #define NULL ((void *) 0) */
  2940. #endif /* NULL */
  2941.  
  2942. /* Maximum length for a fully qualified filename, not counting \0 at end. */
  2943. /*
  2944.   This is a rough cut, and errs on the side of being too big.  We don't 
  2945.   want to pull in hundreds of header files looking for many and varied
  2946.   symbols, for fear of introducing unnecessary conflicts.
  2947. */
  2948. #ifndef CKMAXPATH
  2949. #ifdef MAXPATHLEN            /* (it probably isn't) */
  2950. #define CKMAXPATH MAXPATHLEN
  2951. #else
  2952. #ifdef MAC
  2953. #define CKMAXPATH 63
  2954. #else
  2955. #ifdef pdp11
  2956. #define CKMAXPATH 255
  2957. #else
  2958. #ifdef UNIX                /* Even though some are way less... */
  2959. #define CKMAXPATH 1023
  2960. #else
  2961. #ifdef VMS
  2962. #define CKMAXPATH 675            /* (derivation is complicated...) */
  2963. #else
  2964. #ifdef STRATUS
  2965. #define CKMAXPATH 256            /* == $MXPL from PARU.H */
  2966. #else
  2967. #ifdef datageneral
  2968. #define CKMAXPATH 256            /* == $MXPL from PARU.H */
  2969. #else
  2970. #define CKMAXPATH 255
  2971. #endif /* STRATUS */
  2972. #endif /* datageneral */
  2973. #endif /* VMS */
  2974. #endif /* UNIX */
  2975. #endif /* pdp11 */
  2976. #endif /* MAC */
  2977. #endif /* MAXPATHLEN */
  2978. #endif /* CKMAXPATH */
  2979.  
  2980. /* Funny names for library functions department... */
  2981.  
  2982. #ifdef ZILOG
  2983. #define setjmp setret
  2984. #define longjmp longret
  2985. #define jmp_buf ret_buf
  2986. #define getcwd curdir
  2987. #endif /* ZILOG */
  2988.  
  2989. #ifdef STRATUS
  2990. /* The C-runtime conflicts with things we do in Stratus VOS ckltio.c ... */
  2991. #define printf vosprtf
  2992. _PROTOTYP( int vosprtf, (char *fmt, ...) );
  2993. #define perror(txt) printf("%s\n", txt)
  2994. /* char_varying is a string type from PL/I that VOS uses extensively */
  2995. #define CV char_varying
  2996. #endif /* STRATUS */
  2997.  
  2998. #ifdef NT
  2999. extern int OSVer;
  3000. #define isWin95() (OSVer==VER_PLATFORM_WIN32_WINDOWS)
  3001. #else
  3002. #define isWin95() (0)
  3003. #endif /* NT */
  3004.  
  3005. #endif /* CKCDEB_H */
  3006.  
  3007. /* End of ckcdeb.h */
  3008.