1 #define SYS_UNIX	1
2 #define SYS_OS2		2
3 #define SYS_WIN_32	3
4 #define SYS_BEOS	4
5 #define SYS_RISCOS	5
6 #define SYS_ATHEOS	6
7 #define SYS_SPAD	7
8 #define SYS_INTERIX	8
9 #define SYS_OPENVMS	9
10 
11 /* hardcoded limit of 10 OSes in default.c */
12 
13 #ifdef UNIX
14 #undef UNIX
15 #endif
16 
17 #if defined(__EMX__)
18 #define OS2
19 #elif defined(_WIN32) || defined(__CYGWIN__)
20 #define WIN32
21 #elif defined(__INTERIX)
22 #define INTERIX
23 #elif defined(__BEOS__) || defined(__HAIKU__)
24 #define BEOS
25 #elif defined(__riscos__)
26 #define RISCOS
27 #elif defined(__ATHEOS__) || defined(__SYLLABLE__)
28 #define ATHEOS
29 #elif defined(__SPAD__)
30 #define SPAD
31 #elif defined(__VMS)
32 #define OPENVMS
33 #else
34 #define UNIX
35 #endif
36 
37 #if defined(UNIX)
38 
dir_sep(char x)39 static inline int dir_sep(char x) { return x == '/'; }
40 #define NEWLINE "\n"
41 #define FS_UNIX_RIGHTS
42 #define FS_UNIX_HARDLINKS
43 #define FS_UNIX_SOFTLINKS
44 #define FS_UNIX_USERS
45 #define SYSTEM_ID SYS_UNIX
46 #define SYSTEM_NAME "Unix"
47 #define DEFAULT_SHELL "/bin/sh"
48 #define GETSHELL getenv("SHELL")
49 #define SHARED_CONFIG_DIR "/etc/"
50 #ifdef HAVE_SYS_UN_H
51 #define USE_AF_UNIX
52 #else
53 #define DONT_USE_AF_UNIX
54 #endif
55 #define ASSOC_BLOCK
56 #define ASSOC_CONS_XWIN
57 
58 #elif defined(OS2)
59 
dir_sep(char x)60 static inline int dir_sep(char x) { return x == '/' || x == '\\'; }
61 #define NEWLINE "\r\n"
62 /*#define NO_ASYNC_LOOKUP*/
63 #define SYSTEM_ID SYS_OS2
64 #define SYSTEM_NAME "OS/2"
65 #define DEFAULT_SHELL "cmd.exe"
66 #define GETSHELL getenv("COMSPEC")
67 #define NO_FG_EXEC
68 #define NO_CTRL_Z
69 #define DOS_FS
70 #define DOS_FS_8_3
71 #define NO_FILE_SECURITY
72 #define NO_FORK_ON_EXIT
73 #define ASSOC_CONS_XWIN
74 #define DISABLE_SMB
75 
76 #elif defined(WIN32)
77 
dir_sep(char x)78 static inline int dir_sep(char x) { return x == '/' || x == '\\'; }
79 #define NEWLINE "\r\n"
80 /*#define NO_ASYNC_LOOKUP*/
81 #define SYSTEM_ID SYS_WIN_32
82 #define SYSTEM_NAME "Win32"
83 #define DEFAULT_SHELL "cmd.exe"
84 #define GETSHELL getenv("COMSPEC")
85 #define NO_FG_EXEC
86 #define NO_CTRL_Z
87 #define DOS_FS
88 #define SET_WINDOW_TITLE_UTF_8
89 #define ASSOC_CONS_XWIN
90 #ifdef _UWIN
91 #define DISABLE_SMB
92 #endif
93 #ifdef __CYGWIN__
94 #define OS_BAD_SIGNALS
95 #endif
96 #ifndef HAVE_PTHREADS
97 #define HAVE_PTHREADS
98 #endif
99 #if defined(HAVE_SYS_UN_H) && !defined(_UWIN)
100 #define USE_AF_UNIX
101 #else
102 #define DONT_USE_AF_UNIX
103 #endif
104 
105 #elif defined(INTERIX)
106 
dir_sep(char x)107 static inline int dir_sep(char x) { return x == '/'; }
108 #define NEWLINE "\n"
109 #define FS_UNIX_RIGHTS
110 #define FS_UNIX_HARDLINKS
111 #define FS_UNIX_SOFTLINKS
112 #define FS_UNIX_USERS
113 #define SYSTEM_ID SYS_INTERIX
114 #define SYSTEM_NAME "Interix"
115 #define DEFAULT_SHELL "/bin/sh"
116 #define GETSHELL getenv("SHELL")
117 #define SHARED_CONFIG_DIR "/etc/"
118 #ifdef HAVE_SYS_UN_H
119 #define USE_AF_UNIX
120 #else
121 #define DONT_USE_AF_UNIX
122 #endif
123 #define ASSOC_BLOCK
124 #define ASSOC_CONS_XWIN
125 
126 #elif defined(BEOS)
127 
dir_sep(char x)128 static inline int dir_sep(char x) { return x == '/'; }
129 #define NEWLINE "\n"
130 #define NO_ASYNC_LOOKUP /* async lookup works on BeOS but crashes the Haiku kernel */
131 #define FS_UNIX_RIGHTS
132 #define FS_UNIX_SOFTLINKS
133 #define FS_UNIX_USERS
134 #define SYSTEM_ID SYS_BEOS
135 #define SYSTEM_NAME "BeOS"
136 #define DEFAULT_SHELL "/bin/sh"
137 #define GETSHELL getenv("SHELL")
138 #define NO_CTRL_Z
139 #define SHARED_CONFIG_DIR "/etc/"
140 #define NO_FORK_ON_EXIT
141 #define ASSOC_BLOCK
142 
143 #include <sys/time.h>
144 #include <sys/types.h>
145 #ifdef HAVE_NET_SOCKET_H
146 #include <net/socket.h>
147 #endif
148 #include <sys/socket.h>
149 
150 int be_socket(int, int, int);
151 int be_connect(int, struct sockaddr *, int);
152 int be_getpeername(int, struct sockaddr *, int *);
153 int be_getsockname(int, struct sockaddr *, int *);
154 int be_listen(int, int);
155 int be_accept(int, struct sockaddr *, int *);
156 int be_bind(int, struct sockaddr *, int);
157 int be_pipe(int *);
158 int be_read(int, void *, int);
159 int be_write(int, void *, int);
160 int be_close(int);
161 int be_select(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *);
162 int be_getsockopt(int, int, int, void *, int *);
163 
164 #elif defined(RISCOS)
165 
dir_sep(char x)166 static inline int dir_sep(char x) { return x == '/' || x == '\\'; }
167 #define NEWLINE        "\n"
168 #define SYSTEM_ID SYS_RISCOS
169 #define SYSTEM_NAME "RISC OS"
170 #define DEFAULT_SHELL "gos"
171 #define GETSHELL getenv("SHELL")
172 #define NO_FG_EXEC
173 #define NO_FILE_SECURITY
174 #define NO_FORK_ON_EXIT
175 
176 #elif defined(ATHEOS)
177 
dir_sep(char x)178 static inline int dir_sep(char x) { return x == '/'; }
179 #define NEWLINE "\n"
180 #define FS_UNIX_RIGHTS
181 #define FS_UNIX_HARDLINKS
182 #define FS_UNIX_SOFTLINKS
183 #define FS_UNIX_USERS
184 #define SYSTEM_ID SYS_ATHEOS
185 #define SYSTEM_NAME "Atheos"
186 #define DEFAULT_SHELL "/bin/sh"
187 #define GETSHELL getenv("SHELL")
188 #define SHARED_CONFIG_DIR "/etc/"
189 #define ASSOC_BLOCK
190 
191 #elif defined(SPAD)
192 
dir_sep(char x)193 static inline int dir_sep(char x) { return x == '/'; }
194 #define NEWLINE "\n"
195 #define SYSTEM_ID SYS_SPAD
196 #define SYSTEM_NAME "Spad"
197 #define DEFAULT_SHELL "LIB.:/SHELL.EXE"
198 #define GETSHELL "LIB.:/SHELL.EXE"
199 #define NO_CTRL_Z
200 #define SHARED_CONFIG_DIR "ETC.:/"
201 #ifdef HAVE_SYS_UN_H
202 #define USE_AF_UNIX
203 #else
204 #define DONT_USE_AF_UNIX
205 #endif
206 #define ASSOC_BLOCK
207 #define ASSOC_CONS_XWIN
208 #define NO_FORK_ON_EXIT
209 
210 #elif defined(OPENVMS)
211 
dir_sep(unsigned char x)212 static inline int dir_sep(unsigned char x) { return x == '/'; }
213 #define NEWLINE "\n"
214 #define FS_UNIX_RIGHTS
215 #define SYSTEM_ID SYS_OPENVMS
216 #define SYSTEM_NAME "VMS"
217 #define DEFAULT_SHELL "/DCL"
218 #define GETSHELL NULL
219 #define SHARED_CONFIG_DIR "/etc/"
220 #ifndef HAVE_PTHREADS
221 #define HAVE_PTHREADS
222 #endif
223 #define DONT_USE_AF_UNIX
224 #define ASSOC_BLOCK
225 #define ASSOC_CONS_XWIN
226 #define NO_CTRL_Z
227 #define NO_FORK_ON_EXIT
228 #define DISABLE_SMB
229 
230 #endif
231 
232 #ifdef FS_UNIX_USERS
233 #if !defined(HAVE_GETPWUID) || !defined(HAVE_GETGRGID)
234 #undef FS_UNIX_USERS
235 #endif
236 #endif
237 
238