4 // Copyright transferred from Raider Solutions, Inc to
5 // Kern Sibbald and John Walker by express permission.
7 // Copyright (C) 2004-2005 Kern Sibbald
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of
12 // the License, or (at your option) any later version.
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // General Public License for more details.
19 // You should have received a copy of the GNU General Public
20 // License along with this program; if not, write to the Free
21 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 // MA 02111-1307, USA.
25 * Author : Christopher S. Hull
26 * Created On : Fri Jan 30 13:00:51 2004
27 * Last Modified By: Thorsten Engel
28 * Last Modified On: Fri Apr 22 19:30:00 2004
38 #ifndef HAVE_WXCONSOLE
46 #include <sys/types.h>
69 #if defined HAVE_MINGW
80 #error should not be used under cygwin...
85 typedef UINT64 u_int64_t;
86 typedef UINT64 uint64_t;
87 typedef INT64 int64_t;
88 typedef UINT32 uint32_t;
90 typedef INT64 intmax_t;
91 typedef unsigned char uint8_t;
92 typedef float float32_t;
93 typedef unsigned short uint16_t;
94 typedef signed short int16_t;
96 typedef signed char int8_t;
100 typedef _dev_t dev_t;
101 #ifndef HAVE_WXCONSOLE
102 typedef __int64 ino_t;
103 typedef __int64 off_t; /* STDC=1 means we can define this */
107 typedef long _off_t; /* must be same as sys/types.h */
111 #ifndef HAVE_WXCONSOLE
117 typedef double float64_t;
118 typedef UINT32 u_int32_t;
119 typedef unsigned char u_int8_t;
120 typedef unsigned short u_int16_t;
128 typedef UINT32 key_t;
132 typedef UINT32 uid_t;
133 typedef UINT32 gid_t;
136 typedef UINT32 uid_t;
137 typedef UINT32 gid_t;
138 typedef UINT32 mode_t;
139 typedef INT64 ssize_t;
164 int strcasecmp(const char*, const char *);
165 int strncasecmp(const char*, const char *, int);
166 int gettimeofday(struct timeval *, struct timezone *);
172 #ifndef _STAT_DEFINED
192 #define S_IFMT 0170000 /* file type mask */
194 #define S_IFDIR 0040000 /* directory */
195 #define S_IFCHR 0020000 /* character special */
196 #define S_IFIFO 0010000 /* pipe */
198 #define S_IFREG 0100000 /* regular */
199 #define S_IREAD 0000400 /* read permission, owner */
200 #define S_IWRITE 0000200 /* write permission, owner */
201 #define S_IEXEC 0000100 /* execute/search permission, owner */
203 #define S_IRUSR S_IREAD
204 #define S_IWUSR S_IWRITE
205 #define S_IXUSR S_IEXEC
206 #define S_ISREG(x) (((x) & S_IFREG) == S_IFREG)
207 #define S_ISDIR(x) (((x) & S_IFDIR) == S_IFDIR)
210 #define S_ISFIFO(x) 0
213 #define S_IRGRP 000040
214 #define S_IWGRP 000020
215 #define S_IXGRP 000010
217 #define S_IROTH 00004
218 #define S_IWOTH 00002
219 #define S_IXOTH 00001
221 #define S_IRWXO 000007
222 #define S_IRWXG 000070
223 #define S_ISUID 004000
224 #define S_ISGID 002000
225 #define S_ISVTX 001000
226 #define S_ISSOCK(x) 0
230 #define O_RDONLY _O_RDONLY
231 #define O_WRONLY _O_WRONLY
232 #define O_RDWR _O_RDWR
233 #define O_CREAT _O_CREAT
234 #define O_TRUNC _O_TRUNC
236 #define isascii __isascii
237 #define toascii __toascii
238 #define iscsymf __iscsymf
239 #define iscsym __iscsym
244 int lchown(const char *, uid_t uid, gid_t gid);
245 int chown(const char *, uid_t uid, gid_t gid);
246 int chmod(const char *, mode_t mode);
247 off_t lseek(int, off_t, int);
248 int inet_aton(const char *cp, struct in_addr *inp);
249 int kill(int pid, int signo);
253 int waitpid(int, int *, int);
256 int utime(const char *filename, struct utimbuf *buf);
257 int open(const char *, int, int);
258 #define vsnprintf __vsnprintf
259 int __vsnprintf(char *s, size_t count, const char *format, va_list args);
261 #define vsprintf __vsprintf
262 int __vsprintf(char *s, const char *format, va_list args);
264 #define snprintf __snprintf
265 int __snprintf(char *str, size_t count, const char *fmt, ...);
267 #define sprintf __sprintf
268 int __sprintf(char *str, const char *fmt, ...);
270 #ifndef HAVE_WXCONSOLE
271 ssize_t read(int fd, void *, ssize_t nbytes);
272 ssize_t write(int fd, const void *, ssize_t nbytes);
280 #define WIFEXITED(x) 0
281 #define WEXITSTATUS(x) x
282 #define WIFSIGNALED(x) 0
286 #define HAVE_OLD_SOCKOPT
288 int readdir(unsigned int fd, struct dirent *dirp, unsigned int count);
289 int nanosleep(const struct timespec*, struct timespec *);
290 struct tm *localtime_r(const time_t *, struct tm *);
291 struct tm *gmtime_r(const time_t *, struct tm *);
292 long int random(void);
293 void srandom(unsigned int seed);
294 int lstat(const char *, struct stat *);
295 long pathconf(const char *, int);
296 int readlink(const char *, char *, int);
297 #define _PC_PATH_MAX 1
298 #define _PC_NAME_MAX 2
304 DIR *opendir(const char *name);
305 int closedir(DIR *dir);
315 struct passwd *getpwuid(uid_t);
316 struct group *getgrgid(uid_t);
325 void (*sa_handler)(int);
327 #define sigfillset(x)
328 #define sigaction(a, b, c)
330 #define mkdir(p, m) win32_mkdir(p)
331 #define unlink win32_unlink
332 #define chdir win32_chdir
333 int syslog(int, const char *, const char *);
338 int stat(const char *, struct stat *);
340 #define access _access
341 extern "C" _CRTIMP int __cdecl _access(const char *, int);
342 int execvp(const char *, char *[]);
343 extern "C" void * __cdecl _alloca(size_t);
347 #define getpid _getpid
350 #define gethostid() 0
354 #define getcwd win32_getcwd
355 #define chdir win32_chdir
356 #define fputs win32_fputs
357 char *win32_getcwd(char *buf, int maxlen);
358 int win32_chdir(const char *buf);
359 int win32_mkdir(const char *buf);
360 int win32_fputs(const char *string, FILE *stream);
361 int win32_unlink(const char *filename);
363 char* win32_cgets (char* buffer, int len);
372 #endif /* __COMPAT_H_ */