Fix %t logic and don't output any %; or %e parts.

Fixes PR lib/47490 thanks to Julien Oster
This commit is contained in:
roy 2013-01-23 13:06:18 +00:00
parent 717ab12d38
commit cf892bbeee

View File

@ -1,4 +1,4 @@
/* $NetBSD: tparm.c,v 1.9 2012/11/30 10:14:18 msaitoh Exp $ */
/* $NetBSD: tparm.c,v 1.10 2013/01/23 13:06:18 roy Exp $ */
/*
* Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: tparm.c,v 1.9 2012/11/30 10:14:18 msaitoh Exp $");
__RCSID("$NetBSD: tparm.c,v 1.10 2013/01/23 13:06:18 roy Exp $");
#include <sys/param.h>
#include <assert.h>
@ -454,7 +454,7 @@ _ti_tiparm(TERMINAL *term, const char *str, va_list parms)
break;
case 't': /* then */
pop(&val, NULL, &stack);
if (val != 0) {
if (val == 0) {
l = 0;
for (; *str != '\0'; str++) {
if (*str != '%')
@ -465,10 +465,14 @@ _ti_tiparm(TERMINAL *term, const char *str, va_list parms)
else if (*str == ';') {
if (l > 0)
l--;
else
else {
str++;
break;
} else if (*str == 'e' && l == 0)
}
} else if (*str == 'e' && l == 0) {
str++;
break;
}
}
}
break;
@ -483,8 +487,10 @@ _ti_tiparm(TERMINAL *term, const char *str, va_list parms)
else if (*str == ';') {
if (l > 0)
l--;
else
else {
str++;
break;
}
}
}
break;