1 
2 #ifndef POSIX_HEADERS_MISSING
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <unistd.h>
6 #include <fcntl.h>
7 #endif
8 
9 #ifndef STDC_HEADERS_MISSING
10 #include <stdlib.h>
11 #include <string.h>
12 #include <errno.h>
13 #endif
14 
15 #ifdef MSDOS
16 #undef POSIX_HEADERS_MISSING
17 #include <sys/types.h>
18 #include <sys/stat.h>
19 #include <fcntl.h>
20 #include <io.h>
21 
22 #undef min
23 #define R_OK	0
24 #define mode_t		unsigned short
25 #define SEEK_SET	0
26 #define STDOUT_FILENO	1
27 #define STDERR_FILENO	2
28 #define VERSION 	"MSDOS Compile"
29 #endif
30 
31 /******************************************************************************/
32 
33 /* EEEEyuk!! */
34 
35 #ifdef __STDC__
36 #define P(x)	x
37 #else
38 #define P(x)	()
39 #endif
40 
41 #ifdef STDC_HEADERS_MISSING
42 extern int errno;
43 char *strcat P((char *dest, const char *src));
44 unsigned long strtoul P((const char *s, char **endptr, int base));
45 void exit P((int status));
46 void *malloc P((unsigned size));
47 int strncmp P((const char *s1, const char *s2, unsigned n));
48 char *strncpy P((char *dest, const char *src, unsigned n));
49 char * strcpy P((char* dest, char* src));
50 void *memset P((void *s, int c, unsigned n));
51 #endif
52 
53 #ifdef POSIX_HEADERS_MISSING
54 
55 #define R_OK	0
56 int access P((const char *path, int amode));
57 #define SEEK_SET	0
58 #define STDOUT_FILENO	1
59 #define STDERR_FILENO	2
60 
61 #define mode_t		unsigned short
62 #define off_t		long
63 
64 int chmod P((const char *path, int mode));
65 int close P((int fd));
66 int creat P((const char *path, int mode));
67 int fstat P((int fd, struct stat *statbuf));
68 off_t lseek P((int fd, off_t offset, int whence));
69 int open P((const char *path, int oflag, ...));
70 int read P((int fd, void *buf, unsigned nbytes));
71 mode_t umask P((int oldmask));
72 int write P((int fd, const void *buf, unsigned nbytes));
73 #endif
74 
75 #ifndef O_RDONLY
76 #define O_RDONLY	0
77 #endif
78 #ifndef O_WRONLY
79 #define O_WRONLY	1
80 #endif
81 #ifndef O_RDWR
82 #define O_RDWR		2
83 #endif
84