From 059327df544eda5a4e78c14f33c6e503ff784296 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Mon, 19 Nov 2018 19:27:37 +0000 Subject: 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 via Yuri Pankov . 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. --- mansearch.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'mansearch.c') diff --git a/mansearch.c b/mansearch.c index 784c17be..9cfd64a2 100644 --- a/mansearch.c +++ b/mansearch.c @@ -1,7 +1,7 @@ -/* $Id: mansearch.c,v 1.77 2017/08/22 17:50:11 schwarze Exp $ */ +/* $Id: mansearch.c,v 1.78 2018/11/19 19:27:37 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons - * Copyright (c) 2013-2017 Ingo Schwarze + * Copyright (c) 2013-2018 Ingo Schwarze * * 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; -- cgit v1.2.3