--- cci/usr/include/stdio.h 2019/07/28 12:24:19 1.1.1.1 +++ cci/usr/include/stdio.h 2019/07/28 12:24:22 1.1.1.2 @@ -1,16 +1,22 @@ -/* stdio.h 1.5 83/08/11 */ -#define BUFSIZ 1024 -#define _NFILE 20 +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)stdio.h 5.1 (Berkeley) 5/30/85 + */ + # ifndef FILE +#define BUFSIZ 1024 +#define _NFILE 64 extern struct _iobuf { int _cnt; - char *_ptr; - char *_base; + char *_ptr; /* should be unsigned char */ + char *_base; /* ditto */ int _bufsiz; short _flag; - char _file; + char _file; /* should be short */ } _iob[_NFILE]; -# endif #define _IOREAD 01 #define _IOWRT 02 @@ -28,9 +34,15 @@ extern struct _iobuf { #define stdin (&_iob[0]) #define stdout (&_iob[1]) #define stderr (&_iob[2]) -#define getc(p) (--(p)->_cnt>=0? *(p)->_ptr++&0377:_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? ((int)(*(p)->_ptr++=(unsigned)(x))):_flsbuf((unsigned)(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) @@ -39,8 +51,11 @@ extern struct _iobuf { FILE *fopen(); FILE *fdopen(); FILE *freopen(); +FILE *popen(); long ftell(); +long fseek(); char *fgets(); #ifdef vax char *sprintf(); /* too painful to do right */ #endif +# endif