Initial revision
[binutils.git] / include / mpw / mpw.h
blob58702e725ff835bd5aa2c57543775e9810e674ff
1 /* Mac MPW host-specific definitions. */
3 #ifndef __INCLUDE_MPW_H
4 #define __INCLUDE_MPW_H
6 #ifndef MPW
7 #define MPW
8 #endif
10 /* MPW C is basically ANSI, but doesn't actually enable __STDC__,
11 nor does it allow __STDC__ to be #defined. */
13 #ifndef ALMOST_STDC
14 #define ALMOST_STDC
15 #endif
17 #include <stdio.h>
18 #include <ctype.h>
19 #include <errno.h>
21 #define HAVE_TIME_T_IN_TIME_H 1
23 #define HAVE_STDLIB_H 1
25 #define HAVE_ERRNO_H 1
27 #define HAVE_STDDEF_H 1
29 #define HAVE_STRING_H 1
31 #define HAVE_STDARG_H 1
33 #define HAVE_VPRINTF 1
35 #ifdef USE_MW_HEADERS
37 #include <unix.h>
39 #else
41 #include <fcntl.h>
42 #include <ioctl.h>
43 #include <sys/stat.h>
45 #define HAVE_FCNTL_H 1
47 #ifndef O_ACCMODE
48 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
49 #endif
51 #ifndef fileno
52 #define fileno(fp) ((fp)->_file)
53 #endif
55 /* stdio.h does not define this if __STDC__, so define here. */
57 #ifdef __STDC__
58 FILE *fdopen(int fildes, const char *mode);
59 #endif
61 #endif /* USE_MW_HEADERS */
63 /* Add ersatz definitions, for systems that lack them. */
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
78 #ifndef R_OK
79 #define R_OK 4
80 #define W_OK 2
81 #define X_OK 1
82 #endif
84 /* Binary files have different characteristics; for instance, no cr/nl
85 translation. */
87 #define USE_BINARY_FOPEN
89 #include <spin.h>
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 */
98 #define NO_FCNTL
100 int fstat ();
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);
111 /* Map these standard functions to improved versions in libiberty. */
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
122 #define POSIX_UTIME
124 #define LOSING_TOTALLY
126 /* Define this so that files will be closed before being unlinked. */
128 #define CLOSE_BEFORE_UNLINK
130 #endif /* __INCLUDE_MPW_H */