5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
8 Desc: ANSI-C header file stdio.h
11 #include <sys/_types.h>
12 #include <sys/cdefs.h>
13 #include <sys/arosc.h>
19 typedef __off_t
fpos_t;
22 We are supposed to declare it, without including the file.
23 This is too compiler specific to handle at the moment.
29 /* Need to protect against standard Amiga includes */
34 /* Buffering methods that can be specified with setvbuf() */
35 #define _IOFBF 0 /* Fully buffered. */
36 #define _IOLBF 1 /* Line buffered. */
37 #define _IONBF 2 /* Not buffered. */
42 #define FILENAME_MAX 256 /* Amiga files are 256 */
43 #define FOPEN_MAX 16 /* Must be > 8 */
44 #define TMP_MAX 10240 /* Must be > 10000 */
45 #define L_tmpnam FILENAME_MAX /* Max temporary filename */
47 #if !defined(_ANSI_SOURCE)
48 #define L_ctermid FILENAME_MAX /* Max filename for controlling tty */
52 #define P_tmpdir "T:" /* Default temporary path */
55 #ifndef __typedef_FILE
56 # define __typedef_FILE
57 /* I need a named struct for FILE, so that I can use it in wchar.h> */
58 typedef struct __sFILE
64 # define _STDIO_EOF 0x0001L
65 # define _STDIO_ERROR 0x0002L
66 # define _STDIO_WRITE 0x0004L
67 # define _STDIO_READ 0x0008L
68 # define _STDIO_RDWR _STDIO_WRITE | _STDIO_READ
69 # define _STDIO_APPEND 0x0010L
76 #define stdin (__get_arosc_userdata()->acud_stdin)
77 #define stdout (__get_arosc_userdata()->acud_stdout)
78 #define stderr (__get_arosc_userdata()->acud_stderr)
83 int remove(const char *filename
);
84 int rename(const char *from
, const char *to
);
86 char *tmpnam(char *s
);
87 char *tempnam(const char *dir
, const char *pfx
);
88 int fclose(FILE *stream
);
89 int fflush(FILE *stream
);
90 FILE *fopen(const char * restrict filename
, const char * restrict mode
);
91 FILE *freopen(const char * restrict filename
, const char * restrict mode
,
92 FILE * restrict stream
);
93 void setbuf(FILE * restrict stream
, char * restrict buf
);
94 int setvbuf(FILE * restrict stream
, char * restrict buf
, int mode
,
96 int fprintf(FILE * restrict stream
, const char * restrict format
, ...);
97 int fscanf(FILE * restrict stream
, const char * restrict format
, ...);
98 int printf(const char * restrict format
, ...);
99 int scanf(const char * restrict format
, ...);
100 int snprintf(char * restrict s
, size_t n
, const char * restrict format
, ...);
101 int sprintf(char * restrict s
, const char * restrict format
, ...);
102 int sscanf(const char * restrict s
, const char * restrict format
, ...);
103 int vfprintf(FILE * restrict stream
, const char * restrict format
,
105 int vfscanf(FILE * restrict stream
, const char * restrict format
,
107 int vprintf(const char * restrict format
, va_list arg
);
108 int vscanf(const char * restrict format
, va_list arg
);
109 int vsnprintf(char * restrict s
, size_t n
, const char * restrict format
,
111 int vsprintf(char * restrict s
, const char * restrict format
,
113 int vsscanf(const char * restrict s
, const char * restrict format
,
115 int fgetc(FILE *stream
);
116 char *fgets(char * restrict s
, int n
, FILE * restrict stream
);
117 int fputc(int c
, FILE *stream
);
118 int fputs(const char * restrict s
, FILE * restrict stream
);
119 int getc(FILE *stream
);
122 int putc(int c
, FILE *stream
);
124 int puts(const char *s
);
125 int ungetc(int c
, FILE *stream
);
126 size_t fread(void * restrict ptr
, size_t size
, size_t nmemb
,
127 FILE * restrict stream
);
128 size_t fwrite(const void * restrict ptr
, size_t size
, size_t nmemb
,
129 FILE * restrict stream
);
130 int fgetpos(FILE * restrict stream
, fpos_t * restrict pos
);
131 int fseek(FILE *stream
, long int offset
, int whence
);
132 int fsetpos(FILE *stream
, const fpos_t *pos
);
133 long int ftell(FILE *stream
);
134 void rewind(FILE *stream
);
135 void clearerr(FILE *stream
);
136 int feof(FILE *stream
);
137 int ferror(FILE *stream
);
138 void perror(const char *s
);
140 /* Internal functions */
141 int __vcformat (void * data
, int (*outc
)(int, void *),
142 const char * format
, va_list args
);
143 int __vcscan (void * data
, int (*getc
)(void *),
144 int (*ungetc
)(int, void *),
145 const char * format
, va_list args
);
147 /* AROS specific function to synchronise to keep DOS Input and Output in sync
148 * with the C stdin, stdout and stderr
150 void updatestdio(void);
152 #define putc(c, stream) fputc(c, stream)
153 #define getc(stream) fgetc(stream)
154 #define getchar() getc(stdin)
156 #if !defined(_ANSI_SOURCE)
158 FILE *fdopen (int filedes
, const char *mode
);
161 FILE *popen(const char *, const char *);
163 char *tmpnam(char *);
164 #endif /* !_ANSI_SOURCE */
167 void setlinebuf(FILE *stream
);
171 /* NOTIMPL char *tempnam(const char *, const char *); */
175 /* NOTIMPL char *ctermid(char *); */
176 /* NOTIMPL char *ctermid_r(char *); */
179 #if __POSIX_VISIBLE >= 200112
180 /* NOTIMPL void flockfile(FILE *); */
181 /* NOTIMPL int ftrylockfile(FILE *); */
182 /* NOTIMPL void funlockfile(FILE *); */
184 /* NOTIMPL int getc_unlocked(FILE *); */
185 /* NOTIMPL int getchar_unlocked(void); */
186 /* NOTIMPL int putc_unlocked(int, FILE *); */
187 /* NOTIMPL int putchar_unlocked(int); */
190 #if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600
191 int getw(FILE *stream
);
192 int putw(int word
, FILE *stream
);
197 #endif /* _STDIO_H_ */