summaryrefslogtreecommitdiffstats
path: root/mansearch.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-11-19 19:27:37 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-11-19 19:27:37 +0000
commit556fbe5dbb473b7fd0ad6ba9a1ad36a105cffd66 (patch)
treecc130889fcd3fcc737315827ba0ddcca06a48cc8 /mansearch.c
parent32b67cbf6659b6b8149a3cf8e043f34c2ff3c108 (diff)
downloadmandoc-556fbe5dbb473b7fd0ad6ba9a1ad36a105cffd66.tar.gz
Improve POSIX compliance by making case-insensitive extended
regular expressions the default in man(1) -k searches, also matching what the man-db package used by many Linux distributions does. Originally requested by Wolfram Schneider <wosch at FreeBSD> via Yuri Pankov <yuripv at FreeBSD>. Feedback and OK cheloha@, and no objections when shown on tech@. Thanks to cheloha@ for pointing out that POSIX requires this behaviour and for the suggestion to explicitly say that *extended* regular expressions are used here. While here, unify spelling of case-[in]sensitive, fix a typo, update the EXAMPLES, and add a STANDARDS section.
Diffstat (limited to 'mansearch.c')
-rw-r--r--mansearch.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/mansearch.c b/mansearch.c
index 47285ba4..7ac8bcd2 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2013-2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2013-2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -774,8 +774,9 @@ exprterm(const struct mansearch *search, int argc, char *argv[], int *argi)
cs = 0;
} else if ((val = strpbrk(argv[*argi], "=~")) == NULL) {
e->bits = TYPE_Nm | TYPE_Nd;
- e->match.type = DBM_SUB;
- e->match.str = argv[*argi];
+ e->match.type = DBM_REGEX;
+ val = argv[*argi];
+ cs = 0;
} else {
if (val == argv[*argi])
e->bits = TYPE_Nm | TYPE_Nd;