X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/7002c7bd7b2320133791f6db4aa012a70dadd50c..ca67e7b465996afb3821d6a075c4dc6a7f0f5d52:/usr/src/include/stdio.h diff --git a/usr/src/include/stdio.h b/usr/src/include/stdio.h index d580e48549..5721930097 100644 --- a/usr/src/include/stdio.h +++ b/usr/src/include/stdio.h @@ -1,15 +1,21 @@ -/* @(#)stdio.h 1.1 (Berkeley) %G% */ -#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.4 (Berkeley) 10/22/87 + */ + # 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 @@ -27,16 +33,31 @@ 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)) +#ifndef lint +#define getc(p) (--(p)->_cnt>=0? (int)(*(unsigned char *)(p)->_ptr++):_filbuf(p)) +#endif not lint #define getchar() getc(stdin) -#define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(unsigned)(x))):_flsbuf((unsigned)(x),p)) +#ifndef lint +#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))) +#endif not lint #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(); char *fgets(); +char *gets(); +int sprintf(); /* here until everyone does it right */ +# endif