Commit | Line | Data |
---|---|---|
660f21b7 SC |
1 | #include <fcntl.h> |
2 | #include <errno.h> | |
3 | #include <stdio.h> | |
8215bbac | 4 | #include <sys/types.h> |
660f21b7 | 5 | #include <sys/stat.h> |
b271fff2 | 6 | #include <utime.h> |
660f21b7 SC |
7 | #include <ctype.h> |
8 | #include <string.h> | |
8215bbac | 9 | #include <sys/file.h> |
660f21b7 SC |
10 | #ifndef O_ACCMODE |
11 | #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) | |
12 | #endif | |
13 | #define SEEK_SET 0 | |
14 | #define SEEK_CUR 1 | |
15 | ||
06d0bdef JG |
16 | #define POSIX_UTIME |
17 | ||
18 | /* Some things that need to be defined in order to make code written for | |
19 | BSD Unix compile under System V Unix. */ | |
660f21b7 SC |
20 | |
21 | #include <memory.h> | |
22 | #define bcmp(b1,b2,len) memcmp(b1,b2,len) | |
23 | #define bcopy(src,dst,len) memcpy(dst,src,len) | |
24 | #define bzero(s,n) memset(s,0,n) | |
25 | ||
26 | #include <string.h> | |
27 | #define index(s,c) strchr(s,c) | |
28 | #define rindex(s,c) strrchr(s,c) | |
29 | ||
30 | /* | |
31 | * Might not need these. Leave them out for now. | |
32 | * | |
33 | #ifdef SEEK_SET | |
34 | # ifndef L_SET | |
35 | # define L_SET SEEK_SET | |
36 | # endif | |
37 | # endif | |
38 | ||
39 | #ifdef SEEK_CUR | |
40 | # ifndef L_INCR | |
41 | # define L_INCR SEEK_CUR | |
42 | # endif | |
43 | # endif | |
44 | */ | |
45 | ||
67099990 SC |
46 | #ifndef DONTDECLARE_MALLOC |
47 | extern PROTO(PTR,malloc,(unsigned)); | |
48 | extern PROTO(PTR ,realloc, (PTR, unsigned)); | |
49 | extern PROTO(void, free,(PTR)); | |
50 | #endif | |
51 | ||
660f21b7 SC |
52 | /* EXACT TYPES */ |
53 | typedef char int8e_type; | |
54 | typedef unsigned char uint8e_type; | |
55 | typedef short int16e_type; | |
56 | typedef unsigned short uint16e_type; | |
57 | typedef int int32e_type; | |
58 | typedef unsigned int uint32e_type; | |
59 | ||
60 | /* CORRECT SIZE OR GREATER */ | |
61 | typedef char int8_type; | |
62 | typedef unsigned char uint8_type; | |
63 | typedef short int16_type; | |
64 | typedef unsigned short uint16_type; | |
65 | typedef int int32_type; | |
66 | typedef unsigned int uint32_type; | |
67 | ||
33b6c262 SC |
68 | /* Macros for the 'type' part of an fopen, freopen or fdopen. |
69 | <Read|Write>[Update]<Binary file><text file> | |
70 | */ | |
71 | #define FOPEN_RB "r" | |
72 | #define FOPEN_WB "w" | |
73 | #define FOPEN_AB "a" | |
74 | #define FOPEN_RUB "r+" | |
75 | #define FOPEN_WUB "w+" | |
76 | #define FOPEN_AUB "a+" | |
77 | #define FOPEN_RT "r" | |
78 | #define FOPEN_WT "w" | |
79 | #define FOPEN_AT "a" | |
80 | #define FOPEN_RUT "r+" | |
81 | #define FOPEN_WUT "w+" | |
82 | #define FOPEN_AUT "a+" |