OpenBSD CVS

CVS log for src/usr.bin/mandoc/Attic/apropos_db.c


[BACK] Up to [local] / src / usr.bin / mandoc

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.20, Tue Dec 31 00:40:19 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.19: +1 -1 lines
FILE REMOVED

Replace the Berkeley-DB based mandocdb(8) by an SQLite3-based version,
aiming for more flexible development and optimization options.
Kristaps started this during the summer 2012, i did some very heavy
bugfixing during t2k13 and finally, during the last few days,
got it to a state where it is ripe for in-tree development.
Beware, neither the user interfaces nor the database formats
are expected to be stable just yet.

Will not be installed or activated until further discussion.
No functional change to mandoc(1).

"As long as it remains off until we decide the cost, fine." deraadt@

Revision 1.19 / (download) - annotate - [select for diffs], Sat Oct 5 21:17:29 2013 UTC (10 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.18: +2 -3 lines
Diff to previous 1.18 (colored)

Cleanup suggested by gcc-4.8.1, following hints by Christos Zoulas:
- avoid bad qualifier casting in roff.c, roff_parsetext()
  by changing the mandoc_escape arguments to "const char const **"
- avoid bad qualifier casting in mandocdb.c, index_merge()
- garbage collect a few unused variables elsewhere

Revision 1.18 / (download) - annotate - [select for diffs], Sun Apr 15 11:54:47 2012 UTC (12 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.17: +63 -84 lines
Diff to previous 1.17 (colored)

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

Revision 1.17 / (download) - annotate - [select for diffs], Sun Dec 25 14:51:33 2011 UTC (12 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.16: +21 -21 lines
Diff to previous 1.16 (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.16 / (download) - annotate - [select for diffs], Tue Dec 20 00:41:24 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.15: +7 -6 lines
Diff to previous 1.15 (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.

This now works on both sparc64 and i386, but note that the binary
database format is still machine-dependent.

Revision 1.15 / (download) - annotate - [select for diffs], Mon Dec 19 02:26:33 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.14: +18 -8 lines
Diff to previous 1.14 (colored)

Improvements from kristaps@:
(1) Make the database format simpler and smaller by
- storing the file type as a single character and
- storing paths relative to the dir containing the database.
The latter allows to move trees around.
Both together typically save 15-25% of the index size.
(2) Make sure apropos(1) "any" really covers all search keys.
(3) Make manpath_parseline() static, drop manpath_parseconf() completely.

Revision 1.14 / (download) - annotate - [select for diffs], Sat Dec 10 22:18:20 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.13: +7 -4 lines
Diff to previous 1.13 (colored)

Bugfixes from kristaps@:
(1) Always show architecture-independent manuals,
even when an architecture is specified on the command line.
(2) Do not leak memory when a manual is skipped
because it's the wrong section or architecture.

Revision 1.13 / (download) - annotate - [select for diffs], Sat Dec 3 22:47:27 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.12: +2 -7 lines
Diff to previous 1.12 (colored)

remove useless "#ifdef __linux__" that crept in,
and trivial sync to bsd.lv (two new comments)

Revision 1.12 / (download) - annotate - [select for diffs], Sat Dec 3 14:53:12 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.11: +30 -27 lines
Diff to previous 1.11 (colored)

Make the mandocdb(8) format endian-neutral by storing integer data
in network byte order; from kristaps@.

Hopefully, this finishes the database format.
This commit requires another rebuild of your mandoc databases
by running "sudo mandocdb".

Revision 1.11 / (download) - annotate - [select for diffs], Tue Nov 29 22:30:56 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.10: +3 -12 lines
Diff to previous 1.10 (colored)

Sync to bsd.lv, mostly from kristaps@.
Make `-i' only apply to regular expressions.
For substring matches, always use strcasestr().
Also, improve some manuals and comments.

Revision 1.10 / (download) - annotate - [select for diffs], Mon Nov 28 00:16:38 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.9: +45 -2 lines
Diff to previous 1.9 (colored)

Implement whatis(1) as a special apropos(1) mode as a part of
the mandoc(1) binary; not yet enabled for the general public.
Intended to replace src/usr.bin/whatis at a later time.
Coded by kristaps@, with a few tweaks by me.

To test this:
 $ mandocdb  # unless you have already done so earlier
 $ sudo ln -s /usr/bin/mandoc /usr/bin/whatis.m
 $ whatis.m mandoc apropos whatis
 $ whatis.m man

Revision 1.9 / (download) - annotate - [select for diffs], Sun Nov 27 23:11:32 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.8: +2 -1 lines
Diff to previous 1.8 (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.8 / (download) - annotate - [select for diffs], Sat Nov 26 16:41:35 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.7: +78 -70 lines
Diff to previous 1.7 (colored)

Resync to bsd.lv, most code from kristaps@.
In particular, support the MANPATH environment variable
and don't confuse index record numbers when working with
multiple mandoc databases at once.
Besides, remove lots of gratuitious code and whitespace differences.

Revision 1.7 / (download) - annotate - [select for diffs], Fri Nov 18 01:10:03 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.6: +252 -139 lines
Diff to previous 1.6 (colored)

Support parenthised subexpressions in apropos(1);
written by kristaps@, massive conflict resolution by me.
Lightly tested, putting it in for polishing it in-tree.
This concludes p2k11 for me, thanks robert@!

Revision 1.6 / (download) - annotate - [select for diffs], Thu Nov 17 15:38:27 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.5: +41 -16 lines
Diff to previous 1.5 (colored)

Change the search type mask from 32 to 64 bit such that a full set
of search types can be supported in the future.  While here, replace
a couple of memcpy(3)s by proper, statically type-checked assignments,
and de-obfuscate some magical numbers using sizeof().

Revision 1.5 / (download) - annotate - [select for diffs], Thu Nov 17 14:52:32 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.4: +70 -41 lines
Diff to previous 1.4 (colored)

Minimal man.conf(5) _whatdb support for mandocdb(8) and apropos(1),
and add the standard options -M and -m to apropos(1).
Including a bugfix to prevent mandocdb(8) from leaking
database file descriptors.

Revision 1.4 / (download) - annotate - [select for diffs], Wed Nov 16 13:23:27 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.3: +184 -55 lines
Diff to previous 1.3 (colored)

Support multiple search terms, and logical operations -a and -o
to combine them.  The default remains -o; usual precedence applies.
No explicit grouping by parentheses yet.
from kristaps@

Revision 1.3 / (download) - annotate - [select for diffs], Sun Nov 13 11:07:10 2011 UTC (12 years, 6 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:40:52 2011 UTC (12 years, 6 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:28:38 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN

Split the common code to be reused by other mandocdb clients,
for example the future man.cgi, out of apropos.c (which still
contains the apropos(1) main program, command line handling, and
the terminal output formatter) into apropos_db.{h,c} (which now
contains the database searching backend code).

... and actually commit the two new files.  Oops.

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.