From c412fabe01785366debb0e53069d3ce9fdb89b6f Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 1 Nov 2009 23:16:40 +0000 Subject: 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 --- usr.bin/cap_mkdb/cap_mkdb.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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: -- cgit v1.2.3