From 309ba0ab0e453acde16dc583e036874dbeb4a2a4 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 5 Jan 2014 03:06:43 +0000 Subject: Reimplement apropos -s NUM -S ARCH EXPR by internally converting it to apropos \( EXPR \) -a 'sec~^NUM$' -a 'arch~^(ARCH|any)$' in preparation for removal of sec and arch from the mpage table. Almost no functional change except for the following bonus: This also makes sure that for cross-section and cross-arch MLINKs, all of the following work: apropos -s 1 encrypt apropos -s 8 encrypt apropos -s 1 makekey apropos -s 8 makekey While here, print error messages about invalid regexps to stderr. --- mandocdb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mandocdb.c') diff --git a/mandocdb.c b/mandocdb.c index c6680163..4b5d8fdb 100644 --- a/mandocdb.c +++ b/mandocdb.c @@ -1025,14 +1025,16 @@ mpages_merge(struct mchars *mc, struct mparse *mp, int check_reachable) mandoc_strdup(mpage->mlinks->name); } putkey(mpage, mpage->sec, TYPE_sec); - putkey(mpage, mpage->arch, TYPE_arch); + putkey(mpage, '\0' == *mpage->arch ? + "any" : mpage->arch, TYPE_arch); for (mlink = mpage->mlinks; mlink; mlink = mlink->next) { if ('\0' != *mlink->dsec) putkey(mpage, mlink->dsec, TYPE_sec); if ('\0' != *mlink->fsec) putkey(mpage, mlink->fsec, TYPE_sec); - putkey(mpage, mlink->arch, TYPE_arch); + putkey(mpage, '\0' == *mlink->arch ? + "any" : mlink->arch, TYPE_arch); putkey(mpage, mlink->name, TYPE_Nm); } -- cgit