Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/infocmp Deal with both .db and .cdb extensions...
details: https://anonhg.NetBSD.org/src/rev/1766c7ae4b72
branches: trunk
changeset: 1008611:1766c7ae4b72
user: christos <christos%NetBSD.org@localhost>
date: Sat Mar 28 15:50:25 2020 +0000
description:
Deal with both .db and .cdb extensions...
diffstat:
usr.bin/infocmp/infocmp.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diffs (41 lines):
diff -r ae4b12c38d17 -r 1766c7ae4b72 usr.bin/infocmp/infocmp.c
--- a/usr.bin/infocmp/infocmp.c Sat Mar 28 15:45:56 2020 +0000
+++ b/usr.bin/infocmp/infocmp.c Sat Mar 28 15:50:25 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: infocmp.c,v 1.13 2020/03/13 15:19:25 roy Exp $ */
+/* $NetBSD: infocmp.c,v 1.14 2020/03/28 15:50:25 christos Exp $ */
/*
* Copyright (c) 2009, 2010, 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: infocmp.c,v 1.13 2020/03/13 15:19:25 roy Exp $");
+__RCSID("$NetBSD: infocmp.c,v 1.14 2020/03/28 15:50:25 christos Exp $");
#include <sys/ioctl.h>
@@ -128,14 +128,15 @@
static void
setdb(char *db)
{
- size_t len;
+ static const char *ext[] = { ".cdb", ".db" };
- len = strlen(db);
- if (len > 3 &&
- db[len - 3] == '.' &&
- db[len - 2] == 'd' &&
- db[len - 1] == 'b')
- db[len - 3] = '\0';
+ for (size_t i = 0; i < __arraycount(ext); i++) {
+ char *ptr = strstr(db, ext[i]);
+ if (ptr == NULL || ptr[strlen(ext[i])] != '\0')
+ continue;
+ *ptr = '\0';
+ break;
+ }
setenv("TERMINFO", db, 1);
}
Home |
Main Index |
Thread Index |
Old Index