1 /* os_dep.h
2  * (c) 2002 Mikulas Patocka
3  * This file is a part of the Links program, released under GPL.
4  */
5 
6 #ifndef OS_DEP_H
7 #define OS_DEP_H
8 
9 #define SYS_UNIX	1
10 #define SYS_OS2		2
11 #define SYS_WIN_32	3
12 #define SYS_BEOS	4
13 #define SYS_RISCOS	5
14 #define SYS_ATHEOS	6
15 #define SYS_SPAD	7
16 #define SYS_INTERIX	8
17 #define SYS_OPENVMS	9
18 #define SYS_DOS		10
19 #define SYS_HAIKU	11
20 
21 /* hardcoded limit of 10 OSes in default.c */
22 
23 #ifdef UNIX
24 #undef UNIX
25 #endif
26 
27 #if defined(__EMX__)
28 #define OS2
29 #elif defined(_WIN32) || defined(__CYGWIN__)
30 #define WIN
31 #elif defined(__INTERIX)
32 #define INTERIX
33 #elif defined(__BEOS__)
34 #define BEOS
35 #elif defined(__riscos__)
36 #define RISCOS
37 #elif defined(__ATHEOS__) || defined(__SYLLABLE__)
38 #define ATHEOS
39 #elif defined(__SPAD__)
40 #define SPAD
41 #elif defined(__VMS)
42 #define OPENVMS
43 #elif defined(__DJGPP)
44 #define DOS
45 #elif defined(__HAIKU__)
46 #define HAIKU
47 #else
48 #define UNIX
49 #endif
50 
51 #if defined(UNIX)
52 
dir_sep(unsigned char x)53 static inline int dir_sep(unsigned char x) { return x == '/'; }
54 #define NEWLINE "\n"
55 #define FS_UNIX_RIGHTS
56 #define FS_UNIX_HARDLINKS
57 #define FS_UNIX_SOFTLINKS
58 #define FS_UNIX_USERS
59 #define SYSTEM_ID SYS_UNIX
60 #define SYSTEM_NAME "Unix"
61 #define DEFAULT_SHELL "/bin/sh"
62 #define GETSHELL getenv("SHELL")
63 #define SHARED_CONFIG_DIR "/usr/local/etc/"
64 #ifdef HAVE_SYS_UN_H
65 #define USE_AF_UNIX
66 #endif
67 #define ASSOC_BLOCK
68 #define ASSOC_CONS_XWIN
69 
70 #elif defined(OS2)
71 
dir_sep(unsigned char x)72 static inline int dir_sep(unsigned char x) { return x == '/' || x == '\\'; }
73 #define NEWLINE "\r\n"
74 /*#define NO_ASYNC_LOOKUP*/
75 #define SYSTEM_ID SYS_OS2
76 #define SYSTEM_NAME "OS/2"
77 #define DEFAULT_SHELL "cmd.exe"
78 #define GETSHELL getenv("COMSPEC")
79 #define NO_FG_EXEC
80 #define NO_CTRL_Z
81 #define DOS_FS
82 #define DOS_FS_8_3
83 #define NO_FILE_SECURITY
84 #define NO_FORK_ON_EXIT
85 #define USE_AF_UNIX
86 #define ASSOC_CONS_XWIN
87 #define DISABLE_SMB
88 
89 #elif defined(WIN)
90 
dir_sep(unsigned char x)91 static inline int dir_sep(unsigned char x) { return x == '/' || x == '\\'; }
92 #define NEWLINE "\r\n"
93 /*#define NO_ASYNC_LOOKUP*/
94 #define SYSTEM_ID SYS_WIN_32
95 #define SYSTEM_NAME "Win32"
96 #define DEFAULT_SHELL "cmd.exe"
97 #define GETSHELL getenv("COMSPEC")
98 #define NO_FG_EXEC
99 #define NO_CTRL_Z
100 #define DOS_FS
101 #define SET_WINDOW_TITLE_UTF_8
102 #define ASSOC_CONS_XWIN
103 #define DISABLE_SMB
104 #ifdef __CYGWIN__
105 #define OS_BAD_SIGNALS
106 #endif
107 #ifndef HAVE_PTHREADS
108 #define HAVE_PTHREADS
109 #endif
110 #if defined(HAVE_SYS_UN_H) && !defined(_UWIN)
111 #define USE_AF_UNIX
112 #endif
113 #if defined(_UWIN)
114 #define USE_WIN32_HEAP
115 #endif
116 #ifdef USE_WIN32_HEAP
117 #define NO_FORK_ON_EXIT
118 #endif
119 #ifndef __CYGWIN__
120 #define OS_NO_SYSTEM_CHARSET
121 #endif
122 
123 #elif defined(INTERIX)
124 
dir_sep(unsigned char x)125 static inline int dir_sep(unsigned char x) { return x == '/'; }
126 #define NEWLINE "\n"
127 #define FS_UNIX_RIGHTS
128 #define FS_UNIX_HARDLINKS
129 #define FS_UNIX_SOFTLINKS
130 #define FS_UNIX_USERS
131 #define SYSTEM_ID SYS_INTERIX
132 #define SYSTEM_NAME "Interix"
133 #define DEFAULT_SHELL "/bin/sh"
134 #define GETSHELL getenv("SHELL")
135 #define SHARED_CONFIG_DIR "/usr/local/etc/"
136 #ifdef HAVE_SYS_UN_H
137 #define USE_AF_UNIX
138 #endif
139 #define ASSOC_BLOCK
140 #define ASSOC_CONS_XWIN
141 #define OS_NO_SYSTEM_CHARSET
142 
143 #elif defined(BEOS)
144 
dir_sep(unsigned char x)145 static inline int dir_sep(unsigned char x) { return x == '/'; }
146 #define NEWLINE "\n"
147 #define NO_ASYNC_LOOKUP /* async lookup works on BeOS but crashes the Haiku kernel */
148 #define FS_UNIX_RIGHTS
149 #define FS_UNIX_SOFTLINKS
150 #define FS_UNIX_USERS
151 #define SYSTEM_ID SYS_BEOS
152 #define SYSTEM_NAME "BeOS"
153 #define DEFAULT_SHELL "/bin/sh"
154 #define GETSHELL getenv("SHELL")
155 #define NO_CTRL_Z
156 #define SHARED_CONFIG_DIR "/usr/local/etc/"
157 #define NO_FORK_ON_EXIT
158 #define USE_AF_UNIX
159 #define ASSOC_BLOCK
160 #define OS_NO_SYSTEM_CHARSET
161 #define OS_NO_SYSTEM_LANGUAGE
162 
163 #include <sys/time.h>
164 #include <sys/types.h>
165 #ifdef HAVE_NET_SOCKET_H
166 #include <net/socket.h>
167 #endif
168 #include <sys/socket.h>
169 
170 #include "beos.h"
171 
172 #elif defined(RISCOS)
173 
dir_sep(unsigned char x)174 static inline int dir_sep(unsigned char x) { return x == '/' || x == '\\'; }
175 #define NEWLINE "\n"
176 #define SYSTEM_ID SYS_RISCOS
177 #define SYSTEM_NAME "RISC OS"
178 #define DEFAULT_SHELL "gos"
179 #define GETSHELL getenv("SHELL")
180 #define NO_FG_EXEC
181 #define NO_CTRL_Z
182 #define NO_FILE_SECURITY
183 #define NO_FORK_ON_EXIT
184 #define USE_AF_UNIX
185 #define DISABLE_SMB
186 #define OS_NO_SYSTEM_CHARSET
187 #define OS_NO_SYSTEM_LANGUAGE
188 
189 #elif defined(ATHEOS)
190 
dir_sep(unsigned char x)191 static inline int dir_sep(unsigned char x) { return x == '/'; }
192 #define NEWLINE "\n"
193 #define FS_UNIX_RIGHTS
194 #define FS_UNIX_HARDLINKS
195 #define FS_UNIX_SOFTLINKS
196 #define FS_UNIX_USERS
197 #define SYSTEM_ID SYS_ATHEOS
198 #define SYSTEM_NAME "Atheos"
199 #define DEFAULT_SHELL "/bin/sh"
200 #define GETSHELL getenv("SHELL")
201 #define SHARED_CONFIG_DIR "/usr/local/etc/"
202 #define NO_FORK_ON_EXIT
203 #define ASSOC_BLOCK
204 
205 #elif defined(SPAD)
206 
dir_sep(unsigned char x)207 static inline int dir_sep(unsigned char x) { return x == '/'; }
208 #define NEWLINE "\n"
209 #define SYSTEM_ID SYS_SPAD
210 #define SYSTEM_NAME "Spad"
211 #define DEFAULT_SHELL "LIB.:/SHELL.EXE"
212 #define GETSHELL "LIB.:/SHELL.EXE"
213 #define NO_CTRL_Z
214 #define SHARED_CONFIG_DIR "ETC.:/"
215 #define NO_FORK_ON_EXIT
216 #define ASSOC_BLOCK
217 #define ASSOC_CONS_XWIN
218 #define OS_NO_SYSTEM_CHARSET
219 #define OS_NO_SYSTEM_LANGUAGE
220 
221 #elif defined(OPENVMS)
222 
dir_sep(unsigned char x)223 static inline int dir_sep(unsigned char x) { return x == '/'; }
224 #define NEWLINE "\n"
225 #define FS_UNIX_RIGHTS
226 #define SYSTEM_ID SYS_OPENVMS
227 #define SYSTEM_NAME "VMS"
228 #define DEFAULT_SHELL "/DCL"
229 #define GETSHELL NULL
230 #define SHARED_CONFIG_DIR "/usr/local/etc/"
231 #ifndef HAVE_PTHREADS
232 #define HAVE_PTHREADS
233 #endif
234 #define NO_CTRL_Z
235 #define NO_FORK_ON_EXIT
236 #define ASSOC_BLOCK
237 #define ASSOC_CONS_XWIN
238 #define DISABLE_SMB
239 #define OS_NO_SYSTEM_CHARSET
240 #define OS_NO_SYSTEM_LANGUAGE
241 
242 #elif defined(DOS)
243 
dir_sep(unsigned char x)244 static inline int dir_sep(unsigned char x) { return x == '/' || x == '\\'; }
245 #define NEWLINE "\r\n"
246 #define NO_ASYNC_LOOKUP
247 #define SYSTEM_ID SYS_DOS
248 #define SYSTEM_NAME "DOS"
249 #define DEFAULT_SHELL "command.com"
250 #define GETSHELL getenv("COMSPEC")
251 #define SHARED_CONFIG_DIR "/dev/env/DJDIR/etc"
252 #define NO_CTRL_Z
253 #define DOS_FS
254 #define DOS_FS_8_3
255 #define NO_FILE_SECURITY
256 #define NO_FORK_ON_EXIT
257 #define DISABLE_SMB
258 
259 #elif defined(HAIKU)
260 
dir_sep(unsigned char x)261 static inline int dir_sep(unsigned char x) { return x == '/'; }
262 #define NEWLINE "\n"
263 #define FS_UNIX_RIGHTS
264 #define FS_UNIX_SOFTLINKS
265 #define FS_UNIX_USERS
266 #define SYSTEM_ID SYS_HAIKU
267 #define SYSTEM_NAME "Haiku"
268 #define DEFAULT_SHELL "/bin/sh"
269 #define GETSHELL getenv("SHELL")
270 #define NO_CTRL_Z
271 #define SET_WINDOW_TITLE_UTF_8
272 #define SHARED_CONFIG_DIR "/usr/local/etc/"
273 #define USE_AF_UNIX
274 #define ASSOC_BLOCK
275 
276 #endif
277 
278 #ifdef FS_UNIX_USERS
279 #if !defined(HAVE_GETPWUID) || !defined(HAVE_GETGRGID)
280 #undef FS_UNIX_USERS
281 #endif
282 #endif
283 
284 #endif /* #ifndef OS_DEP_H */
285