Module Name: src
Committed By: roy
Date: Fri Feb 5 16:43:46 UTC 2010
Modified Files:
src/usr.bin/infocmp: infocmp.1 infocmp.c
Log Message:
Fix infocmp when both -a and -x are given as arguments.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/infocmp/infocmp.1
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/infocmp/infocmp.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/infocmp/infocmp.1
diff -u src/usr.bin/infocmp/infocmp.1:1.2 src/usr.bin/infocmp/infocmp.1:1.3
--- src/usr.bin/infocmp/infocmp.1:1.2 Wed Feb 3 15:51:51 2010
+++ src/usr.bin/infocmp/infocmp.1 Fri Feb 5 16:43:46 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: infocmp.1,v 1.2 2010/02/03 15:51:51 wiz Exp $
+.\" $NetBSD: infocmp.1,v 1.3 2010/02/05 16:43:46 roy Exp $
.\"
.\" Copyright (c) 2009 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd July 18, 2009
+.Dd February 5, 2010
.Dt INFOCMP 1
.Os
.Sh NAME
@@ -86,6 +86,9 @@
.It Fl u
Build a new terminal description for the first terminal description,
using subsequent terminal descriptions.
+This also sets the
+.Fl a
+flag.
.It Fl w Ar cols
Limit the width to
.Ar cols .
Index: src/usr.bin/infocmp/infocmp.c
diff -u src/usr.bin/infocmp/infocmp.c:1.3 src/usr.bin/infocmp/infocmp.c:1.4
--- src/usr.bin/infocmp/infocmp.c:1.3 Fri Feb 5 12:31:56 2010
+++ src/usr.bin/infocmp/infocmp.c Fri Feb 5 16:43:46 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: infocmp.c,v 1.3 2010/02/05 12:31:56 roy Exp $ */
+/* $NetBSD: infocmp.c,v 1.4 2010/02/05 16:43:46 roy Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: infocmp.c,v 1.3 2010/02/05 12:31:56 roy Exp $");
+__RCSID("$NetBSD: infocmp.c,v 1.4 2010/02/05 16:43:46 roy Exp $");
#include <sys/ioctl.h>
@@ -52,7 +52,7 @@
} TIENT;
static size_t cols;
-static int aflag, cflag, nflag, qflag, xflag, raw;
+static int aflag, cflag, nflag, qflag, xflag;
static size_t
outstr(FILE *f, const char *str)
@@ -232,40 +232,35 @@
}
n = 0;
- if (xflag < 2) {
- for (i = 0; i <= max; i++) {
- switch (type) {
- case 'f':
- if (t->flags[i] == 1 ||
- (raw != 0 &&
- t->flags[i] == CANCELLED_BOOLEAN))
- {
- ents[n].id = _ti_flagid(i);
- ents[n].type = 'f';
- ents[n++].flag = t->flags[i];
- }
- break;
- case 'n':
- if (VALID_NUMERIC(t->nums[i]) ||
- (raw != 0 &&
- t->nums[i] == CANCELLED_NUMERIC))
- {
- ents[n].id = _ti_numid(i);
- ents[n].type = 'n';
- ents[n++].num = t->nums[i];
- }
- break;
- default:
- if (VALID_STRING(t->strs[i]) ||
- (raw != 0 &&
- t->strs[i] == CANCELLED_STRING))
- {
- ents[n].id = _ti_strid(i);
- ents[n].type = 's';
- ents[n++].str = t->strs[i];
- }
- break;
+ for (i = 0; i <= max; i++) {
+ switch (type) {
+ case 'f':
+ if (t->flags[i] == 1 ||
+ (aflag && t->flags[i] == CANCELLED_BOOLEAN))
+ {
+ ents[n].id = _ti_flagid(i);
+ ents[n].type = 'f';
+ ents[n++].flag = t->flags[i];
+ }
+ break;
+ case 'n':
+ if (VALID_NUMERIC(t->nums[i]) ||
+ (aflag && t->nums[i] == CANCELLED_NUMERIC))
+ {
+ ents[n].id = _ti_numid(i);
+ ents[n].type = 'n';
+ ents[n++].num = t->nums[i];
+ }
+ break;
+ default:
+ if (VALID_STRING(t->strs[i]) ||
+ (aflag && t->strs[i] == CANCELLED_STRING))
+ {
+ ents[n].id = _ti_strid(i);
+ ents[n].type = 's';
+ ents[n++].str = t->strs[i];
}
+ break;
}
}
@@ -275,17 +270,17 @@
if (ud->type == type) {
switch (type) {
case 'f':
- if (raw == 0 &&
+ if (!aflag &&
!VALID_BOOLEAN(ud->flag))
continue;
break;
case 'n':
- if (raw == 0 &&
+ if (!aflag &&
!VALID_NUMERIC(ud->num))
continue;
break;
case 's':
- if (raw == 0 &&
+ if (!aflag &&
!VALID_STRING(ud->str))
continue;
break;
@@ -674,26 +669,26 @@
Barg = optarg;
break;
case 'a':
- aflag++;
- xflag++;
+ aflag = 1;
break;
case 'c':
- cflag++;
+ cflag = 1;
break;
case 'n':
- nflag++;
+ nflag = 1;
break;
case 'q':
- qflag++;
+ qflag = 1;
break;
case 'u':
- uflag++;
+ uflag = 1;
+ aflag = 1;
break;
case 'w':
cols = strtoul(optarg, NULL, 10);
break;
case 'x':
- xflag++;
+ xflag = 1;
break;
case '?':
default:
@@ -706,7 +701,7 @@
cols--;
if (optind + 1 < argc)
- raw = 1;
+ aflag = 1;
if (optind < argc)
term = argv[optind++];