Annotation of src/usr.bin/mandoc/apropos.1, Revision 1.26
1.26 ! schwarze 1: .\" $Id: apropos.1,v 1.25 2014/08/27 00:06:08 schwarze Exp $
1.1 schwarze 2: .\"
1.25 schwarze 3: .\" Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
1.21 schwarze 4: .\" Copyright (c) 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
1.1 schwarze 5: .\"
6: .\" Permission to use, copy, modify, and distribute this software for any
7: .\" purpose with or without fee is hereby granted, provided that the above
8: .\" copyright notice and this permission notice appear in all copies.
9: .\"
10: .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11: .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12: .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13: .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14: .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15: .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16: .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17: .\"
1.26 ! schwarze 18: .Dd $Mdocdate: August 27 2014 $
1.1 schwarze 19: .Dt APROPOS 1
20: .Os
21: .Sh NAME
1.25 schwarze 22: .Nm apropos ,
23: .Nm whatis
1.6 schwarze 24: .Nd search manual page databases
1.1 schwarze 25: .Sh SYNOPSIS
26: .Nm
1.26 ! schwarze 27: .Op Fl acfklVw
1.9 schwarze 28: .Op Fl C Ar file
1.13 schwarze 29: .Op Fl M Ar path
30: .Op Fl m Ar path
1.20 schwarze 31: .Op Fl O Ar outkey
1.3 schwarze 32: .Op Fl S Ar arch
33: .Op Fl s Ar section
1.9 schwarze 34: .Ar expression ...
1.1 schwarze 35: .Sh DESCRIPTION
36: The
1.25 schwarze 37: .Nm apropos
38: and
39: .Nm whatis
40: utilities query manual page databases generated by
1.16 schwarze 41: .Xr makewhatis 8 ,
1.23 schwarze 42: evaluating
1.4 schwarze 43: .Ar expression
1.6 schwarze 44: for each file in each database.
1.25 schwarze 45: By default, they display the names, section numbers, and description lines
1.23 schwarze 46: of all matching manuals.
1.12 schwarze 47: .Pp
48: By default,
49: .Nm
50: searches for
1.16 schwarze 51: .Xr makewhatis 8
1.12 schwarze 52: databases in the default paths stipulated by
1.23 schwarze 53: .Xr man 1
54: and uses case-insensitive substring matching
55: .Pq the Cm = No operator
1.12 schwarze 56: over manual names and descriptions
57: .Pq the Li \&Nm No and Li \&Nd No macro keys .
58: Multiple terms imply pairwise
59: .Fl o .
60: .Pp
1.25 schwarze 61: .Nm whatis
62: is a synonym for
63: .Nm
64: .Fl f .
65: .Pp
66: The options are as follows:
1.1 schwarze 67: .Bl -tag -width Ds
1.25 schwarze 68: .It Fl a
69: Instead of showing only the title lines, show the complete manual pages,
70: just like
71: .Xr man 1
72: .Fl a
73: would.
74: If the standard output is a terminal device and
75: .Fl c
76: is not specified, use
77: .Xr more 1
78: to paginate them.
79: In
80: .Fl a
81: mode, the options
82: .Fl IOTW
83: described in the
84: .Xr mandoc 1
85: manual are also available.
1.9 schwarze 86: .It Fl C Ar file
87: Specify an alternative configuration
88: .Ar file
89: in
90: .Xr man.conf 5
91: format.
1.25 schwarze 92: .It Fl c
93: In
94: .Fl a
95: mode, copy the formatted manual pages to the standard output without using
96: .Xr more 1
97: to paginate them.
98: .It Fl f
99: Search for all words in
100: .Ar expression
101: in manual page names only.
102: The search is case insensitive and matches whole words only.
103: In this mode, macro keys, comparison operators, and logical operators
104: are not available.
105: This overrides any earlier
106: .Fl k
1.26 ! schwarze 107: and
! 108: .Fl l
! 109: options.
1.25 schwarze 110: .It Fl k
111: Support the full
112: .Ar expression
113: syntax.
114: This overrides any earlier
115: .Fl f
1.26 ! schwarze 116: and
! 117: .Fl l
! 118: options.
1.25 schwarze 119: It is the default for
120: .Nm .
1.26 ! schwarze 121: .It Fl l
! 122: An alias for
! 123: .Xr mandoc 1
! 124: .Fl a .
! 125: This overrides any earlier
! 126: .Fl f ,
! 127: .Fl k ,
! 128: and
! 129: .Fl w
! 130: options.
1.13 schwarze 131: .It Fl M Ar path
1.6 schwarze 132: Use the colon-separated path instead of the default list of paths
133: searched for
1.16 schwarze 134: .Xr makewhatis 8
1.6 schwarze 135: databases.
136: Invalid paths, or paths without manual databases, are ignored.
1.13 schwarze 137: .It Fl m Ar path
1.6 schwarze 138: Prepend the colon-separated paths to the list of paths searched
139: for
1.16 schwarze 140: .Xr makewhatis 8
1.6 schwarze 141: databases.
142: Invalid paths, or paths without manual databases, are ignored.
1.20 schwarze 143: .It Fl O Ar outkey
144: Show the values associated with the key
145: .Ar outkey
146: instead of the manual descriptions.
1.3 schwarze 147: .It Fl S Ar arch
1.13 schwarze 148: Restrict the search to pages for the specified
149: .Xr machine 1
150: architecture.
151: .Ar arch
152: is case insensitive.
153: By default, pages for all architectures are shown.
154: .It Fl s Ar section
155: Restrict the search to the specified section of the manual.
156: By default, pages from all sections are shown.
1.1 schwarze 157: See
158: .Xr man 1
1.13 schwarze 159: for a listing of sections.
1.26 ! schwarze 160: .It Fl V
! 161: Print version and exit.
1.25 schwarze 162: .It Fl w
163: Instead of showing title lines, show the pathnames of the matching
164: manual pages, just like
165: .Xr man 1
166: .Fl w
167: would.
1.4 schwarze 168: .El
169: .Pp
170: An
171: .Ar expression
172: consists of search terms joined by logical operators
173: .Fl a
174: .Pq and
175: and
176: .Fl o
177: .Pq or .
178: The
179: .Fl a
180: operator has precedence over
181: .Fl o
182: and both are evaluated left-to-right.
183: .Bl -tag -width Ds
184: .It \&( Ar expr No \&)
185: True if the subexpression
186: .Ar expr
187: is true.
188: .It Ar expr1 Fl a Ar expr2
189: True if both
190: .Ar expr1
191: and
192: .Ar expr2
193: are true (logical
1.23 schwarze 194: .Sq and ) .
1.4 schwarze 195: .It Ar expr1 Oo Fl o Oc Ar expr2
196: True if
197: .Ar expr1
198: and/or
199: .Ar expr2
200: evaluate to true (logical
1.23 schwarze 201: .Sq or ) .
1.4 schwarze 202: .It Ar term
203: True if
204: .Ar term
205: is satisfied.
206: This has syntax
1.23 schwarze 207: .Sm off
208: .Oo
209: .Op Ar key Op , Ar key ...
210: .Pq Cm = | ~
211: .Oc
1.24 schwarze 212: .Ar val ,
213: .Sm on
1.23 schwarze 214: where
215: .Ar key
1.4 schwarze 216: is an
217: .Xr mdoc 7
218: macro to query and
1.23 schwarze 219: .Ar val
1.4 schwarze 220: is its value.
1.7 schwarze 221: See
222: .Sx Macro Keys
223: for a list of available keys.
1.4 schwarze 224: Operator
1.23 schwarze 225: .Cm =
1.4 schwarze 226: evaluates a substring, while
1.23 schwarze 227: .Cm ~
1.4 schwarze 228: evaluates a regular expression.
229: .It Fl i Ar term
1.8 schwarze 230: If
1.4 schwarze 231: .Ar term
1.8 schwarze 232: is a regular expression, it
1.4 schwarze 233: is evaluated case-insensitively.
1.8 schwarze 234: Has no effect on substring terms.
1.1 schwarze 235: .El
236: .Pp
1.23 schwarze 237: Results are sorted by manual sections and names, with output formatted as
1.1 schwarze 238: .Pp
1.23 schwarze 239: .D1 name[, name...](sec) \- description
1.1 schwarze 240: .Pp
241: Where
1.23 schwarze 242: .Dq name
243: is the manual's name,
244: .Dq sec
1.3 schwarze 245: is the manual section, and
1.23 schwarze 246: .Dq description
1.1 schwarze 247: is the manual's short description.
248: If an architecture is specified for the manual, it is displayed as
249: .Pp
1.23 schwarze 250: .D1 name(sec/arch) \- description
1.1 schwarze 251: .Pp
252: Resulting manuals may be accessed as
253: .Pp
1.23 schwarze 254: .Dl $ man \-s sec name
1.1 schwarze 255: .Pp
256: If an architecture is specified in the output, use
257: .Pp
1.23 schwarze 258: .Dl $ man \-s sec \-S arch name
1.7 schwarze 259: .Ss Macro Keys
260: Queries evaluate over a subset of
261: .Xr mdoc 7
262: macros indexed by
1.16 schwarze 263: .Xr makewhatis 8 .
1.7 schwarze 264: In addition to the macro keys listed below, the special key
265: .Cm any
266: may be used to match any available macro key.
267: .Pp
268: Names and description:
269: .Bl -column "xLix" description -offset indent -compact
270: .It Li \&Nm Ta manual name
271: .It Li \&Nd Ta one-line manual description
1.20 schwarze 272: .It Li arch Ta machine architecture (case-insensitive)
273: .It Li sec Ta manual section number
1.7 schwarze 274: .El
275: .Pp
276: Sections and cross references:
277: .Bl -column "xLix" description -offset indent -compact
278: .It Li \&Sh Ta section header (excluding standard sections)
279: .It Li \&Ss Ta subsection header
280: .It Li \&Xr Ta cross reference to another manual page
281: .It Li \&Rs Ta bibliographic reference
282: .El
283: .Pp
284: Semantic markup for command line utilities:
285: .Bl -column "xLix" description -offset indent -compact
286: .It Li \&Fl Ta command line options (flags)
287: .It Li \&Cm Ta command modifier
288: .It Li \&Ar Ta command argument
289: .It Li \&Ic Ta internal or interactive command
290: .It Li \&Ev Ta environmental variable
291: .It Li \&Pa Ta file system path
292: .El
293: .Pp
294: Semantic markup for function libraries:
295: .Bl -column "xLix" description -offset indent -compact
296: .It Li \&Lb Ta function library name
297: .It Li \&In Ta include file
298: .It Li \&Ft Ta function return type
299: .It Li \&Fn Ta function name
300: .It Li \&Fa Ta function argument type and name
301: .It Li \&Vt Ta variable type
302: .It Li \&Va Ta variable name
303: .It Li \&Dv Ta defined variable or preprocessor constant
304: .It Li \&Er Ta error constant
305: .It Li \&Ev Ta environmental variable
306: .El
307: .Pp
308: Various semantic markup:
309: .Bl -column "xLix" description -offset indent -compact
310: .It Li \&An Ta author name
311: .It Li \&Lk Ta hyperlink
312: .It Li \&Mt Ta Do mailto Dc hyperlink
313: .It Li \&Cd Ta kernel configuration declaration
314: .It Li \&Ms Ta mathematical symbol
315: .It Li \&Tn Ta tradename
316: .El
317: .Pp
318: Physical markup:
319: .Bl -column "xLix" description -offset indent -compact
320: .It Li \&Em Ta italic font or underline
321: .It Li \&Sy Ta boldface font
322: .It Li \&Li Ta typewriter font
323: .El
324: .Pp
325: Text production:
326: .Bl -column "xLix" description -offset indent -compact
327: .It Li \&St Ta reference to a standards document
328: .It Li \&At Ta At No version reference
329: .It Li \&Bx Ta Bx No version reference
330: .It Li \&Bsx Ta Bsx No version reference
331: .It Li \&Nx Ta Nx No version reference
332: .It Li \&Fx Ta Fx No version reference
333: .It Li \&Ox Ta Ox No version reference
334: .It Li \&Dx Ta Dx No version reference
335: .El
1.6 schwarze 336: .Sh ENVIRONMENT
1.25 schwarze 337: .Bl -tag -width MANPAGER
338: .It Ev MANPAGER
339: Any non-empty value of the environment variable
340: .Ev MANPAGER
341: will be used instead of the standard pagination program,
342: .Xr more 1 .
1.6 schwarze 343: .It Ev MANPATH
1.13 schwarze 344: The standard search path used by
345: .Xr man 1
346: may be changed by specifying a path in the
347: .Ev MANPATH
348: environment variable.
1.6 schwarze 349: Invalid paths, or paths without manual databases, are ignored.
350: Overridden by
351: .Fl M .
1.10 schwarze 352: If
353: .Ev MANPATH
1.13 schwarze 354: begins with a colon, it is appended to the default list;
355: if it ends with a colon, it is prepended to the default list;
356: or if it contains two adjacent colons,
357: the standard search path is inserted between the colons.
358: If none of these conditions are met, it overrides the
359: standard search path.
1.25 schwarze 360: .It Ev PAGER
361: Specifies the pagination program to use when
362: .Ev MANPAGER
363: is not defined.
364: If neither PAGER nor MANPAGER is defined,
365: .Pa /usr/bin/more Fl s
366: will be used.
1.9 schwarze 367: .El
368: .Sh FILES
369: .Bl -tag -width "/etc/man.conf" -compact
1.15 schwarze 370: .It Pa mandoc.db
1.9 schwarze 371: name of the
1.16 schwarze 372: .Xr makewhatis 8
1.9 schwarze 373: keyword database
374: .It Pa /etc/man.conf
375: default
376: .Xr man 1
377: configuration file
1.6 schwarze 378: .El
1.1 schwarze 379: .Sh EXIT STATUS
380: .Ex -std
381: .Sh EXAMPLES
382: Search for
1.14 schwarze 383: .Qq .cf
384: as a substring of manual names and descriptions:
1.4 schwarze 385: .Pp
1.14 schwarze 386: .Dl $ apropos .cf
1.4 schwarze 387: .Pp
1.8 schwarze 388: Include matches for
1.14 schwarze 389: .Qq .cnf
1.8 schwarze 390: and
1.14 schwarze 391: .Qq .conf
392: as well:
1.4 schwarze 393: .Pp
1.14 schwarze 394: .Dl $ apropos .cf .cnf .conf
1.4 schwarze 395: .Pp
1.14 schwarze 396: Search in names and descriptions using a regular expression:
397: .Pp
398: .Dl $ apropos '~set.?[ug]id'
399: .Pp
1.23 schwarze 400: Search for manuals in the library section mentioning both the
1.1 schwarze 401: .Qq optind
1.14 schwarze 402: and the
1.4 schwarze 403: .Qq optarg
1.14 schwarze 404: variables:
405: .Pp
406: .Dl $ apropos \-s 3 Va=optind \-a Va=optarg
407: .Pp
408: Do exactly the same as calling
409: .Xr whatis 1
410: with the argument
411: .Qq ssh :
1.1 schwarze 412: .Pp
1.14 schwarze 413: .Dl $ apropos \-\- \-i 'Nm~[[:<:]]ssh[[:>:]]'
1.20 schwarze 414: .Pp
415: The following two invocations are equivalent:
416: .Pp
417: .D1 Li $ apropos -S Ar arch Li -s Ar section expression
418: .Bd -ragged -offset indent
419: .Li $ apropos \e( Ar expression Li \e)
420: .Li -a arch~^( Ns Ar arch Ns Li |any)$
421: .Li -a sec~^ Ns Ar section Ns Li $
422: .Ed
1.1 schwarze 423: .Sh SEE ALSO
424: .Xr man 1 ,
1.8 schwarze 425: .Xr re_format 7 ,
1.16 schwarze 426: .Xr makewhatis 8
1.17 schwarze 427: .Sh HISTORY
1.25 schwarze 428: Part of the functionality of
429: .Nm whatis
430: was already provided by the former
431: .Nm manwhere
432: utility in
433: .Bx 1 .
434: The
1.17 schwarze 435: .Nm
1.25 schwarze 436: and
437: .Nm whatis
438: utilities first appeared in
1.17 schwarze 439: .Bx 2 .
1.25 schwarze 440: They were rewritten from scratch for
1.20 schwarze 441: .Ox 5.6 .
1.17 schwarze 442: .Pp
443: The
444: .Fl M
445: option and the
446: .Ev MANPATH
447: variable first appeared in
448: .Bx 4.3 ;
449: .Fl m
450: in
451: .Bx 4.3 Reno ;
452: .Fl C
453: in
454: .Bx 4.4 Lite1 ;
455: and
456: .Fl S
457: and
458: .Fl s
459: in
1.25 schwarze 460: .Ox 4.5
461: for
462: .Nm
463: and in
464: .Ox 5.6
465: for
466: .Nm whatis .
1.1 schwarze 467: .Sh AUTHORS
1.17 schwarze 468: .An -nosplit
469: .An Bill Joy
1.25 schwarze 470: wrote
471: .Nm manwhere
472: in 1977 and the original
1.17 schwarze 473: .Bx
1.1 schwarze 474: .Nm
1.25 schwarze 475: and
476: .Nm whatis
1.17 schwarze 477: in February 1979.
478: The current version was written by
1.20 schwarze 479: .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
480: and
481: .An Ingo Schwarze Aq Mt schwarze@openbsd.org .