CVS log for mandoc/Attic/apropos_db.c

[BACK] Up to [cvsweb.bsd.lv] / mandoc

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.33, Fri Jun 8 10:47:17 2012 UTC (11 years, 10 months ago) by kristaps
Branch: MAIN
CVS Tags: HEAD
Changes since 1.32: +1 -1 lines
FILE REMOVED

Remove lint from Makefile.
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).

Revision 1.32 / (download) - annotate - [select for diffs], Sun Mar 25 00:48:47 2012 UTC (12 years ago) by kristaps
Branch: MAIN
Branch point for: VERSION_1_12
Changes since 1.31: +4 -1 lines
Diff to previous 1.31 (colored)

Some documentation nits.

Revision 1.31 / (download) - annotate - [select for diffs], Sat Mar 24 01:46:25 2012 UTC (12 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_12_1
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

Be insane.  Make apropos(1) subsume man(1).

Revision 1.30 / (download) - annotate - [select for diffs], Sat Mar 24 00:31:55 2012 UTC (12 years ago) by kristaps
Branch: MAIN
Changes since 1.29: +59 -83 lines
Diff to previous 1.29 (colored)

Simplify by not pre-filtering the result vector for satisfied matches:
we can do this in the frontend.

Revision 1.29 / (download) - annotate - [select for diffs], Fri Mar 23 05:07:35 2012 UTC (12 years ago) by kristaps
Branch: MAIN
Changes since 1.28: +2 -1 lines
Diff to previous 1.28 (colored)

Merge some/most of schwarze@'s OpenBSD changes into mandoc: many more
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.

Revision 1.28 / (download) - annotate - [select for diffs], Sun Dec 25 14:58:39 2011 UTC (12 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.27: +21 -21 lines
Diff to previous 1.27 (colored)

For binary compatability of the databases across architectures,
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.

Revision 1.27 / (download) - annotate - [select for diffs], Tue Dec 20 21:41:11 2011 UTC (12 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.26: +7 -6 lines
Diff to previous 1.26 (colored)

Do not cast void pointers to pointers requiring alignment.
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.

Revision 1.26 / (download) - annotate - [select for diffs], Fri Dec 16 20:06:58 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (colored)

Two lint fixes.

Revision 1.25 / (download) - annotate - [select for diffs], Fri Dec 16 12:07:45 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored)

Make sure that "any" is UINT64_MAX, not just INT_MAX, else "any" won't
cover all types.  Found after some database trawling.

Revision 1.24 / (download) - annotate - [select for diffs], Fri Dec 16 12:06:35 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.23: +15 -5 lines
Diff to previous 1.23 (colored)

Make the stored "cat"/"mdoc"/"man" strings just be c/d/a single-character
bytes.  This cuts down a little in index size and allows for cleaner
extraction of information.

Revision 1.23 / (download) - annotate - [select for diffs], Sat Dec 10 21:46:59 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.22: +3 -2 lines
Diff to previous 1.22 (colored)

Plug a memory leak in single_search().

Revision 1.22 / (download) - annotate - [select for diffs], Fri Dec 9 11:18:57 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.21: +5 -3 lines
Diff to previous 1.21 (colored)

When specifying an architecture to whatis(1)/apropos(1)/man.cgi(7), do a
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.

Revision 1.21 / (download) - annotate - [select for diffs], Sat Dec 3 18:47:09 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.20: +1 -2 lines
Diff to previous 1.20 (colored)

Back out lorder, which doesn't seem necessary (?).  I think this means all
fields are endian-neutral, although the recno(3) key is unknown.

Revision 1.20 / (download) - annotate - [select for diffs], Sat Dec 3 12:09:07 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.19: +2 -1 lines
Diff to previous 1.19 (colored)

Make sure the btree(3) goop is also BE.  This covers both the DB metadata
and prior commits handle the contained binary fields.

Revision 1.19 / (download) - annotate - [select for diffs], Fri Dec 2 00:21:56 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.18: +10 -2 lines
Diff to previous 1.18 (colored)

This is a little gross: Linux and Apple need lots some cajoling to work
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.

Revision 1.18 / (download) - annotate - [select for diffs], Thu Dec 1 23:55:58 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.17: +3 -5 lines
Diff to previous 1.17 (colored)

Use OpenBSD's endian functions.  Make btree type also be endian-neutral.

Revision 1.17 / (download) - annotate - [select for diffs], Thu Dec 1 23:46:26 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.16: +30 -27 lines
Diff to previous 1.16 (colored)

In apropos_db.c, move all btree reading (and safety checks) into the
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.

Revision 1.16 / (download) - annotate - [select for diffs], Tue Nov 29 10:53:42 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.15: +3 -12 lines
Diff to previous 1.15 (colored)

Make `-i' only apply to regular expressions.  For the equality operator
(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).

Revision 1.15 / (download) - annotate - [select for diffs], Mon Nov 28 09:44:05 2011 UTC (12 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.14: +5 -6 lines
Diff to previous 1.14 (colored)

Tweak whatis(1):
* 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@

Revision 1.14 / (download) - annotate - [select for diffs], Sun Nov 27 23:11:37 2011 UTC (12 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.13: +2 -1 lines
Diff to previous 1.13 (colored)

Save the manual type (mdoc, man, or cat) in the index file
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.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Nov 27 18:54:01 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.12: +46 -2 lines
Diff to previous 1.12 (colored)

Get us a whatis(1) mode for apropos(1).
This is from a patch to tech@ as critiqued by schwarze@, checked in to
get the ball rolling.

Revision 1.12 / (download) - annotate - [select for diffs], Sat Nov 26 22:38:11 2011 UTC (12 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.11: +28 -27 lines
Diff to previous 1.11 (colored)

Sync to OpenBSD, mostly gratuitous and whitespace differences,
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@

Revision 1.11 / (download) - annotate - [select for diffs], Wed Nov 23 09:55:28 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.10: +8 -7 lines
Diff to previous 1.10 (colored)

Let apropos_db.h export the volume of manpages for a parsed record.
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.

Revision 1.10 / (download) - annotate - [select for diffs], Sun Nov 20 16:29:50 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.9: +19 -13 lines
Diff to previous 1.9 (colored)

Clarify some behaviour, bringing schwarze@'s patch and mine closer together
(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.

Revision 1.9 / (download) - annotate - [select for diffs], Sun Nov 20 15:45:37 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

Ooops... tiny type error slipped in.

Revision 1.8 / (download) - annotate - [select for diffs], Sun Nov 20 15:43:14 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.7: +85 -59 lines
Diff to previous 1.7 (colored)

Integrate a moderately-patched version of schwarze@'s support for multiple
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.

Revision 1.7 / (download) - annotate - [select for diffs], Sun Nov 20 12:46:53 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.6: +40 -40 lines
Diff to previous 1.6 (colored)

Fix white-space in apropos_db.c to make merging cleaner.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Nov 20 12:39:08 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.5: +58 -32 lines
Diff to previous 1.5 (colored)

Merge schwarze@'s work for 64-bit types.  This is based on a tweaked patch
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.

Revision 1.5 / (download) - annotate - [select for diffs], Fri Nov 18 07:02:19 2011 UTC (12 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.4: +339 -95 lines
Diff to previous 1.4 (colored)

Evaluation with logical subexpressions.  This allows support for arbitrary,
nested logical subexpressions with AND (-a) and OR (-o) support.

Revision 1.4 / (download) - annotate - [select for diffs], Mon Nov 14 10:07:06 2011 UTC (12 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.3: +8 -8 lines
Diff to previous 1.3 (colored)

Have exprcomp() accept a string instead of an array-pointer.  Also, collapse
the arguments in apropos(1) into a single string passed to exprcomp().  Ok
schwarze@.

Revision 1.3 / (download) - annotate - [select for diffs], Sun Nov 13 11:10:27 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.2: +52 -58 lines
Diff to previous 1.2 (colored)

Rewrite the expression parser for a more concise syntax:

 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@

Revision 1.2 / (download) - annotate - [select for diffs], Sun Nov 13 10:49:57 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.1: +19 -17 lines
Diff to previous 1.1 (colored)

Inventing new keywords for mostly the same thing when a well-established
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.

Revision 1.1 / (download) - annotate - [select for diffs], Sun Nov 13 10:12:05 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN

Less misleading file names; ok kristaps@.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb