From b75c11b20edad4e507d5bc2455177de59a38ec9f Mon Sep 17 00:00:00 2001 From: rsc Date: Sun, 16 Jul 2006 16:00:03 +0000 Subject: add %s to cprintf for cons_puts --- console.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'console.c') diff --git a/console.c b/console.c index eb394f1..28ef587 100644 --- a/console.c +++ b/console.c @@ -105,7 +105,7 @@ printint(int xx, int base, int sgn) } /* - * print to the console. only understands %d and %x. + * print to the console. only understands %d, %x, %p, %s. */ void cprintf(char *fmt, ...) @@ -131,8 +131,19 @@ cprintf(char *fmt, ...) } else if(c == 'x' || c == 'p'){ printint(*ap, 16, 0); ap++; + } else if(c == 's'){ + char *s = (char*)*ap; + ap++; + while(*s != 0){ + real_cons_putc(*s); + s++; + } } else if(c == '%'){ real_cons_putc(c); + } else { + // Unknown % sequence. Print it to draw attention. + real_cons_putc('%'); + real_cons_putc(c); } state = 0; } -- cgit v1.2.3