summaryrefslogtreecommitdiffstats
path: root/apropos_db.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove lint from Makefile.Kristaps Dzonsons2012-06-081-879/+0
| | | | | | | Disable some parts of the build (man.cgi, etc.) while sqlite3 is being merged in nice and slow. Remove the bit swapping stuff in config.h.post. Remove apropos_db (replaced by mansearch).
* Some documentation nits.Kristaps Dzonsons2012-03-251-0/+3
|
* Be insane. Make apropos(1) subsume man(1).Kristaps Dzonsons2012-03-241-1/+1
|
* Simplify by not pre-filtering the result vector for satisfied matches:Kristaps Dzonsons2012-03-241-82/+58
| | | | we can do this in the frontend.
* Merge some/most of schwarze@'s OpenBSD changes into mandoc: many moreKristaps Dzonsons2012-03-231-0/+1
| | | | | | | | | | | | | | | warnings about grokking manpages in their respective directories. DO NOT, however, import his temporary-file routines (I don't plan on staying with a recno/btree split) nor the realpath() routines, which destroy relative path-ness. Also pull in the lorder bits. There are some changes I started to make then stopped relating to reporting errors in the correct directories. I'll clean this up in subsequent commits. This puts us more or less on parity with OpenBSD.
* For binary compatability of the databases across architectures,Ingo Schwarze2011-12-251-20/+20
| | | | | | | use pointers to arrays, not pointers to structs. It is now possible to create databases on sparc64 and use them on i386 and vice versa. Kristaps@ can't think of anything else that might be required, either. Put this in now such that we can move on.
* Do not cast void pointers to pointers requiring alignment.Ingo Schwarze2011-12-201-5/+6
| | | | | | | | | This makes mandocdb(8)/apropos(1) work on strict alignment architectures. Basic way to fix this confirmed by deraadt@ and kettenis@, thanks. ok kristaps@ This now works on both sparc64 and i386, but note that the binary database format is still machine-dependent.
* Two lint fixes.Kristaps Dzonsons2011-12-161-2/+2
|
* Make sure that "any" is UINT64_MAX, not just INT_MAX, else "any" won'tKristaps Dzonsons2011-12-161-1/+1
| | | | cover all types. Found after some database trawling.
* Make the stored "cat"/"mdoc"/"man" strings just be c/d/a single-characterKristaps Dzonsons2011-12-161-4/+14
| | | | | bytes. This cuts down a little in index size and allows for cleaner extraction of information.
* Plug a memory leak in single_search().Kristaps Dzonsons2011-12-101-1/+2
|
* When specifying an architecture to whatis(1)/apropos(1)/man.cgi(7), do aKristaps Dzonsons2011-12-091-2/+4
| | | | | | comparison only if the manual specifies an architecture, otherwise let it through. Looked over by schwarze@. This brings us much more in line with OpenBSD's behaviour.
* Back out lorder, which doesn't seem necessary (?). I think this means allKristaps Dzonsons2011-12-031-1/+0
| | | | fields are endian-neutral, although the recno(3) key is unknown.
* Make sure the btree(3) goop is also BE. This covers both the DB metadataKristaps Dzonsons2011-12-031-0/+1
| | | | and prior commits handle the contained binary fields.
* This is a little gross: Linux and Apple need lots some cajoling to workKristaps Dzonsons2011-12-021-1/+9
| | | | | | | | with byte-swapping. Tested on Mac. Any Linux machines somebody can test on? Anybody? While here, note the correct byte-size in mandocdb(8) and also note field widths and endianness. The btree is now endian-neutral.
* Use OpenBSD's endian functions. Make btree type also be endian-neutral.Kristaps Dzonsons2011-12-011-4/+2
|
* In apropos_db.c, move all btree reading (and safety checks) into theKristaps Dzonsons2011-12-011-26/+29
| | | | | | | | btree_read() function. Also, add a forgotten free() for the type of grokked record. Then in both mandocdb.c and apropos_db.c, make the "rec" field of the btree by in network-order.
* Make `-i' only apply to regular expressions. For the equality operatorKristaps Dzonsons2011-11-291-11/+2
| | | | | | (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-5/+4
| | | | | | | * 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-0/+1
| | | | | | | | 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-1/+45
| | | | | 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-26/+27
| | | | | | | | | 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-6/+7
| | | | | | | | | 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-12/+18
| | | | | | | | | | | | | | | | (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-1/+1
|
* Integrate a moderately-patched version of schwarze@'s support for multipleKristaps Dzonsons2011-11-201-58/+84
| | | | | | | | | | | 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-39/+39
|
* Merge schwarze@'s work for 64-bit types. This is based on a tweaked patchKristaps Dzonsons2011-11-201-31/+57
| | | | | | | 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-94/+338
| | | | 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-7/+7
| | | | | 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-56/+50
| | | | | | | | | | | | | 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-16/+18
| | | | | | | | | | 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