BSD 3 development
[unix-history] / .ref-BSD-2 / src / libNS / stdio.h
CommitLineData
d0391c55
KS
1/* Copyright (c) 1979 Regents of the University of California */
2#define BUFSIZ 512
3#define _NFILE 20
4# ifndef FILE
5extern struct _iobuf {
6 int _cnt;
7 char *_ptr;
8 char *_base;
9 char _flag;
10 char _file;
11short int _delta;
12} _iob[_NFILE];
13# endif
14
15#define _IOREAD 01
16#define _IOWRT 02
17#define _IONBF 04
18#define _IOMYBUF 010
19#define _IOEOF 020
20#define _IOERR 040
21#define _IOSTRG 0100
22#define _IODIRT 0200
23#define NULL 0
24#define FILE struct _iobuf
25#define EOF (-1)
26
27#define stdin (&_iob[0])
28#define stdout (&_iob[1])
29#define stderr (&_iob[2])
30#define getc(p) (--(p)->_cnt>=0? *(p)->_ptr++&0377:_filbuf(p))
31#define getchar() getc(stdin)
32#define peekc(p) (p->_cnt>0? *(p)->_ptr&0377:_filbuf(p)==-1?-1:((p)->_cnt++,*--(p)->_ptr&0377))
33#define peekchar() peekc(stdin)
34#define putc(x,p) (((p)->_flag |= _IODIRT,--(p)->_cnt)>=0? ((int)(*(p)->_ptr++ = (unsigned)(x))):_flsbuf( (unsigned)(x),p))
35#define putchar(x) putc(x,stdout)
36#define feof(p) (((p)->_flag&_IOEOF)!=0)
37#define ferror(p) (((p)->_flag&_IOERR)!=0)
38#define fileno(p) p->_file
39
40FILE *fopen();
41FILE *fdopen();
42FILE *freopen();
43long ftell();
44char *fgets();
45short getsh();
46short putsh();