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".
13 #include <minix/ansi.h>
16 #include <sys/null.h> /* For NULL */
19 * Focus point of all stdio activity.
21 typedef struct __iobuf
{
32 #define _IOWRITE 0x002
34 #define _IOMYBUF 0x008
38 #define _IOREADING 0x080
39 #define _IOWRITING 0x100
40 #define _IOAPPEND 0x200
43 /* The following definitions are also in <unistd.h>. They should not
50 #define stdin (&__stdin)
51 #define stdout (&__stdout)
52 #define stderr (&__stderr)
59 #include <minix/dir.h>
60 #define FILENAME_MAX DIRSIZ
63 #define L_tmpnam (sizeof("/tmp/") + FILENAME_MAX)
64 #define P_tmpdir "/tmp"
65 #define __STDIO_VA_LIST__ void *
67 typedef long int fpos_t;
71 typedef unsigned int size_t; /* type returned by sizeof */
74 extern FILE *__iotab
[FOPEN_MAX
];
75 extern FILE __stdin
, __stdout
, __stderr
;
77 _PROTOTYPE( int remove
, (const char *_filename
) );
78 _PROTOTYPE( int rename
, (const char *_old
, const char *_new
) );
79 _PROTOTYPE( FILE *tmpfile
, (void) );
80 _PROTOTYPE( char *tmpnam
, (char *_s
) );
81 _PROTOTYPE( int fclose
, (FILE *_stream
) );
82 _PROTOTYPE( int fflush
, (FILE *_stream
) );
83 _PROTOTYPE( FILE *fopen
, (const char *_filename
, const char *_mode
) );
84 _PROTOTYPE( FILE *freopen
,
85 (const char *_filename
, const char *_mode
, FILE *_stream
) );
86 _PROTOTYPE( void setbuf
, (FILE *_stream
, char *_buf
) );
87 _PROTOTYPE( int setvbuf
,
88 (FILE *_stream
, char *_buf
, int _mode
, size_t _size
) );
89 _PROTOTYPE( int fprintf
, (FILE *_stream
, const char *_format
, ...) );
90 _PROTOTYPE( int printf
, (const char *_format
, ...) );
91 _PROTOTYPE( int sprintf
, (char *_s
, const char *_format
, ...) );
92 _PROTOTYPE( int vfprintf
,
93 (FILE *_stream
, const char *_format
, char *_arg
) );
94 _PROTOTYPE( int vprintf
, (const char *_format
, char *_arg
) );
95 _PROTOTYPE( int vsprintf
, (char *_s
, const char *_format
, char *_arg
) );
96 _PROTOTYPE( int fscanf
, (FILE *_stream
, const char *_format
, ...) );
97 _PROTOTYPE( int scanf
, (const char *_format
, ...) );
98 _PROTOTYPE( int sscanf
, (const char *_s
, const char *_format
, ...) );
99 #define vfscanf _doscan
100 _PROTOTYPE( int vfscanf
, (FILE *_stream
, const char *_format
, char *_arg
));
101 _PROTOTYPE( int vscanf
, (const char *_format
, char *_arg
) );
102 _PROTOTYPE( int vsscanf
, (const char *_s
, const char *_format
, char *_arg
));
103 _PROTOTYPE( int fgetc
, (FILE *_stream
) );
104 _PROTOTYPE( char *fgets
, (char *_s
, int _n
, FILE *_stream
) );
105 _PROTOTYPE( int fputc
, (int _c
, FILE *_stream
) );
106 _PROTOTYPE( int fputs
, (const char *_s
, FILE *_stream
) );
107 _PROTOTYPE( int getc
, (FILE *_stream
) );
108 _PROTOTYPE( int getchar
, (void) );
109 _PROTOTYPE( char *gets
, (char *_s
) );
110 _PROTOTYPE( int putc
, (int _c
, FILE *_stream
) );
111 _PROTOTYPE( int putchar
, (int _c
) );
112 _PROTOTYPE( int puts
, (const char *_s
) );
113 _PROTOTYPE( int ungetc
, (int _c
, FILE *_stream
) );
114 _PROTOTYPE( size_t fread
,
115 (void *_ptr
, size_t _size
, size_t _nmemb
, FILE *_stream
) );
116 _PROTOTYPE( size_t fwrite
,
117 (const void *_ptr
, size_t _size
, size_t _nmemb
, FILE *_stream
) );
118 _PROTOTYPE( int fgetpos
, (FILE *_stream
, fpos_t *_pos
) );
119 _PROTOTYPE( int fseek
, (FILE *_stream
, long _offset
, int _whence
) );
120 _PROTOTYPE( int fseeko
, (FILE *_stream
, off_t _offset
, int _whence
) );
121 _PROTOTYPE( int fsetpos
, (FILE *_stream
, fpos_t *_pos
) );
122 _PROTOTYPE( long ftell
, (FILE *_stream
) );
123 _PROTOTYPE( off_t ftello
, (FILE *_stream
) );
124 _PROTOTYPE( void rewind
, (FILE *_stream
) );
125 _PROTOTYPE( void clearerr
, (FILE *_stream
) );
126 _PROTOTYPE( int feof
, (FILE *_stream
) );
127 _PROTOTYPE( int ferror
, (FILE *_stream
) );
128 _PROTOTYPE( void perror
, (const char *_s
) );
129 _PROTOTYPE( int __fillbuf
, (FILE *_stream
) );
130 _PROTOTYPE( int __flushbuf
, (int _c
, FILE *_stream
) );
132 #define getchar() getc(stdin)
133 #define putchar(c) putc(c,stdout)
134 #define getc(p) (--(p)->_count >= 0 ? (int) (*(p)->_ptr++) : \
136 #define putc(c, p) (--(p)->_count >= 0 ? \
137 (int) (*(p)->_ptr++ = (c)) : \
140 #define feof(p) (((p)->_flags & _IOEOF) != 0)
141 #define ferror(p) (((p)->_flags & _IOERR) != 0)
142 #define clearerr(p) ((p)->_flags &= ~(_IOERR|_IOEOF))
145 _PROTOTYPE( int fileno
, (FILE *_stream
) );
146 _PROTOTYPE (FILE *fdopen
, (int _fildes
, const char *_types
) );
147 #define fileno(stream) ((stream)->_fd)
148 #define L_ctermid 255 /* required by POSIX */
149 #define L_cuserid 255 /* required by POSIX */
151 _PROTOTYPE(FILE *popen
, (const char *_command
, const char *_type
));
152 _PROTOTYPE(int pclose
, (FILE *_stream
));
153 _PROTOTYPE(int snprintf
, (char *_s
, size_t _n
, const char *_format
, ...));
154 _PROTOTYPE(int vsnprintf
, (char *_s
, size_t _n
, const char *_format
,
156 _PROTOTYPE(char *fgetln
, (FILE *stream
, size_t *len
));
160 _PROTOTYPE(int asprintf
, (char **ret
, const char *fmt
, ...));
161 _PROTOTYPE(int vasprintf
, (char **ret
, const char *fmt
, char *_arg
));
164 #endif /* _STDIO_H */