Repository navigation
Expand file tree
/
Copy pathstdio.h
More file actions
executable file
·156 lines (137 loc) · 5.06 KB
/
Copy pathstdio.h
File metadata and controls
executable file
·156 lines (137 loc) · 5.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
* stdio.h - input/output definitions
*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
#ifndef _STDIO_H
#define _STDIO_H
#ifndef _ANSI_H
#include <ansi.h>
#endif
/*
* Focus point of all stdio activity.
*/
typedef struct __iobuf {
int _count;
int _fd;
int _flags;
int _bufsiz;
unsigned char *_buf;
unsigned char *_ptr;
} FILE;
#define _IOFBF 0x000
#define _IOREAD 0x001
#define _IOWRITE 0x002
#define _IONBF 0x004
#define _IOMYBUF 0x008
#define _IOEOF 0x010
#define _IOERR 0x020
#define _IOLBF 0x040
#define _IOREADING 0x080
#define _IOWRITING 0x100
#define _IOAPPEND 0x200
#define _IOFIFO 0x400
/* The following definitions are also in <unistd.h>. They should not
* conflict.
*/
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define stdin (&__stdin)
#define stdout (&__stdout)
#define stderr (&__stderr)
#define BUFSIZ 1024
#define NULL ((void *)0)
#define EOF (-1)
#define FOPEN_MAX 20
#include <sys/dir.h>
#define FILENAME_MAX DIRSIZ
#define TMP_MAX 999
#define L_tmpnam (sizeof("/tmp/") + FILENAME_MAX)
#define __STDIO_VA_LIST__ void *
typedef long int fpos_t;
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* type returned by sizeof */
#endif /* _SIZE_T */
extern FILE *__iotab[FOPEN_MAX];
extern FILE __stdin, __stdout, __stderr;
_PROTOTYPE( int remove, (const char *_filename) );
_PROTOTYPE( int rename, (const char *_old, const char *_new) );
_PROTOTYPE( FILE *tmpfile, (void) );
_PROTOTYPE( char *tmpnam, (char *_s) );
_PROTOTYPE( int fclose, (FILE *_stream) );
_PROTOTYPE( int fflush, (FILE *_stream) );
_PROTOTYPE( FILE *fopen, (const char *_filename, const char *_mode) );
_PROTOTYPE( FILE *freopen,
(const char *_filename, const char *_mode, FILE *_stream) );
_PROTOTYPE( void setbuf, (FILE *_stream, char *_buf) );
_PROTOTYPE( int setvbuf,
(FILE *_stream, char *_buf, int _mode, size_t _size) );
_PROTOTYPE( int fprintf, (FILE *_stream, const char *_format, ...) );
_PROTOTYPE( int printf, (const char *_format, ...) );
_PROTOTYPE( int sprintf, (char *_s, const char *_format, ...) );
_PROTOTYPE( int vfprintf,
(FILE *_stream, const char *_format, char *_arg) );
_PROTOTYPE( int vprintf, (const char *_format, char *_arg) );
_PROTOTYPE( int vsprintf, (char *_s, const char *_format, char *_arg) );
_PROTOTYPE( int fscanf, (FILE *_stream, const char *_format, ...) );
_PROTOTYPE( int scanf, (const char *_format, ...) );
_PROTOTYPE( int sscanf, (const char *_s, const char *_format, ...) );
#define vfscanf _doscan
_PROTOTYPE( int vfscanf, (FILE *_stream, const char *_format, char *_arg));
_PROTOTYPE( int vscanf, (const char *_format, char *_arg) );
_PROTOTYPE( int vsscanf, (const char *_s, const char *_format, char *_arg));
_PROTOTYPE( int fgetc, (FILE *_stream) );
_PROTOTYPE( char *fgets, (char *_s, int _n, FILE *_stream) );
_PROTOTYPE( int fputc, (int _c, FILE *_stream) );
_PROTOTYPE( int fputs, (const char *_s, FILE *_stream) );
_PROTOTYPE( int getc, (FILE *_stream) );
_PROTOTYPE( int getchar, (void) );
_PROTOTYPE( char *gets, (char *_s) );
_PROTOTYPE( int putc, (int _c, FILE *_stream) );
_PROTOTYPE( int putchar, (int _c) );
_PROTOTYPE( int puts, (const char *_s) );
_PROTOTYPE( int ungetc, (int _c, FILE *_stream) );
_PROTOTYPE( size_t fread,
(void *_ptr, size_t _size, size_t _nmemb, FILE *_stream) );
_PROTOTYPE( size_t fwrite,
(const void *_ptr, size_t _size, size_t _nmemb, FILE *_stream) );
_PROTOTYPE( int fgetpos, (FILE *_stream, fpos_t *_pos) );
_PROTOTYPE( int fseek, (FILE *_stream, long _offset, int _whence) );
_PROTOTYPE( int fsetpos, (FILE *_stream, fpos_t *_pos) );
_PROTOTYPE( long ftell, (FILE *_stream) );
_PROTOTYPE( void rewind, (FILE *_stream) );
_PROTOTYPE( void clearerr, (FILE *_stream) );
_PROTOTYPE( int feof, (FILE *_stream) );
_PROTOTYPE( int ferror, (FILE *_stream) );
_PROTOTYPE( void perror, (const char *_s) );
_PROTOTYPE( int __fillbuf, (FILE *_stream) );
_PROTOTYPE( int __flushbuf, (int _c, FILE *_stream) );
#define getchar() getc(stdin)
#define putchar(c) putc(c,stdout)
#define getc(p) (--(p)->_count >= 0 ? (int) (*(p)->_ptr++) : \
__fillbuf(p))
#define putc(c, p) (--(p)->_count >= 0 ? \
(int) (*(p)->_ptr++ = (c)) : \
__flushbuf((c),(p)))
#define feof(p) (((p)->_flags & _IOEOF) != 0)
#define ferror(p) (((p)->_flags & _IOERR) != 0)
#define clearerr(p) ((p)->_flags &= ~(_IOERR|_IOEOF))
#ifdef _POSIX_SOURCE
_PROTOTYPE( int fileno, (FILE *_stream) );
_PROTOTYPE (FILE *fdopen, (int _fildes, const char *_types) );
#define fileno(stream) ((stream)->_fd)
#define L_ctermid 255 /* required by POSIX */
#define L_cuserid 255 /* required by POSIX */
#endif
#ifdef _MINIX
_PROTOTYPE(FILE *popen, (const char *_command, const char *_type));
_PROTOTYPE(int pclose, (FILE *_stream));
_PROTOTYPE(int snprintf, (char *_s, size_t _n, const char *_format, ...));
_PROTOTYPE(int vsnprintf, (char *_s, size_t _n, const char *_format,
char *_arg) );
#endif
#endif /* _STDIO_H */