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

  1. /*  C K C D E B . H  */
  2.  
  3. /*
  4.   This file is included by all C-Kermit modules, including the modules
  5.   that aren't specific to Kermit (like the command parser and the ck?tio and
  6.   ck?fio modules.  It specifies format codes for debug(), tlog(), and similar
  7.   functions, and includes any necessary definitions to be used by all C-Kermit
  8.   modules, and also includes some feature selection compile-time switches, and
  9.   also system- or compiler-dependent definitions, plus #includes and prototypes
  10.   required by all C-Kermit modules.
  11. */
  12.  
  13. /*
  14.   Author: Frank da Cruz (fdc@columbia.edu, FDCCU@CUVMA.BITNET),
  15.   Columbia University Center for Computing Activities.
  16.   First released January 1985.
  17.   Copyright (C) 1985, 1992, Trustees of Columbia University in the City of New
  18.   York.  Permission is granted to any individual or institution to use this
  19.   software as long as it is not sold for profit.  This copyright notice must be
  20.   retained.  This software may not be included in commercial products without
  21.   written permission of Columbia University.
  22. */
  23.  
  24. /*
  25.   Etymology: The name of this file means "C-Kermit Common-C-Language Debugging
  26.   Header", because originally it contained only the formats (F000-F111) for
  27.   the debug() and tlog() functions.  See how it has grown...
  28. */
  29.  
  30. #ifndef CKCDEB_H            /* Don't include me more than once. */
  31. #define CKCDEB_H
  32.  
  33. #ifdef OS2                /* For OS/2 debugging */
  34. #include "ckoker.h"
  35. #endif /* OS2 */
  36.  
  37. #include <stdio.h>            /* Begin by including this. */
  38. #include <ctype.h>            /* and this. */
  39.  
  40. #ifdef MAC
  41. /*
  42.  * The MAC doesn't use standard stdio routines.
  43.  */
  44. #undef getchar
  45. #undef putchar
  46. #endif /* MAC */
  47.  
  48. /* System-type compilation switches */
  49.  
  50. #ifdef FT21                /* Fortune For:Pro 2.1 implies 1.8 */
  51. #ifndef FT18
  52. #define FT18
  53. #endif /* FT18 */
  54. #endif /* FT21 */
  55.  
  56. #ifdef AIXPS2                /* AIXPS2 implies AIX370 */
  57. #ifndef AIX370
  58. #define AIX370
  59. #endif /* AIX370 */
  60. #endif /* AIXPS2 */
  61.  
  62. #ifdef AIX370                /* AIX PS/2 or 370 implies BSD4 */
  63. #ifndef BSD4
  64. #define BSD4
  65. #endif /* BSD4 */
  66. #endif /* AIX370 */
  67.  
  68. #ifdef AIXESA                /* AIX/ESA implies BSD4.4 */
  69. #ifndef BSD44
  70. #define BSD44
  71. #endif /* BSD44 */
  72. #endif /* AIXESA */
  73.  
  74. #ifdef DGUX540                /* DG UX 5.40 implies Sys V R 4 */
  75. #ifndef SVR4
  76. #define SVR4
  77. #endif /* SVR4 */
  78. #endif /* DGUX540 */
  79.  
  80. #ifdef SUNOS41                /* SUNOS41 implies SUNOS4 */
  81. #ifndef SUNOS4
  82. #define SUNOS4
  83. #endif /* SUNOS4 */
  84. #endif /* SUNOS41 */
  85.  
  86. #ifdef SUN4S5                /* Sun-4 System V environment */
  87. #ifndef SVR3                /* implies System V R3 or later */
  88. #define SVR3
  89. #endif /* SVR3 */
  90. #endif /* SUN4S5 */
  91.  
  92. #ifdef MIPS                /* MIPS System V environment */
  93. #ifndef SVR3                /* implies System V R3 or later */
  94. #define SVR3
  95. #endif /* SVR3 */
  96. #endif /* MIPS */
  97.  
  98. /*
  99.   4.4BSD is a mixture of System V R4, POSIX, and 4.3BSD.
  100. */
  101. #ifdef BSD44                /* 4.4 BSD */
  102. #ifndef SVR4                /* BSD44 implies SVR4 */
  103. #define SVR4
  104. #endif /* SVR4 */
  105. #ifndef NOSETBUF            /* NOSETBUF is safe */
  106. #define NOSETBUF
  107. #endif /* NOSETBUF */
  108. #ifndef DIRENT                /* Uses <dirent.h> */
  109. #define DIRENT
  110. #endif /* DIRENT */
  111. #endif /* BSD44 */
  112.  
  113. #ifdef SVR3                /* SVR3 implies ATTSV */
  114. #ifndef ATTSV
  115. #define ATTSV
  116. #endif /* ATTSV */
  117. #endif /* SVR3 */
  118.  
  119. #ifdef SVR4                /* SVR4 implies ATTSV */
  120. #ifndef ATTSV
  121. #define ATTSV
  122. #endif /* ATTSV */
  123. #ifndef SVR3                /* ...as well as SVR3 */
  124. #define SVR3
  125. #endif /* SVR3 */
  126. #endif /* SVR4 */
  127.  
  128. #ifdef OXOS
  129. #ifndef ATTSV
  130. #define ATTSV                /* OXOS implies ATTSV */
  131. #endif /* ! ATTSV */
  132. #define SW_ACC_ID            /* access() wants privs on */
  133. #define kill priv_kill            /* kill() wants privs on */
  134. #ifndef NOSETBUF
  135. #define NOSETBUF            /* NOSETBUF is safe */
  136. #endif /* ! NOSETBUF */
  137. #endif /* OXOS */
  138.  
  139. #ifdef UTSV                /* UTSV implies ATTSV */
  140. #ifndef ATTSV
  141. #define ATTSV
  142. #endif /* ATTSV */
  143. #endif /* UTSV */
  144.  
  145. #ifdef XENIX                /* XENIX implies ATTSV */
  146. #ifndef ATTSV
  147. #define ATTSV
  148. #endif /* ATTSV */
  149. #endif /* XENIX */
  150.  
  151. #ifdef AUX                /* AUX implies ATTSV */
  152. #ifndef ATTSV
  153. #define ATTSV
  154. #endif /* ATTSV */
  155. #endif /* AUX */
  156.  
  157. #ifdef ATT7300                /* ATT7300 implies ATTSV */
  158. #ifndef ATTSV
  159. #define ATTSV
  160. #endif /* ATTSV */
  161. #endif /* ATT7300 */
  162.  
  163. #ifdef ATT6300                /* ATT6300 implies ATTSV */
  164. #ifndef ATTSV
  165. #define ATTSV
  166. #endif /* ATTSV */
  167. #endif /* ATT6300 */
  168.  
  169. #ifdef HPUX                /* HPUX implies ATTSV */
  170. #ifndef ATTSV
  171. #define ATTSV
  172. #endif /* ATTSV */
  173. #endif /* HPUX */
  174.  
  175. #ifdef ISIII                /* ISIII implies ATTSV */
  176. #ifndef ATTSV
  177. #define ATTSV
  178. #endif /* ATTSV */
  179. #endif /* ISIII */
  180.  
  181. #ifdef NEXT                /* NEXT implies BSD4 */
  182. #ifndef BSD4
  183. #define BSD4
  184. #endif /* BSD4 */
  185. #endif /* NEXT */
  186.  
  187. #ifdef SUNOS4                /* SUNOS4 implies BSD4 */
  188. #ifndef BSD4
  189. #define BSD4
  190. #endif /* BSD4 */
  191. #endif /* SUNOS4 */
  192.  
  193. #ifdef BSD41                /* BSD41 implies BSD4 */
  194. #ifndef BSD4
  195. #define BSD4
  196. #endif /* BSD4 */
  197. #endif /* BSD41 */
  198.  
  199. #ifdef BSD43                /* BSD43 implies BSD4 */
  200. #ifndef BSD4
  201. #define BSD4
  202. #endif /* BSD4 */
  203. #endif /* BSD43 */
  204.  
  205. #ifdef BSD4                /* BSD4 implies ANYBSD */
  206. #ifndef ANYBSD
  207. #define ANYBSD
  208. #endif /* ANYBSD */
  209. #endif /* BSD4 */
  210.  
  211. #ifdef BSD29                /* BSD29 implies ANYBSD */
  212. #ifndef ANYBSD
  213. #define ANYBSD
  214. #endif /* ANYBSD */
  215. #endif /* BSD29 */
  216.  
  217. #ifdef ATTSV                /* ATTSV implies UNIX */
  218. #ifndef UNIX
  219. #define UNIX
  220. #endif /* UNIX */
  221. #endif /* ATTSV */
  222.  
  223. #ifdef ANYBSD                /* ANYBSD implies UNIX */
  224. #ifndef UNIX
  225. #define UNIX
  226. #endif /* UNIX */
  227. #endif /* ANYBSD */
  228.  
  229. #ifdef POSIX                /* POSIX implies UNIX */
  230. #ifndef UNIX
  231. #define UNIX
  232. #endif /* UNIX */
  233. #ifndef DIRENT                /* and DIRENT, i.e. <dirent.h> */
  234. #ifndef SDIRENT
  235. #define DIRENT
  236. #endif /* SDIRENT */
  237. #endif /* DIRENT */
  238. #ifndef NOFILEH                /* POSIX doesn't use <sys/file.h> */
  239. #define NOFILEH
  240. #endif /* NOFILEH */
  241. #endif /* POSIX */
  242.  
  243. #ifdef V7
  244. #ifndef UNIX
  245. #define UNIX
  246. #endif /* UNIX */
  247. #endif /* V7 */
  248.  
  249. #ifdef COHERENT
  250. #ifndef UNIX
  251. #define UNIX
  252. #endif /* UNIX */
  253. #endif /* COHERENT */
  254.  
  255. #ifdef MINIX
  256. #ifndef UNIX
  257. #define UNIX
  258. #endif /* UNIX */
  259. #endif /* MINIX */
  260. /*
  261.   The symbol SVORPOSIX is defined for both AT&T and POSIX compilations
  262.   to make it easier to select items that System V and POSIX have in common,
  263.   but which BSD, V7, etc, do not have.
  264. */
  265. #ifdef ATTSV
  266. #ifndef SVORPOSIX
  267. #define SVORPOSIX
  268. #endif /* SVORPOSIX */
  269. #endif /* ATTSV */
  270.  
  271. #ifdef POSIX
  272. #ifndef SVORPOSIX
  273. #define SVORPOSIX
  274. #endif /* SVORPOSIX */
  275. #endif /* POSIX */
  276.  
  277. /*
  278.   The symbol SVR4ORPOSIX is defined for both AT&T System V R4 and POSIX 
  279.   compilations to make it easier to select items that System V R4 and POSIX 
  280.   have in common, but which BSD, V7, and System V R3 and earlier, etc, do
  281.   not have.
  282. */
  283. #ifdef POSIX
  284. #ifndef SVR4ORPOSIX
  285. #define SVR4ORPOSIX
  286. #endif /* SVR4ORPOSIX */
  287. #endif /* POSIX */
  288. #ifdef SVR4
  289. #ifndef SVR4ORPOSIX
  290. #define SVR4ORPOSIX
  291. #endif /* SVR4ORPOSIX */
  292. #endif /* SVR4 */
  293.  
  294. /*
  295.   The symbol BSD44ORPOSIX is defined for both 4.4BSD and POSIX compilations
  296.   to make it easier to select items that 4.4BSD and POSIX have in common,
  297.   but which System V, BSD, V7, etc, do not have.
  298. */
  299. #ifdef BSD44
  300. #ifndef BSD44ORPOSIX
  301. #define BSD44ORPOSIX
  302. #endif /* BSD44ORPOSIX */
  303. #endif /* BSD44 */
  304.  
  305. #ifdef POSIX
  306. #ifndef BSD44ORPOSIX
  307. #define BSD44ORPOSIX
  308. #endif /* BSD44ORPOSIX */
  309. #endif /* POSIX */
  310.  
  311. #ifdef apollo                /* May be ANSI-C, check further */
  312. #ifdef __STDCPP__
  313. #define CK_ANSIC            /* Yes, this is real ANSI-C */
  314. #define SIG_V
  315. #else
  316. #define NOANSI                /* Nope, not ANSI */
  317. #undef __STDC__                /* Even though it say it is! */
  318. #define SIG_I
  319. #endif /* __STDCPP__ */
  320. #endif /* apollo */
  321.  
  322. #ifdef POSIX                /* -DPOSIX on cc command line */
  323. #ifndef _POSIX_SOURCE            /* Implies _POSIX_SOURCE */
  324. #define _POSIX_SOURCE
  325. #endif /* _POSIX_SOURCE */
  326. #endif /* POSIX */
  327.  
  328. /*
  329.   ANSI C?  That is, do we have function prototypes, new-style
  330.   function declarations, and parameter type checking and coercion?
  331. */
  332. #ifdef MAC                /* MPW C is ANSI */
  333. #ifndef NOANSI
  334. #ifndef CK_ANSIC
  335. #define CK_ANSIC
  336. #endif /* CK_ANSIC */
  337. #endif /* NOANSI */
  338. #endif /* MAC */
  339.  
  340. #ifndef NOANSI
  341. #ifdef __STDC__                /* __STDC__ means ANSI C */
  342. #ifndef CK_ANSIC
  343. #define CK_ANSIC
  344. #endif /* CK_ANSIC */
  345. #endif /* __STDC__ */
  346. #endif /* NOANSI */
  347. /*
  348.   _PROTOTYP() is used for forward declarations of functions so we can have
  349.   parameter and return value type checking if the compiler offers it.
  350.   __STDC__ should be defined by the compiler only if function prototypes are
  351.   allowed.  Otherwise, we get old-style forward declarations.  Our own private
  352.   CK_ANSIC symbol tells whether we use ANSI C prototypes.  To force use of
  353.   ANSI prototypes, include -DCK_ANSIC on the cc command line.  To disable the
  354.   use of ANSI prototypes, include -DNOANSI.
  355. */
  356. #ifdef CK_ANSIC
  357. #define _PROTOTYP( func, parms ) func parms
  358. #else /* Not ANSI C */
  359. #define _PROTOTYP( func, parms ) func()
  360. #endif /* CK_ANSIC */
  361.  
  362. /*
  363.   Altos-specific items: 486, 586, 986 models...
  364. */
  365. #ifdef A986
  366. #define M_VOID
  367. #define void int
  368. #define CHAR char
  369. #define SIG_I
  370. #endif /* A986 */
  371.  
  372. /* Void type */
  373.  
  374. #ifndef VOID                /* Used throughout all C-Kermit */
  375. #ifdef CK_ANSIC                /* modules... */
  376. #define VOID void
  377. #else
  378. #define VOID int
  379. #endif /* CK_ANSIC */
  380. #endif /* VOID */
  381.  
  382. /* Signal type */
  383.  
  384. #ifndef SIG_V                /* signal() type, if not def'd yet */
  385. #ifndef SIG_I
  386. #ifdef OS2
  387. #define SIG_V
  388. #else
  389. #ifdef POSIX
  390. #define SIG_V
  391. #else
  392. #ifdef SVR3                /* System V R3 and later */
  393. #define SIG_V
  394. #else
  395. #ifdef SUNOS4                /* SUNOS V 4.0 and later */
  396. #ifndef sun386
  397. #define SIG_V 
  398. #else
  399. #define SIG_I
  400. #endif /* sun386 */
  401. #else
  402. #ifdef NEXT                /* NeXT */
  403. #define SIG_V
  404. #else
  405. #ifdef AIX370
  406. #include <signal.h>
  407. #define SIG_V
  408. #define SIGTYP __SIGVOID        /* AIX370 */
  409. #else
  410. #define SIG_I
  411. #endif /* AIX370 */
  412. #endif /* NEXT */
  413. #endif /* SUNOS4 */
  414. #endif /* SVR3 */
  415. #endif /* POSIX */
  416. #endif /* OS2 */
  417. #endif /* SIG_I */
  418. #endif /* SIG_V */
  419.  
  420. #ifdef SIG_I
  421. #define SIGRETURN return(0)
  422. #ifndef SIGTYP
  423. #define SIGTYP int
  424. #endif /* SIGTYP */
  425. #endif /* SIG_I */
  426.  
  427. #ifdef SIG_V
  428. #define SIGRETURN return
  429. #ifndef SIGTYP
  430. #define SIGTYP void
  431. #endif /* SIGTYP */
  432. #endif /* SIG_V */
  433.  
  434. #ifndef SIGTYP
  435. #define SIGTYP int
  436. #endif /* SIGTYP */
  437.  
  438. #ifndef SIGRETURN
  439. #define SIGRETURN return(0)
  440. #endif /* SIGRETURN */
  441.  
  442. /* We want all characters to be unsigned if the compiler supports it */
  443.  
  444. #ifdef PROVX1
  445. typedef char CHAR;
  446. /* typedef long LONG; */
  447. typedef int void;
  448. #else
  449. #ifdef MINIX
  450. typedef unsigned char CHAR;
  451. #else
  452. #ifdef V7
  453. typedef char CHAR;
  454. #else
  455. #ifdef C70
  456. typedef char CHAR;
  457. /* typedef long LONG; */
  458. #else
  459. #ifdef BSD29
  460. typedef char CHAR;
  461. /* typedef long LONG; */
  462. #else
  463. #ifdef datageneral
  464. #define CHAR unsigned char            /* 3.22 compiler */    
  465. #else
  466. #ifdef CHAR
  467. #undef CHAR
  468. #endif /* CHAR */
  469. typedef unsigned char CHAR;
  470. #endif /* datageneral */
  471. #endif /* BSD29 */
  472. #endif /* C70 */
  473. #endif /* V7 */
  474. #endif /* MINIX */
  475. #endif /* PROVX1 */
  476.  
  477. /*
  478.  Debug and transaction logging is included automatically unless you define
  479.  NODEBUG or NOTLOG.  Do this if you want to save the space and overhead.
  480.  (Note, in version 4F these definitions changed from "{}" to the null string
  481.  to avoid problems with semicolons after braces, as in: "if (x) tlog(this);
  482.  else tlog(that);"
  483. */
  484. #ifndef NODEBUG
  485. #ifndef DEBUG
  486. #define DEBUG
  487. #endif /* DEBUG */
  488. #else
  489. #ifdef DEBUG
  490. #undef DEBUG
  491. #endif /* DEBUG */
  492. #endif /* NODEBUG */
  493.  
  494. #ifndef NOTLOG
  495. #ifndef TLOG
  496. #define TLOG
  497. #endif /* TLOG */
  498. #endif /* NOTLOG */
  499.  
  500. /* debug() macro style selection. */
  501.  
  502. #ifdef MAC
  503. #ifndef IFDEBUG
  504. #define IFDEBUG
  505. #endif /* IFDEBUG */
  506. #endif /* MAC */
  507.  
  508. #ifdef OS2
  509. #ifndef IFDEBUG
  510. #define IFDEBUG
  511. #endif /* IFDEBUG */
  512. #endif /* OS2 */
  513.  
  514. #ifdef OXOS                /* tst is faster than jsr */
  515. #ifndef IFDEBUG
  516. #define IFDEBUG
  517. #endif /* IFDEBUG */
  518. #endif /* OXOS */
  519.  
  520. #ifndef DEBUG
  521. /* Compile all the debug() statements away.  Saves a lot of space and time. */
  522. #define debug(a,b,c,d)
  523. #else
  524. #ifndef CKCMAI
  525. /* Debugging included.  Declare debug log flag in main program only. */
  526. extern int deblog;
  527. #endif /* CKCMAI */
  528. /* Now define the debug() macro. */
  529. #ifdef IFDEBUG
  530. /* Use this form to avoid function calls: */
  531. #define debug(a,b,c,d) if (deblog) dodebug(a,b,(char *)c,(long)d)
  532. #else
  533. /* Use this form to save space: */
  534. #define debug(a,b,c,d) dodebug(a,b,(char *)c,(long)d)
  535. #endif /* MAC */
  536. _PROTOTYP(int dodebug,(int, char *, char *, long));
  537. #endif /* DEBUG */
  538.  
  539. #ifndef TLOG
  540. #define tlog(a,b,c,d)
  541. #else
  542. _PROTOTYP(VOID tlog,(int, char *, char *, long));
  543. #endif /* TLOG */
  544.  
  545. /* Formats for debug() and tlog() */
  546.  
  547. #define F000 0
  548. #define F001 1
  549. #define F010 2
  550. #define F011 3
  551. #define F100 4
  552. #define F101 5
  553. #define F110 6
  554. #define F111 7
  555.  
  556. /* Kermit feature selection */
  557.  
  558. #ifdef MAC                /* For Macintosh, no escape */
  559. #define NOPUSH                /* to operating system */
  560. #endif /* MAC */
  561.  
  562. #ifdef UNIX
  563. #ifndef NOPARSEN
  564. #define PARSENSE            /* Automatic parity detection */
  565. #endif /* NOPARSEN */
  566. #endif /* UNIX */            /* for Unix */
  567.  
  568. #ifdef VMS                /* ... and VMS */
  569. #ifndef NOPARSEN
  570. #define PARSENSE
  571. #endif /* NOPARSEN */
  572. #endif /* VMS */
  573.  
  574. #ifdef MAC                /* and Macintosh */
  575. #ifndef NOPARSEN
  576. #define PARSENSE
  577. #endif /* NOPARSEN */
  578. #endif /* MAC */
  579.  
  580. #ifdef VMS                /* Use dynamic memory allocation */
  581. #ifndef DYNAMIC
  582. #define DYNAMIC                /* in VMS version. */
  583. #endif /* DYNAMIC */
  584. #endif /* VMS */
  585.  
  586. #ifndef CK_LBRK                /* Can send Long BREAK */
  587.  
  588. #ifdef UNIX                /* (everybody but OS-9) */
  589. #define CK_LBRK
  590. #endif /* UNIX */
  591. #ifdef VMS
  592. #define CK_LBRK
  593. #endif /* VMS */
  594. #ifdef datageneral
  595. #define CK_LBRK
  596. #endif /* datageneral */
  597. #ifdef GEMDOS
  598. #define CK_LBRK
  599. #endif /* GEMDOS */
  600. #ifdef OS2
  601. #define CK_LBRK
  602. #endif /* OS2 */
  603. #ifdef AMIGA
  604. #define CK_LBRK
  605. #endif /* AMIGA */
  606.  
  607. #endif /* CK_LBRK */
  608.  
  609. /* Carrier treatment */
  610. /* These are defined here because they are shared by the system dependent */
  611. /* and the system independent modules. */
  612.  
  613. #define  CAR_OFF 0    /* On: heed carrier always, except during DIAL. */
  614. #define  CAR_ON  1      /* Off: ignore carrier always. */
  615. #define  CAR_AUT 2      /* Auto: heed carrier, but only if line is declared */
  616.             /* to be a modem line, and only during CONNECT. */
  617.  
  618. /* Hangup by modem command supported by default */
  619.  
  620. #ifndef NODIAL
  621. #ifndef NOMDMHUP
  622. #ifndef MDMHUP
  623. #define MDMHUP 
  624. #endif /* MDMHUP */
  625. #endif /* NOMDMHUP */
  626. #endif /* NODIAL */
  627.  
  628. /* Types of flow control available */
  629.  
  630. #define CK_XONXOFF            /* Everybody can do this, right? */
  631.  
  632. #ifdef AMIGA                /* Commodore Amiga */
  633. #define CK_RTSCTS            /* has RTS/CTS */
  634. #endif /* AMIGA */
  635.  
  636. #ifdef SUN4S5                /* SunOS in System V environment */
  637. #define CK_RTSCTS
  638. #else                    /* SunOS 4.0/4.1 in BSD environment */
  639. #ifdef SUNOS4                /* SunOS 4.0+later supports RTS/CTS */
  640. #ifdef SUNOS41                /* Easy in 4.1 and later */
  641. #define CK_RTSCTS
  642. #else                    /* Harder in 4.0 */
  643. #ifndef __GNUC__            /* (see tthflow() in ckutio.c) */
  644. #ifndef GNUC
  645. #define CK_RTSCTS            /* Only if not using GNU gcc */
  646. #endif /* __GNUC__ */
  647. #endif /* GNUC */
  648. #endif /* SUNOS41 */
  649. #endif /* SUNOS4 */
  650. #endif /* SUN4S5 */
  651.  
  652. #ifdef BSD44                /* And in 4.4 BSD */
  653. #define CK_RTSCTS
  654. #endif /* BSD44 */
  655.  
  656. #ifdef TERMIOX                /* Sys V R4 <termiox.h> */
  657. #define CK_RTSCTS            /* has RTS/CTS */
  658. #define CK_DTRCD            /* and DTR/CD */
  659. #endif /* TERMIOX */
  660. #ifdef STERMIOX                /* Sys V R4 <sys/termiox.h> */
  661. #define CK_RTSCTS            /* Ditto. */
  662. #define CK_DTRCD
  663. #endif /* STERMIOX */
  664.  
  665. #ifdef OXOS                /* X/OS R2 struct termios */
  666. #define CK_RTSCTS            /* Ditto. */
  667. #define CK_DTRCD
  668. #endif /* OXOS */
  669.  
  670. /*
  671.  Systems where we can expand tilde at the beginning of file or directory names
  672. */
  673. #ifdef POSIX
  674. #ifndef DTILDE
  675. #define DTILDE
  676. #endif /* DTILDE */
  677. #endif /* POSIX */
  678. #ifdef BSD4
  679. #ifndef DTILDE
  680. #define DTILDE
  681. #endif /* DTILDE */
  682. #endif /* BSD4 */
  683. #ifdef ATTSV
  684. #ifndef DTILDE
  685. #define DTILDE
  686. #endif /* DTILDE */
  687. #endif /* ATTSV */
  688. #ifdef OSK
  689. #ifndef DTILDE
  690. #define DTILDE
  691. #endif /* DTILDE */
  692. #endif /* OSK */
  693. #ifdef HPUX                /* I don't know why this is */
  694. #ifndef DTILDE                /* necessary, since -DHPUX */
  695. #define DTILDE                /* automatically defines ATTSV */
  696. #endif /* DTILDE */            /* (see above) ... */
  697. #endif /* HPUX */
  698.  
  699. /* Line delimiter for text files */
  700.  
  701. /*
  702.  If the system uses a single character for text file line delimitation,
  703.  define NLCHAR to the value of that character.  For text files, that
  704.  character will be converted to CRLF upon output, and CRLF will be converted
  705.  to that character on input during text-mode (default) packet operations.
  706. */
  707. #ifdef MAC                              /* Macintosh */
  708. #define NLCHAR 015
  709. #else
  710. #ifdef OSK                /* OS-9/68K */
  711. #define NLCHAR 015
  712. #else                                   /* All Unix-like systems */
  713. #define NLCHAR 012
  714. #endif /* OSK */
  715. #endif /* MAC */
  716.  
  717. /*
  718.  At this point, if there's a system that uses ordinary CRLF line
  719.  delimitation AND the C compiler actually returns both the CR and
  720.  the LF when doing input from a file, then #undef NLCHAR.
  721. */
  722. #ifdef OS2                /* OS/2 */
  723. #undef NLCHAR
  724. #endif /* OS2 */
  725.  
  726. #ifdef GEMDOS                /* Atari ST */
  727. #undef NLCHAR
  728. #endif /* GEMDOS */
  729.  
  730. /*
  731.   VMS file formats are so complicated we need to do all the conversion 
  732.   work in the CKVFIO module, so we tell the rest of C-Kermit not to fiddle
  733.   with the bytes.
  734. */
  735.  
  736. #ifdef vms
  737. #undef NLCHAR
  738. #endif /* vms */
  739.  
  740. /* The device name of a job's controlling terminal */
  741. /* Special for VMS, same for all Unixes (?), not used by Macintosh */
  742.  
  743. #ifdef vms
  744. #define CTTNAM "TT:"
  745. #else
  746. #ifdef datageneral
  747. #define CTTNAM "@output"
  748. #else
  749. #ifdef OSK
  750. extern char myttystr[];
  751. #define CTTNAM myttystr
  752. #else
  753. #ifdef OS2
  754. #define CTTNAM "con"
  755. #else
  756. #ifdef UNIX
  757. #define CTTNAM "/dev/tty"
  758. #else
  759. #ifdef GEMDOS
  760. #define CTTNAM "aux:"
  761. #else /* Anyone else... */
  762. #define CTTNAM "stdout"            /* This is a kludge used by Mac */
  763. #endif /* GEMDOS */
  764. #endif /* UNIX */
  765. #endif /* OS2 */
  766. #endif /* OSK */
  767. #endif /* datageneral */
  768. #endif /* vms */
  769.  
  770. #ifdef SUNS4S5
  771. #define tolower _tolower
  772. #define toupper _toupper
  773. #endif /* SUNS4S5 */
  774.  
  775. /* Error number */
  776.  
  777. #ifdef _CRAY                /* Cray UNICOS defines */
  778. #include <errno.h>            /* errno as a function. */
  779. #else                    /* OK for UNICOS 6.1 and 7.0. */
  780. #ifndef VMS
  781. #ifndef OS2
  782. /*
  783.   The following declaration causes problems for VMS and OS/2, in which
  784.   errno is an "extern volatile int noshare"...
  785. */
  786. extern int errno;            /* Needed by most modules. */
  787. #endif /* OS2 */
  788. #endif /* VMS */
  789. #endif /* _CRAY */
  790.  
  791. /* File System Defaults */
  792.  
  793. #ifdef VMS
  794. #define DBLKSIZ 512
  795. #define DLRECL 512
  796. #else
  797. #define DBLKSIZ 0
  798. #define DLRECL 0
  799. #endif
  800.  
  801. /* Program return codes for DECUS C and UNIX (VMS uses UNIX codes) */
  802.  
  803. #ifdef decus
  804. #define GOOD_EXIT   IO_NORMAL
  805. #define BAD_EXIT    IO_ERROR
  806. #else
  807. #define GOOD_EXIT   0
  808. #define BAD_EXIT    1
  809. #endif /* decus */
  810.  
  811. /* Special hack for Fortune, which doesn't have <sys/file.h>... */
  812.  
  813. #ifdef FT18
  814. #define FREAD 0x01
  815. #define FWRITE 0x10
  816. #endif /* FT18 */
  817.  
  818. /* Special hack for OS-9/68k */
  819. #ifdef OSK
  820. #define SIGALRM 30            /* May always cancel I/O */
  821. #define SIGARB    1234            /* Arbitrary for I/O */
  822. SIGTYP (*signal())();
  823. #endif /* OSK */
  824.  
  825. #ifdef OS2
  826. #ifdef putchar                  /* MSC 5.1 simply uses a macro which causes */
  827. #undef putchar                  /* no problems. */
  828. #endif /* putchar */
  829. #endif /* OS2 */
  830.  
  831. #ifdef MINIX
  832. #ifdef putchar
  833. #undef putchar
  834. #endif /* putchar */
  835. #define putchar(c) {putc(c,stdout);fflush(stdout);}
  836. #endif /* MINIX */
  837.  
  838. #ifdef datageneral            /* Data General AOS/VS */
  839. #ifdef putchar
  840. #undef putchar
  841. #endif /* putchar */
  842. #define putchar(c) conoc(c)
  843. #endif /* datageneral */
  844.  
  845. /* Escape/quote character used by the command parser */
  846.  
  847. #define CMDQ '\\'
  848.  
  849. /* Symbols for RS-232 modem signals */
  850.  
  851. #define KM_FG    1            /* Frame ground */
  852. #define KM_TXD   2            /* Transmit */
  853. #define KM_RXD   3            /* Receive */
  854. #define KM_RTS   4            /* Request to Send */
  855. #define KM_CTS   5            /* Clear to Send */
  856. #define KM_DSR   6            /* Data Set Ready */
  857. #define KM_SG    7            /* Signal ground */
  858. #define KM_DCD   8            /* Carrier Detect */
  859. #define KM_DTR  20            /* Data Terminal Ready */
  860. #define KM_RI   22            /* Ring Indication */
  861.  
  862. /* Bit mask values for modem signals */
  863.  
  864. #define BM_CTS   0001            /* Clear to send       (From DCE) */
  865. #define BM_DSR   0002            /* Dataset ready       (From DCE) */
  866. #define BM_DCD   0004            /* Carrier             (From DCE) */
  867. #define BM_RNG   0010            /* Ring Indicator      (From DCE) */
  868. #define BM_DTR   0020            /* Data Terminal Ready (From DTE) */
  869. #define BM_RTS   0040            /* Request to Send     (From DTE) */
  870.  
  871. /* Codes for full duplex flow control */
  872.  
  873. #define FLO_NONE 0            /* None */
  874. #define FLO_XONX 1            /* Xon/Xoff (soft) */
  875. #define FLO_RTSC 2            /* RTS/CTS (hard) */
  876. #define FLO_DTRC 3            /* DTR/CD (hard) */
  877. #define FLO_ETXA 4            /* ETX/ACK (soft) */
  878. #define FLO_STRG 5            /* String-based (soft) */
  879. #define FLO_DIAL 6            /* DIALing kludge */
  880. #define FLO_DIAX 7            /* Cancel dialing kludge */
  881. #define FLO_DTRT 8            /* DTR/CTS (hard) */
  882. #define FLO_KEEP 9            /* Keep, i.e. don't touch or change */
  883.  
  884. /* And finally... */
  885.  
  886. #ifdef COMMENT                /* Make sure this is NOT defined! */
  887. #undef COMMENT
  888. #endif /* COMMENT */
  889.  
  890. /* Structure definitions for Kermit file attributes */
  891. /* All strings come as pointer and length combinations */
  892. /* Empty string (or for numeric variables, -1) = unused attribute. */
  893.  
  894. struct zstr {             /* string format */
  895.     int len;              /* length */
  896.     char *val;            /* value */
  897. };
  898. struct zattr {            /* Kermit File Attribute structure */
  899.     long lengthk;         /* (!) file length in K */
  900.     struct zstr type;     /* (") file type (text or binary) */
  901.     struct zstr date;     /* (#) file creation date yyyymmdd[ hh:mm[:ss]] */
  902.     struct zstr creator;  /* ($) file creator id */
  903.     struct zstr account;  /* (%) file account */
  904.     struct zstr area;     /* (&) area (e.g. directory) for file */
  905.     struct zstr passwd;   /* (') password for area */
  906.     long blksize;         /* (() file blocksize */
  907.     struct zstr access;   /* ()) file access: new, supersede, append, warn */
  908.     struct zstr encoding; /* (*) encoding (transfer syntax) */
  909.     struct zstr disp;     /* (+) disposition (mail, message, print, etc) */
  910.     struct zstr lprotect; /* (,) protection (local syntax) */
  911.     struct zstr gprotect; /* (-) protection (generic syntax) */
  912.     struct zstr systemid; /* (.) ID for system of origin */
  913.     struct zstr recfm;    /* (/) record format */
  914.     struct zstr sysparam; /* (0) system-dependent parameter string */
  915.     long length;          /* (1) exact length on system of origin */
  916.     struct zstr charset;  /* (2) transfer syntax character set */
  917.     struct zstr reply;    /* This goes last, used for attribute reply */
  918. };
  919.  
  920. /* Kermit file information structure */
  921.  
  922. struct filinfo {
  923.   int bs;                /* Blocksize */
  924.   int cs;                /* Character set */
  925.   long rl;                /* Record length */
  926.   int org;                /* Organization */
  927.   int fmt;                /* Record format */
  928.   int cc;                /* Carriage control */
  929.   int typ;                /* Type (text/binary) */
  930.   int dsp;                /* Disposition */
  931.   char *os_specific;            /* OS-specific attributes */
  932.   unsigned int lblopts;            /* LABELED FILE options bitmask */
  933. };
  934.  
  935. /* VMS values for LABELED FILE options bitmask */
  936.  
  937. #ifdef VMS
  938. #define LBL_NAM  1            /* Ignore incoming name if set */
  939. #define LBL_PTH  2            /* Use complete path if set */
  940. #define LBL_ACL  4            /* Preserve ACLs if set */
  941. #define LBL_BCK  8            /* Preserve backup date if set */
  942. #define LBL_OWN 16            /* Preserve ownership if set */
  943. #endif /* VMS */
  944.  
  945. /*
  946.   Data types.  First the header file for data types so we can pick up the
  947.   types used for pids, uids, and gids.  Override this section by putting
  948.   -DCKTYP_H=xxx on the command line to specify the header file where your
  949.   system defines these types.
  950. */
  951. #ifdef OSK                /* OS-9 */
  952. #include <types.h>
  953. #else                    /* General case, not OS-9 */
  954. #ifndef CKTYP_H
  955. #ifndef VMS
  956. #ifndef MAC
  957. #ifndef AMIGA
  958. #define CKTYP_H <sys/types.h>
  959. #endif /* AMIGA */
  960. #endif /* MAC */
  961. #endif /* VMS */
  962. #endif /* CKTYP_H */
  963.  
  964. #ifdef GEMDOS
  965. #undef CKTYP_H
  966. #include <types.h>
  967. #endif /* GEMDOS */
  968.  
  969. #ifdef OS2
  970. #undef CKTYP_H
  971. #include <sys/types.h>
  972. #endif /* OS2 */
  973.  
  974. #ifdef CKTYP_H                /* Include it. */
  975. #ifdef COHERENT                /* Except for COHERENT */
  976. #include <sys/types.h>
  977. #else
  978. #ifdef datageneral
  979. #include <sys/types.h>            /* Compiler didn't like other */
  980. #else
  981. #include CKTYP_H
  982. #endif /* datageneral */
  983. #endif /* COHERENT */
  984. #endif /* CKTYP_H */
  985.  
  986. #endif /* OSK */            /* End of types.h section */
  987.  
  988. /*
  989.   Data type for pids.  If your system uses a different type, put something
  990.   like -DPID_T=pid_t on command line, or override here.
  991. */
  992. #ifndef PID_T
  993. #define PID_T int
  994. #endif /* PID_T */
  995. /*
  996.   Data types for uids and gids.  Same deal as for pids.
  997.   Wouldn't be nice if there was a preprocessor test to find out if a
  998.   typedef existed?
  999. */
  1000. #ifdef VMS
  1001. /* Not used in VMS so who cares */
  1002. #define UID_T int
  1003. #define GID_T int
  1004. #endif /* VMS */
  1005.  
  1006. #ifdef POSIX
  1007. /* Or would it be better (or worse?) to use _POSIX_SOURCE here? */
  1008. #ifndef UID_T
  1009. #define UID_T uid_t
  1010. #endif /* UID_T */
  1011. #ifndef GID_T
  1012. #define GID_T gid_t
  1013. #endif /* GID_T */
  1014. #else /* Not POSIX */
  1015. #ifdef SVR4
  1016. /* SVR4 and later have uid_t and gid_t. */
  1017. /* SVR3 and earlier use int, or unsigned short, or.... */
  1018. #ifndef UID_T
  1019. #define UID_T uid_t
  1020. #endif /* UID_T */
  1021. #ifndef GID_T
  1022. #define GID_T gid_t
  1023. #endif /* GID_T */
  1024. #else /* Not SVR4 */
  1025. #ifdef BSD43
  1026. #ifndef UID_T
  1027. #define UID_T uid_t
  1028. #endif /* UID_T */
  1029. #ifndef GID_T
  1030. #define GID_T gid_t
  1031. #endif /* GID_T */
  1032. #else /* Not BSD43 */
  1033. /* Default these to int for older UNIX versions */
  1034. #ifndef UID_T
  1035. #define UID_T int
  1036. #endif /* UID_T */
  1037. #ifndef GID_T
  1038. #define GID_T int
  1039. #endif /* GID_T */
  1040. #endif /* BSD43 */
  1041. #endif /* SVR4  */
  1042. #endif /* POSIX */
  1043.  
  1044. /* 
  1045.   getpwuid() arg type, which is not necessarily the same as UID_T,
  1046.   e.g. in SCO UNIX SVR3, it's int.
  1047. */
  1048. #ifndef PWID_T
  1049. #define PWID_T UID_T
  1050. #endif /* PWID_T */
  1051.  
  1052. #ifdef NEXT                /* Argument for wait() */
  1053. #include <sys/wait.h>
  1054. typedef union wait WAIT_T;
  1055. #else
  1056. #ifdef POSIX
  1057. #include <sys/wait.h>
  1058. #ifndef WAIT_T
  1059. #ifdef QNX
  1060. typedef int WAIT_T;
  1061. #else
  1062. #define WAIT_T pid_t
  1063. #endif /* QNX */
  1064. #endif /* WAIT_T */
  1065. #else
  1066. typedef int WAIT_T;
  1067. #endif /* POSIX */
  1068. #endif /* NEXT */
  1069.  
  1070. /* Forward declarations of system-dependent functions callable from all */
  1071. /* C-Kermit modules. */
  1072.  
  1073. /* File-related functions from system-dependent file i/o module */
  1074.  
  1075. _PROTOTYP( int zkself, (void) );
  1076. _PROTOTYP( int zopeni, (int, char *) );
  1077. _PROTOTYP( int zopeno, (int, char *, struct zattr *, struct filinfo *) );
  1078. _PROTOTYP( int zclose, (int) );
  1079. #ifndef MAC
  1080. _PROTOTYP( int zchin, (int, int *) );
  1081. #endif /* MAC */
  1082. _PROTOTYP( int zsinl, (int, char *, int) );
  1083. _PROTOTYP( int zinfill, (void) );
  1084. _PROTOTYP( int zsout, (int, char*) );
  1085. _PROTOTYP( int zsoutl, (int, char*) );
  1086. _PROTOTYP( int zsoutx, (int, char*, int) );
  1087. _PROTOTYP( int zchout, (int, char) );
  1088. _PROTOTYP( int zoutdump, (void) );
  1089. _PROTOTYP( int zsyscmd, (char *) );
  1090. _PROTOTYP( int zshcmd, (char *) );
  1091. _PROTOTYP( int chkfn, (int) );
  1092. _PROTOTYP( long zchki, (char *) );
  1093. _PROTOTYP( int iswild, (char *) );
  1094. _PROTOTYP( int zchko, (char *) );
  1095. _PROTOTYP( int zdelet, (char *) );
  1096. _PROTOTYP( VOID zrtol, (char *,char *) );
  1097. _PROTOTYP( VOID zltor, (char *,char *) );
  1098. _PROTOTYP( VOID zstrip, (char *,char **) );
  1099. _PROTOTYP( int zchdir, (char *) );
  1100. _PROTOTYP( char * zhome, (void) );
  1101. _PROTOTYP( char * zgtdir, (void) );
  1102. _PROTOTYP( int zxcmd, (int, char *) );
  1103. #ifndef MAC
  1104. _PROTOTYP( int zclosf, (int) );
  1105. #endif /* MAC */
  1106. _PROTOTYP( int zxpand, (char *) );
  1107. _PROTOTYP( int znext, (char *) );
  1108. _PROTOTYP( int zchkspa, (char *, long) );
  1109. _PROTOTYP( VOID znewn, (char *, char **) );
  1110. _PROTOTYP( int zrename, (char *, char *) );
  1111. _PROTOTYP( int zsattr, (struct zattr *) );
  1112. _PROTOTYP( int zfree, (char *) );
  1113. _PROTOTYP( char * zfcdat, (char *) );
  1114. _PROTOTYP( int zstime, (char *, struct zattr *, int) );
  1115. _PROTOTYP( int zmail, (char *, char *) ); 
  1116. _PROTOTYP( int zprint, (char *, char *) ); 
  1117. _PROTOTYP( char * tilde_expand, (char *) ); 
  1118.  
  1119. /* Functions from system-dependent terminal i/o module */
  1120.  
  1121. _PROTOTYP( int ttopen, (char *, int *, int, int) );  /* tty functions */
  1122. #ifndef MAC
  1123. _PROTOTYP( int ttclos, (int) );
  1124. #endif /* MAC */
  1125. _PROTOTYP( int tthang, (void) );
  1126. _PROTOTYP( int ttres, (void) );
  1127. _PROTOTYP( int ttpkt, (long, int, int) );
  1128. #ifndef MAC
  1129. _PROTOTYP( int ttvt, (long, int) );
  1130. #endif /* MAC */
  1131. _PROTOTYP( int ttsspd, (int) );
  1132. _PROTOTYP( long ttgspd, (void) );
  1133. _PROTOTYP( int ttflui, (void) );
  1134. _PROTOTYP( int ttfluo, (void) );
  1135. _PROTOTYP( int ttchk, (void) );
  1136. _PROTOTYP( int ttxin, (int, CHAR *) );
  1137. _PROTOTYP( int ttol, (CHAR *, int) );
  1138. _PROTOTYP( int ttoc, (char) );
  1139. _PROTOTYP( int ttinc, (int) );
  1140. _PROTOTYP( int ttscarr, (int) );
  1141. _PROTOTYP( int ttgmdm, (void) );
  1142. _PROTOTYP( int ttsndb, (void) );
  1143. _PROTOTYP( int ttsndlb, (void) );
  1144. #ifdef PARSENSE
  1145. #ifdef UNIX
  1146. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
  1147. #else
  1148. #ifdef VMS
  1149. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
  1150. #else
  1151. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR) );
  1152. #endif /* VMS */
  1153. #endif /* UNIX */
  1154. #else
  1155. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR) );
  1156. #endif /* PARSENSE */
  1157.  
  1158. /* Console functions */
  1159.  
  1160. _PROTOTYP( int congm, (void) );
  1161. #ifdef COMMENT
  1162. _PROTOTYP( VOID conint, (SIGTYP (*)(int, int), SIGTYP (*)(int, int)) );
  1163. #else
  1164. _PROTOTYP( VOID conint, (SIGTYP (*)(int), SIGTYP (*)(int)) );
  1165. #endif
  1166. _PROTOTYP( VOID connoi, (void) );
  1167. _PROTOTYP( int concb, (char) );
  1168. _PROTOTYP( int conbin, (char) );
  1169. _PROTOTYP( int conres, (void) );
  1170. _PROTOTYP( int conoc, (char) );
  1171. _PROTOTYP( int conxo, (int, char *) );
  1172. _PROTOTYP( int conol, (char *) );
  1173. _PROTOTYP( int conola, (char *[]) );
  1174. _PROTOTYP( int conoll, (char *) );
  1175. _PROTOTYP( int conchk, (void) );
  1176. _PROTOTYP( int coninc, (int) );
  1177. _PROTOTYP( int psuspend, (int) );
  1178. _PROTOTYP( int priv_ini, (void) );
  1179. _PROTOTYP( int priv_on, (void) );
  1180. _PROTOTYP( int priv_off, (void) );
  1181. _PROTOTYP( int priv_can, (void) );
  1182. _PROTOTYP( int priv_chk, (void) );
  1183. _PROTOTYP( int priv_opn, (char *, int) );
  1184.  
  1185. _PROTOTYP( int sysinit, (void) );    /* Misc Kermit functions */
  1186. _PROTOTYP( int syscleanup, (void) );
  1187. _PROTOTYP( int msleep, (int) );
  1188. _PROTOTYP( VOID rtimer, (void) );
  1189. _PROTOTYP( int gtimer, (void) );
  1190. _PROTOTYP( VOID ttimoff, (void) );
  1191. _PROTOTYP( VOID ztime, (char **) );
  1192. _PROTOTYP( int parchk, (CHAR *, CHAR, int) );
  1193. _PROTOTYP( VOID doexit, (int, int) );
  1194. _PROTOTYP( int askmore, (void) );
  1195. _PROTOTYP( VOID fatal, (char *) );
  1196.  
  1197. /* Key mapping support */
  1198.  
  1199. #ifdef NOICP
  1200. #ifndef NOSETKEY
  1201. #define NOSETKEY
  1202. #endif /* NOSETKEY */
  1203. #endif /* NOICP */
  1204.  
  1205. _PROTOTYP( int congks, (int) );
  1206. #ifndef NOSETKEY
  1207. #ifdef OS2
  1208. #define KMSIZE 768
  1209. typedef int KEY;
  1210. typedef CHAR *MACRO;
  1211. extern int wideresult;
  1212. _PROTOTYP( VOID keymapinit, (void) );
  1213. #else /* Not OS2 */
  1214. /*
  1215.   Catch-all for systems where we don't know how to read keyboard scan
  1216.   codes > 255.  Note: CHAR (i.e. unsigned char) is very important here.
  1217. */
  1218. #define KMSIZE 256
  1219. typedef CHAR KEY;
  1220. typedef CHAR * MACRO;
  1221. #define congks coninc
  1222. #endif /* OS2 */
  1223. #endif /* NOSETKEY */
  1224.  
  1225. /*
  1226.   Function prototypes for system and library functions.
  1227. */
  1228. #ifdef _POSIX_SOURCE
  1229. #ifndef VMS
  1230. #ifndef MAC
  1231. #define CK_ANSILIBS
  1232. #endif /* MAC */
  1233. #endif /* VMS */
  1234. #endif /* _POSIX_SOURCE */
  1235.  
  1236. #ifdef NEXT
  1237. #define CK_ANSILIBS
  1238. #endif /* NEXT */
  1239.  
  1240. #ifdef SVR4
  1241. #define CK_ANSILIBS
  1242. #endif /* SVR4 */
  1243.  
  1244. #ifdef OS2
  1245. #define KANJI
  1246. #define CK_ANSILIBS
  1247. #define MYCURSES
  1248. #define CK_RTSCTS
  1249. #ifdef __IBMC__
  1250. #define S_IFMT 0xF000
  1251. #define timezone _timezone
  1252. #endif /* __IBMC__ */
  1253. #include <io.h>
  1254. #ifdef __EMX__
  1255. #ifndef __32BIT__
  1256. #define __32BIT__
  1257. #endif /* __32BIT__ */
  1258. #include <sys/timeb.h>
  1259. #else
  1260. #include <direct.h>
  1261. #define SIGALRM SIGUSR1
  1262. _PROTOTYP( unsigned alarm, (unsigned) );
  1263. _PROTOTYP( unsigned sleep, (unsigned) );
  1264. #endif /* __EMX__ */
  1265. _PROTOTYP( long zdskspace, (int) );
  1266. _PROTOTYP( int zchdsk, (int) );
  1267. _PROTOTYP( int conincraw, (int) );
  1268. _PROTOTYP( int ttiscom, (int f) );
  1269. _PROTOTYP( int IsFileNameValid, (char *) );
  1270. _PROTOTYP( void ChangeNameForFAT, (char *) );
  1271. _PROTOTYP( char *GetLoadPath, (void) );
  1272. #endif /* OS2 */
  1273.  
  1274. #ifdef MYCURSES                /* MYCURSES implies CK_CURSES */
  1275. #ifndef CK_CURSES
  1276. #define CK_CURSES
  1277. #endif /* CK_CURSES */
  1278. #endif /* MYCURSES */
  1279.  
  1280. #ifdef CK_ANSILIBS
  1281. /*
  1282.   String library functions.
  1283.   For ANSI C, get prototypes from <string.h>.
  1284.   Otherwise, skip the prototypes.
  1285. */
  1286. #include <string.h>
  1287.  
  1288. /*
  1289.   Prototypes for other commonly used library functions, such as
  1290.   malloc, free, getenv, atol, atoi, and exit.  Otherwise, no prototypes.
  1291. */
  1292. #include <stdlib.h>
  1293. #ifdef DIAB /* DIAB DS90 */
  1294. /* #include <commonC.h>  */
  1295. #include <sys/wait.h>
  1296. #ifdef COMMENT
  1297. extern void exit(int status);
  1298. extern void _exit(int status);
  1299. extern int uname(struct utsname *name);
  1300. #endif /* COMMENT */
  1301. extern int chmod(char *path, int mode);
  1302. extern int ioctl(int fildes, int request, ...);
  1303. extern int rdchk(int ttyfd);
  1304. extern int nap(int m);
  1305. #ifdef COMMENT
  1306. extern int getppid(void);
  1307. #endif /* COMMENT */
  1308. extern int _filbuf(FILE *stream);
  1309. extern int _flsbuf(char c,FILE *stream);
  1310. #endif /* DIAB */
  1311.  
  1312. /*
  1313.   Prototypes for UNIX functions like access, alarm, chdir, sleep, fork,
  1314.   and pause.  Otherwise, no prototypes.
  1315. */
  1316. #ifdef NEXT
  1317. #include <libc.h>
  1318. #else
  1319. #ifndef AMIGA
  1320. #ifndef OS2
  1321. #include <unistd.h>
  1322. #endif /* OS2 */
  1323. #endif /* AMIGA */
  1324. #endif /* NEXT */
  1325.  
  1326. #else /* Not ANSI libs... */
  1327.  
  1328. #ifdef MAC
  1329. #include <String.h>
  1330. #include <StdLib.h>
  1331. #endif /* MAC */
  1332.  
  1333. #ifdef SUNOS41
  1334. #include <unistd.h>
  1335. #include <stdlib.h>
  1336. #else
  1337. /*
  1338.   It is essential that these are declared correctly!
  1339. */
  1340. _PROTOTYP( char * malloc, (unsigned int) );
  1341. _PROTOTYP( char * getenv, (char *) );
  1342. _PROTOTYP( long atol, (char *) );
  1343. #endif /* SUNOS4 */
  1344. #endif /* CK_ANSILIBS */
  1345.  
  1346. #ifndef NULL                /* In case NULL is still not defined */
  1347. #define NULL 0L
  1348. /* or #define NULL 0 */
  1349. /* or #define NULL ((char *) 0) */
  1350. /* or #define NULL ((void *) 0) */
  1351. #endif /* NULL */
  1352.  
  1353. /* Funny names for library functions department... */
  1354.  
  1355. #ifdef ZILOG
  1356. #define setjmp setret
  1357. #define longjmp longret
  1358. #define jmp_buf ret_buf
  1359. #define getcwd curdir
  1360. #endif /* ZILOG */
  1361.  
  1362. #endif /* CKCDEB_H */
  1363.  
  1364. /* End of ckcdeb.h */
  1365.