aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apropos_db.c
Commit message (Collapse)AuthorAgeFilesLines
* Make `-i' only apply to regular expressions. For the equality operatorKristaps Dzonsons2011-11-291-12/+3
| | | | | | (and thus the default), always use strcasestr(). Discussed on tech@ with schwarze@. While here, fix the apropos.c usage() message to be consistent with apropos(1) and clean up the EXAMPLES in apropos(1).
* Tweak whatis(1):Ingo Schwarze2011-11-281-6/+5
| | | | | | | * Bugfix: Use all arguments, not just the last one. * Use 'Nm~' instead of 'Nm,Nd~' to match OpenBSD behaviour. * For the progname, accept '^whatis', not '^whatis$' to ease testing. ok kristaps@
* Save the manual type (mdoc, man, or cat) in the index fileIngo Schwarze2011-11-271-1/+2
| | | | | | | | of the mandoc databases, as suggested by kristaps@. Given the well-structured code, this is surprisingly simple. This changes the mandoc.index database format. Run "sudo mandocdb" to regenerate your databases.
* Get us a whatis(1) mode for apropos(1).Kristaps Dzonsons2011-11-271-2/+46
| | | | | This is from a patch to tech@ as critiqued by schwarze@, checked in to get the ball rolling.
* Sync to OpenBSD, mostly gratuitous and whitespace differences,Ingo Schwarze2011-11-261-27/+28
| | | | | | | | | but a few serious things as well: * -M overrides MANPATH * -m prepends to the path * put back database close calls that got lost in mandocdb * missing sys/types.h in manpath.c, needed for size_t ok kristaps@
* Let apropos_db.h export the volume of manpages for a parsed record.Kristaps Dzonsons2011-11-231-7/+8
| | | | | | | | | This is necessary since an array of records can have duplicate record numbers in different mandoc.index files. The volume [right now] is just the index of the parsed mandoc.index in the manpaths. This is sensible because the order of the manpath is significant (it's the order of duplicate-named manuals displayed by man(1)) and is thus not likely to change.
* Clarify some behaviour, bringing schwarze@'s patch and mine closer togetherKristaps Dzonsons2011-11-201-13/+19
| | | | | | | | | | | | | | | | (although I still don't have -M, which is a big piece). First, the default search path is the cwd. This will change to use -M once I look over that code. If MANPATH is specified, this replaces the cwd. Both of these are augmented by -m. If paths don't exist or don't have databases, they're silently ignored. This makes perfect sense: you may be given a superset of possible paths. The corner case of no paths (where, say, MANPATH consists of bogus paths or the cwd is unreadable) simply means that no paths are searched.
* Ooops... tiny type error slipped in.Kristaps Dzonsons2011-11-201-2/+2
|
* Integrate a moderately-patched version of schwarze@'s support for multipleKristaps Dzonsons2011-11-201-59/+85
| | | | | | | | | | | directories containing mandocdb(8) databases. Some changes follow: (1) don't support -M yet; (2) fall back to cwd if no prior manpath has been specified; (3) resolve manpages using realpath() to prevent consecutive chdir()'s over relative paths; (4) note where further error-reporting is required; (5) fix leaking memory on exit in several cases.
* Fix white-space in apropos_db.c to make merging cleaner.Kristaps Dzonsons2011-11-201-40/+40
|
* Merge schwarze@'s work for 64-bit types. This is based on a tweaked patchKristaps Dzonsons2011-11-201-32/+58
| | | | | | | submitted to tech@ on 16/11/2011, 01:39. It has been updated to account for the logical-operator functions and to avoid keeping a live pointer into the DBT value, which is not guaranteed to be consistent across calls into the bdb library.
* Evaluation with logical subexpressions. This allows support for arbitrary,Kristaps Dzonsons2011-11-181-95/+339
| | | | nested logical subexpressions with AND (-a) and OR (-o) support.
* Have exprcomp() accept a string instead of an array-pointer. Also, collapseKristaps Dzonsons2011-11-141-8/+8
| | | | | the arguments in apropos(1) into a single string passed to exprcomp(). Ok schwarze@.
* Rewrite the expression parser for a more concise syntax:Ingo Schwarze2011-11-131-57/+51
| | | | | | | | | | | | | apropos [search_type[,...]=]substring apropos search_type[,...][,i]~regex ... and expression evaluation must take the search type into account. This allows to: * drop the global -I option and * drop the enum match, just using a boolean int. "go ahead" kristaps@
* Inventing new keywords for mostly the same thing when a well-establishedIngo Schwarze2011-11-131-17/+19
| | | | | | | | | | set of keywords already exists is a bad idea, so reuse the mdoc(7) macro names as apropos(1) search types. This is a gain in brevity as well. Some time ago, kristaps@ agreed in principle. The search type bit field constants are used by both mandocdb(8) and apropos(1) and should better stay in sync, so give them their own header file.
* Less misleading file names; ok kristaps@.Ingo Schwarze2011-11-131-0/+541