Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | /* Mac MPW host-specific definitions. */ |
2 | ||
3 | #ifndef __INCLUDE_MPW_H | |
4 | #define __INCLUDE_MPW_H | |
5 | ||
6 | #ifndef MPW | |
7 | #define MPW | |
8 | #endif | |
9 | ||
10 | /* MPW C is basically ANSI, but doesn't actually enable __STDC__, | |
11 | nor does it allow __STDC__ to be #defined. */ | |
12 | ||
13 | #ifndef ALMOST_STDC | |
14 | #define ALMOST_STDC | |
15 | #endif | |
16 | ||
17 | #include <stdio.h> | |
18 | #include <ctype.h> | |
19 | #include <errno.h> | |
20 | ||
21 | #define HAVE_TIME_T_IN_TIME_H 1 | |
22 | ||
23 | #define HAVE_STDLIB_H 1 | |
24 | ||
25 | #define HAVE_ERRNO_H 1 | |
26 | ||
27 | #define HAVE_STDDEF_H 1 | |
28 | ||
29 | #define HAVE_STRING_H 1 | |
30 | ||
31 | #define HAVE_STDARG_H 1 | |
32 | ||
33 | #define HAVE_VPRINTF 1 | |
34 | ||
35 | #ifdef USE_MW_HEADERS | |
36 | ||
37 | #include <unix.h> | |
38 | ||
39 | #else | |
40 | ||
41 | #include <fcntl.h> | |
42 | #include <ioctl.h> | |
43 | #include <sys/stat.h> | |
44 | ||
45 | #define HAVE_FCNTL_H 1 | |
46 | ||
47 | #ifndef O_ACCMODE | |
48 | #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) | |
49 | #endif | |
50 | ||
51 | #ifndef fileno | |
52 | #define fileno(fp) ((fp)->_file) | |
53 | #endif | |
54 | ||
55 | /* stdio.h does not define this if __STDC__, so define here. */ | |
56 | ||
57 | #ifdef __STDC__ | |
58 | FILE *fdopen(int fildes, const char *mode); | |
59 | #endif | |
60 | ||
61 | #endif /* USE_MW_HEADERS */ | |
62 | ||
63 | /* Add ersatz definitions, for systems that lack them. */ | |
64 | ||
65 | #ifndef EIO | |
66 | #define EIO 96 | |
67 | #endif | |
68 | #ifndef ENOENT | |
69 | #define ENOENT 97 | |
70 | #endif | |
71 | #ifndef EACCES | |
72 | #define EACCES 98 | |
73 | #endif | |
74 | #ifndef ENOSYS | |
75 | #define ENOSYS 99 | |
76 | #endif | |
77 | ||
78 | #ifndef R_OK | |
79 | #define R_OK 4 | |
80 | #define W_OK 2 | |
81 | #define X_OK 1 | |
82 | #endif | |
83 | ||
84 | /* Binary files have different characteristics; for instance, no cr/nl | |
85 | translation. */ | |
86 | ||
87 | #define USE_BINARY_FOPEN | |
88 | ||
89 | #include <spin.h> | |
90 | ||
91 | #ifdef MPW_C | |
92 | #undef __PTR_TO_INT | |
93 | #define __PTR_TO_INT(P) ((int)(P)) | |
94 | #undef __INT_TO_PTR | |
95 | #define __INT_TO_PTR(P) ((char *)(P)) | |
96 | #endif /* MPW_C */ | |
97 | ||
98 | #define NO_FCNTL | |
99 | ||
100 | int fstat (); | |
101 | ||
102 | FILE *mpw_fopen (); | |
103 | int mpw_fseek (); | |
104 | int mpw_fread (); | |
105 | int mpw_fwrite (); | |
106 | int mpw_access (); | |
107 | int mpw_open (); | |
108 | int mpw_creat (); | |
109 | void mpw_abort (void); | |
110 | ||
111 | /* Map these standard functions to improved versions in libiberty. */ | |
112 | ||
113 | #define fopen mpw_fopen | |
114 | #define fseek mpw_fseek | |
115 | #define fread mpw_fread | |
116 | #define fwrite mpw_fwrite | |
117 | #define open mpw_open | |
118 | #define access mpw_access | |
119 | #define creat mpw_creat | |
120 | #define abort mpw_abort | |
121 | ||
122 | #define POSIX_UTIME | |
123 | ||
124 | #define LOSING_TOTALLY | |
125 | ||
126 | /* Define this so that files will be closed before being unlinked. */ | |
127 | ||
128 | #define CLOSE_BEFORE_UNLINK | |
129 | ||
130 | #endif /* __INCLUDE_MPW_H */ |