diff --git a/kernel/printf.c b/kernel/printf.c index d20534c150..9326608da4 100644 --- a/kernel/printf.c +++ b/kernel/printf.c @@ -108,6 +108,8 @@ printf(char *fmt, ...) i += 2; } else if(c0 == 'p'){ printptr(va_arg(ap, uint64)); + } else if(c0 == 'c'){ + putc(fd, va_arg(ap, int)); } else if(c0 == 's'){ if((s = va_arg(ap, char*)) == 0) s = "(null)"; diff --git a/user/printf.c b/user/printf.c index 81787467fa..14cc9db0d8 100644 --- a/user/printf.c +++ b/user/printf.c @@ -47,7 +47,7 @@ printptr(int fd, uint64 x) { putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]); } -// Print to the given fd. Only understands %d, %x, %p, %s. +// Print to the given fd. Only understands %d, %x, %p, %c, %s. void vprintf(int fd, const char *fmt, va_list ap) { @@ -93,6 +93,8 @@ vprintf(int fd, const char *fmt, va_list ap) i += 2; } else if(c0 == 'p'){ printptr(fd, va_arg(ap, uint64)); + } else if(c0 == 'c'){ + putc(fd, va_arg(ap, int)); } else if(c0 == 's'){ if((s = va_arg(ap, char*)) == 0) s = "(null)";