summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-11-01 23:16:40 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-11-01 23:16:40 +0000
commitc412fabe01785366debb0e53069d3ce9fdb89b6f (patch)
treec819a2bae1d34d6d89b8e7550dc4c6d94cdd175f
parent4deda1b87a5fba9d18b16318ddd5f8f0770bc42a (diff)
If the last name field looks like a description rather than an alias (if it
contains spaces), ignore it. Knocks a few K off the termcap and terminfo databases and gets rid of some warnings. ok millert
-rw-r--r--usr.bin/cap_mkdb/cap_mkdb.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.bin/cap_mkdb/cap_mkdb.c b/usr.bin/cap_mkdb/cap_mkdb.c
index a2c899ac63c..890d6e936fb 100644
--- a/usr.bin/cap_mkdb/cap_mkdb.c
+++ b/usr.bin/cap_mkdb/cap_mkdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cap_mkdb.c,v 1.16 2009/10/27 23:59:36 deraadt Exp $ */
+/* $OpenBSD: cap_mkdb.c,v 1.17 2009/11/01 23:16:39 nicm Exp $ */
/* $NetBSD: cap_mkdb.c,v 1.5 1995/09/02 05:47:12 jtc Exp $ */
/*-
@@ -283,6 +283,16 @@ db_build(char **ifiles)
if (p > t && (*p == (info ? ',' : ':') || *p == '|')) {
key.size = p - t;
key.data = t;
+
+ /*
+ * If this is the last entry and contains any
+ * spaces, it is a description rather than an
+ * alias, so skip it and break.
+ */
+ if (*p != '|' &&
+ memchr(key.data, ' ', key.size) != NULL)
+ break;
+
switch(capdbp->put(capdbp,
&key, &data, R_NOOVERWRITE)) {
case -1: