import cbaos v0.1
[cbaos.git] / include / stdio.h
blob41c8a4f85897e7191612cc868fe8f420bfc75846
1 #ifndef _STDIO_H_
2 #define _STDIO_H_
4 #include <stddef.h>
6 #define EOF (-1)
8 #define O_NONBLOCK 1
10 struct _FILE {
11 struct device *dev;
14 typedef struct _FILE FILE;
16 extern FILE *stdin, *stdout, *stderr;
19 int fopen(FILE *fd, const char *path, int flags);
20 void fclose(FILE *fd);
21 int fwrite(FILE *fd, const void *buf, size_t count);
22 int fread(FILE *fd, void *buf, size_t count);
25 int printf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
26 int fprintf(FILE *stream, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
27 int sprintf(char *str, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
28 int snprintf(char *str, size_t len, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
30 // implement scanf
32 /* XXX see these actually work */
33 int fputc(int c, FILE *stream);
34 int fputs(const char *s, FILE *stream);
35 #define putc(c, s) fputc(c, s)
36 #define putchar(c) fputc(c, stdout)
37 int puts(const char *s);
39 int fgetc(FILE *f);
40 int getchar(void);
42 #endif