Module Name: src Committed By: roy Date: Thu Mar 4 15:35:26 UTC 2010
Modified Files: src/lib/libterminfo: termcap.c Log Message: Convert padding for unknown capabilities as well. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libterminfo/termcap.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/termcap.c diff -u src/lib/libterminfo/termcap.c:1.6 src/lib/libterminfo/termcap.c:1.7 --- src/lib/libterminfo/termcap.c:1.6 Thu Mar 4 15:16:39 2010 +++ src/lib/libterminfo/termcap.c Thu Mar 4 15:35:26 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: termcap.c,v 1.6 2010/03/04 15:16:39 roy Exp $ */ +/* $NetBSD: termcap.c,v 1.7 2010/03/04 15:35:26 roy Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: termcap.c,v 1.6 2010/03/04 15:16:39 roy Exp $"); +__RCSID("$NetBSD: termcap.c,v 1.7 2010/03/04 15:35:26 roy Exp $"); #include <assert.h> #include <ctype.h> @@ -347,7 +347,7 @@ char *info, *ip, *token, *val, *p, tok[3]; const char *name; size_t len, lp, nl, vl, rl; - int defs[__arraycount(def_infos)]; + int defs[__arraycount(def_infos)], fv; _DIAGASSERT(cap != NULL); @@ -367,10 +367,12 @@ if (token[0] == '\0') continue; name = token; - val = NULL; + val = p = NULL; + fv = nl = 0; if (token[1] != '\0') { tok[0] = token[0]; tok[1] = token[1]; + nl = 1; if (token[2] == '\0') { name = flagname(tok); val = NULL; @@ -380,13 +382,23 @@ } else if (token[2] == '=') { name = strname(tok); val = strval(token + 2); + fv = 1; + } else + nl = 0; + } + /* If not matched we may need to convert padding still. */ + if (nl == 0) { + p = strchr(name, '='); + if (p != NULL) { + val = strval(p); + *p = '\0'; + fv = 1; } } /* See if this sets a default. */ for (nl = 0; nl < __arraycount(def_infos); nl++) { if (strcmp(name, def_infos[nl].name) == 0) { - printf ("matched %s\n", name); defs[nl] = 1; break; } @@ -420,7 +432,7 @@ if (val != NULL) { strcpy(ip, val); ip += vl; - if (token[2] == '=') + if (fv == 1) free(val); } }