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