From 76cc2bb0d3f922c9a83f0348f0278fd48d576502 Mon Sep 17 00:00:00 2001 From: schwarze Date: Tue, 18 Apr 2017 15:04:35 +0000 Subject: [PATCH] The apropos(1) manual still documents the unary -i operator for regular expression search terms, but it appears that somewhere along the way, the implementation got lost, so restore it. Bug found while investigating other reports from Gonzalo Tornaria. --- usr.bin/mandoc/mansearch.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usr.bin/mandoc/mansearch.c b/usr.bin/mandoc/mansearch.c index e56e758f311..cad99d58ab5 100644 --- a/usr.bin/mandoc/mansearch.c +++ b/usr.bin/mandoc/mansearch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mansearch.c,v 1.54 2017/04/18 13:57:12 schwarze Exp $ */ +/* $OpenBSD: mansearch.c,v 1.55 2017/04/18 15:04:35 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * Copyright (c) 2013-2017 Ingo Schwarze @@ -669,6 +669,12 @@ exprterm(const struct mansearch *search, int argc, char *argv[], int *argi) return e; } + if (strcmp("-i", argv[*argi]) == 0 && *argi + 1 < argc) { + cs = 0; + ++*argi; + } else + cs = 1; + e = mandoc_calloc(1, sizeof(*e)); e->type = EXPR_TERM; e->bits = 0; @@ -687,7 +693,6 @@ exprterm(const struct mansearch *search, int argc, char *argv[], int *argi) * If needed, request regular expression handling. */ - cs = 1; if (search->argmode == ARG_WORD) { e->bits = TYPE_Nm; e->match.type = DBM_REGEX; -- 2.20.1