Module Name:    src
Committed By:   roy
Date:           Wed Jan 23 13:06:19 UTC 2013

Modified Files:
        src/lib/libterminfo: tparm.c

Log Message:
Fix %t logic and don't output any %; or %e parts.
Fixes PR lib/47490 thanks to Julien Oster


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libterminfo/tparm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libterminfo/tparm.c
diff -u src/lib/libterminfo/tparm.c:1.9 src/lib/libterminfo/tparm.c:1.10
--- src/lib/libterminfo/tparm.c:1.9	Fri Nov 30 10:14:18 2012
+++ src/lib/libterminfo/tparm.c	Wed Jan 23 13:06:18 2013
@@ -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 *s
 			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 *s
 					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 *s
 				else if (*str == ';') {
 					if (l > 0)
 						l--;
-					else
+					else {
+						str++;
 						break;
+					}
 				}
 			}
 			break;

Reply via email to