X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/265d6db32902a4c2288266fbf90d645f842512cc..178376034accaeb72b22b1d4cd2657b394495700:/usr/src/include/stdio.h diff --git a/usr/src/include/stdio.h b/usr/src/include/stdio.h index 14105e8864..f35c0770aa 100644 --- a/usr/src/include/stdio.h +++ b/usr/src/include/stdio.h @@ -1,16 +1,14 @@ -/* stdio.h 1.7 84/11/08 */ -#define BUFSIZ 1024 -#define _NFILE 20 +/* stdio.h 1.12 85/05/30 */ # ifndef FILE +#define BUFSIZ 1024 extern struct _iobuf { int _cnt; - char *_ptr; - char *_base; + char *_ptr; /* should be unsigned char */ + char *_base; /* ditto */ int _bufsiz; short _flag; - char _file; -} _iob[_NFILE]; -# endif + char _file; /* should be short */ +} _iob[]; #define _IOREAD 01 #define _IOWRT 02 @@ -28,22 +26,30 @@ extern struct _iobuf { #define stdin (&_iob[0]) #define stdout (&_iob[1]) #define stderr (&_iob[2]) -#define getc(p) (--(p)->_cnt >= 0 ? *(unsigned char *)(p)->_ptr++ : _filbuf(p)) +#define getc(p) (--(p)->_cnt>=0? (int)(*(unsigned char *)(p)->_ptr++):_filbuf(p)) #define getchar() getc(stdin) -#define putc(x, p) (--(p)->_cnt >= 0 ? (*(p)->_ptr++ = (x)) :\ - ((p)->_flag&_IOLBF && -(p)->_cnt <= (p)->_bufsiz && (x)!='\n' ?\ - *(p)->_ptr++ = (x) : _flsbuf(x, p))) +#define putc(x, p) (--(p)->_cnt >= 0 ?\ + (int)(*(unsigned char *)(p)->_ptr++ = (x)) :\ + (((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\ + ((*(p)->_ptr = (x)) != '\n' ?\ + (int)(*(unsigned char *)(p)->_ptr++) :\ + _flsbuf(*(unsigned char *)(p)->_ptr, p)) :\ + _flsbuf((unsigned char)(x), p))) #define putchar(x) putc(x,stdout) #define feof(p) (((p)->_flag&_IOEOF)!=0) #define ferror(p) (((p)->_flag&_IOERR)!=0) #define fileno(p) ((p)->_file) +#define clearerr(p) ((p)->_flag &= ~(_IOERR|_IOEOF)) FILE *fopen(); FILE *fdopen(); FILE *freopen(); +FILE *popen(); long ftell(); +long fseek(); char *fgets(); char *gets(); #ifdef vax char *sprintf(); /* too painful to do right */ #endif +# endif