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