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. */
16 vprintf (const char *format, va_list args)
18 struct vprintf_aux aux;
21 __vprintf (format, args, vprintf_helper, &aux);
23 write (STDOUT_FILENO, aux.buf, aux.p - aux.buf);
27 /* Helper function for vprintf(). */
29 vprintf_helper (char c, void *aux_)
31 struct vprintf_aux *aux = aux_;
33 if (aux->p >= aux->buf + sizeof aux->buf)
35 write (STDOUT_FILENO, aux->buf, aux->p - aux->buf);
41 /* Writes C to the console. */
46 write (STDOUT_FILENO, &c2, 1);