* Print a character on console or users terminal. If destination is * the console then the last bunch of characters are saved in msgbuf for * inspection later. */
| 487 | * inspection later. |
| 488 | */ |
| 489 | static void |
| 490 | putchar(int c, void *arg) |
| 491 | { |
| 492 | struct putchar_arg *ap = (struct putchar_arg*) arg; |
| 493 | struct tty *tp = ap->tty; |
| 494 | int flags = ap->flags; |
| 495 | |
| 496 | /* Don't use the tty code after a panic or while in ddb. */ |
| 497 | if (kdb_active) { |
| 498 | if (c != '\0') |
| 499 | cnputc(c); |
| 500 | return; |
| 501 | } |
| 502 | |
| 503 | if ((flags & TOTTY) && tp != NULL && !KERNEL_PANICKED()) |
| 504 | tty_putchar(tp, c); |
| 505 | |
| 506 | if ((flags & (TOCONS | TOLOG)) && c != '\0') |
| 507 | putbuf(c, ap); |
| 508 | } |
| 509 | |
| 510 | /* |
| 511 | * Scaled down version of sprintf(3). |