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 #if !defined(__GNUC__) 10 #include <alloca.h> 11 #endif 12 #ifndef O_ACCMODE 13 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) 14 #endif 15 #define SEEK_SET 0 16 #define SEEK_CUR 1 17 #ifdef __STDC__ 18 #if __GNUC__ >= 2 19 #define abort __hide_abort 20 #define exit __hide_exit 21 #endif 22 #include <stdlib.h> 23 #undef exit 24 #undef abort 25 #include <string.h> 26 #else 27 extern char *EXFUN(mktemp,(CONST char*)); 28 extern int EXFUN(fflush,(FILE *)); 29 extern int EXFUN(write,(int, CONST char *, int)); 30 extern int EXFUN(index,(CONST char *, char c)); 31 extern void EXFUN(abort,(void)); 32 extern int EXFUN(close,(int)); 33 extern int EXFUN(fcntl,(int des, int cmd, int e)); 34 extern int EXFUN(fprintf,(FILE *,char *,...)); 35 extern int EXFUN(printf,(char *,...)); 36 extern int EXFUN(qsort,(void *data,int els, int siz, int func())); 37 extern void EXFUN(exit,(int)); 38 extern int EXFUN(fseek,(FILE*, int, int)); 39 extern int EXFUN(fclose,(FILE*)); 40 extern void EXFUN(bcopy,(char*,char*,int)); 41 extern int EXFUN(bcmp,(char *, char *, int)); 42 extern void EXFUN(bzero,(char *, int)); 43 extern PTR EXFUN(memset,(PTR, int, int)); 44 extern void EXFUN(puts,(CONST char*)); 45 extern void EXFUN(fputs,(CONST char*,FILE*)); 46 extern int EXFUN(rmdir,(CONST char *)); 47 extern int EXFUN(getuid,(void)); 48 extern int EXFUN(getgid,(void)); 49 extern int EXFUN(rename,(CONST char *, CONST char*)); 50 extern int EXFUN(etuid,()); 51 extern int EXFUN(etgid,()); 52 extern void EXFUN(perror,(CONST char *)); 53 #ifndef DONTDECLARE_MALLOC 54 extern PTR EXFUN(malloc,(unsigned)); 55 extern PTR EXFUN(realloc, (PTR, unsigned)); 56 #endif 57 58 #ifndef __GNUC__ 59 extern PTR EXFUN(memcpy,(PTR,CONST PTR,unsigned int)); 60 #else 61 /* char * EXFUN( memcpy,(char *,CONST char *,unsigned int)); */ 62 #endif 63 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 extern int EXFUN(free,(PTR)); 77 78 79 extern char *strrchr(); 80 extern char *ctime(); 81 extern int _flsbuf(); 82 extern int fclose(); 83 extern int time(); 84 extern int utimes(); 85 extern int vfprintf(); 86 extern long atol(); 87 extern char *getenv(); 88 extern int fputc(); 89 extern int unlink(); 90 #endif /* __STDC__ */ 91 92 /* EXACT TYPES */ 93 typedef char int8e_type; 94 typedef unsigned char uint8e_type; 95 typedef short int16e_type; 96 typedef unsigned short uint16e_type; 97 typedef int int32e_type; 98 typedef unsigned int uint32e_type; 99 100 101 #ifdef __GNUC__ 102 typedef unsigned long long uint64e_type; 103 104 #else 105 typedef struct { 106 uint32e_type low, high; 107 } uint64e_type; 108 109 #endif 110 /* CORRECT SIZE OR GREATER */ 111 typedef char int8_type; 112 typedef unsigned char uint8_type; 113 typedef short int16_type; 114 typedef unsigned short uint16_type; 115 typedef int int32_type; 116 typedef unsigned int uint32_type; 117 118 #ifdef __GNUC__ 119 typedef unsigned long long uint64_type; 120 typedef long long int64_type; 121 #else 122 typedef struct { 123 uint32e_type low, high; 124 } uint64_type; 125 126 typedef struct { 127 uint32e_type low, high; 128 } int64_type; 129 130 #endif 131 132 133 #define BYTES_IN_PRINTF_INT 4 134 #ifndef __GNUC__ 135 #define uint64_typeLOW(x) (uint32_type)(((x).low)) 136 #define uint64_typeHIGH(x) (uint32_type)(((x).high)) 137 #else 138 #define uint64_typeLOW(x) (uint32_type)(((x) & 0xffffffff)) 139 #define uint64_typeHIGH(x) (uint32_type)(((x) >> 32) & 0xffffffff) 140 #endif 141 142 143 #include "fopen-same.h" 144