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".
7 /* $Id: stdio.h,v 1.11 1994/06/24 11:41:21 ceriel Exp $ */
13 * Focus point of all stdio activity.
15 typedef struct __iobuf {
26 #define _IOWRITE 0x002
28 #define _IOMYBUF 0x008
32 #define _IOREADING 0x080
33 #define _IOWRITING 0x100
34 #define _IOAPPEND 0x200
36 /* The following definitions are also in <unistd.h>. They should not
43 #define stdin (&__stdin)
44 #define stdout (&__stdout)
45 #define stderr (&__stderr)
48 #define NULL ((void *)0)
54 #define FILENAME_MAX 255
56 #define FILENAME_MAX 14
59 #define L_tmpnam (sizeof("/tmp/") + 15)
61 typedef long int fpos_t;
65 typedef unsigned int size_t; /* type returned by sizeof */
68 extern FILE *__iotab[FOPEN_MAX];
69 extern FILE __stdin, __stdout, __stderr;
71 int remove(const char *_filename);
72 int rename(const char *_old, const char *_new);
74 char *tmpnam(char *_s);
75 int fclose(FILE *_stream);
76 int fflush(FILE *_stream);
77 FILE *fopen(const char *_filename, const char *_mode);
78 FILE *freopen(const char *_filename, const char *_mode, FILE *_stream);
79 void setbuf(FILE *_stream, char *_buf);
80 int setvbuf(FILE *_stream, char *_buf, int _mode, size_t _size);
81 int fprintf(FILE *_stream, const char *_format, ...);
82 int fscanf(FILE *_stream, const char *_format, ...);
83 int printf(const char *_format, ...);
84 int scanf(const char *_format, ...);
85 int sprintf(char *_s, const char *_format, ...);
86 int sscanf(const char *_s, const char *_format, ...);
87 int vfprintf(FILE *_stream, const char *_format, char *_arg);
88 int vprintf(const char *_format, char *_arg);
89 int vsprintf(char *_s, const char *_format, char *_arg);
90 int fgetc(FILE *_stream);
91 char *fgets(char *_s, int _n, FILE *_stream);
92 int fputc(int _c, FILE *_stream);
93 int fputs(const char *_s, FILE *_stream);
94 int getc(FILE *_stream);
97 int putc(int _c, FILE *_stream);
99 int puts(const char *_s);
100 int ungetc(int _c, FILE *_stream);
101 size_t fread(void *_ptr, size_t _size, size_t _nmemb, FILE *_stream);
102 size_t fwrite(const void *_ptr, size_t _size, size_t _nmemb, FILE *_stream);
103 int fgetpos(FILE *_stream, fpos_t *_pos);
104 int fseek(FILE *_stream, long _offset, int _whence);
105 int fsetpos(FILE *_stream, fpos_t *_pos);
106 long ftell(FILE *_stream);
107 void rewind(FILE *_stream);
108 void clearerr(FILE *_stream);
109 int feof(FILE *_stream);
110 int ferror(FILE *_stream);
111 void perror(const char *_s);
113 int __fillbuf(FILE *_stream);
114 int __flushbuf(int _c, FILE *_stream);
117 #define getchar() getc(stdin)
118 #define putchar(c) putc(c,stdout)
119 #define getc(p) (--(p)->_count >= 0 ? (int) (*(p)->_ptr++) : \
121 #define putc(c, p) (--(p)->_count >= 0 ? \
122 (int) (*(p)->_ptr++ = (c)) : \
125 #define feof(p) (((p)->_flags & _IOEOF) != 0)
126 #define ferror(p) (((p)->_flags & _IOERR) != 0)
127 #define clearerr(p) ((p)->_flags &= ~(_IOERR|_IOEOF))
129 #if defined(__BSD4_2) || defined(__USG) || defined(_POSIX_SOURCE)
130 int fileno(FILE *_stream);
131 FILE *fdopen(int fildes, const char *type);
132 #define fileno(stream) ((stream)->_fd)
133 #endif /* __BSD4_2 || __USG || _POSIX_SOURCE */
135 #endif /* _STDIO_H */