Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libterminfo Fix %t logic and don't output any %; or %e p...



details:   https://anonhg.NetBSD.org/src/rev/45decd46345f
branches:  trunk
changeset: 784261:45decd46345f
user:      roy <roy%NetBSD.org@localhost>
date:      Wed Jan 23 13:06:18 2013 +0000

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

diffstat:

 lib/libterminfo/tparm.c |  18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diffs (56 lines):

diff -r c832a20e3a84 -r 45decd46345f lib/libterminfo/tparm.c
--- a/lib/libterminfo/tparm.c   Wed Jan 23 12:35:06 2013 +0000
+++ b/lib/libterminfo/tparm.c   Wed Jan 23 13:06:18 2013 +0000
@@ -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 @@
                        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 @@
                                        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 @@
                                else if (*str == ';') {
                                        if (l > 0)
                                                l--;
-                                       else
+                                       else {
+                                               str++;
                                                break;
+                                       }
                                }
                        }
                        break;



Home | Main Index | Thread Index | Old Index