CVS log for mandoc/Attic/apropos.c

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

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.42, Sun Aug 17 03:24:47 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.41: +1 -1 lines
FILE REMOVED

Fully integrate apropos(1) into mandoc(1).
Switch the argmode on the progname, including man(1).
Provide -f and -k options to switch the argmode.
Store the argmode inside struct search, generalizing the flags.
Derive the deftype from the argmode when needed instead of storing it.
Store the outkey inside struct search instead of passing it alone.
While here, get rid of the trailing blanks in Makefile.depend.

Revision 1.41 / (download) - annotate - [select for diffs], Sat Aug 16 23:04:25 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.40: +2 -2 lines
Diff to previous 1.40 (colored)

When BUILD_DB is active, link apropos(1) into the mandoc binary.
This is the first step on the way to a man(1) implementation.
The new ./configure is flexible enough to make this step quite easy.

Revision 1.40 / (download) - annotate - [select for diffs], Sun Aug 10 23:54:41 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.39: +3 -3 lines
Diff to previous 1.39 (colored)

Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.
Include <sys/types.h> where needed, it does not belong in config.h.
Remove <stdio.h> from config.h; if it is missing somewhere, it should
be added, but i cannot find a *.c file where it is missing.

Revision 1.39 / (download) - annotate - [select for diffs], Sun Apr 20 16:46:04 2014 UTC (10 years ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_1
Changes since 1.38: +8 -7 lines
Diff to previous 1.38 (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.38 / (download) - annotate - [select for diffs], Fri Apr 11 15:46:52 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.37: +3 -1 lines
Diff to previous 1.37 (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.37 / (download) - annotate - [select for diffs], Mon Jan 6 03:02:46 2014 UTC (10 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.36: +3 -5 lines
Diff to previous 1.36 (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.36 / (download) - annotate - [select for diffs], Tue Dec 31 03:41:14 2013 UTC (10 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.35: +14 -4 lines
Diff to previous 1.35 (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.35 / (download) - annotate - [select for diffs], Fri Dec 27 18:51:25 2013 UTC (10 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.34: +4 -2 lines
Diff to previous 1.34 (colored)

Change the mansearch() interface to use the mlinks table in the database
and return a list of names with sections, used by apropos(1) for display.
While here, improve uniformity of the interface by allocating the file
name dynamically, just like the names list and the description.

Revision 1.34 / (download) - annotate - [select for diffs], Fri Jul 5 09:33:02 2013 UTC (10 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +11 -11 lines
Diff to previous 1.33 (colored)

Simple partial sync with OpenBSD:
* Again accept suffixes on the name of the whatis utility.
* The usage line for whatis must not invite expressions.
* Revert the argument names in the SYNOPSIS back to the usual ones.
* Revert a few gratuitious changes regarding line breaks etc.

Revision 1.33 / (download) - annotate - [select for diffs], Sat Jun 9 17:49:13 2012 UTC (11 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.32: +2 -1 lines
Diff to previous 1.32 (colored)

Allow compilation on Mac OSX.

Revision 1.32 / (download) - annotate - [select for diffs], Sat Jun 9 14:11:15 2012 UTC (11 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.31: +13 -8 lines
Diff to previous 1.31 (colored)

Merge whatis.1 into apropos.1 (and remove), add whatis bits to apropos
(via mansearch), and merge mandocdb.h into mansearch.h (and remove).

Revision 1.31 / (download) - annotate - [select for diffs], Fri Jun 8 10:44:52 2012 UTC (11 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.30: +32 -167 lines
Diff to previous 1.30 (colored)

Flip apropos to use mansearch instead of apropos_db.
This makes the utility much smaller and simpler.
A lot of functionality has been omitted while the sqlite3 search routines
improve (logical operations, etc.).
It still needs work to make the output more conventional.
Also add the manpage utility, which I use extensively as a mind-meld of
apropos and man.

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

Forgot chdir(2) into volume path.

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

Small tweaks for release.

Revision 1.28 / (download) - annotate - [select for diffs], Sat Mar 24 01:46:25 2012 UTC (12 years ago) by kristaps
Branch: MAIN
Changes since 1.27: +91 -19 lines
Diff to previous 1.27 (colored)

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

Revision 1.27 / (download) - annotate - [select for diffs], Sat Mar 24 00:31:55 2012 UTC (12 years ago) by kristaps
Branch: MAIN
Branch point for: VERSION_1_12
Changes since 1.26: +17 -10 lines
Diff to previous 1.26 (colored)

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

Revision 1.26 / (download) - annotate - [select for diffs], Fri Mar 23 02:52:33 2012 UTC (12 years ago) by kristaps
Branch: MAIN
Changes since 1.25: +5 -4 lines
Diff to previous 1.25 (colored)

Revert to mandocdb.{index,db} for database files.

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

When parsing catpages, read from the first section (NAME, we hope) until
the next section.  Also, remove the limit of 72 characters and enforce
this, instead in the apropos frontend.

Revision 1.24 / (download) - annotate - [select for diffs], Mon Dec 12 02:00:49 2011 UTC (12 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.23: +10 -4 lines
Diff to previous 1.23 (colored)

implement -C (alternative config file) for apropos(1) and mandocdb(8),
including various tweaks to the whatis(8) manual;
ok kristaps@

Revision 1.23 / (download) - annotate - [select for diffs], Wed Dec 7 16:08:55 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

Apropos and man.cgi should strcasecmp their output sorting.
man.cgi should sort in the first place -- it wasn't before.
Revert uppercasing of man.cgi title.

Revision 1.22 / (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.21: +3 -3 lines
Diff to previous 1.21 (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.21 / (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.20: +2 -2 lines
Diff to previous 1.20 (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.20 / (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.19: +13 -9 lines
Diff to previous 1.19 (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.19 / (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.18: +10 -10 lines
Diff to previous 1.18 (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.18 / (download) - annotate - [select for diffs], Wed Nov 23 09:50:40 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.17: +5 -134 lines
Diff to previous 1.17 (colored)

Have apropos(1) take advantage of manpath.h instead of doing the work
itself.

Revision 1.17 / (download) - annotate - [select for diffs], Sun Nov 20 21:36:00 2011 UTC (12 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.16: +93 -9 lines
Diff to previous 1.16 (colored)

Initial support for man.conf/makepath(1).

Revision 1.16 / (download) - annotate - [select for diffs], Sun Nov 20 16:29:50 2011 UTC (12 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.15: +22 -23 lines
Diff to previous 1.15 (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.15 / (download) - annotate - [select for diffs], Sun Nov 20 15:43:14 2011 UTC (12 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.14: +90 -20 lines
Diff to previous 1.14 (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.14 / (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.13: +14 -38 lines
Diff to previous 1.13 (colored)

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

Revision 1.13 / (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.12: +29 -2 lines
Diff to previous 1.12 (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.12 / (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.11: +4 -9 lines
Diff to previous 1.11 (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.11 / (download) - annotate - [select for diffs], Sun Nov 13 10:12:05 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

Less misleading file names; ok kristaps@.

Revision 1.10 / (download) - annotate - [select for diffs], Wed Nov 9 22:05:56 2011 UTC (12 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.9: +16 -57 lines
Diff to previous 1.9 (colored)

Make apropos's lookup use a find(1)-like expression.  I'll write more on
this when it completes; this is to keep it in-tree.

Right now this uses prefix notation.  Ignore it.  I'll make this into
infix notation real soon.

The goal of this (exprcomp and exprexec) is to have arbitrary logical
expressions.

Revision 1.9 / (download) - annotate - [select for diffs], Wed Nov 9 10:53:48 2011 UTC (12 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.8: +6 -6 lines
Diff to previous 1.8 (colored)

Change getopt() to be more like schwarze@'s suggestions.

Revision 1.8 / (download) - annotate - [select for diffs], Wed Nov 9 01:24:23 2011 UTC (12 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.7: +25 -537 lines
Diff to previous 1.7 (colored)

Split apropos.c into db.c and apropos.h with simpler code (re-written, but
inspired by apropos.c and mandoc-tools' mandoc-cgi.c).  This uses UTF-8
right now for its re-writing, but will soon accomodate for the regular
suspects (this is a rather simple matter).

I also introduce man.cgi (cgi.c), which is a standalone CGI that replaces
mandoc-tools' mandoc.cgi.  Right now it's just a framework.

Revision 1.7 / (download) - annotate - [select for diffs], Sun Oct 9 10:46:38 2011 UTC (12 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.6: +17 -15 lines
Diff to previous 1.6 (colored)

Make apropos results-gathering able to error out and clean up before
making the utility exit non-zero.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Oct 9 10:37:52 2011 UTC (12 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.5: +8 -26 lines
Diff to previous 1.5 (colored)

Remove some unnecessary variables and note that mchars_alloc never returns
NULL.

Revision 1.5 / (download) - annotate - [select for diffs], Sun Oct 9 10:35:12 2011 UTC (12 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.4: +32 -6 lines
Diff to previous 1.4 (colored)

Use a binary tree (for now, unbalanced) for deduping the records in the
results array.  This is much faster than the previous method, a linear
search, at a small cost.  Note that array offsets are used instead of
storing the res pointer because we may realloc the results vector.

Revision 1.4 / (download) - annotate - [select for diffs], Sat Oct 8 12:20:09 2011 UTC (12 years, 6 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_12_0
Changes since 1.3: +2 -5 lines
Diff to previous 1.3 (colored)

Use mandoc_realloc() in apropos, as we're linking to libmandoc.a.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Oct 7 13:29:03 2011 UTC (12 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.2: +8 -6 lines
Diff to previous 1.2 (colored)

Lift hard-coded limit of results.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Oct 7 13:22:33 2011 UTC (12 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.1: +97 -117 lines
Diff to previous 1.1 (colored)

Clean up file a bit: remove errx and err function pointers from the
state struct (directly using fprintf and perror to do this); add some
in-line documentation; remove state init and destroy directly to the
main function.

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

Import apropos from mandoc-tools after inlining all source files
(originally including extern.h, state.c, and sort.c).  The apropos
utility interfaces with the databases of mandocdb to provide semantic
searching capabilities.  It Works For Me, but will need lots of cleanup
in the coming months.

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