summaryrefslogtreecommitdiffstats
path: root/include/stdio.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-04-14 09:37:28 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-04-15 12:21:46 +0200
commit5559bfd2719f0b0795a6ce66b859d879271bb1e4 (patch)
treeea8c3d5779197b753e68d271b45e660d5eb50931 /include/stdio.h
parent473d6f8a7a16d1440f360b8562b746fbadee2d82 (diff)
downloadbarebox-5559bfd2719f0b0795a6ce66b859d879271bb1e4.tar.gz
barebox-5559bfd2719f0b0795a6ce66b859d879271bb1e4.tar.xz
stdio: Replace FILE functions with filedescriptor functions
We have defined stdin, stdout and stderr as integer file descriptors, but normally they should be FILE *. Also fprintf, fputc and fputs take file descriptors instead of FILE *. As FILE * are inconvenient in the barebox environment replace the f* functions with the corresponding d* functions. dprintf is POSIX conform whereas dputc and dputs are barebox specific, but do not conflict with any stdc function. fgetc is unused and can be removed without replacing it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/stdio.h')
-rw-r--r--include/stdio.h21
1 files changed, 9 insertions, 12 deletions
diff --git a/include/stdio.h b/include/stdio.h
index 1ead0e6e00..5e615718c1 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -89,23 +89,20 @@ static inline void putchar(char c)
console_putc(CONSOLE_STDOUT, c);
}
-/* stderr */
-#define eputc(c) console_putc(CONSOLE_STDERR, c)
-#define eputs(s) console_puts(CONSOLE_STDERR, s)
-#define eprintf(fmt,args...) fprintf(stderr,fmt ,##args)
-
/*
* FILE based functions
*/
-#define stdin 0
-#define stdout 1
-#define stderr 2
+/* stderr */
+#define eprintf(fmt,args...) dprintf(STDERR_FILENO, fmt ,##args)
+
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
#define MAX_FILES 128
-int fprintf(int file, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
-int fputs(int file, const char *s);
-int fputc(int file, const char c);
-int fgetc(int file);
+int dprintf(int file, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
+int dputs(int file, const char *s);
+int dputc(int file, const char c);
#endif /* __STDIO_H */