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 #pragma once
25 
26 #include "lndir-Xosdefs.h"
27 
28 /*
29  * Get major data types (esp. caddr_t)
30  */
31 
32 #if defined(USG)
33 #if !defined(__TYPES__)
34 #if defined(CRAY)
35 #define word word_t
36 #endif /* CRAY */
37 #include <sys/types.h>			/* forgot to protect it... */
38 #define __TYPES__
39 #endif /* __TYPES__ */
40 #else /* USG */
41 #if defined(_POSIX_SOURCE) && defined(MOTOROLA)
42 #undef _POSIX_SOURCE
43 #include <sys/types.h>
44 #define _POSIX_SOURCE
45 #else
46 #include <sys/types.h>
47 #endif
48 #endif /* USG */
49 
50 
51 /*
52  * Just about everyone needs the strings routines.  We provide both forms here,
53  * index/rindex and strchr/strrchr, so any systems that don't provide them all
54  * need to have #defines here.
55  */
56 
57 #if !defined(X_NOT_STDC_ENV)
58 #include <string.h>
59 #define index strchr
60 #define rindex strrchr
61 #else
62 #if defined(SYSV)
63 #include <string.h>
64 #define index strchr
65 #define rindex strrchr
66 #else
67 #include <strings.h>
68 #define strchr index
69 #define strrchr rindex
70 #endif
71 #endif
72 
73 
74 /*
75  * Get open(2) constants
76  */
77 #if defined(X_NOT_POSIX)
78 #include <fcntl.h>
79 #if defined(USL)
80 #include <unistd.h>
81 #endif /* USL */
82 #if defined(CRAY)
83 #include <unistd.h>
84 #endif /* CRAY */
85 #if defined(MOTOROLA)
86 #include <unistd.h>
87 #endif /* MOTOROLA */
88 #if defined(SYSV386)
89 #include <unistd.h>
90 #endif /* SYSV386 */
91 #include <sys/file.h>
92 #else /* X_NOT_POSIX */
93 #if !defined(_POSIX_SOURCE) && defined(macII)
94 #define _POSIX_SOURCE
95 #include <fcntl.h>
96 #undef _POSIX_SOURCE
97 #else
98 #include <fcntl.h>
99 #endif
100 #include <unistd.h>
101 #endif /* X_NOT_POSIX else */
102 
103 /*
104  * Get struct timeval
105  */
106 
107 #if defined(SYSV)
108 
109 #if !defined(USL)
110 #include <sys/time.h>
111 #endif
112 #include <time.h>
113 #if defined(CRAY)
114 #undef word
115 #endif /* CRAY */
116 #if defined(USG) && !defined(CRAY) && !defined(MOTOROLA)
117 struct timeval {
118     long tv_sec;
119     long tv_usec;
120 };
121 #if !defined(USL_SHARELIB)
122 struct timezone {
123     int tz_minuteswest;
124     int tz_dsttime;
125 };
126 #endif /* USL_SHARELIB */
127 #endif /* USG */
128 
129 #else /* not SYSV */
130 
131 #if defined(_POSIX_SOURCE) && defined(SVR4)
132 /* need to omit _POSIX_SOURCE in order to get what we want in SVR4 */
133 #undef _POSIX_SOURCE
134 #include <sys/time.h>
135 #define _POSIX_SOURCE
136 #else
137 #include <sys/time.h>
138 #endif
139 
140 #endif /* SYSV */
141 
142 /* use POSIX name for signal */
143 #if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD)
144 #define SIGCHLD SIGCLD
145 #endif
146 
147 #if defined(ISC)
148 #include <sys/bsdtypes.h>
149 #endif
150