home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / test / tar / x30.tar.gz / x30.tar / ckcdeb.h < prev    next >
C/C++ Source or Header  |  2010-03-30  |  142KB  |  6,603 lines

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