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