#ifndef _STDIO_ #define _STDIO_ typedef struct FILE { int fd; int valid; unsigned char *ptr; unsigned char *buf; int cnt; char eof; char err; } FILE; #ifdef NOANSI FILE *fopen(); char *fgets(); char *gets(); #else #include FILE *fopen(const char *filename,const char *mode); int fclose(FILE *fp); void rewind(FILE *fp); void fflush(FILE *fp); #if 1 /* these require stdarg.h - but I don't have that yet */ int printf(const char *fmt,...); int fprintf(FILE *fp,const char *fmt,...); int sprintf(char *dst,const char *fmt,...); int fscanf(FILE *fp,const char *fmt,...); int scanf(const char *fmt,...); int sscanf(char *str,const char *fmt,...); #else /* so for now, just use k&r decl */ int printf(),fprintf(),sprintf(),fscanf(),scanf(),sscanf(); #endif int vprintf(const char *fmt,va_list arg); int vfprintf(FILE *fp,const char *fmt,va_list arg); int vsprintf(char *dst,const char *fmt,va_list arg); int fgetc(FILE *fp); char *fgets(char *dst,int max,FILE *fp); int fputc(int c,FILE *fp); int fputs(const char *s,FILE *fp); int puts(const char *s); int ungetc(int c,FILE *fp); #endif extern FILE _iob[]; #define getc(p) ((--(p)->cnt>=0)?((int)*(p)->ptr++):_filbuf(p)) #define getchar() getc(stdin) #define putchar(x) putc((x),stdout) #define stdin (&_iob[0]) #define stdout (&_iob[1]) #define stderr (&_iob[2]) #define fileno(p) ((p)->fd) #define clearerr(p) ((p)->err=(p)->eof=0) #define feof(p) ((p)->eof) #define ferror(p) ((p)->err) #define OPEN_MAX 8 #define MAXLN 256 #define NULL 0 #define EOF (-1) #include #endif /* _STDIO_ */