3 #include <syscall-nr.h>
5 static void vprintf_helper (char, void *);
7 /* Auxiliary data for vprintf_helper(). */
10 char buf[64]; /* Character buffer. */
11 char *p; /* Current position in buffer. */
12 int char_cnt; /* Total characters written so far. */
15 /* The standard vprintf() function,
16 which is like printf() but uses a va_list.
17 Writes its output to the STDOUT_FILENO handle. */
19 vprintf (const char *format, va_list args)
21 struct vprintf_aux aux;
24 __vprintf (format, args, vprintf_helper, &aux);
26 write (STDOUT_FILENO, aux.buf, aux.p - aux.buf);
30 /* Helper function for vprintf(). */
32 vprintf_helper (char c, void *aux_)
34 struct vprintf_aux *aux = aux_;
36 if (aux->p >= aux->buf + sizeof aux->buf)
38 write (STDOUT_FILENO, aux->buf, aux->p - aux->buf);
44 /* Writes string S to the console, followed by a new-line
56 /* Writes C to the console. */
61 write (STDOUT_FILENO, &c2, 1);