set up rewinddir to work correctly
[unix-history] / usr / src / include / stdio.h
CommitLineData
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 *
97b8a2b7 6 * @(#)stdio.h 5.7 (Berkeley) %G%
586c39b1
DF
7 */
8
97b8a2b7
KB
9#ifndef NULL
10#define NULL 0
11#endif
12
13#ifndef FILE
17837603 14#define BUFSIZ 1024
7002c7bd
MT
15extern struct _iobuf {
16 int _cnt;
17837603
S
17 char *_ptr; /* should be unsigned char */
18 char *_base; /* ditto */
f4c06a32 19 int _bufsiz;
7002c7bd 20 short _flag;
17837603
S
21 char _file; /* should be short */
22} _iob[];
7002c7bd
MT
23
24#define _IOREAD 01
25#define _IOWRT 02
26#define _IONBF 04
27#define _IOMYBUF 010
28#define _IOEOF 020
29#define _IOERR 040
30#define _IOSTRG 0100
31#define _IOLBF 0200
32#define _IORW 0400
7002c7bd
MT
33#define FILE struct _iobuf
34#define EOF (-1)
35
36#define stdin (&_iob[0])
37#define stdout (&_iob[1])
38#define stderr (&_iob[2])
8f67787a 39#ifndef lint
d3ea1b0a 40#define getc(p) (--(p)->_cnt>=0? (int)(*(unsigned char *)(p)->_ptr++):_filbuf(p))
8f67787a 41#endif not lint
7002c7bd 42#define getchar() getc(stdin)
8f67787a 43#ifndef lint
9ad481cf
RC
44#define putc(x, p) (--(p)->_cnt >= 0 ?\
45 (int)(*(unsigned char *)(p)->_ptr++ = (x)) :\
46 (((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\
47 ((*(p)->_ptr = (x)) != '\n' ?\
48 (int)(*(unsigned char *)(p)->_ptr++) :\
49 _flsbuf(*(unsigned char *)(p)->_ptr, p)) :\
50 _flsbuf((unsigned char)(x), p)))
8f67787a 51#endif not lint
7002c7bd
MT
52#define putchar(x) putc(x,stdout)
53#define feof(p) (((p)->_flag&_IOEOF)!=0)
54#define ferror(p) (((p)->_flag&_IOERR)!=0)
55#define fileno(p) ((p)->_file)
17837603 56#define clearerr(p) ((p)->_flag &= ~(_IOERR|_IOEOF))
7002c7bd
MT
57
58FILE *fopen();
59FILE *fdopen();
60FILE *freopen();
17837603 61FILE *popen();
7002c7bd
MT
62long ftell();
63char *fgets();
56f5aad0 64char *gets();
06eef7c4 65int sprintf(); /* here until everyone does it right */
17837603 66# endif
cede253f
KF
67
68#define L_cuserid 9 /* posix says it goes in stdio.h :( */
8cf3ae7d
KF
69char *getlogin();
70char *cuserid();