Commit | Line | Data |
---|---|---|
586c39b1 DF |
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 | * | |
8cf3ae7d | 6 | * @(#)stdio.h 5.6 (Berkeley) %G% |
586c39b1 DF |
7 | */ |
8 | ||
7002c7bd | 9 | # ifndef FILE |
17837603 | 10 | #define BUFSIZ 1024 |
7002c7bd MT |
11 | extern struct _iobuf { |
12 | int _cnt; | |
17837603 S |
13 | char *_ptr; /* should be unsigned char */ |
14 | char *_base; /* ditto */ | |
f4c06a32 | 15 | int _bufsiz; |
7002c7bd | 16 | short _flag; |
17837603 S |
17 | char _file; /* should be short */ |
18 | } _iob[]; | |
7002c7bd MT |
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 | #define NULL 0 | |
30 | #define FILE struct _iobuf | |
31 | #define EOF (-1) | |
32 | ||
33 | #define stdin (&_iob[0]) | |
34 | #define stdout (&_iob[1]) | |
35 | #define stderr (&_iob[2]) | |
8f67787a | 36 | #ifndef lint |
d3ea1b0a | 37 | #define getc(p) (--(p)->_cnt>=0? (int)(*(unsigned char *)(p)->_ptr++):_filbuf(p)) |
8f67787a | 38 | #endif not lint |
7002c7bd | 39 | #define getchar() getc(stdin) |
8f67787a | 40 | #ifndef lint |
9ad481cf RC |
41 | #define putc(x, p) (--(p)->_cnt >= 0 ?\ |
42 | (int)(*(unsigned char *)(p)->_ptr++ = (x)) :\ | |
43 | (((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\ | |
44 | ((*(p)->_ptr = (x)) != '\n' ?\ | |
45 | (int)(*(unsigned char *)(p)->_ptr++) :\ | |
46 | _flsbuf(*(unsigned char *)(p)->_ptr, p)) :\ | |
47 | _flsbuf((unsigned char)(x), p))) | |
8f67787a | 48 | #endif not lint |
7002c7bd MT |
49 | #define putchar(x) putc(x,stdout) |
50 | #define feof(p) (((p)->_flag&_IOEOF)!=0) | |
51 | #define ferror(p) (((p)->_flag&_IOERR)!=0) | |
52 | #define fileno(p) ((p)->_file) | |
17837603 | 53 | #define clearerr(p) ((p)->_flag &= ~(_IOERR|_IOEOF)) |
7002c7bd MT |
54 | |
55 | FILE *fopen(); | |
56 | FILE *fdopen(); | |
57 | FILE *freopen(); | |
17837603 | 58 | FILE *popen(); |
7002c7bd MT |
59 | long ftell(); |
60 | char *fgets(); | |
56f5aad0 | 61 | char *gets(); |
06eef7c4 | 62 | int sprintf(); /* here until everyone does it right */ |
17837603 | 63 | # endif |
cede253f KF |
64 | |
65 | #define L_cuserid 9 /* posix says it goes in stdio.h :( */ | |
8cf3ae7d KF |
66 | char *getlogin(); |
67 | char *cuserid(); |