Commit | Line | Data |
---|---|---|
cc9a3bd6 PB |
1 | #include <fcntl.h> |
2 | #include <errno.h> | |
3 | #include <stdio.h> | |
4 | #include <sys/types.h> | |
5 | #include <sys/stat.h> | |
6 | #include <ctype.h> | |
7 | #include <string.h> | |
8 | #include <sys/file.h> | |
9 | ||
10 | #ifndef O_ACCMODE | |
11 | #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) | |
12 | #endif | |
13 | #ifndef SEEK_SET | |
14 | #define SEEK_SET 0 | |
15 | #endif | |
16 | #ifndef SEEK_CUR | |
17 | #define SEEK_CUR 1 | |
18 | #endif | |
19 | #ifdef STDC_HEADERS | |
20 | #include <stdlib.h> | |
21 | /*#include <string.h>*/ | |
22 | #else | |
23 | extern char *EXFUN(mktemp,(CONST char*)); | |
24 | extern int EXFUN(fflush,(FILE *)); | |
25 | extern int EXFUN(write,(int, CONST char *, int)); | |
26 | extern void EXFUN(abort,(void)); | |
27 | extern int EXFUN(close,(int)); | |
28 | extern int EXFUN(fcntl,(int des, int cmd, int e)); | |
29 | extern int EXFUN(fprintf,(FILE *,char *,...)); | |
30 | extern int EXFUN(printf,(char *,...)); | |
31 | extern int EXFUN(qsort,(void *data,int els, int siz, int func())); | |
32 | extern void EXFUN(exit,(int)); | |
33 | extern int EXFUN(fseek,(FILE*, int, int)); | |
34 | extern int EXFUN(fclose,(FILE*)); | |
35 | extern void EXFUN(bcopy,(char*,char*,int)); | |
36 | extern int EXFUN(bcmp,(char *, char *, int)); | |
37 | extern void EXFUN(bzero,(char *, int)); | |
38 | extern PTR EXFUN(memset,(PTR, int, int)); | |
39 | extern void EXFUN(puts,(CONST char*)); | |
40 | extern void EXFUN(fputs,(CONST char*,FILE*)); | |
41 | extern int EXFUN(rmdir,(CONST char *)); | |
42 | extern int EXFUN(getuid,(void)); | |
43 | extern int EXFUN(getgid,(void)); | |
44 | extern int EXFUN(rename,(CONST char *, CONST char*)); | |
45 | extern int EXFUN(getuid,()); | |
46 | extern int EXFUN(getgid,()); | |
47 | extern void EXFUN(perror,(CONST char *)); | |
48 | #ifndef DONTDECLARE_MALLOC | |
49 | extern PTR EXFUN(malloc,(unsigned)); | |
50 | extern PTR EXFUN(realloc, (PTR, unsigned)); | |
51 | #endif | |
52 | ||
53 | #ifndef __GNUC__ | |
54 | extern PTR EXFUN(memcpy,(PTR,CONST PTR,unsigned int)); | |
55 | #else | |
56 | /* char * EXFUN( memcpy,(char *,CONST char *,unsigned int)); */ | |
57 | #endif | |
58 | ||
59 | #ifdef __STDC__ | |
60 | extern void EXFUN(free,(PTR)); | |
61 | #else | |
62 | extern int free(); | |
63 | #endif | |
64 | ||
65 | extern char * strchr(); | |
66 | extern char *getenv(); | |
67 | extern char *memchr(); | |
68 | extern char *strrchr(); | |
69 | extern int chmod(); | |
70 | extern int fread(); | |
71 | extern int fstat(); | |
72 | extern int fwrite(); | |
73 | extern int sscanf(); | |
74 | extern int stat(); | |
75 | extern int strtol(); | |
76 | ||
77 | extern char *strrchr(); | |
78 | extern char *ctime(); | |
79 | extern int _flsbuf(); | |
80 | extern int fclose(); | |
81 | extern int time(); | |
82 | extern int utimes(); | |
83 | extern int vfprintf(); | |
84 | extern long atol(); | |
85 | extern char *getenv(); | |
86 | extern int fputc(); | |
87 | extern int unlink(); | |
88 | #endif /* __STDC__ */ | |
89 | ||
90 | /* EXACT TYPES */ | |
91 | #ifndef int8e_type | |
92 | #define int8e_type char | |
93 | #endif | |
94 | #ifndef uint8e_type | |
95 | #define uint8e_type unsigned char | |
96 | #endif | |
97 | #ifndef int16e_type | |
98 | #define int16e_type short | |
99 | #endif | |
100 | #ifndef uint16e_type | |
101 | #define uint16e_type unsigned short | |
102 | #endif | |
103 | #ifndef int32e_type | |
104 | #define int32e_type int | |
105 | #endif | |
106 | #ifndef uint32e_type | |
107 | #define uint32e_type unsigned int | |
108 | #endif | |
109 | #ifndef uint64e_type | |
110 | #ifdef __GNUC__ | |
111 | #define uint64e_type unsigned long long | |
112 | #define int64e_type struct long long | |
113 | #define uint64_typeLOW(x) (uint32_type)(((x) & 0xffffffff)) | |
114 | #define uint64_typeHIGH(x) (uint32_type)(((x) >> 32) & 0xffffffff) | |
115 | #else | |
116 | typedef struct uint64e_struct { | |
117 | uint32e_type low, high; | |
118 | }; | |
119 | #define uint64e_type struct uint64e_struct | |
120 | #define int64e_type struct uint64e_struct | |
121 | #define uint64_typeLOW(x) (uint32_type)(((x).low)) | |
122 | #define uint64_typeHIGH(x) (uint32_type)(((x).high)) | |
123 | #endif | |
124 | #endif | |
125 | ||
126 | /* CORRECT SIZE OR GREATER */ | |
127 | #ifndef int8_type | |
128 | #define int8_type int8e_type | |
129 | #endif | |
130 | #ifndef uint8_type | |
131 | #define uint8_type uint8e_type | |
132 | #endif | |
133 | #ifndef int16_type | |
134 | #define int16_type int16e_type | |
135 | #endif | |
136 | #ifndef uint16_type | |
137 | #define uint16_type uint16e_type | |
138 | #endif | |
139 | #ifndef int32_type | |
140 | #define int32_type int32e_type | |
141 | #endif | |
142 | #ifndef uint32_type | |
143 | #define uint32_type uint32e_type | |
144 | #endif | |
145 | #ifndef int64_type | |
146 | #define int64_type int64e_type | |
147 | #endif | |
148 | #ifndef uint64_type | |
149 | #define uint64_type uint64e_type | |
150 | #endif | |
151 | ||
152 | #ifndef BYTES_IN_PRINTF_INT | |
153 | #define BYTES_IN_PRINTF_INT 4 | |
154 | #endif | |
155 | ||
156 | #include "fopen-same.h" |