1: #define BUFSIZ 512 2: #define RMSSIZ 256 3: #define _NFILE 20 4: # ifndef FILE 5: extern struct _iobuf { 6: char *_ptr; 7: char *_rms; 8: char *_base; 9: long int _sectr; 10: short int _flag; 11: short int _cnt; 12: char _links; 13: char _file; 14: short int _maxoffset; 15: long int _maxsectr; 16: } _iob[_NFILE]; 17: # endif 18: 19: #define _IOREAD 01 20: #define _IOWRT 02 21: #define _IOBIN 04 22: #define _IOPRT 010 23: #define _IOMODE 014 24: #define _IOTXT 00 25: #define _IOMYBUF 002000 26: #define _IOEOF 020 27: #define _IOERR 040 28: #define _IOSTRG 0100 29: #define _IONBF 0200 30: #define _IOTTY 0400 31: #define _IODIRT 01000 32: #define NULL 0 33: #define FILE struct _iobuf 34: #define EOF (-1) 35: 36: #define stdin (&_iob[0]) 37: #define stdout (&_iob[1]) 38: #define stderr (&_iob[2]) 39: #define getc(p) (--(p)->_cnt>=0? *(p)->_ptr++&0377:_filbuf(p)) 40: #define getchar() getc(stdin) 41: #define putchar(x) putc(x,stdout) 42: #define feof(p) (((p)->_flag&_IOEOF)!=0) 43: #define ferror(p) (((p)->_flag&_IOERR)!=0) 44: #define fileno(p) p->_file 45: 46: FILE *fopen(); 47: FILE *freopen(); 48: extern struct io$head { 49: int initzd; 50: int lobr; 51: FILE *ufiles[_NFILE]; 52: int hibr; 53: int mxbr; 54: int lopg; 55: int hipg; 56: int mxpg; 57: char stinrms[RMSSIZ]; 58: char storms[RMSSIZ]; 59: char sterrms[RMSSIZ]; 60: char stinbuf[BUFSIZ]; 61: char stobuf[BUFSIZ]; 62: char sterbuf[BUFSIZ]; 63: } io_com ; 64: 65: #define check(c,s); if (c) {errno = s; return(-1);} 66: #define EBADF 9 67: #define EINVAL 22 68: #define EMFILE 24 69: 70: extern int errno;