home *** CD-ROM | disk | FTP | other *** search
/ ftp.ncftp.com / ftp.ncftp.com.zip / ftp.ncftp.com / ncftp / ncftp-1.9.5.tar.gz / ncftp-1.9.5.tar / ncftp-1.9.5 / sys.h < prev    next >
C/C++ Source or Header  |  1995-10-29  |  13KB  |  638 lines

  1. /* Sys.h
  2.  * See the README for details.
  3.  */
  4.  
  5. /*  $RCSfile: sys.h,v $
  6.  *  $Revision: 14020.13 $
  7.  *  $Date: 93/06/21 06:42:11 $
  8.  */
  9.  
  10.  
  11. #ifdef __sun
  12. #    ifndef sun
  13. #        define sun 1
  14. #    endif
  15. #endif
  16.  
  17. #ifdef sun
  18. #    if !defined(__GNUC__) && !defined(__STDC__) && !defined(SunOverride)
  19.     /* If you choke here, but you know what you're doing, just
  20.      * define SunOverride.
  21.      */
  22.     ^^^ "You need to use an ANSI C compiler.  Try using gcc or acc." ^^^
  23. #    endif
  24. #    ifdef Solaris    /* not predefined. */
  25. #        ifndef SYSV
  26. #            define SYSV 1
  27. #        endif
  28. #        define System "Solaris"
  29. #    else
  30. #        define System "SunOS"
  31. #        ifndef RINDEX
  32. #            define RINDEX 1
  33. #        endif
  34. #    endif    /* not Solaris */
  35. #    ifndef TERMIOS
  36. #        define TERMIOS 1
  37. #    endif
  38. #    ifndef HAS_DOMAINNAME
  39. #        define HAS_DOMAINNAME 1
  40. #    endif
  41. #endif /* sun */
  42.  
  43. #ifdef __sgi
  44. #    ifndef sgi
  45. #        define sgi 1
  46. #    endif
  47. #endif
  48.  
  49. #ifdef sgi
  50. #    define System "IRIX"
  51. #    ifndef SYSV
  52. #        define SYSV 1
  53. #    endif
  54. #    ifndef HERROR
  55. #        define HERROR 1
  56. #    endif
  57. #    ifndef U_WAIT
  58. #        define U_WAIT 1
  59. #    endif
  60. #    ifndef STRICT_PROTOS
  61. #        define STRICT_PROTOS 1
  62. #    endif
  63. #    ifndef TERMIOS
  64. #        define TERMIOS 1
  65. #    endif
  66. #endif /* sgi */
  67.  
  68. #ifdef    AIX
  69. #    define System "AIX 2.2.1"
  70. #    define BSD_INCLUDES
  71. #    define SYSV
  72. #    define NO_STDLIB
  73. #    define NO_UTIME_H
  74. #    define NO_STRFTIME
  75. #    define NO_STRSTR
  76. #    define NO_MKTIME
  77. #endif    /* AIX */
  78.  
  79. #ifdef _AIX
  80. #    define System "AIX 3.x"
  81. #    define SYSSELECTH 1
  82. #    define TERMIOS 1
  83. #endif    /* _AIX */
  84.  
  85. #ifdef __QNX__
  86. #   define QNX
  87. #   define System "QNX 4.21 (POSIX)"
  88. #   define SYSSELECTH
  89. #   define TERMIOS
  90. #   define _POSIX_SOURCE
  91. #   define GETCWDSIZET
  92. #   define STRICT_PROTOS
  93. #   define RINDEX
  94. #    define NO_CURSES_H
  95. #   define unlink remove
  96. #   define bcopy(s,d,l) memcpy((d),(s),(l))
  97. #   define bzero(cp,l) memset((cp),0,(l))
  98. #   define NO_SYSPARAM
  99. #   include <limits.h>
  100. #   define NCARGS _POSIX_ARG_MAX
  101. #endif
  102.  
  103. #ifdef SCOXNX
  104. #    define System "SCO Xenix"
  105. #    define LAI_TCP
  106. #    define NO_UTIMEH
  107. #    define NO_MKTIME
  108. #    define NO_STRFTIME
  109. #    define NO_STRSTR
  110. #    define NO_RENAME
  111. #    define LINGER   /* else SCO bug causes incomplete transfers */
  112. #    define SYSV 1
  113. #endif    /* SCOXNX */
  114.  
  115. #ifdef SCO322
  116. #    define System "SCO Unix 3.2v2"
  117. #    define BOTCHED_FOPEN_RW
  118. #    define NO_RENAME    /* it exists, but it corrupts filesystems */
  119. #    define BROKEN_MEMCPY 1
  120. #    define SYSV 1
  121. #endif    /* SCO322 */
  122.  
  123. #ifdef SCO324
  124. #    define System "SCO Unix 3.2v4"
  125. #    ifndef SYSV
  126. #        define SYSV 1
  127. #    endif
  128. #    ifndef BROKEN_MEMCPY
  129. #        define BROKEN_MEMCPY 1
  130. #    endif
  131. #endif    /* SCO324 */
  132.  
  133. #ifdef linux
  134. #    define System "Linux"
  135. #    ifndef HAS_DOMAINNAME
  136. #        define HAS_DOMAINNAME 1
  137. #    endif
  138. #    ifndef TERMIOS
  139. #        define TERMIOS 1
  140. #    endif
  141. #    ifndef SYSV
  142. #        define SYSV 1
  143. #    endif
  144. #endif
  145.  
  146. #ifdef ISC
  147. #    define System "Interactive Unix"
  148. #    ifndef SYSV
  149. #        define SYSV 1
  150. #    endif
  151. #    ifndef BROKEN_MEMCPY
  152. #        define BROKEN_MEMCPY 1
  153. #    endif
  154. #    ifndef NET_ERRNO_H
  155. #        define NET_ERRNO_H 1
  156. #    endif
  157. #endif  /* ISC */
  158.  
  159. #ifdef aux
  160. #    define System "A/UX"
  161. #    ifndef BROKEN_MEMCPY
  162. #        define BROKEN_MEMCPY 1
  163. #    endif
  164. #    ifndef SYSV
  165. #        define SYSV 1
  166. #    endif
  167. #endif
  168.  
  169. #ifdef NeXT
  170. #    define System "NeXTStep"
  171. #    ifndef RINDEX
  172. #        define RINDEX 1
  173. #    endif
  174. #    ifndef BSD
  175. #        define BSD 1
  176. #    endif
  177. #    ifndef NO_UNISTDH
  178. #        define NO_UNISTDH 1
  179. #    endif
  180. #    ifndef NO_UTIMEH
  181. #        define NO_UTIMEH
  182. #    endif
  183. #    ifndef HAS_DOMAINNAME
  184. #        define HAS_DOMAINNAME 1
  185. #    endif
  186. #endif
  187.  
  188. #ifdef pyr
  189. #    define System "OSx"
  190. #    ifndef BSD
  191. #        define BSD 1
  192. #    endif
  193. #    ifndef SGTTYB
  194. #        define SGTTYB 1
  195. #    endif
  196. #    ifndef NO_STDLIBH
  197. #        define NO_STDLIBH 1
  198. #    endif
  199. extern int errno;
  200. #endif    /* pyr */
  201.  
  202. #ifdef _SEQUENT_
  203. #    if !defined(DYNIXPTX) && !defined(DYNIX)
  204. #        define DYNIXPTX 1
  205. #    endif
  206. #endif
  207.  
  208. #if DYNIXPTX
  209. #    define System "Dynix/PTX"
  210. #    ifndef SYSV
  211. #        define SYSV 1
  212. #    endif
  213. #    ifndef TRY_NOREPLY
  214. #        define TRY_NOREPLY 1
  215. #    endif
  216. #    define gettimeofday(a, b) get_process_stats(a, getpid(), 0, 0)
  217. #endif  /* DYNIXPTX */
  218.  
  219. #ifdef DYNIX
  220. #    define System "Dynix"
  221. #    ifndef BSD
  222. #        define BSD 1
  223. #    endif
  224. #    ifndef SGTTYB
  225. #        define SGTTYB 1
  226. #    endif
  227. #    ifndef NO_UTIMEH
  228. #        define NO_UTIMEH 1
  229. #    endif
  230. #    ifndef NO_STDLIBH
  231. #        define NO_STDLIBH 1
  232. #    endif
  233. #    ifndef NO_VARARGS
  234. #        define NO_VARARGS 1
  235. #    endif
  236. #endif    /* DYNIX */
  237.  
  238. #ifdef ultrix
  239. #    define System "Ultrix"
  240. #    ifndef BSD
  241. #        define BSD 1
  242. #    endif
  243. #    ifndef USE_GETPWUID
  244. #        define USE_GETPWUID 1
  245. #    endif
  246. #    ifndef __GNUC__
  247. #        ifndef NO_CONST
  248. #            define NO_CONST 1
  249. #        endif
  250. #    endif
  251. #endif    /* ultrix */
  252.  
  253. #ifdef __hpux
  254. #    ifndef HPUX
  255. #        define HPUX 1
  256. #    endif
  257. #    define Select(a,b,c,d,e) select((a), (int *)(b), (c), (d), (e))
  258. #endif
  259.  
  260. #ifdef HPUX 
  261. #    define System "HP-UX"
  262. #    ifndef _HPUX_SOURCE
  263. #        define _HPUX_SOURCE 1
  264. #    endif
  265. #    ifndef GETCWDSIZET
  266. #        define GETCWDSIZET 1
  267. #    endif
  268. #    define SYSV 1
  269. #endif    /* HPUX */
  270.  
  271. #ifdef SINIX
  272. #    define System "SINIX"
  273. #    ifndef SYSV
  274. #        define SYSV 1
  275. #    endif
  276. /* You may need to add -lresolv, -lport, -lcurses to MORELIBS in Makefile. */
  277. #endif
  278.  
  279. #ifdef BULL          /* added 23nov92 for Bull DPX/2 */
  280. #    define _POSIX_SOURCE
  281. #    define _XOPEN_SOURCE
  282. #    define _BULL_SOURCE
  283. #    ifndef SYSV
  284. #        define SYSV 1
  285. #    endif
  286. #    define bull
  287. #    define System "Bull DPX/2 BOS"
  288. #    define SYSSELECTH
  289. #endif  /* BULL */   /* added 23nov92 for Bull DPX/2 */
  290.  
  291. #ifdef __dgux
  292. #     ifndef DGUX
  293. #             define DGUX 1
  294. #     endif
  295. #endif
  296.  
  297. #ifdef DGUX
  298. #     ifndef _DGUX_SOURCE
  299. #             define _DGUX_SOURCE
  300. #     endif
  301. #     define GETCWDSIZET 1
  302. #     define BAD_INETADDR 1
  303. #     define SYSV 1
  304. #     define System "DG/UX"
  305. #endif  /* DGUX */
  306.  
  307. #ifdef apollo
  308. #    ifndef BSD
  309. #        define BSD 43
  310. #    endif
  311. #    define NO_UTIMEH 1
  312. #    define System "Apollo"
  313. #endif
  314.  
  315. #ifdef __Besta__
  316. #       define SYSV 1
  317. #       define SYSSELECTH 1
  318. #       define NO_UNISTDH 1
  319. #       define NO_STDLIBH 1
  320. #       define NO_UTIMEH 1
  321. #    ifndef BROKEN_MEMCPY
  322. #        define BROKEN_MEMCPY 1
  323. #    endif
  324. #       include <sys/types.h>
  325. #endif
  326.  
  327. #ifdef __osf__
  328. #    ifdef __alpha    /* DEC OSF/1 */
  329. #        define GETCWDSIZET 1
  330. #    endif
  331. #    ifndef System
  332. #        define System "DEC OSF/1"
  333. #    endif
  334. #endif
  335.  
  336. #ifdef DELL
  337. #    ifndef System
  338. #        define System "DELL SVR4 Issue 2.2"
  339. #    endif
  340. #    ifndef HAS_DOMAINNAME
  341. #        define HAS_DOMAINNAME 1
  342. #    endif
  343. #    ifndef LINGER
  344. #        define LINGER   /* SVR4/386 Streams TCP/IP bug on close */
  345. #    endif
  346. #endif    /* DELL */
  347.  
  348. /* -------------------------------------------------------------------- */
  349.  
  350. #ifdef _SYSV
  351. #    ifndef SYSV
  352. #        define SYSV 1
  353. #    endif
  354. #endif
  355.  
  356. #ifdef USG
  357. #    ifndef SYSV
  358. #        define SYSV 1
  359. #    endif
  360. #endif
  361.  
  362. #ifdef _BSD
  363. #    ifndef BSD
  364. #        define BSD 1
  365. #    endif
  366. #endif
  367.  
  368. #ifdef SVR4
  369. #    ifndef System
  370. #        define System "System V.4"
  371. #    endif
  372. #    ifndef SYSV
  373. #        define SYSV 1
  374. #    endif
  375. #    ifndef VOID
  376. #        define VOID void
  377. #    endif
  378. #    ifndef HERROR
  379. #        define HERROR 1
  380. #    endif
  381. #    ifdef TERMH
  382. #        define TERMH 1
  383. #    endif
  384. #    ifndef Gettimeofday
  385. #        define Gettimeofday gettimeofday
  386. #    endif
  387. #endif  /* SVR4 */
  388.  
  389. #ifdef SYSV
  390. #    ifndef RINDEX
  391. #        define RINDEX 1
  392. #    endif
  393. #    define bcopy(s,d,l) memcpy((d),(s),(l))
  394. #    define bzero(cp,l) memset((cp),0,(l))
  395. #    ifndef HAS_GETCWD
  396. #        define HAS_GETCWD 1
  397. #    endif
  398. #endif
  399.  
  400. #ifdef __bsdi__
  401. #    define System "BSDi"
  402. #    ifndef BSD
  403. #        define BSD 1
  404. #    endif
  405. #    ifndef SYSSELECTH
  406. #        define SYSSELECTH 1
  407. #    endif
  408. #    ifndef GETCWDSIZET
  409. #        define GETCWDSIZET 1
  410. #    endif
  411. #    ifndef HERROR
  412. #        define HERROR 1
  413. #    endif
  414. #endif    /* BSDi */
  415.  
  416. #ifdef __FreeBSD__
  417. #               define System "FreeBSD"
  418. #               define GZCAT "/usr/bin/gzcat"
  419. #        define HAS_DOMAINNAME 1
  420. #       include <sys/types.h>
  421. #       include <sys/param.h>   /* this two for BSD definition */
  422.                 /* to avoid redefinition of it to 1 */
  423. #       define HERROR 1
  424. #    define TERMIOS 1
  425. #       define HAS_GETCWD 1
  426. #       define U_WAIT 1
  427. #    define NO_CONST 1       /* avoid prototype conflict */
  428. #endif
  429.  
  430. #ifdef __NetBSD__
  431. #    define System "NetBSD"
  432. #    define GZCAT "/usr/bin/zcat"
  433. #       define HERROR 1
  434. #    define TERMIOS 1
  435. #       define HAS_GETCWD 1
  436. #    define HAS_DOMAINNAME 1
  437. #       define U_WAIT 1
  438. #    define GETCWDSIZET 1
  439. #    define NO_CONST 1       /* avoid prototype conflict */
  440. #    include <sys/types.h>
  441. #    include <sys/param.h>
  442. #endif
  443.  
  444. #ifdef BSD
  445. #    ifndef __FreeBSD__
  446. #        ifndef SYSDIRH
  447. #            define SYSDIRH 1
  448. #        endif
  449. #    endif
  450. #    ifndef SGTTYB
  451. #        define SGTTYB 1
  452. #    endif
  453. #endif
  454.  
  455. /*
  456.  * Generic pointer type, e.g. as returned by malloc().
  457.  */
  458. #ifndef PTRTYPE
  459. #    define PTRTYPE void
  460. #endif
  461.  
  462. #ifndef Free
  463. #    define Free(a) free((PTRTYPE *)(a))
  464. #endif
  465.  
  466. /*
  467.  * Some systems besides System V don't use rindex/index (like SunOS).
  468.  * Add -DRINDEX to your SDEFS line if you need to.
  469.  */
  470. #ifdef RINDEX
  471.     /* or #include <strings.h> if you have it. */
  472. #    define rindex strrchr
  473. #    define index strchr
  474. #endif /* RINDEX */
  475.  
  476. #ifdef SOCKS
  477. #define Getsockname(d,a,l) Rgetsockname((d), (struct sockaddr *)(a), (l))
  478. #else
  479. #ifdef SYSV
  480. #    define Getsockname(d,a,l) getsockname((d), (void *)(a), (l))
  481. #else
  482. #    define Getsockname(d,a,l) getsockname((d), (struct sockaddr *)(a), (l))
  483. #endif
  484. #endif
  485.  
  486. #ifndef Select
  487. #    define Select(a,b,c,d,e) select((a), (b), (c), (d), (e))
  488. #endif
  489.  
  490. #ifndef Connect
  491. #ifndef SVR4
  492. #    define Connect(a,b,c) (connect((a), (struct sockaddr *)(b), (int)(c)))
  493. #    define Bind(a,b,c) (bind((a), (struct sockaddr *)(b), (int)(c)))
  494. #    define Accept(a,b,c) (accept((a), (struct sockaddr *)(b), (int *)(c)))
  495. #else  /* SVR4 */
  496. #    define Connect(a,b,c) (connect((a), (caddr_t)(b), (int)(c)))
  497. #    define Bind(a,b,c) (bind((a), (caddr_t)(b), (int)(c)))
  498. #    define Accept(a,b,c) (accept((a), (caddr_t)(b), (int *)(c)))
  499. #endif    /* SVR4 */
  500. #endif    /* Connect */
  501.  
  502. #ifndef Gettimeofday
  503. #    define Gettimeofday(a) gettimeofday(a, (struct timezone *)0)
  504. #endif /* Gettimeofday */
  505.  
  506. #ifdef GETPASS
  507. #    define Getpass getpass
  508. #endif
  509.  
  510. /* Enable connections through firewall gateways */
  511. #ifndef GATEWAY
  512. #    define GATEWAY 1
  513. #endif
  514.  
  515. #ifdef _POSIX_SOURCE
  516. #    define TERMIOS
  517. #endif
  518.  
  519. /* Include frequently used headers: */
  520.  
  521. #include <sys/types.h>
  522.  
  523. #ifndef NO_SYSPARAM
  524. #include <sys/param.h>
  525. #endif
  526.  
  527. #include <stdio.h>
  528. #include <string.h>
  529. #include <sys/socket.h>
  530.  
  531. #include <sys/time.h>
  532. #include <time.h>
  533.  
  534. #ifndef NO_STDLIBH
  535. #    include <stdlib.h>
  536. #else
  537. extern PTRTYPE *malloc(size_t);
  538. extern PTRTYPE *calloc(size_t, size_t);
  539. extern PTRTYPE *malloc(size_t);
  540. extern void    free(PTRTYPE *);
  541. extern PTRTYPE *realloc(PTRTYPE *, size_t);
  542. extern void    exit(int);
  543.  
  544. #ifdef NO_CONST
  545. extern char *getenv(char *);
  546. extern int atoi(char *);
  547. #else
  548. extern char *getenv(const char *);
  549. extern int atoi(const char *);
  550. #endif
  551.  
  552. #endif    /* NO_STDLIBH */
  553.  
  554. #ifndef NO_UNISTDH
  555. #    include <unistd.h>
  556. #else
  557. char *getlogin (void);
  558. #    ifdef NO_CONST
  559. extern char *getenv(char *);
  560. #    else
  561. extern char *getenv(const char *);
  562. #    endif
  563. #endif    /* NO_UNISTDH */
  564.  
  565. #ifdef NO_STD_PROTOS
  566. extern    int     _filbuf(FILE *);
  567. extern    int     _flsbuf(int, FILE *);
  568. extern    int     fflush(FILE *);
  569. extern    int     fgetc(FILE *);
  570. extern    int     fprintf(FILE *, char *, ...);
  571. extern    int     fputc(int, FILE *);
  572. extern    int     fputs(char *, FILE *);
  573. extern    int     fclose(FILE *);
  574. extern    int     pclose(FILE *);
  575. extern    void    perror(char *);
  576. extern    int     printf(char *, ...);
  577. extern    int     rewind(FILE *);
  578. extern    int     sscanf(char *, char *, ...);
  579. extern    int     vfprintf(FILE *, char *, char *);
  580.  
  581. extern    char *  mktemp(char *);
  582. extern    int     rename(char *, char *);
  583.  
  584. extern    int     gettimeofday(struct timeval *, struct timezone *);
  585. extern    time_t  mktime(struct tm *);
  586. extern    int     strftime(char *, int, char *, struct tm *);
  587. extern    time_t  time(time_t *);
  588.  
  589. extern    int     tolower(int);
  590. extern    int     toupper(int);
  591.  
  592. #ifndef bcopy
  593. extern    void    bcopy(char *, char *, size_t);
  594. #endif
  595. #ifndef bzero
  596. extern    void    bzero(char *, size_t);
  597. #endif
  598.  
  599. #ifdef SOCKS 
  600. extern    int     Raccept(int, struct sockaddr *, int *);
  601. extern    int     Rbind(int, struct sockaddr *, int, unsigned long);
  602. extern    int     Rconnect(int, struct sockaddr *, int);
  603. extern    int     Rlisten(int, int);
  604. extern    int     Rgetsockname(int, struct sockaddr *, int *);
  605. #else
  606. extern    int     accept(int, struct sockaddr *, int *);
  607. extern    int     bind(int, struct sockaddr *, int);
  608. extern    int     connect(int, struct sockaddr *, int);
  609. extern    int     listen(int, int);
  610. extern    int     getsockname(int, struct sockaddr *, int *);
  611. #endif
  612. extern    int     gethostname(char *, int), getdomainname(char *, int);
  613. #ifndef Select
  614. extern    int     select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
  615. #endif
  616. extern    int     send(int, char *, int, int);
  617. extern    int     setsockopt(int, int, int, char *, int);
  618. extern    int     shutdown(int, int);
  619. extern    int     socket(int, int, int);
  620. #endif    /* NO_STD_PROTOS */
  621.  
  622. /* This malloc stuff is mostly for our own use. */
  623. #define LIBC_MALLOC 0
  624. #define FAST_MALLOC 1
  625. #define DEBUG_MALLOC 2
  626.  
  627. #ifdef LIBMALLOC
  628. #    if LIBMALLOC != LIBC_MALLOC
  629.         /* Make sure you use -I to use the malloc.h of choice. */
  630. #        include <malloc.h>
  631. #    endif
  632. #else
  633. #    define LIBMALLOC LIBC_MALLOC
  634. #endif
  635. /* End of personal malloc junk. */
  636.  
  637. /* eof sys.h */
  638.