home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ckc190.zip / ckcdeb.h < prev    next >
C/C++ Source or Header  |  1994-11-02  |  58KB  |  2,367 lines

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