165874Sbostic #include <fcntl.h> 265874Sbostic #include <errno.h> 365874Sbostic #include <stdio.h> 465874Sbostic #include <sys/types.h> 565874Sbostic #include <sys/stat.h> 665874Sbostic #include <ctype.h> 765874Sbostic #include <string.h> 865874Sbostic #include <sys/file.h> 9*65877Sbostic #if !defined(__GNUC__) 1065874Sbostic #include <alloca.h> 11*65877Sbostic #endif 1265874Sbostic #ifndef O_ACCMODE 1365874Sbostic #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) 1465874Sbostic #endif 1565874Sbostic #define SEEK_SET 0 1665874Sbostic #define SEEK_CUR 1 1765874Sbostic #ifdef __STDC__ 1865874Sbostic #if __GNUC__ >= 2 1965874Sbostic #define abort __hide_abort 2065874Sbostic #define exit __hide_exit 2165874Sbostic #endif 2265874Sbostic #include <stdlib.h> 2365874Sbostic #undef exit 2465874Sbostic #undef abort 2565874Sbostic #include <string.h> 2665874Sbostic #else 2765874Sbostic extern char *EXFUN(mktemp,(CONST char*)); 2865874Sbostic extern int EXFUN(fflush,(FILE *)); 2965874Sbostic extern int EXFUN(write,(int, CONST char *, int)); 3065874Sbostic extern int EXFUN(index,(CONST char *, char c)); 3165874Sbostic extern void EXFUN(abort,(void)); 3265874Sbostic extern int EXFUN(close,(int)); 3365874Sbostic extern int EXFUN(fcntl,(int des, int cmd, int e)); 3465874Sbostic extern int EXFUN(fprintf,(FILE *,char *,...)); 3565874Sbostic extern int EXFUN(printf,(char *,...)); 3665874Sbostic extern int EXFUN(qsort,(void *data,int els, int siz, int func())); 3765874Sbostic extern void EXFUN(exit,(int)); 3865874Sbostic extern int EXFUN(fseek,(FILE*, int, int)); 3965874Sbostic extern int EXFUN(fclose,(FILE*)); 4065874Sbostic extern void EXFUN(bcopy,(char*,char*,int)); 4165874Sbostic extern int EXFUN(bcmp,(char *, char *, int)); 4265874Sbostic extern void EXFUN(bzero,(char *, int)); 4365874Sbostic extern PTR EXFUN(memset,(PTR, int, int)); 4465874Sbostic extern void EXFUN(puts,(CONST char*)); 4565874Sbostic extern void EXFUN(fputs,(CONST char*,FILE*)); 4665874Sbostic extern int EXFUN(rmdir,(CONST char *)); 4765874Sbostic extern int EXFUN(getuid,(void)); 4865874Sbostic extern int EXFUN(getgid,(void)); 4965874Sbostic extern int EXFUN(rename,(CONST char *, CONST char*)); 5065874Sbostic extern int EXFUN(etuid,()); 5165874Sbostic extern int EXFUN(etgid,()); 5265874Sbostic extern void EXFUN(perror,(CONST char *)); 5365874Sbostic #ifndef DONTDECLARE_MALLOC 5465874Sbostic extern PTR EXFUN(malloc,(unsigned)); 5565874Sbostic extern PTR EXFUN(realloc, (PTR, unsigned)); 5665874Sbostic #endif 5765874Sbostic 5865874Sbostic #ifndef __GNUC__ 5965874Sbostic extern PTR EXFUN(memcpy,(PTR,CONST PTR,unsigned int)); 6065874Sbostic #else 6165874Sbostic /* char * EXFUN( memcpy,(char *,CONST char *,unsigned int)); */ 6265874Sbostic #endif 6365874Sbostic 6465874Sbostic 6565874Sbostic extern char * strchr(); 6665874Sbostic extern char *getenv(); 6765874Sbostic extern char *memchr(); 6865874Sbostic extern char *strrchr(); 6965874Sbostic extern int chmod(); 7065874Sbostic extern int fread(); 7165874Sbostic extern int fstat(); 7265874Sbostic extern int fwrite(); 7365874Sbostic extern int sscanf(); 7465874Sbostic extern int stat(); 7565874Sbostic extern int strtol(); 7665874Sbostic extern int EXFUN(free,(PTR)); 7765874Sbostic 7865874Sbostic 7965874Sbostic extern char *strrchr(); 8065874Sbostic extern char *ctime(); 8165874Sbostic extern int _flsbuf(); 8265874Sbostic extern int fclose(); 8365874Sbostic extern int time(); 8465874Sbostic extern int utimes(); 8565874Sbostic extern int vfprintf(); 8665874Sbostic extern long atol(); 8765874Sbostic extern char *getenv(); 8865874Sbostic extern int fputc(); 8965874Sbostic extern int unlink(); 9065874Sbostic #endif /* __STDC__ */ 9165874Sbostic 9265874Sbostic /* EXACT TYPES */ 9365874Sbostic typedef char int8e_type; 9465874Sbostic typedef unsigned char uint8e_type; 9565874Sbostic typedef short int16e_type; 9665874Sbostic typedef unsigned short uint16e_type; 9765874Sbostic typedef int int32e_type; 9865874Sbostic typedef unsigned int uint32e_type; 9965874Sbostic 10065874Sbostic 10165874Sbostic #ifdef __GNUC__ 10265874Sbostic typedef unsigned long long uint64e_type; 10365874Sbostic 10465874Sbostic #else 10565874Sbostic typedef struct { 10665874Sbostic uint32e_type low, high; 10765874Sbostic } uint64e_type; 10865874Sbostic 10965874Sbostic #endif 11065874Sbostic /* CORRECT SIZE OR GREATER */ 11165874Sbostic typedef char int8_type; 11265874Sbostic typedef unsigned char uint8_type; 11365874Sbostic typedef short int16_type; 11465874Sbostic typedef unsigned short uint16_type; 11565874Sbostic typedef int int32_type; 11665874Sbostic typedef unsigned int uint32_type; 11765874Sbostic 11865874Sbostic #ifdef __GNUC__ 11965874Sbostic typedef unsigned long long uint64_type; 12065874Sbostic typedef long long int64_type; 12165874Sbostic #else 12265874Sbostic typedef struct { 12365874Sbostic uint32e_type low, high; 12465874Sbostic } uint64_type; 12565874Sbostic 12665874Sbostic typedef struct { 12765874Sbostic uint32e_type low, high; 12865874Sbostic } int64_type; 12965874Sbostic 13065874Sbostic #endif 13165874Sbostic 13265874Sbostic 13365874Sbostic #define BYTES_IN_PRINTF_INT 4 13465874Sbostic #ifndef __GNUC__ 13565874Sbostic #define uint64_typeLOW(x) (uint32_type)(((x).low)) 13665874Sbostic #define uint64_typeHIGH(x) (uint32_type)(((x).high)) 13765874Sbostic #else 13865874Sbostic #define uint64_typeLOW(x) (uint32_type)(((x) & 0xffffffff)) 13965874Sbostic #define uint64_typeHIGH(x) (uint32_type)(((x) >> 32) & 0xffffffff) 14065874Sbostic #endif 14165874Sbostic 14265874Sbostic 14365874Sbostic #include "fopen-same.h" 144