e91e959c73f6de52d737e6204d0855b79bc427df
[ghc.git] / utils / lndir / lndir-Xos.h
1 /*
2 * $XConsortium: Xos.h,v 1.47 91/08/17 17:14:38 rws Exp $
3 *
4 * Copyright 1987 by the Massachusetts Institute of Technology
5 *
6 * Permission to use, copy, modify, and distribute this software and its
7 * documentation for any purpose and without fee is hereby granted, provided
8 * that the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of M.I.T. not be used in advertising
11 * or publicity pertaining to distribution of the software without specific,
12 * written prior permission. M.I.T. makes no representations about the
13 * suitability of this software for any purpose. It is provided "as is"
14 * without express or implied warranty.
15 *
16 * The X Window System is a Trademark of MIT.
17 *
18 */
19
20 /* This is a collection of things to try and minimize system dependencies
21 * in a "signficant" number of source files.
22 */
23
24 #ifndef _XOS_H_
25 #define _XOS_H_
26
27 #include "lndir-Xosdefs.h"
28
29 /*
30 * Get major data types (esp. caddr_t)
31 */
32
33 #ifdef USG
34 #ifndef __TYPES__
35 #ifdef CRAY
36 #define word word_t
37 #endif /* CRAY */
38 #include <sys/types.h> /* forgot to protect it... */
39 #define __TYPES__
40 #endif /* __TYPES__ */
41 #else /* USG */
42 #if defined(_POSIX_SOURCE) && defined(MOTOROLA)
43 #undef _POSIX_SOURCE
44 #include <sys/types.h>
45 #define _POSIX_SOURCE
46 #else
47 #include <sys/types.h>
48 #endif
49 #endif /* USG */
50
51
52 /*
53 * Just about everyone needs the strings routines. We provide both forms here,
54 * index/rindex and strchr/strrchr, so any systems that don't provide them all
55 * need to have #defines here.
56 */
57
58 #ifndef X_NOT_STDC_ENV
59 #include <string.h>
60 #define index strchr
61 #define rindex strrchr
62 #else
63 #ifdef SYSV
64 #include <string.h>
65 #define index strchr
66 #define rindex strrchr
67 #else
68 #include <strings.h>
69 #define strchr index
70 #define strrchr rindex
71 #endif
72 #endif
73
74
75 /*
76 * Get open(2) constants
77 */
78 #ifdef X_NOT_POSIX
79 #include <fcntl.h>
80 #ifdef USL
81 #include <unistd.h>
82 #endif /* USL */
83 #ifdef CRAY
84 #include <unistd.h>
85 #endif /* CRAY */
86 #ifdef MOTOROLA
87 #include <unistd.h>
88 #endif /* MOTOROLA */
89 #ifdef SYSV386
90 #include <unistd.h>
91 #endif /* SYSV386 */
92 #include <sys/file.h>
93 #else /* X_NOT_POSIX */
94 #if !defined(_POSIX_SOURCE) && defined(macII)
95 #define _POSIX_SOURCE
96 #include <fcntl.h>
97 #undef _POSIX_SOURCE
98 #else
99 #include <fcntl.h>
100 #endif
101 #include <unistd.h>
102 #endif /* X_NOT_POSIX else */
103
104 /*
105 * Get struct timeval
106 */
107
108 #ifdef SYSV
109
110 #ifndef USL
111 #include <sys/time.h>
112 #endif
113 #include <time.h>
114 #ifdef CRAY
115 #undef word
116 #endif /* CRAY */
117 #if defined(USG) && !defined(CRAY) && !defined(MOTOROLA)
118 struct timeval {
119 long tv_sec;
120 long tv_usec;
121 };
122 #ifndef USL_SHARELIB
123 struct timezone {
124 int tz_minuteswest;
125 int tz_dsttime;
126 };
127 #endif /* USL_SHARELIB */
128 #endif /* USG */
129
130 #else /* not SYSV */
131
132 #if defined(_POSIX_SOURCE) && defined(SVR4)
133 /* need to omit _POSIX_SOURCE in order to get what we want in SVR4 */
134 #undef _POSIX_SOURCE
135 #include <sys/time.h>
136 #define _POSIX_SOURCE
137 #else
138 #include <sys/time.h>
139 #endif
140
141 #endif /* SYSV */
142
143 /* use POSIX name for signal */
144 #if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD)
145 #define SIGCHLD SIGCLD
146 #endif
147
148 #ifdef ISC
149 #include <sys/bsdtypes.h>
150 #endif
151
152 #endif /* _XOS_H_ */