OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.23, Wed Aug 27 00:06:08 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.22: +1 -1 lines
FILE REMOVED

Add an implementation of man(1) into the /usr/bin/mandoc binary and
provide a unified set of command line options for mandoc(1), man(1),
apropos(1), and whatis(1), each option doing the same for all four.
Not adding any completely new options, only extending exiting ones
from one tool to the others.  New options are:
* apropos & whatis -acfkw  (in the past, these were man(1) only)
* apropos & whatis -a -IOTW  (in the past, mandoc(1) only)
* mandoc -ac  (in the past, man(1) only)
* man -IOTW  (in the past, mandoc(1) only)

Before we can decide whether or not we want to replace src/usr.bin/man
with this implementation, considerable bugfixing, testing, and
performance measurements are needed, which i'd rather do in the tree
than outside.  Note that these bugs only affect the new man(1) mode,
existing mandoc(1), apropos(1), and whatis(1) is fine.

The new functionality in mandoc(1), apropos(1), and whatis(1)
is fully enabled.  To play with the new man(1), you can try:
# mv /usr/bin/man /usr/bin/oman
# ln -s /usr/bin/mandoc /usr/bin/man

Positive feedback about the general direction from sthen@ and jmc@,
and deraadt@ is not against it.

Revision 1.22 / (download) - annotate - [select for diffs], Sun Apr 20 16:44:44 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.21: +8 -7 lines
Diff to previous 1.21 (colored)

KNF: case (FOO):  ->  case FOO, remove /* LINTED */ and /* ARGSUSED */,
remove trailing whitespace and blanks before tabs, improve some indenting;
no functional change

Revision 1.21 / (download) - annotate - [select for diffs], Fri Apr 11 15:45:39 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.20: +3 -1 lines
Diff to previous 1.20 (colored)

Further apropos(1) speed optimization was trickier than anticipated.
Contrary to what i initially thought, almost all time is now spent
inside sqlite3(3) routines, and i found no easy way calling less of them.
However, sqlite(3) spends substantial time in malloc(3), and even more
(twice that) in its immediate malloc wrapper, sqlite3MemMalloc(),
keeping track of all individual malloc chunk sizes.  Typically about
90% of the malloced memory is used for purposes of the pagecache.

By providing an mmap(3) MAP_ANON SQLITE_CONFIG_PAGECACHE, execution
time decreases by 20-25% for simple (Nd and/or Nm) queries, 10-20% for
non-NAME queries, and even apropos(1) resident memory size as reported
by top(1) decreases by 20% for simple and by 60% for non-NAME queries.
The new function, mansearch_setup(), spends no measurable time.

The pagesize chosen is optimal:
* Substantially smaller pages yield no gain at all.
* Larger pages provide no additional benefit and just waste memory.

The chosen number of pages in the cache is a compromise:
* For simple queries, a handful of pages would suffice to get the full
speed effect, at an apropos(1) resident memory size of about 2.0 MB.
* For non-NAME queries, a large pagecache with 2k pages (2.5 MB) might
gain a few more percent in speed, but at the expense of doubling the
apropos(1) resident memory size for *all* queries.
* The chosen number of 256 pages (330 kB) allows nearly full speed gain
for all queries at the price of a 15% resident memory size increase.

Revision 1.20 / (download) - annotate - [select for diffs], Mon Jan 6 03:02:39 2014 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.19: +3 -5 lines
Diff to previous 1.19 (colored)

Drop Nd from the mpages table, it is still in the keys table.
This shrinks the database in standard mode by 3%, in -Q mode by 9%,
without loss of functionality.

Revision 1.19 / (download) - annotate - [select for diffs], Tue Dec 31 03:41:09 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.18: +14 -4 lines
Diff to previous 1.18 (colored)

