bug in serve_close fixed.
[mit-jos.git] / kern / printf.c
blob6932ca57c7d2a9d6722af4217a8f177ee6ba73c6
1 // Simple implementation of cprintf console output for the kernel,
2 // based on printfmt() and the kernel console's cputchar().
4 #include <inc/types.h>
5 #include <inc/stdio.h>
6 #include <inc/stdarg.h>
9 static void
10 putch(int ch, int *cnt)
12 cputchar(ch);
13 *cnt++;
16 int
17 vcprintf(const char *fmt, va_list ap)
19 int cnt = 0;
21 vprintfmt((void*)putch, &cnt, fmt, ap);
22 return cnt;
25 int
26 cprintf(const char *fmt, ...)
28 va_list ap;
29 int cnt;
31 va_start(ap, fmt);
32 cnt = vcprintf(fmt, ap);
33 va_end(ap);
35 return cnt;