set up rewinddir to work correctly
[unix-history] / usr / src / include / stdio.h
... / ...
CommitLineData
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.7 (Berkeley) %G%
7 */
8
9#ifndef NULL
10#define NULL 0
11#endif
12
13#ifndef FILE
14#define BUFSIZ 1024
15extern struct _iobuf {
16 int _cnt;
17 char *_ptr; /* should be unsigned char */
18 char *_base; /* ditto */
19 int _bufsiz;
20 short _flag;
21 char _file; /* should be short */
22} _iob[];
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
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])
39#ifndef lint
40#define getc(p) (--(p)->_cnt>=0? (int)(*(unsigned char *)(p)->_ptr++):_filbuf(p))
41#endif not lint
42#define getchar() getc(stdin)
43#ifndef lint
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)))
51#endif not lint
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)
56#define clearerr(p) ((p)->_flag &= ~(_IOERR|_IOEOF))
57
58FILE *fopen();
59FILE *fdopen();
60FILE *freopen();
61FILE *popen();
62long ftell();
63char *fgets();
64char *gets();
65int sprintf(); /* here until everyone does it right */
66# endif
67
68#define L_cuserid 9 /* posix says it goes in stdio.h :( */
69char *getlogin();
70char *cuserid();