Semi-decennial update. 50% code inflation.
[cbaos.git] / include / stdio.h
blob26618c55ac6da93c6dc260a62bab779dfa253ed1
1 #ifndef _STDIO_H_
2 #define _STDIO_H_
4 #include <stddef.h>
5 #include <ioctl.h>
7 #define EOF (-1)
9 #define O_NONBLOCK 1
11 struct _FILE {
12 struct device *dev;
15 typedef struct _FILE FILE;
17 extern FILE *stdin, *stdout, *stderr;
20 int fopen(FILE *fd, const char *path, int flags);
21 void fclose(FILE *fd);
22 int fwrite(FILE *fd, const void *buf, size_t count);
23 int fwriteall(FILE *fd, const void *buf, size_t count);
24 int fread(FILE *fd, void *buf, size_t count);
25 int ioctl(FILE *fd, enum ioctl cmd, int arg);
28 int printf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
29 int fprintf(FILE *stream, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
30 int sprintf(char *str, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
31 int snprintf(char *str, size_t len, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
33 // implement scanf
35 /* XXX see these actually work */
36 int fputc(int c, FILE *stream);
37 int fputs(const char *s, FILE *stream);
38 #define putc(c, s) fputc(c, s)
39 #define putchar(c) fputc(c, stdout)
40 int puts(const char *s);
42 int fgetc(FILE *f);
43 int getchar(void);
44 char *fgets(char *s, int size, FILE *f);
46 #endif