summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_prf.c
diff options
context:
space:
mode:
authordm <dm@openbsd.org>1996-07-19 23:13:39 +0000
committerdm <dm@openbsd.org>1996-07-19 23:13:39 +0000
commitce6a609712c027f6b5dbe1bd37000984545511e9 (patch)
tree8b5642df7b5f3e4649ec9b8a5325287cffa49530 /sys/kern/subr_prf.c
parentGot rid of blinking square in the screen saver (it prevented fancy monitors (diff)
downloadwireguard-openbsd-ce6a609712c027f6b5dbe1bd37000984545511e9.tar.xz
wireguard-openbsd-ce6a609712c027f6b5dbe1bd37000984545511e9.zip
Fixed NetBSD pr #2633 (douzzer@mit.edu)--Be slightly more reasonable
about something like printf ("bogus format %l");
Diffstat (limited to 'sys/kern/subr_prf.c')
-rw-r--r--sys/kern/subr_prf.c14
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;