Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/infocmp Fix infocmp when both -a and -x are given as...
details: https://anonhg.NetBSD.org/src/rev/f350178ca23e
branches: trunk
changeset: 751486:f350178ca23e
user: roy <roy%NetBSD.org@localhost>
date: Fri Feb 05 16:43:46 2010 +0000
description:
Fix infocmp when both -a and -x are given as arguments.
diffstat:
usr.bin/infocmp/infocmp.1 | 7 ++-
usr.bin/infocmp/infocmp.c | 89 ++++++++++++++++++++++------------------------
2 files changed, 47 insertions(+), 49 deletions(-)
diffs (188 lines):
diff -r 7486ec4d1f97 -r f350178ca23e usr.bin/infocmp/infocmp.1
--- a/usr.bin/infocmp/infocmp.1 Fri Feb 05 16:36:09 2010 +0000
+++ b/usr.bin/infocmp/infocmp.1 Fri Feb 05 16:43:46 2010 +0000
@@ -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 .
diff -r 7486ec4d1f97 -r f350178ca23e usr.bin/infocmp/infocmp.c
--- a/usr.bin/infocmp/infocmp.c Fri Feb 05 16:36:09 2010 +0000
+++ b/usr.bin/infocmp/infocmp.c Fri Feb 05 16:43:46 2010 +0000
@@ -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++];
Home |
Main Index |
Thread Index |
Old Index