Pristine Ack-5.5
[Ack-5.5.git] / include / _tail_cc / stdio.h
1 /* $Id: stdio.h,v 1.10 1994/06/24 11:05:38 ceriel Exp $ */
2 /*
3  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4  * See the copyright notice in the ACK home directory, in the file "Copyright".
5  */
6
7 #ifndef _STDIO_H
8 #define _STDIO_H
9
10 #define BUFSIZ  1024
11 #ifdef __vax
12 #define _NBF    8
13 #endif
14 #ifdef __mc68020
15 #define _NBF    8
16 #endif
17 #ifndef _NBF
18 #define _NBF    1
19 #endif
20 #define _BUFSIZ (_NBF * BUFSIZ)
21 #define _NFILES  20
22 #define NULL       0
23 #define EOF     (-1)
24
25 #define IO_READMODE     1
26 #define IO_WRITEMODE    2
27 #define IO_UNBUFF       4
28 #define IO_EOF         8
29 #define IO_ERR        16
30 #define IO_MYBUF     32
31 #define IO_PERPRINTF   64
32
33 #ifndef FILE
34
35 extern struct _io_buf {
36     int     _count;
37     int     _flags;
38     unsigned char   *_buf;
39     unsigned char   *_ptr;
40     int     _bufsiz;
41     int     _fd;
42 }  *_io_table[_NFILES], _stdin, _stdout, _stderr;
43
44
45 #endif  /* FILE */
46
47 #define FILE struct _io_buf
48
49
50 #define stdin  (&_stdin)
51 #define stdout  (&_stdout)
52 #define stderr  (&_stderr)
53
54 #define getchar()               getc(stdin)
55 #define putchar(c)              putc(c,stdout)
56 #define getc(p)                 (--(p)->_count >= 0 ? (int) (*(p)->_ptr++) : \
57                                         _fillbuf(p))
58 #define putc(c, p)              (--(p)->_count >= 0 ? \
59                                  (int) (*(p)->_ptr++ = (c)) : \
60                                  _flushbuf((c),(p)))
61 #define feof(p)                 (((p)->_flags & IO_EOF) != 0)
62 #define ferror(p)               (((p)->_flags & IO_ERR) != 0)
63 #define fileno(p)               ((p)->_fd)
64 #define io_testflag(p,x)        ((p)->_flags & (x))
65
66 /* If you want a stream to be flushed after each printf use:
67  * 
68  *      io_perprintf(stream);
69  *
70  * If you want to stop with this kind of buffering use:
71  *
72  *      io_noperprintf(stream);
73  */
74
75 #define io_noperprintf(p)       ((p)->_flags &= ~IO_PERPRINTF)
76 #define io_perprintf(p)         ((p)->_flags |= IO_PERPRINTF)
77
78 extern FILE *fopen(), *fdopen(), *freopen(), *popen();
79 extern long ftell();
80 extern setbuf(), rewind();
81 extern char *fgets(), *gets();
82
83 #endif /* _STDIO_H */