home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / AP / TERMNET / NCFTP183 / SYS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-20  |  11.8 KB  |  612 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. #        define SYSV 1
  26. #        define System "Solaris"
  27. #        undef __STDC__
  28. #        define __STDC__ 0
  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 SIG_PARAMS (int sig, ...)
  312. #    define NO_UTIMEH 1
  313. #    define System "Apollo"
  314. #endif
  315.  
  316. #ifdef __Besta__
  317. #       define SYSV 1
  318. #       define SYSSELECTH 1
  319. #       define NO_UNISTDH 1
  320. #       define NO_STDLIBH 1
  321. #       define NO_UTIMEH 1
  322. #    ifndef BROKEN_MEMCPY
  323. #        define BROKEN_MEMCPY 1
  324. #    endif
  325. #       include <sys/types.h>
  326. #endif
  327.  
  328. #ifdef __osf__
  329. #    ifdef __alpha    /* DEC OSF/1 */
  330. #        define GETCWDSIZET 1
  331. #    endif
  332. #endif
  333.  
  334. /* -------------------------------------------------------------------- */
  335.  
  336. #ifdef _SYSV
  337. #    ifndef SYSV
  338. #        define SYSV 1
  339. #    endif
  340. #endif
  341.  
  342. #ifdef USG
  343. #    ifndef SYSV
  344. #        define SYSV 1
  345. #    endif
  346. #endif
  347.  
  348. #ifdef _BSD
  349. #    ifndef BSD
  350. #        define BSD 1
  351. #    endif
  352. #endif
  353.  
  354. #ifdef SVR4
  355. #    ifndef System
  356. #        define System "System V.4"
  357. #    endif
  358. #    ifndef SYSV
  359. #        define SYSV 1
  360. #    endif
  361. #    ifndef VOID
  362. #        define VOID void
  363. #    endif
  364. #    ifndef HERROR
  365. #        define HERROR 1
  366. #    endif
  367. #    ifdef TERMH
  368. #        define TERMH 1
  369. #    endif
  370. #    ifndef Gettimeofday
  371. #        define Gettimeofday gettimeofday
  372. #    endif
  373. #endif  /* SVR4 */
  374.  
  375. #ifdef SYSV
  376. #    ifndef RINDEX
  377. #        define RINDEX 1
  378. #    endif
  379. #    define bcopy(s,d,l) memcpy((d),(s),(l))
  380. #    define bzero(cp,l) memset((cp),0,(l))
  381. #    ifndef HAS_GETCWD
  382. #        define HAS_GETCWD 1
  383. #    endif
  384. #endif
  385.  
  386. #ifdef __bsdi__
  387. #    define System "BSDi"
  388. #    ifndef BSD
  389. #        define BSD 1
  390. #    endif
  391. #    ifndef SYSSELECTH
  392. #        define SYSSELECTH 1
  393. #    endif
  394. #    ifndef GETCWDSIZET
  395. #        define GETCWDSIZET 1
  396. #    endif
  397. #    ifndef HERROR
  398. #        define HERROR 1
  399. #    endif
  400. #endif    /* BSDi */
  401.  
  402. #ifdef __386BSD__
  403. #       ifdef __FreeBSD__
  404. #               define System "FreeBSD"
  405. #               define GZCAT "/usr/bin/gzcat"
  406. #        define HAS_DOMAINNAME 1
  407. #       endif
  408. #       include <sys/types.h>
  409. #       include <sys/param.h>   /* this two for BSD definition */
  410.                 /* to avoid redefinition of it to 1 */
  411. #       define HERROR 1
  412. #    define TERMIOS 1
  413. #       define HAS_GETCWD 1
  414. #       define U_WAIT 1
  415. #    define NO_CONST 1       /* avoid prototype conflict */
  416. #endif
  417.  
  418. #ifdef BSD
  419. #    ifndef __386BSD__
  420. #        ifndef SYSDIRH
  421. #            define SYSDIRH 1
  422. #        endif
  423. #        ifndef SGTTYB
  424. #            define SGTTYB
  425. #        endif
  426. #    endif
  427. #endif
  428.  
  429. /*
  430.  * Generic pointer type, e.g. as returned by malloc().
  431.  */
  432. #ifndef PTRTYPE
  433. #    define PTRTYPE void
  434. #endif
  435.  
  436. #ifndef Free
  437. #    define Free(a) free((PTRTYPE *)(a))
  438. #endif
  439.  
  440. /*
  441.  * Some systems besides System V don't use rindex/index (like SunOS).
  442.  * Add -DRINDEX to your SDEFS line if you need to.
  443.  */
  444. #ifdef RINDEX
  445.     /* or #include <strings.h> if you have it. */
  446. #    define rindex strrchr
  447. #    define index strchr
  448. #endif /* RINDEX */
  449.  
  450. #ifdef SOCKS
  451. #define Getsockname(d,a,l) Rgetsockname((d), (struct sockaddr *)(a), (l))
  452. #else
  453. #ifdef SYSV
  454. #    define Getsockname(d,a,l) getsockname((d), (void *)(a), (l))
  455. #else
  456. #    define Getsockname(d,a,l) getsockname((d), (struct sockaddr *)(a), (l))
  457. #endif
  458. #endif
  459.  
  460. #ifndef Select
  461. #    define Select(a,b,c,d,e) select((a), (b), (c), (d), (e))
  462. #endif
  463.  
  464. #ifndef Connect
  465. #ifndef SVR4
  466. #    define Connect(a,b,c) (connect((a), (struct sockaddr *)(b), (int)(c)))
  467. #    define Bind(a,b,c) (bind((a), (struct sockaddr *)(b), (int)(c)))
  468. #    define Accept(a,b,c) (accept((a), (struct sockaddr *)(b), (int *)(c)))
  469. #else  /* SVR4 */
  470. #    define Connect(a,b,c) (connect((a), (caddr_t)(b), (int)(c)))
  471. #    define Bind(a,b,c) (bind((a), (caddr_t)(b), (int)(c)))
  472. #    define Accept(a,b,c) (accept((a), (caddr_t)(b), (int *)(c)))
  473. #endif    /* SVR4 */
  474. #endif    /* Connect */
  475.  
  476. #ifndef Gettimeofday
  477. #    define Gettimeofday(a) gettimeofday(a, (struct timezone *)0)
  478. #endif /* Gettimeofday */
  479.  
  480. #ifdef GETPASS
  481. #    define Getpass getpass
  482. #endif
  483.  
  484. /* Enable connections through firewall gateways */
  485. #ifndef GATEWAY
  486. #    define GATEWAY 1
  487. #endif
  488.  
  489. #ifdef _POSIX_SOURCE
  490. #    define TERMIOS
  491. #endif
  492.  
  493. /* Include frequently used headers: */
  494.  
  495. #include <sys/types.h>
  496.  
  497. #ifndef NO_SYSPARAM
  498. #include <sys/param.h>
  499. #endif
  500.  
  501. #include <stdio.h>
  502. #include <string.h>
  503. #include <sys/socket.h>
  504.  
  505. #include <sys/time.h>
  506. #include <time.h>
  507.  
  508. #ifndef NO_STDLIBH
  509. #    include <stdlib.h>
  510. #else
  511. extern PTRTYPE *malloc(size_t);
  512. extern PTRTYPE *calloc(size_t, size_t);
  513. extern PTRTYPE *malloc(size_t);
  514. extern void    free(PTRTYPE *);
  515. extern PTRTYPE *realloc(PTRTYPE *, size_t);
  516. extern void    exit(int);
  517.  
  518. #ifdef NO_CONST
  519. extern char *getenv(char *);
  520. extern int atoi(char *);
  521. #else
  522. extern char *getenv(const char *);
  523. extern int atoi(const char *);
  524. #endif
  525.  
  526. #endif    /* NO_STDLIBH */
  527.  
  528. #ifndef NO_UNISTDH
  529. #    include <unistd.h>
  530. #else
  531. char *getlogin (void);
  532. #    ifdef NO_CONST
  533. extern char *getenv(char *);
  534. #    else
  535. extern char *getenv(const char *);
  536. #    endif
  537. #endif    /* NO_UNISTDH */
  538.  
  539. #ifdef NO_STD_PROTOS
  540. extern    int     _filbuf(FILE *);
  541. extern    int     _flsbuf(int, FILE *);
  542. extern    int     fflush(FILE *);
  543. extern    int     fgetc(FILE *);
  544. extern    int     fprintf(FILE *, char *, ...);
  545. extern    int     fputc(int, FILE *);
  546. extern    int     fputs(char *, FILE *);
  547. extern    int     fclose(FILE *);
  548. extern    int     pclose(FILE *);
  549. extern    void    perror(char *);
  550. extern    int     printf(char *, ...);
  551. extern    int     rewind(FILE *);
  552. extern    int     sscanf(char *, char *, ...);
  553. extern    int     vfprintf(FILE *, char *, char *);
  554.  
  555. extern    char *  mktemp(char *);
  556. extern    int     rename(char *, char *);
  557.  
  558. extern    int     gettimeofday(struct timeval *, struct timezone *);
  559. extern    time_t  mktime(struct tm *);
  560. extern    int     strftime(char *, int, char *, struct tm *);
  561. extern    time_t  time(time_t *);
  562.  
  563. extern    int     tolower(int);
  564. extern    int     toupper(int);
  565.  
  566. #ifndef bcopy
  567. extern    void    bcopy(char *, char *, size_t);
  568. #endif
  569. #ifndef bzero
  570. extern    void    bzero(char *, size_t);
  571. #endif
  572.  
  573. #ifdef SOCKS 
  574. extern    int     Raccept(int, struct sockaddr *, int *);
  575. extern    int     Rbind(int, struct sockaddr *, int, unsigned long);
  576. extern    int     Rconnect(int, struct sockaddr *, int);
  577. extern    int     Rlisten(int, int);
  578. extern    int     Rgetsockname(int, struct sockaddr *, int *);
  579. #else
  580. extern    int     accept(int, struct sockaddr *, int *);
  581. extern    int     bind(int, struct sockaddr *, int);
  582. extern    int     connect(int, struct sockaddr *, int);
  583. extern    int     listen(int, int);
  584. extern    int     getsockname(int, struct sockaddr *, int *);
  585. #endif
  586. extern    int     gethostname(char *, int), getdomainname(char *, int);
  587. #ifndef Select
  588. extern    int     select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
  589. #endif
  590. extern    int     send(int, char *, int, int);
  591. extern    int     setsockopt(int, int, int, char *, int);
  592. extern    int     shutdown(int, int);
  593. extern    int     socket(int, int, int);
  594. #endif    /* NO_STD_PROTOS */
  595.  
  596. /* This malloc stuff is mostly for our own use. */
  597. #define LIBC_MALLOC 0
  598. #define FAST_MALLOC 1
  599. #define DEBUG_MALLOC 2
  600.  
  601. #ifdef LIBMALLOC
  602. #    if LIBMALLOC != LIBC_MALLOC
  603.         /* Make sure you use -I to use the malloc.h of choice. */
  604. #        include <malloc.h>
  605. #    endif
  606. #else
  607. #    define LIBMALLOC LIBC_MALLOC
  608. #endif
  609. /* End of personal malloc junk. */
  610.  
  611. /* eof sys.h */
  612.