1: /* 2: * Copyright (c) 1980 Regents of the University of California. 3: * All rights reserved. The Berkeley software License Agreement 4: * specifies the terms and conditions for redistribution. 5: * 6: * @(#)stdio.h 5.3.2 (2.11BSD) 1997/7/29 7: */ 8: 9: # ifndef FILE 10: #define BUFSIZ 1024 11: extern struct _iobuf { 12: int _cnt; 13: char *_ptr; /* should be unsigned char */ 14: char *_base; /* ditto */ 15: int _bufsiz; 16: short _flag; 17: char _file; /* should be short */ 18: } _iob[]; 19: 20: #define _IOREAD 01 21: #define _IOWRT 02 22: #define _IONBF 04 23: #define _IOMYBUF 010 24: #define _IOEOF 020 25: #define _IOERR 040 26: #define _IOSTRG 0100 27: #define _IOLBF 0200 28: #define _IORW 0400 29: 30: /* 31: * The following definition is for ANSI C, which took them 32: * from System V, which brilliantly took internal interface macros and 33: * made them official arguments to setvbuf(), without renaming them. 34: * Hence, these ugly _IOxxx names are *supposed* to appear in user code. 35: */ 36: #define _IOFBF 0 /* setvbuf should set fully buffered */ 37: /* _IONBF and _IOLBF are used from the flags above */ 38: 39: #ifndef NULL 40: #define NULL 0 41: #endif 42: 43: #define FILE struct _iobuf 44: #define EOF (-1) 45: 46: #define stdin (&_iob[0]) 47: #define stdout (&_iob[1]) 48: #define stderr (&_iob[2]) 49: #ifndef lint 50: #define getc(p) (--(p)->_cnt>=0? (int)(*(unsigned char *)(p)->_ptr++):_filbuf(p)) 51: #endif not lint 52: #define getchar() getc(stdin) 53: #ifndef lint 54: #define putc(x, p) (--(p)->_cnt >= 0 ?\ 55: (int)(*(unsigned char *)(p)->_ptr++ = (x)) :\ 56: (((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\ 57: ((*(p)->_ptr = (x)) != '\n' ?\ 58: (int)(*(unsigned char *)(p)->_ptr++) :\ 59: _flsbuf(*(unsigned char *)(p)->_ptr, p)) :\ 60: _flsbuf((unsigned char)(x), p))) 61: #endif not lint 62: #define putchar(x) putc(x,stdout) 63: #define feof(p) (((p)->_flag&_IOEOF)!=0) 64: #define ferror(p) (((p)->_flag&_IOERR)!=0) 65: #define fileno(p) ((p)->_file) 66: #define clearerr(p) ((p)->_flag &= ~(_IOERR|_IOEOF)) 67: 68: FILE *fopen(); 69: FILE *fdopen(); 70: FILE *freopen(); 71: FILE *popen(); 72: long ftell(); 73: char *fgets(); 74: char *gets(); 75: # endif /* _FILE */