home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / tmp4 / ckcdeb.h < prev    next >
C/C++ Source or Header  |  2009-10-16  |  147KB  |  6,555 lines

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