home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / archives / ck9192.tar.Z / ck9192.tar / ckcdeb.h < prev    next >
Text File  |  1996-12-15  |  68KB  |  3,009 lines

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