2 * stdio.h - input/output definitions
4 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
5 * See the copyright notice in the ACK home directory, in the file "Copyright".
17 * Focus point of all stdio activity.
19 typedef struct __iobuf
{
30 #define _IOWRITE 0x002
32 #define _IOMYBUF 0x008
36 #define _IOREADING 0x080
37 #define _IOWRITING 0x100
38 #define _IOAPPEND 0x200
41 /* The following definitions are also in <unistd.h>. They should not
48 #define stdin (&__stdin)
49 #define stdout (&__stdout)
50 #define stderr (&__stderr)
53 #define NULL ((void *)0)
58 #include <minix/dir.h>
59 #define FILENAME_MAX DIRSIZ
62 #define L_tmpnam (sizeof("/tmp/") + FILENAME_MAX)
63 #define __STDIO_VA_LIST__ void *
65 typedef long int fpos_t;
69 typedef unsigned int size_t; /* type returned by sizeof */
72 extern FILE *__iotab
[FOPEN_MAX
];
73 extern FILE __stdin
, __stdout
, __stderr
;
75 _PROTOTYPE( int remove
, (const char *_filename
) );
76 _PROTOTYPE( int rename
, (const char *_old
, const char *_new
) );
77 _PROTOTYPE( FILE *tmpfile
, (void) );
78 _PROTOTYPE( char *tmpnam
, (char *_s
) );
79 _PROTOTYPE( int fclose
, (FILE *_stream
) );
80 _PROTOTYPE( int fflush
, (FILE *_stream
) );
81 _PROTOTYPE( FILE *fopen
, (const char *_filename
, const char *_mode
) );
82 _PROTOTYPE( FILE *freopen
,
83 (const char *_filename
, const char *_mode
, FILE *_stream
) );
84 _PROTOTYPE( void setbuf
, (FILE *_stream
, char *_buf
) );
85 _PROTOTYPE( int setvbuf
,
86 (FILE *_stream
, char *_buf
, int _mode
, size_t _size
) );
87 _PROTOTYPE( int fprintf
, (FILE *_stream
, const char *_format
, ...) );
88 _PROTOTYPE( int printf
, (const char *_format
, ...) );
89 _PROTOTYPE( int sprintf
, (char *_s
, const char *_format
, ...) );
90 _PROTOTYPE( int vfprintf
,
91 (FILE *_stream
, const char *_format
, char *_arg
) );
92 _PROTOTYPE( int vprintf
, (const char *_format
, char *_arg
) );
93 _PROTOTYPE( int vsprintf
, (char *_s
, const char *_format
, char *_arg
) );
94 _PROTOTYPE( int fscanf
, (FILE *_stream
, const char *_format
, ...) );
95 _PROTOTYPE( int scanf
, (const char *_format
, ...) );
96 _PROTOTYPE( int sscanf
, (const char *_s
, const char *_format
, ...) );
97 #define vfscanf _doscan
98 _PROTOTYPE( int vfscanf
, (FILE *_stream
, const char *_format
, char *_arg
));
99 _PROTOTYPE( int vscanf
, (const char *_format
, char *_arg
) );
100 _PROTOTYPE( int vsscanf
, (const char *_s
, const char *_format
, char *_arg
));
101 _PROTOTYPE( int fgetc
, (FILE *_stream
) );
102 _PROTOTYPE( char *fgets
, (char *_s
, int _n
, FILE *_stream
) );
103 _PROTOTYPE( int fputc
, (int _c
, FILE *_stream
) );
104 _PROTOTYPE( int fputs
, (const char *_s
, FILE *_stream
) );
105 _PROTOTYPE( int getc
, (FILE *_stream
) );
106 _PROTOTYPE( int getchar
, (void) );
107 _PROTOTYPE( char *gets
, (char *_s
) );
108 _PROTOTYPE( int putc
, (int _c
, FILE *_stream
) );
109 _PROTOTYPE( int putchar
, (int _c
) );
110 _PROTOTYPE( int puts
, (const char *_s
) );
111 _PROTOTYPE( int ungetc
, (int _c
, FILE *_stream
) );
112 _PROTOTYPE( size_t fread
,
113 (void *_ptr
, size_t _size
, size_t _nmemb
, FILE *_stream
) );
114 _PROTOTYPE( size_t fwrite
,
115 (const void *_ptr
, size_t _size
, size_t _nmemb
, FILE *_stream
) );
116 _PROTOTYPE( int fgetpos
, (FILE *_stream
, fpos_t *_pos
) );
117 _PROTOTYPE( int fseek
, (FILE *_stream
, long _offset
, int _whence
) );
118 _PROTOTYPE( int fsetpos
, (FILE *_stream
, fpos_t *_pos
) );
119 _PROTOTYPE( long ftell
, (FILE *_stream
) );
120 _PROTOTYPE( void rewind
, (FILE *_stream
) );
121 _PROTOTYPE( void clearerr
, (FILE *_stream
) );
122 _PROTOTYPE( int feof
, (FILE *_stream
) );
123 _PROTOTYPE( int ferror
, (FILE *_stream
) );
124 _PROTOTYPE( void perror
, (const char *_s
) );
125 _PROTOTYPE( int __fillbuf
, (FILE *_stream
) );
126 _PROTOTYPE( int __flushbuf
, (int _c
, FILE *_stream
) );
128 #define getchar() getc(stdin)
129 #define putchar(c) putc(c,stdout)
130 #define getc(p) (--(p)->_count >= 0 ? (int) (*(p)->_ptr++) : \
132 #define putc(c, p) (--(p)->_count >= 0 ? \
133 (int) (*(p)->_ptr++ = (c)) : \
136 #define feof(p) (((p)->_flags & _IOEOF) != 0)
137 #define ferror(p) (((p)->_flags & _IOERR) != 0)
138 #define clearerr(p) ((p)->_flags &= ~(_IOERR|_IOEOF))
141 _PROTOTYPE( int fileno
, (FILE *_stream
) );
142 _PROTOTYPE (FILE *fdopen
, (int _fildes
, const char *_types
) );
143 #define fileno(stream) ((stream)->_fd)
144 #define L_ctermid 255 /* required by POSIX */
145 #define L_cuserid 255 /* required by POSIX */
147 _PROTOTYPE(FILE *popen
, (const char *_command
, const char *_type
));
148 _PROTOTYPE(int pclose
, (FILE *_stream
));
149 _PROTOTYPE(int snprintf
, (char *_s
, size_t _n
, const char *_format
, ...));
150 _PROTOTYPE(int vsnprintf
, (char *_s
, size_t _n
, const char *_format
,
154 #endif /* _STDIO_H */