diff options
author | dm <dm@cvs.openbsd.org> | 1996-07-19 23:13:40 +0000 |
---|---|---|
committer | dm <dm@cvs.openbsd.org> | 1996-07-19 23:13:40 +0000 |
commit | c5e61bf0bdb3fa3aea32da8a30105abd1425a906 (patch) | |
tree | b554f3d73f9ddc6cbfdca7e38cace6353b3d68c6 /sys/kern | |
parent | c8821dcbdaec826ebc634f789517843da935d717 (diff) |
Fixed NetBSD pr #2633 (douzzer@mit.edu)--Be slightly more reasonable
about something like printf ("bogus format %l");
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/subr_prf.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 46e68bf8633..b37be3bf15b 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_prf.c,v 1.7 1996/07/02 06:51:59 niklas Exp $ */ +/* $OpenBSD: subr_prf.c,v 1.8 1996/07/19 23:13:39 dm Exp $ */ /* $NetBSD: subr_prf.c,v 1.25 1996/04/22 01:38:46 christos Exp $ */ /*- @@ -395,6 +395,12 @@ kprintf(fmt, flags, tp, ap) } lflag = 0; reswitch: switch (ch = *(u_char *)fmt++) { + case '\0': + while(*--fmt != '%') + ; + fmt++; + putchar('%', flags, tp); + continue; case '0': padc = '0'; goto reswitch; @@ -554,6 +560,12 @@ vsprintf(buf, cfmt, ap) lflag = 0; reswitch: switch (ch = *(u_char *)fmt++) { + case '\0': + while(*--fmt != '%') + ; + while(*bp++ = *fmt++) + ; + return; case '0': padc = '0'; goto reswitch; |