Experimental feature to let apropos(1) show different keys than .Nd.
This really takes us beyond what grep -R /usr/*/man/ can do
because now you can search for pages by *one* criterion and then
display the contents of *another* macro from those pages, like in
$ apropos -O Ox Fa~wchar
to get an impression how long wide character handling is available.

Revision 1.18 / (download) - annotate - [select for diffs], Tue Dec 31 00:40:19 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.17: +26 -70 lines
Diff to previous 1.17 (colored)

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.17 / (download) - annotate - [select for diffs], Fri Jul 12 11:01:42 2013 UTC (10 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.16: +13 -12 lines
Diff to previous 1.16 (colored)

Simple partial sync to bsd.lv:
* Without arguments, show the usage line and EXIT_FAILURE.
* Resolve some gratuitious differences (order, parantheses, white space, etc).

Revision 1.16 / (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_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.15: +23 -14 lines
Diff to previous 1.15 (colored)

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

Revision 1.15 / (download) - annotate - [select for diffs], Thu Jan 5 22:07:42 2012 UTC (12 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.14: +7 -17 lines
Diff to previous 1.14 (colored)

Small tweaks for precision; lots of feedback from jmc@.
Update usage() as well; reminded by jmc@.
Mention the manwhere(1) predecessor in 1BSD; suggested by kristaps@.
OK jmc@.

Revision 1.14 / (download) - annotate - [select for diffs], Wed Dec 28 01:17:01 2011 UTC (12 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.13: +3 -3 lines
Diff to previous 1.13 (colored)

Some parsing improvements from kristaps@:
* Accept multiple lines in cat page NAME parsing.
* Do not trim the description to 70 characters in the database.
* Instead, limit the length of the description during output.
* In man(7), accept \-\- as a Nm-Nd separator; occurs in 3p.

Revision 1.13 / (download) - annotate - [select for diffs], Mon Dec 26 12:45:58 2011 UTC (12 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.12: +3 -3 lines
Diff to previous 1.12 (colored)

Document whatis(1) -S and -s; leading, trailing, and double colons
in the MANPATH; and the new whatis.index file.
Include some synching to apropos(1) and to the usage() string.
Use some feedback from jmc@.

Revision 1.12 / (download) - annotate - [select for diffs], Mon Dec 12 01:59:13 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.11: +10 -4 lines
Diff to previous 1.11 (colored)

implement -C (alternative config file) for apropos(1) and mandocdb(8);
ok kristaps@

Revision 1.11 / (download) - annotate - [select for diffs], Fri Dec 9 00:44:15 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

sort output case-insensitively; from kristaps@

Revision 1.10 / (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.9: +3 -3 lines
Diff to previous 1.9 (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.9 / (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.8: +13 -9 lines
Diff to previous 1.8 (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.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: +40 -36 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: +11 -9 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 14:52:32 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.5: +21 -5 lines
Diff to previous 1.5 (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.5 / (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.4: +4 -3 lines
Diff to previous 1.4 (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.4 / (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.3: +4 -9 lines
Diff to previous 1.3 (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.3 / (download) - annotate - [select for diffs], Sun Nov 13 09:58:21 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.2: +37 -581 lines
Diff to previous 1.2 (colored)

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).

While here,
* Drop the -e option; to search for exact strings, use REs.
* Drop the -r option (more changes related to this coming soon).
* Use the traditional -s and -S instead of inventing our own options.
* Drop the sort option (at least for now), it got in the way.

Written by kristaps@.

Revision 1.2 / (download) - annotate - [select for diffs], Sun Oct 9 17:59:56 2011 UTC (12 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.1: +142 -153 lines
Diff to previous 1.1 (colored)

Sync to version 1.12.0; all code by kristaps@:
Implement .Rv in -Tman.
Let -man -Tman work a bit like cat(1).
Add the -Ofragment option to -T[x]html.
Minor fixes in -T[x]html.
Lots of apropos(1) and -Tman code cleanup.

Revision 1.1 / (download) - annotate - [select for diffs], Thu Oct 6 23:04:16 2011 UTC (12 years, 7 months ago) by schwarze
Branch: MAIN

1) Import the future apropos(1) replacement written by kristaps@.
2) Link both that one and mandocdb(8) into the mandoc(1) binary.
3) Install a /usr/bin/mandocdb hardlink and the mandocdb(8) manual.

Do not replace /usr/bin/apropos by a hardlink yet because it is
not ready for production, and ports integration is still missing.
Development will be done in the tree, even the user interfaces
are still subject to change at this point.

Both jmc@ and deraadt@ agree with getting this in.

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.