1 /* A server must occasionally print some message. It uses a simple version of
2 * printf() found in the system lib that calls kputc() to output characters.
3 * Printing is done with a call to the kernel, and not by going through FS.
5 * This routine can only be used by servers and device drivers. The kernel
6 * must define its own kputc(). Note that the log driver also defines its own
7 * kputc() to directly call the TTY instead of going through this library.
12 static char print_buf
[DIAG_BUFSIZE
]; /* output is buffered here */
14 /*===========================================================================*
16 *===========================================================================*/
19 /* Accumulate another character. If 0 or buffer full, print it. */
20 static int buf_count
; /* # characters in the buffer */
22 if ((c
== 0 && buf_count
> 0) || buf_count
== sizeof(print_buf
)) {
23 sys_diagctl_diag(print_buf
, buf_count
);
28 /* Append a single character to the output buffer. */
29 print_buf
[buf_count
] = c
;