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.
-.\" $Id: apropos.1,v 1.47 2018/02/23 18:54:02 schwarze Exp $
+.\" $Id: apropos.1,v 1.48 2018/11/19 19:27:37 schwarze Exp $
.\"
.\" Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
.\" Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
-.\" Copyright (c) 2011, 2012, 2014, 2017 Ingo Schwarze <schwarze@openbsd.org>
+.\" Copyright (c) 2011,2012,2014,2017,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
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: February 23 2018 $
+.Dd $Mdocdate: November 19 2018 $
.Dt APROPOS 1
.Os
.Sh NAME
.Dt APROPOS 1
.Os
.Sh NAME
.Xr makewhatis 8
databases in the default paths stipulated by
.Xr man 1
.Xr makewhatis 8
databases in the default paths stipulated by
.Xr man 1
-and uses case-insensitive substring matching
-.Pq the Cm = No operator
+and uses case-insensitive extended regular expression matching
over manual names and descriptions
.Pq the Li \&Nm No and Li \&Nd No macro keys .
Multiple terms imply pairwise
over manual names and descriptions
.Pq the Li \&Nm No and Li \&Nd No macro keys .
Multiple terms imply pairwise
Search for all words in
.Ar expression
in manual page names only.
Search for all words in
.Ar expression
in manual page names only.
-The search is case insensitive and matches whole words only.
+The search is case-insensitive and matches whole words only.
In this mode, macro keys, comparison operators, and logical operators
are not available.
.It Fl k
In this mode, macro keys, comparison operators, and logical operators
are not available.
.It Fl k
.Xr machine 1
architecture.
.Ar arch
.Xr machine 1
architecture.
.Ar arch
By default, pages for all architectures are shown.
.It Fl s Ar section
Restrict the search to the specified section of the manual.
By default, pages for all architectures are shown.
.It Fl s Ar section
Restrict the search to the specified section of the manual.
.Cm =
evaluates a substring, while
.Cm \(ti
.Cm =
evaluates a substring, while
.Cm \(ti
-evaluates a regular expression.
+evaluates a case-sensitive extended regular expression.
.It Fl i Ar term
If
.Ar term
.It Fl i Ar term
If
.Ar term
.Ic \&Fn
lines
.It Li \&Fn
.Ic \&Fn
lines
.It Li \&Fn
-fuction names marked up with
+function names marked up with
.Ic \&Fo
macros
.It Li \&In
.Ic \&Fo
macros
.It Li \&In
.Qq .cf
as a substring of manual names and descriptions:
.Pp
.Qq .cf
as a substring of manual names and descriptions:
.Pp
.Pp
Include matches for
.Qq .cnf
.Pp
Include matches for
.Qq .cnf
-.Dl $ apropos .cf .cnf .conf
+.Dl $ apropos =.cf =.cnf =.conf
-Search in names and descriptions using a regular expression:
+Search in names and descriptions using a case-sensitive regular expression:
.Pp
.Dl $ apropos \(aq\(tiset.?[ug]id\(aq
.Pp
.Pp
.Dl $ apropos \(aq\(tiset.?[ug]id\(aq
.Pp
.Xr man 1 ,
.Xr re_format 7 ,
.Xr makewhatis 8
.Xr man 1 ,
.Xr re_format 7 ,
.Xr makewhatis 8
+.Sh STANDARDS
+The
+.Nm
+utility is compliant with the
+.St -p1003.1-2008
+specification of
+.Xr man 1
+.Fl k .
+.Pp
+All options, the
+.Nm whatis
+command, support for logical operators, macro keys,
+substring matching, sorting of results, the environment variables
+.Ev MANPAGER
+and
+.Ev MANPATH ,
+the database format, and the configuration file
+are extensions to that specification.
.Sh HISTORY
Part of the functionality of
.Nm whatis
.Sh HISTORY
Part of the functionality of
.Nm whatis
-/* $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 <kristaps@bsd.lv>
/*
* 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
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
cs = 0;
} else if ((val = strpbrk(argv[*argi], "=~")) == NULL) {
e->bits = TYPE_Nm | TYPE_Nd;
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;
} else {
if (val == argv[*argi])
e->bits = TYPE_Nm | TYPE_Nd;