8288ff04ac8b18c677eb0ee58a0267691654e04c
[pintos-anon] / src / lib / stdio.h
1 #ifndef __LIB_STDIO_H
2 #define __LIB_STDIO_H
3
4 #include <debug.h>
5 #include <stdarg.h>
6 #include <stdbool.h>
7 #include <stddef.h>
8 #include <stdint.h>
9
10 /* Include lib/user/stdio.h or lib/kernel/stdio.h, as
11    appropriate. */
12 #include_next <stdio.h>
13
14 /* Predefined file handles. */
15 #define STDIN_FILENO 0
16 #define STDOUT_FILENO 1
17
18 /* Standard functions. */
19 int printf (const char *, ...) PRINTF_FORMAT (1, 2);
20 int snprintf (char *, size_t, const char *, ...) PRINTF_FORMAT (3, 4);
21 int vprintf (const char *, va_list) PRINTF_FORMAT (1, 0);
22 int vsnprintf (char *, size_t, const char *, va_list) PRINTF_FORMAT (3, 0);
23 int putchar (int);
24 int puts (const char *);
25
26 /* Nonstandard functions. */
27 void hex_dump (uintptr_t ofs, const void *, size_t size, bool ascii);
28
29 /* Internal functions. */
30 void __vprintf (const char *format, va_list args,
31                 void (*output) (char, void *), void *aux);
32 void __printf (const char *format,
33                void (*output) (char, void *), void *aux, ...);
34
35 /* Try to be helpful. */
36 #define sprintf dont_use_sprintf_use_snprintf
37 #define vsprintf dont_use_vsprintf_use_vsnprintf
38
39 #endif /* lib/stdio.h */