CVS log for mandoc/mandocdb.c

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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.267 / (download) - annotate - [select for diffs], Fri Apr 3 11:35:01 2020 UTC (4 months ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.266: +5 -3 lines
Diff to previous 1.266 (colored)

Remove some stray argument names from function prototypes,
for consistency with the dominant style used in mandoc.
No functional change.
Patch from Martin Vahlensieck <academicsolutions dot ch>.

Revision 1.266 / (download) - annotate - [select for diffs], Sun Jan 26 21:25:41 2020 UTC (6 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.265: +86 -36 lines
Diff to previous 1.265 (colored)

Repair more of the issues that i found in filescan() while investigating
the report from <Andreas dot Kahari at abc dot se> on ports@:

For a symlink, use the first of the following names that is available:
1. In -t mode, the symlink itself (unchanged).
2. When the (unresolved) symlink already resides inside the manpath,
just strip the manpath and use the rest (unchanged).
3. When prefix(es) of the unresolved symlink point to the manpath,
strip the longest such prefix and use the rest (new); this fixes
situations where the manpath or one of its parent directories is a
symlink and at the same time contains symlinks to manual pages.
4. Fall back to the fully resolved symlink, with the manpath stripped
(new); this may for example happen when the command line passes
symlinks from outside the manpath that point to manual pages inside
the manpath, or if manual page trees contain symlinks to symlinks and
not all of them are given on the command line.

The fallback (4) isn't perfect.  You can construct symlink spaghetti
in such a way that this algorithm will not enter all manual page
names into the database that a human would be able to deduce.  But
i do not expect such spaghetti to actually occur in practice (not
even in ports), and a full fix would require re-implementing
realpath(3) in terms of step-by-step readlink(2) calls, repeating
the complicated algorithm (3) after each step.

While here, also stop using PATH_MAX as the size of a static buffer
in filescan(); on some systems, it can be unreasonably large.
Instead, allocate path strings dynamically.

Revision 1.265 / (download) - annotate - [select for diffs], Sun Jan 26 11:16:47 2020 UTC (6 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.264: +3 -3 lines
Diff to previous 1.264 (colored)

Fix incorrect file type tests.
This bug caused sockets and character special devices to be accepted
as manual pages if they appeared inside manpaths, and
it caused incorrect file names to be entered into the database when
the manpath or one of its parent directories was a symbolic link.
This fixes the issues reported by <Andreas dot Kahari at abc dot se>
on ports@, but additional issues remain when symbolic links are
contained in a manpath that involves another symbolic link.

Revision 1.264 / (download) - annotate - [select for diffs], Sat Jan 25 22:59:22 2020 UTC (6 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.263: +60 -55 lines
Diff to previous 1.263 (colored)

Minor cleanup, no functional change:
Do not abuse strstr(3) to check whether one long string starts with
another long string.  Instead, use strncmp(3) with the proper length.
In set_basedir(), also reset *basedir in the error brances for extra safety.
While here, invert some more Yoda conditions in the neighbourhood.

Revision 1.263 / (download) - annotate - [select for diffs], Fri May 3 18:17:12 2019 UTC (15 months ago) by schwarze
Branch: MAIN
Changes since 1.262: +12 -7 lines
Diff to previous 1.262 (colored)

Enter dangling .so links into the database, to avoid harassing
users of man(1) about running makewhatis(8), which won't help.
Seeing the content of the broken .so request might even help
users to figure out how to access the manual page they want.

Fixing the last issue reported by Lorenzo Beretta <loreb at github>
as part of https://github.com/void-linux/void-packages/issues/9868 .

Revision 1.262 / (download) - annotate - [select for diffs], Sun Dec 30 00:49:55 2018 UTC (19 months, 1 week ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_5
Changes since 1.261: +21 -25 lines
Diff to previous 1.261 (colored)

Cleanup, no functional change:

The struct roff_man used to be a bad mixture of internal parser
state and public parsing results.  Move the public results to the
parsing result struct roff_meta, which is already public.  Move the
rest of struct roff_man to the parser-internal header roff_int.h.

Since the validators need access to the parser state, call them
from the top level parser during mparse_result() rather than from
the main programs, also reducing code duplication.

This keeps parser internal state out of thee main programs (five
in mandoc portable) and out of eight formatters.

Revision 1.261 / (download) - annotate - [select for diffs], Fri Dec 14 01:18:26 2018 UTC (19 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.260: +2 -3 lines
Diff to previous 1.260 (colored)

Major cleanup; may imply minor changes in edge cases of error reporting.

Finally, drop support for the run-time configurable mandocmsg()
callback.  It was over-engineered from the start, never used for
anything in a decade, and repeatedly caused maintenance headaches.

Consolidate reporting infrastructure into two files, mandoc.h and
mandoc_msg.c, mopping up the bits and pieces that were scattered
around main.c, read.c, mandoc_parse.h, libmandoc.h, the prototypes
of four parsing-related functions, and both parser structs.

Revision 1.260 / (download) - annotate - [select for diffs], Thu Dec 13 11:55:46 2018 UTC (19 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.259: +2 -1 lines
Diff to previous 1.259 (colored)

Cleanup, no functional change:
Split the top level parser interface out of the utility header
mandoc.h, into a new header mandoc_parse.h, for use in the main
program and in the main parser only.
Move enum mandoc_os into roff.h because struct roff_man is the
place where it is stored.
This allows removal of mandoc.h from seven files in low-level
parsers and in formatters.

Revision 1.259 / (download) - annotate - [select for diffs], Fri Aug 17 20:33:37 2018 UTC (23 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.258: +13 -11 lines
Diff to previous 1.258 (colored)

Remove more pointer arithmetic passing via regions outside the array
that is undefined according to the C standard.  Robert Elz <kre at
munnari dot oz dot au> pointed out i wasn't quite done yet.

Revision 1.258 / (download) - annotate - [select for diffs], Fri Feb 23 18:25:57 2018 UTC (2 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_4
Changes since 1.257: +27 -6 lines
Diff to previous 1.257 (colored)

Logically, the following are are type names - just like .Vt,
some of them with an optional variable name following:
- .Ft
- .Fa in the SYNOPSIS
- .Fn second and later arguments in the SYNOPSIS
So add these to the .Vt macro table in the mandoc.db(5) database.
During my LibreSSL work, i'm getting really tired of typing
$ man -k Vt,Ft,Fa=some_type_name
over and over again; now, this becomes just:
$ man -k Vt=some_type_name

Revision 1.257 / (download) - annotate - [select for diffs], Wed Feb 7 20:31:39 2018 UTC (2 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.256: +13 -3 lines
Diff to previous 1.256 (colored)

In man(7) and cat pages, cut off excessive one line descriptions.
An extreme example of how rogue files could mess up apropos(1) output
was reported by bentley@: qwtlicense(3) in the x11/qwt port.

Revision 1.256 / (download) - annotate - [select for diffs], Sat Aug 26 20:38:14 2017 UTC (2 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.255: +6 -6 lines
Diff to previous 1.255 (colored)

Fix previous: mmap(2) returns MAP_FAILED on failure, not NULL.
Bug pointed out by tedu@.

Revision 1.255 / (download) - annotate - [select for diffs], Sat Aug 26 15:55:46 2017 UTC (2 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.254: +54 -42 lines
Diff to previous 1.254 (colored)

Do not fork and exec cmp(1); instead, simply fstat(2), mmap(2), and
compare the files directly, allowing a much stricter pledge(2), at
very little cost: merely 15 additional lines of very simple code.
Suggested by George Brown <321 dot george at gmail dot com> on misc@.

Revision 1.254 / (download) - annotate - [select for diffs], Sat Aug 26 12:59:17 2017 UTC (2 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.253: +4 -21 lines
Diff to previous 1.253 (colored)

No need to fork and exec rm(1) -rf, we know that we have exactly
one file and exactly one directory to remove.  While here, increase
the size of the buffer such that the file name actually fits.
Minus 17 lines of code, no functional change.

Opportunity for simplification reported by George Brown <321 dot
george at gmail dot com> on misc@.

Revision 1.253 / (download) - annotate - [select for diffs], Fri Jul 28 14:48:25 2017 UTC (3 years ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_3, VERSION_1_14_2
Changes since 1.252: +2 -2 lines
Diff to previous 1.252 (colored)

When the mparse_alloc() prototype changed in read.c 1.179, updating
the enum constant was forgotten in this call.  No functional change
since the mmsg argument is NULL anyway.
Found by florian@ with clang.

Revision 1.252 / (download) - annotate - [select for diffs], Sat Jul 15 13:17:49 2017 UTC (3 years ago) by schwarze
Branch: MAIN
Changes since 1.251: +2 -2 lines
Diff to previous 1.251 (colored)

Improve rev. 1.250 further:
If a database is empty, we already don't write a database file and
delete an existing one.  If none exists, that only means the database
was empty and remains so, which is not an error.  So don't nag about
it, in particular because that would be a weekly(8) annoyance.
Issue reported by jmc@.

Revision 1.251 / (download) - annotate - [select for diffs], Sat Jun 24 14:38:32 2017 UTC (3 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.250: +3 -2 lines
Diff to previous 1.250 (colored)

Split -Wstyle into -Wstyle and the even lower -Wbase, and add
-Wopenbsd and -Wnetbsd to check conventions for the base system of
a specific operating system.  Mark operating system specific messages
with "(OpenBSD)" at the end.

Please use just "-Tlint" to check base system manuals (defaulting
to -Wall, which is now -Wbase), but prefer "-Tlint -Wstyle" for the
manuals of portable software projects you maintain that are not
part of OpenBSD base, to avoid bogus recommendations about base
system conventions that do not apply.

Issue originally reported by semarie@, solution using
an idea from tedu@, discussed with jmc@ and jca@.

Revision 1.250 / (download) - annotate - [select for diffs], Wed May 17 22:27:12 2017 UTC (3 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.249: +23 -1 lines
Diff to previous 1.249 (colored)

Never create empty databases.

When pkg_add(1)ing packages installing manual pages into some directory,
the database in that directory automatically gets created or updated,
no change so far.  This patch causes the database file to be
automatically unlinked when pkg_delete(1)ing the last package having
manual pages in that directory, to leave less cruft behind.

Suggested by ajacoutot@.

Revision 1.249 / (download) - annotate - [select for diffs], Fri May 5 15:17:32 2017 UTC (3 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.248: +1 -2 lines
Diff to previous 1.248 (colored)

Move .sp to the roff modules.  Enough infrastructure is in place
now that this actually saves code: -70 LOC.

Revision 1.248 / (download) - annotate - [select for diffs], Fri May 5 13:17:55 2017 UTC (3 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.247: +1 -2 lines
Diff to previous 1.247 (colored)

move .ll to the roff modules

Revision 1.247 / (download) - annotate - [select for diffs], Thu May 4 17:48:28 2017 UTC (3 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.246: +5 -3 lines
Diff to previous 1.246 (colored)

Parser reorg:
Generate the first node on the roff level: .br
Fix some column numbers in diagnostic messages while here.

Revision 1.246 / (download) - annotate - [select for diffs], Mon Apr 24 23:06:18 2017 UTC (3 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.245: +9 -10 lines
Diff to previous 1.245 (colored)

Continue parser unification:
* Make enum rofft an internal interface as enum roff_tok in "roff.h".
* Represent mdoc and man macros in enum roff_tok.
* Make TOKEN_NONE a proper enum value and use it throughout.
* Put the prologue macros first in the macro tables.
* Unify mdoc_macroname[] and man_macroname[] into roff_name[].

Revision 1.245 / (download) - annotate - [select for diffs], Fri Mar 3 13:41:42 2017 UTC (3 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.244: +2 -2 lines
Diff to previous 1.244 (colored)

Fix a copy-and-paste error that caused man(7) manuals without
a section number in .TH to be misinterpreted as preformatted.
Found by jsg@ with cppcheck.

Revision 1.220.2.12 / (download) - annotate - [select for diffs], Fri Feb 17 14:50:13 2017 UTC (3 years, 5 months ago) by schwarze
Branch: VERSION_1_13
Changes since 1.220.2.11: +3 -3 lines
Diff to previous 1.220.2.11 (colored) next main 1.221 (colored)

merge small style improvements from christos@ to the 1.13 branch

Revision 1.244 / (download) - annotate - [select for diffs], Fri Feb 17 14:45:55 2017 UTC (3 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_1
Changes since 1.243: +2 -2 lines
Diff to previous 1.243 (colored)

No need to cast NULL when assigning it to a variable;
from Christos Zoulas <christos at NetBSD>.

Revision 1.243 / (download) - annotate - [select for diffs], Fri Feb 17 14:31:52 2017 UTC (3 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.242: +2 -2 lines
Diff to previous 1.242 (colored)

Be consistent in protecting __attribute__ attributes with __;
from Christos Zoulas <christos @ NetBSD>.

Revision 1.220.2.11 / (download) - annotate - [select for diffs], Fri Jan 27 14:32:54 2017 UTC (3 years, 6 months ago) by schwarze
Branch: VERSION_1_13
Changes since 1.220.2.10: +9 -5 lines
Diff to previous 1.220.2.10 (colored)

merge rev 1.242: warn about missing one-line description

Revision 1.220.2.10 / (download) - annotate - [select for diffs], Fri Jan 27 14:23:13 2017 UTC (3 years, 6 months ago) by schwarze
Branch: VERSION_1_13
Changes since 1.220.2.9: +31 -14 lines
Diff to previous 1.220.2.9 (colored)

merge rev. 1.241: parse section number from the content of preformatted pages

Revision 1.220.2.9 / (download) - annotate - [select for diffs], Fri Jan 27 14:18:42 2017 UTC (3 years, 6 months ago) by schwarze
Branch: VERSION_1_13
Changes since 1.220.2.8: +20 -15 lines
Diff to previous 1.220.2.8 (colored)

merge rev. 1.240: default to preformatted, not to man(7)

Revision 1.220.2.8 / (download) - annotate - [select for diffs], Fri Jan 27 13:59:28 2017 UTC (3 years, 6 months ago) by schwarze
Branch: VERSION_1_13
Changes since 1.220.2.7: +15 -1 lines
Diff to previous 1.220.2.7 (colored)

merge rev. 1.239: fix base directory detection for makewhatis -t

Revision 1.242 / (download) - annotate - [select for diffs], Fri Jan 27 11:33:26 2017 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.241: +9 -4 lines
Diff to previous 1.241 (colored)

warn about missing one-line description;
missing feature found in the TODO file

Revision 1.241 / (download) - annotate - [select for diffs], Fri Jan 27 01:14:47 2017 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.240: +31 -14 lines
Diff to previous 1.240 (colored)

Parse the section number from the content of preformatted pages
and warn if it doesn't match the directory where the file was found.

Revision 1.240 / (download) - annotate - [select for diffs], Fri Jan 27 01:09:14 2017 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.239: +17 -13 lines
Diff to previous 1.239 (colored)

If parsing a page reveals that it is neither mdoc(7) nor man(7),
fall back to treating it as preformatted rather than treating
it as man(7) anyway.

Revision 1.239 / (download) - annotate - [select for diffs], Fri Jan 27 01:04:25 2017 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.238: +15 -1 lines
Diff to previous 1.238 (colored)

fix base directory detection for makewhatis -t

Revision 1.238 / (download) - annotate - [select for diffs], Fri Jan 27 00:56:32 2017 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.237: +7 -5 lines
Diff to previous 1.237 (colored)

Always register names taken from file names in the names ohash.
Bug found by makewhatis -p crashing in mlink_check().

Revision 1.220.2.7 / (download) - annotate - [select for diffs], Wed Jan 11 17:46:54 2017 UTC (3 years, 6 months ago) by schwarze
Branch: VERSION_1_13
Changes since 1.220.2.6: +3 -3 lines
Diff to previous 1.220.2.6 (colored)

merge rev. 1.237: completion of NODE_NOSRC work

Revision 1.237 / (download) - annotate - [select for diffs], Wed Jan 11 17:39:53 2017 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.236: +3 -3 lines
Diff to previous 1.236 (colored)

Do text production for .Bt, .Ex, .Rv, .Ud at the validation stage
rather than in the formatters.  Use NODE_NOSRC flag for .Lb and
NODE_NOSRC and NODE_NOPRT for .St.  Results in a more rigorous
syntax tree and in 135 lines less code.

This work was triggered by a question from Abhinav Upadhyay <er dot
abhinav dot upadhyay at gmail dot com> (NetBSD) on discuss@.

Revision 1.220.2.6 / (download) - annotate - [select for diffs], Tue Jan 10 23:40:01 2017 UTC (3 years, 6 months ago) by schwarze
Branch: VERSION_1_13
Changes since 1.220.2.5: +3 -3 lines
Diff to previous 1.220.2.5 (colored)

merge rev. 1.236: NODE_NOSRC and NODE_NOPRT for .Bx and .At

Revision 1.236 / (download) - annotate - [select for diffs], Tue Jan 10 23:36:34 2017 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.235: +3 -3 lines
Diff to previous 1.235 (colored)

Use new NODE_NOSRC and NODE_NOPRT flags for .Bx and .At.
More rigorous AST and 40 lines less code.

Revision 1.220.2.5 / (download) - annotate - [select for diffs], Tue Jan 10 22:04:26 2017 UTC (3 years, 6 months ago) by schwarze
Branch: VERSION_1_13
Changes since 1.220.2.4: +136 -131 lines
Diff to previous 1.220.2.4 (colored)

merge rev. 1.235: use NODE_NOSRC for .Ux, .Ox, and friends

Revision 1.235 / (download) - annotate - [select for diffs], Tue Jan 10 21:59:47 2017 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.234: +136 -131 lines
Diff to previous 1.234 (colored)

For the .Ux/.Ox family of macros, do text production at the validation
stage rather than in each and every individual formatter, using the
new NODE_NOSRC flag.  More rigorous and also ten lines less code.

Revision 1.220.2.4 / (download) - annotate - [select for diffs], Sat Oct 22 10:13:40 2016 UTC (3 years, 9 months ago) by schwarze
Branch: VERSION_1_13
Changes since 1.220.2.3: +3 -2 lines
Diff to previous 1.220.2.3 (colored)

merge 1.234: cast off_t and uint64_t for printf(3)

Revision 1.234 / (download) - annotate - [select for diffs], Sat Oct 22 10:09:27 2016 UTC (3 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.233: +3 -2 lines
Diff to previous 1.233 (colored)

cast off_t and uint64_t for printf(3)
to make sure that widths match on all platforms;
from Ed Maste <emaste at freebsd dot org>;
OK guenther@

Revision 1.220.2.3 / (download) - annotate - [select for diffs], Thu Oct 20 18:52:27 2016 UTC (3 years, 9 months ago) by schwarze
Branch: VERSION_1_13
Changes since 1.220.2.2: +32 -15 lines
Diff to previous 1.220.2.2 (colored)

merge reproducible build support including compat glue to 1.13 branch:
mandocdb.c 1.231 & 1.232; configure 1.52 & 1.53; configure.local.example 1.21

Revision 1.220.2.2 / (download) - annotate - [select for diffs], Thu Oct 20 17:40:12 2016 UTC (3 years, 9 months ago) by schwarze
Branch: VERSION_1_13
Changes since 1.220.2.1: +2 -2 lines
Diff to previous 1.220.2.1 (colored)

merge rev. 1.233: 0x%llu is a bad idea, make that 0x%llx

Revision 1.220.2.1 / (download) - annotate - [select for diffs], Thu Oct 20 17:35:58 2016 UTC (3 years, 9 months ago) by schwarze
Branch: VERSION_1_13
Changes since 1.220: +2 -2 lines
Diff to previous 1.220 (colored)

merge rev. 1.226: fix a typo that prevented names from .Dt
from getting priority over names from .Sh NAME

Revision 1.233 / (download) - annotate - [select for diffs], Thu Oct 20 16:31:00 2016 UTC (3 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.232: +2 -2 lines
Diff to previous 1.232 (colored)

0x%llu is a bad idea, make that 0x%llx;
noticed while investigating a report from Ed Maste

Revision 1.232 / (download) - annotate - [select for diffs], Tue Oct 18 16:06:44 2016 UTC (3 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.231: +9 -1 lines
Diff to previous 1.231 (colored)

Compat glue for the FreeBSD comparison function prototype for fts_open(3)
which differs from what most other systems use.
While here, improve diagnostic output of ./configure tests.

Revision 1.231 / (download) - annotate - [select for diffs], Tue Oct 18 14:15:33 2016 UTC (3 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.230: +26 -36 lines
Diff to previous 1.230 (colored)

Simplify and correct support for reproducible builds, such that database
entries come in a well-defined order even in the presence of MLINKS.
Do this by using the compar() argument of fts_open(3) rather than
trying to sort later, which missed some cases.
This also shortens the code by a few lines.

Diff from Ed Maste <emaste @ FreeBSD>, adapted to our tree
and tweaked a bit by me, final version confirmed by Ed.

Revision 1.230 / (download) - annotate - [select for diffs], Fri Sep 2 14:03:30 2016 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.229: +4 -4 lines
Diff to previous 1.229 (colored)

When "makewhatis -d" tries to add to a database that doesn't (yet) exist,
silently create it from scratch instead of printing a warning.
The annoying warning message was reported by ajacoutot@, and espie@
convincingly argues that a non-existing database can be considered
equivalent to an empty one.

Revision 1.229 / (download) - annotate - [select for diffs], Thu Sep 1 15:08:04 2016 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.228: +2 -2 lines
Diff to previous 1.228 (colored)

remove "sparc" from a comment

Revision 1.228 / (download) - annotate - [select for diffs], Mon Aug 22 16:15:26 2016 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.227: +5 -5 lines
Diff to previous 1.227 (colored)

When trying to edit an existing database with makewhatis(8) -d or -u
but reading the database fails, report the full path to the database
on standard error, and mention that the database is automatically
recreated from scratch.
Suggested by espie@.

Revision 1.227 / (download) - annotate - [select for diffs], Wed Aug 17 20:46:56 2016 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.226: +3 -2 lines
Diff to previous 1.226 (colored)

When the content of a manual page does not specify a section, the
empty string got added to the list of sections, breaking the database
format slightly and causing the page to not be considered part of
any section, not even if a section could be deduced from the directory
or from the file name.
Bug found due to the bogus pcredemo(3) "manual" in the pcre-8.38p0 package.

Revision 1.226 / (download) - annotate - [select for diffs], Fri Aug 5 17:22:45 2016 UTC (4 years ago) by schwarze
Branch: MAIN
Changes since 1.225: +2 -2 lines
Diff to previous 1.225 (colored)

fix a typo that prevented names from .Dt from getting priority
over names from .Sh NAME

Revision 1.225 / (download) - annotate - [select for diffs], Mon Aug 1 20:53:13 2016 UTC (4 years ago) by schwarze
Branch: MAIN
Changes since 1.224: +4 -3 lines
Diff to previous 1.224 (colored)

Repair makewhatis -t, regression in rev. 1.221 reported by naddy@.

Revision 1.224 / (download) - annotate - [select for diffs], Fri Jul 29 15:26:37 2016 UTC (4 years ago) by schwarze
Branch: MAIN
Changes since 1.223: +27 -8 lines
Diff to previous 1.223 (colored)

Sort pages in the pages table by file names.

Revision 1.223 / (download) - annotate - [select for diffs], Fri Jul 29 15:23:57 2016 UTC (4 years ago) by schwarze
Branch: MAIN
Changes since 1.222: +8 -25 lines
Diff to previous 1.222 (colored)

No need to populate the TYPE_arch and TYPE_sec bits, the information
is provided directly to dba_page_add() in dbadd_mlink()
and to dba_page_new() in dbadd().

No need for a dedicated loop for NAME_FILE.
It's done in dbadd_mlink() anyway.

In this context, also record section numbers taken from filenames
and from .Dt and .TH macros, architectures taken from .Dt macros,
and fix the filtering of duplicate filename entries.

Revision 1.222 / (download) - annotate - [select for diffs], Tue Jul 19 22:40:33 2016 UTC (4 years ago) by schwarze
Branch: MAIN
Changes since 1.221: +2 -3 lines
Diff to previous 1.221 (colored)

Now that our man.conf(5) format is mature and extremely simple,
delete manpath(1) support.  With the mandoc-based man(1), manpath(1)
is utterly useless.  Just set MANPATH_DEFAULT in configure.local
for sane operating system defaults, use man.conf(5) for machine-
specific modifications, and use ${MANPATH}, -m, and -M for user
preferences.

Revision 1.221 / (download) - annotate - [select for diffs], Tue Jul 19 21:31:55 2016 UTC (4 years ago) by schwarze
Branch: MAIN
Changes since 1.220: +91 -368 lines
Diff to previous 1.220 (colored)

Remove the dependency on SQLite without loss of functionality.
Stop supporting systems that don't have mmap(3).
Drop the obsolete names_check() now that we deleted MLINKS.

Revision 1.220 / (download) - annotate - [select for diffs], Tue Jul 19 13:36:13 2016 UTC (4 years ago) by schwarze
Branch: MAIN
Branch point for: VERSION_1_13
Changes since 1.219: +5 -4 lines
Diff to previous 1.219 (colored)

Use __attribute__((__format__ throughout.
Triggered by a smaller patch from Christos Zoulas.

While here, unify style, move several config tests to config.h,
and delete the useless MANDOC_CONFIG_H.

Revision 1.219 / (download) - annotate - [select for diffs], Fri Jul 15 18:03:45 2016 UTC (4 years ago) by schwarze
Branch: MAIN
Changes since 1.218: +4 -1 lines
Diff to previous 1.218 (colored)

add missing prototypes, no code change;
noticed by Christos Zoulas with -Wmissing-prototypes

Revision 1.218 / (download) - annotate - [select for diffs], Tue Jul 12 05:18:38 2016 UTC (4 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_13_4
Changes since 1.217: +11 -1 lines
Diff to previous 1.217 (colored)

Add support for Mac OS X's sandbox_init(3) sandbox functionality, which
is marked as DEPRECATED in OS X after 2011 or so, but has not been
removed and has no replacement.

ok schwarze@

Revision 1.217 / (download) - annotate - [select for diffs], Sat Jul 9 15:24:19 2016 UTC (4 years ago) by schwarze
Branch: MAIN
Changes since 1.216: +1 -2 lines
Diff to previous 1.216 (colored)

getopt(3) is declared in <unistd.h>, and <getopt.h> is not needed;
from Joerg Sonnenberger via Thomas Klausner, NetBSD.

Revision 1.216 / (download) - annotate - [select for diffs], Thu Mar 17 21:26:26 2016 UTC (4 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.215: +2 -2 lines
Diff to previous 1.215 (colored)

'accomodate' -> 'accommodate' in a comment.
From krw@, started by a diff from Mical Mazurek.

Revision 1.215 / (download) - annotate - [select for diffs], Fri Jan 8 17:48:09 2016 UTC (4 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.214: +10 -9 lines
Diff to previous 1.214 (colored)

Delete the redundant "nchild" member of struct roff_node, replacing
most uses by one, a few by two pointer checks, and only one by a
tiny loop - not only making data smaller, but code shorter as well.

This gets rid of an implicit invariant that confused both static
analysis tools and human auditors.  No functional change.

Revision 1.214 / (download) - annotate - [select for diffs], Fri Jan 8 15:02:54 2016 UTC (4 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.213: +4 -4 lines
Diff to previous 1.213 (colored)

Prefer warn(3) over perror(3) at the few places where it was used.
It is useful to see the program name, and we have err.h compat in place anyway.
Suggested by Christos Zoulas (NetBSD).

Revision 1.213 / (download) - annotate - [select for diffs], Fri Jan 8 02:53:13 2016 UTC (4 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.212: +2 -3 lines
Diff to previous 1.212 (colored)

Simplify the mparse_open() interface.
Just return the file descriptor or -1 on error;
there is just one kind of error anyway.
Suggested by Christos Zoulas (NetBSD).

Revision 1.212 / (download) - annotate - [select for diffs], Fri Jan 8 02:13:39 2016 UTC (4 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.211: +2 -1 lines
Diff to previous 1.211 (colored)

It was very surprising that a function called mparse_readfd()
closed the file descriptor passed to it after completing its work,
in particular considering the fact that it required its callers
to call open(2) or mparse_open() beforehand.

Change mparse_readfd() to not call close(2) and change the callers
to call close(2) afterwards, more or less bringing open and close
to the same level of the code and making review easier.  Note that
man.cgi(8) already did that, even though it was wrong in the past.

Small restructuring suggested by Christos Zoulas (NetBSD).

Revision 1.211 / (download) - annotate - [select for diffs], Mon Jan 4 14:44:57 2016 UTC (4 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.210: +29 -14 lines
Diff to previous 1.210 (colored)

Improve handling of .Va and .Vt macros.
tedu@ noticed that no Vt= database entries were generated.
Serguey Parkhomovsky suggested the deletion of parse_mdoc_body().
tb@ noticed that the fix requires more than just adding TYPE_Vt
to the MDOC_Vt mask in the mdoc_handler array.

Revision 1.210 / (download) - annotate - [select for diffs], Tue Dec 15 17:38:45 2015 UTC (4 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.209: +12 -9 lines
Diff to previous 1.209 (colored)

pledge(2) style:
Make sure to always use the idiom 'if (pledge("'
such that it can easily be searched for.
No functional change.
Requested by deraadt@ some time ago.

Revision 1.209 / (download) - annotate - [select for diffs], Sat Nov 7 17:58:55 2015 UTC (4 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.208: +22 -18 lines
Diff to previous 1.208 (colored)

Modernization, no functional change intended:
Use the POSIX function getline(3) rather than the slightly
dangerous BSD function fgetln(3).
Remove the related compatibility code.

Revision 1.208 / (download) - annotate - [select for diffs], Sat Nov 7 14:22:29 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.207: +3 -1 lines
Diff to previous 1.207 (colored)

Without HAVE_ERR, don't try to include <err.h>, it probably isn't there.
In that case, the required prototypes are in "config.h".
Patch from Peter Bray <pdb_ml at yahoo dot com dot au>.

Revision 1.207 / (download) - annotate - [select for diffs], Fri Nov 6 17:33:34 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.206: +23 -1 lines
Diff to previous 1.206 (colored)

merge pledge(2) support from OpenBSD

Revision 1.206 / (download) - annotate - [select for diffs], Fri Nov 6 16:30:33 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.205: +4 -6 lines
Diff to previous 1.205 (colored)

Use getprogname(3) rather than __progname.
Suggested by Joerg@ Sonnenberger (NetBSD).
Last year, deraadt@ confirmed on tech@ that this "has the potential
to be more portable", and micro-optimizing for speed is not relevant
here.  Also gets rid of one global variable.

Revision 1.205 / (download) - annotate - [select for diffs], Thu Oct 22 22:06:43 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.204: +2 -1 lines
Diff to previous 1.204 (colored)

use the new function man_validate() here, too

Revision 1.204 / (download) - annotate - [select for diffs], Tue Oct 20 02:01:31 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.203: +2 -1 lines
Diff to previous 1.203 (colored)

In order to become able to generate syntax tree nodes on the roff(7)
level, validation must be separated from parsing and rewinding.
This first big step moves calling of the mdoc(7) post_*() functions
out of the parser loop into their own mdoc_validate() pass, while
using a new mdoc_state() module to make syntax tree state handling
available to both the parser loop and the validation pass.

Revision 1.203 / (download) - annotate - [select for diffs], Tue Oct 13 22:59:54 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.202: +6 -8 lines
Diff to previous 1.202 (colored)

Major character table cleanup:
* Use ohash(3) rather than a hand-rolled hash table.
* Make the character table static in the chars.c module:
There is no need to pass a pointer around, we most certainly
never want to use two different character tables concurrently.
* No need to keep the characters in a separate file chars.in;
that merely encourages downstream porters to mess with them.
* Sort the characters to agree with the mandoc_chars(7) manual page.
* Specify Unicode codepoints in hex, not decimal (that's the detail
that originally triggered this patch).
No functional change, minus 100 LOC, and i don't see a performance change.

Revision 1.202 / (download) - annotate - [select for diffs], Tue Oct 13 15:53:05 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.201: +10 -52 lines
Diff to previous 1.201 (colored)

Reduce the amount of code by moving the three copies of the ohash
callback functions into one common place, preparing for the use of
ohash for some additional purposes.  No functional change.

Revision 1.201 / (download) - annotate - [select for diffs], Mon Oct 12 21:17:15 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.200: +3 -4 lines
Diff to previous 1.200 (colored)

Garbage collect an unused variable, no functional change;
found by Svyatoslav Mishyn <juef at openmailbox dot org> with cppcheck.

Revision 1.200 / (download) - annotate - [select for diffs], Mon Oct 12 00:32:55 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.199: +23 -20 lines
Diff to previous 1.199 (colored)

Clear dform and dsec when exiting a first-level directory in treescan().
Fixes a segfault reported by bentley@.
While here, do some style cleanup in the same function.

Revision 1.199 / (download) - annotate - [select for diffs], Mon Oct 12 00:08:15 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.198: +1 -7 lines
Diff to previous 1.198 (colored)

To make the code more readable, delete 283 /* FALLTHROUGH */ comments
that were right between two adjacent case statement.  Keep only
those 24 where the first case actually executes some code before
falling through to the next case.

Revision 1.198 / (download) - annotate - [select for diffs], Sun Oct 11 21:12:54 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.197: +10 -17 lines
Diff to previous 1.197 (colored)

Finally use __progname, err(3) and warn(3).
That's more readable and less error-prone than fumbling around
with argv[0], fprintf(3), strerror(3), perror(3), and exit(3).

It's a bad idea to boycott good interfaces merely because standards
committees ignore them.  Instead, let's provide compatibility modules
for archaic systems (like commercial Solaris) that still don't have
them.  The compat module has an UCB Copyright (c) 1993...

Revision 1.197 / (download) - annotate - [select for diffs], Tue Oct 6 18:32:19 2015 UTC (4 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.196: +43 -43 lines
Diff to previous 1.196 (colored)

modernize style: "return" is not a function

Revision 1.196 / (download) - annotate - [select for diffs], Wed Sep 16 09:50:29 2015 UTC (4 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.195: +3 -3 lines
Diff to previous 1.195 (colored)

for portability, use (char *)NULL in execlp(3) as discussed on tech@ OpenBSD
(didn't blow up anywhere yet, but better safe than sorry)

Revision 1.195 / (download) - annotate - [select for diffs], Sun Jul 19 06:05:16 2015 UTC (5 years ago) by schwarze
Branch: MAIN
Changes since 1.194: +1 -5 lines
Diff to previous 1.194 (colored)

Do not fork and exec gunzip(1), just link with libz instead.
As discussed with deraadt@, that's cleaner and will help tame(2).
Something like this was also suggested earlier by bapt at FreeBSD.
Minus 50 lines of code, deleting one interface function (mparse_wait),
no functional change intended.

Revision 1.194 / (download) - annotate - [select for diffs], Thu Apr 23 16:17:44 2015 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.193: +3 -3 lines
Diff to previous 1.193 (colored)

Unify mdoc_deroff() and man_deroff() into a common function deroff().
No functional change except that for mdoc(7), it now skips leading
escape sequences just like it already did for man(7).
Escape sequences rarely occur in mdoc(7) code and if they do,
skipping them is an improvement in this context.
Minus 30 lines of code.

Revision 1.193 / (download) - annotate - [select for diffs], Sat Apr 18 17:53:21 2015 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.192: +8 -9 lines
Diff to previous 1.192 (colored)

Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),
man_node() from the mandoc(3) semi-public interface and the internal
wrapper functions print_mdoc() and print_man() from the HTML formatters.
Minus 60 lines of code, no functional change.

Revision 1.192 / (download) - annotate - [select for diffs], Sat Apr 18 16:34:25 2015 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.191: +9 -11 lines
Diff to previous 1.191 (colored)

Profit from the unified struct roff_man and reduce the number of
arguments of mparse_result() by one.  No functional change.
Written on the ICE Bruxelles-Koeln on the way back from p2k15.

Revision 1.191 / (download) - annotate - [select for diffs], Sat Apr 18 16:06:40 2015 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.190: +3 -3 lines
Diff to previous 1.190 (colored)

Replace the structs mdoc and man by a unified struct roff_man.
Almost completely mechanical, no functional change.
Written on the train from Exeter to London returning from p2k15.

Revision 1.190 / (download) - annotate - [select for diffs], Thu Apr 2 23:48:19 2015 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.189: +24 -24 lines
Diff to previous 1.189 (colored)

Third step towards parser unification:
Replace struct mdoc_meta and struct man_meta by a unified struct roff_meta.
Written of the train from London to Exeter on the way to p2k15.

Revision 1.189 / (download) - annotate - [select for diffs], Thu Apr 2 22:48:17 2015 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.188: +29 -29 lines
Diff to previous 1.188 (colored)

Second step towards parser unification:
Replace struct mdoc_node and struct man_node by a unified struct roff_node.
To be able to use the tok member for both mdoc(7) and man(7) without
defining all the macros in roff.h, sacrifice a tiny bit of type safety
and make tok an int rather than an enum.
Almost mechanical, no functional change.
Written on the Eurostar from Bruxelles to London on the way to p2k15.

Revision 1.188 / (download) - annotate - [select for diffs], Thu Apr 2 21:36:50 2015 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.187: +24 -23 lines
Diff to previous 1.187 (colored)

First step towards parser unification:
Replace enum mdoc_type and enum man_type by a unified enum roff_type.
Almost mechanical, no functional change.
Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.

Revision 1.187 / (download) - annotate - [select for diffs], Fri Mar 27 17:37:25 2015 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.186: +23 -23 lines
Diff to previous 1.186 (colored)

Parse the new man.conf(5) "output" directive.
The next step will be to actually use the parsed data.

Revision 1.186 / (download) - annotate - [select for diffs], Fri Mar 13 00:19:41 2015 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_3
Changes since 1.185: +2 -1 lines
Diff to previous 1.185 (colored)

Fix hardlink detection on platforms having padding in struct inodev,
typically 64bit platforms.  This was basically broken since forever.
Not only is the padding used, but it was used uninitialized.
Problem reported by jmc@.

Revision 1.185 / (download) - annotate - [select for diffs], Fri Feb 27 16:22:09 2015 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.184: +3 -2 lines
Diff to previous 1.184 (colored)

When makewhatis(8) scans a tree, ignore trailing garbage on filenames.
This is relevant because some ports install files like man1/xsel.1x,
as reported by patrick keshishian <pkeshish at gmail dot com> on misc@.

We can probably improve functionality and simplify the code by ignoring
file name extensions altogether; we already know the section number from
the name of the directory.  But so close to lock, i'm keeping the fix
minimal.

Revision 1.184 / (download) - annotate - [select for diffs], Wed Jan 21 22:41:49 2015 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.183: +10 -2 lines
Diff to previous 1.183 (colored)

Support homebrew-style linking on Mac OS X.
Idea found together with Alexis Hildebrandt <surryhill at gmail dot com>.

Revision 1.183 / (download) - annotate - [select for diffs], Thu Jan 15 04:26:40 2015 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.182: +6 -9 lines
Diff to previous 1.182 (colored)

Fatal errors no longer exist.
If a file can be opened, mandoc will produce some output;
at worst, the output may be almost empty.
Simplifies error handling and frees a message type for future use.

Revision 1.182 / (download) - annotate - [select for diffs], Sat Jan 3 12:55:25 2015 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.181: +16 -23 lines
Diff to previous 1.181 (colored)

Fix a potential NULL pointer access in an error message after waitpid()
failure; found using detailed information provided by Ulrich Spoerlein
<uqs at FreeBSD> about FreeBSD Coverity CID 1261304.

Revision 1.181 / (download) - annotate - [select for diffs], Fri Jan 2 17:02:19 2015 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.180: +4 -2 lines
Diff to previous 1.180 (colored)

Explicitly set the *data member of struct ohash_info to NULL.
It is never dereferenced, but it gets copied around, which worries
static analysis tools and might also confuse human auditors.
FreeBSD Coverity CID 1261298, 1261299, 1261300, reported by
Pedro Giffuni and Ulrich Spörlein <pfg@ and uqs@ at FreeBSD>.

Revision 1.180 / (download) - annotate - [select for diffs], Tue Dec 30 20:41:00 2014 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.179: +2 -1 lines
Diff to previous 1.179 (colored)

When a file is given on the command line, actually exists, and its name
relative to the respective manual tree is longer than PATH_MAX, do not
leak the memory allocated to hold the name.  Not sure that can actually
happen, but better safe than sorry.
FreeBSD Coverity Scan CID 1261303, reported by Pedro Giffuni <pfg@>.

Revision 1.179 / (download) - annotate - [select for diffs], Tue Dec 9 07:29:42 2014 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_2
Changes since 1.178: +2 -2 lines
Diff to previous 1.178 (colored)

Integrate the makewhatis binary into the mandoc binary
just like we do it on OpenBSD.  Smaller and neater.
While here, let ./configure set INSTALL_TARGETS.

Revision 1.178 / (download) - annotate - [select for diffs], Fri Dec 5 16:18:14 2014 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.177: +28 -25 lines
Diff to previous 1.177 (colored)

Improve parsing of function names.
This gets rid of the last bogus entries in base and Xenocara.

Revision 1.177 / (download) - annotate - [select for diffs], Fri Dec 5 15:16:54 2014 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.176: +4 -1 lines
Diff to previous 1.176 (colored)

Do not misinterpret function arguments as function names;
improves semantic analysis of more than 300 manuals.

Revision 1.176 / (download) - annotate - [select for diffs], Fri Dec 5 14:26:40 2014 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.175: +113 -122 lines
Diff to previous 1.175 (colored)

Render text before, not after accumulating flag bits, such that flags
for different representations of the same string end up in the same
database entry.  Improves name classification for 500 manuals.

Revision 1.175 / (download) - annotate - [select for diffs], Thu Dec 4 21:48:48 2014 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.174: +17 -4 lines
Diff to previous 1.174 (colored)

When finding a .so link after the page was already processed,
do not clobber the existing names flags;
instead, OR the additional flags into them.

Revision 1.174 / (download) - annotate - [select for diffs], Thu Dec 4 20:13:25 2014 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.173: +28 -11 lines
Diff to previous 1.173 (colored)

correctly store .Dt and .TH information in the names table

Revision 1.173 / (download) - annotate - [select for diffs], Thu Dec 4 18:31:20 2014 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.172: +17 -2 lines
Diff to previous 1.172 (colored)

in the SYNOPSIS, add .Fo and first .Fn arguments to the names table

Revision 1.172 / (download) - annotate - [select for diffs], Thu Dec 4 17:36:00 2014 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.171: +48 -25 lines
Diff to previous 1.171 (colored)

In the SYNOPSIS, if .Nm occurs without argument, give the first .Nm
that occurred in the document a NAME_SYN entry in the names table.

Revision 1.171 / (download) - annotate - [select for diffs], Thu Nov 27 01:58:21 2014 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.170: +19 -15 lines
Diff to previous 1.170 (colored)

Make makewhatis(8) understand .so links to .gz pages.
Drop the FORM_GZ annotation in the mpages table; it is conceptually wrong
because it ought to be in the mlinks table: An uncompressed .so link file
can point to a compressed manual page file and vice versa.
Besides, it is no longer needed because mparse_open() handles it all.
Sprinkle some KNF while here.

Revision 1.170 / (download) - annotate - [select for diffs], Wed Nov 26 21:40:17 2014 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.169: +3 -6 lines
Diff to previous 1.169 (colored)

Simplify the mparse_open()/mparse_wait() interface.
Don't bother the user with the PID of the child process,
store it inside the opaque mparse handle.

Revision 1.169 / (download) - annotate - [select for diffs], Wed Nov 19 20:40:51 2014 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.168: +14 -4 lines
Diff to previous 1.168 (colored)

Three fixes with respect to the names table:
1. Do not mask out NAME_FIRST before its first use.
2. Avoid duplicate NAME_FILE entries.
3. Correctly mask NAME_FILE for .so links.

Revision 1.168 / (download) - annotate - [select for diffs], Tue Oct 28 17:36:19 2014 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.167: +4 -4 lines
Diff to previous 1.167 (colored)

Make the character table available to libroff so it can check the
validity of character escape names and warn about unknown ones.
This requires mchars_spec2cp() to report unknown names again.
Fortunately, that doesn't require changing the calling code because
according to groff, invalid character escapes should not produce
output anyway, and now that we warn about them, that's fine.

Revision 1.167 / (download) - annotate - [select for diffs], Mon Oct 27 13:31:04 2014 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.166: +2 -2 lines
Diff to previous 1.166 (colored)

Fix a regression in term.c rev. 1.229 reported by bentley@:
In UTF-8 output, do not print anything if mchars_spec2cp() returns 0.
In particular, this repairs handling of zero-width spaces (\&).

While here, let mchars_spec2cp() return 0xFFFD instead of -1
if the character is not found, simplifying the using code.
In HTML output, do not print obfuscated ASCII characters and
do not test for one-char escapes, mchars_spec2cp() already does that.

Revision 1.166 / (download) - annotate - [select for diffs], Sun Oct 12 20:32:39 2014 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.165: +2 -1 lines
Diff to previous 1.165 (colored)

add missing entry for .ll to the dispatch table;
patch from Martin <Natano at natano dot net>, thanks

Revision 1.165 / (download) - annotate - [select for diffs], Tue Sep 9 19:35:25 2014 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.164: +16 -12 lines
Diff to previous 1.164 (colored)

If a manpath directory (for example, a _whatdb entry from man.conf(5)
or an entry in the MANPATH environment variable) does not exist,
silently skip it.  This brings makewhatis(8) back closer to the
behaviour of espie@'s version and ought to shut up the weekly(8)
whining observed by henning@ on machines not having xbase installed.
Also, don't error out after the first unusable manpath entry, still
try the others.

Of course, still complain about non-existent directories specified
on the command line and about any directories failing for other
reasons than ENOENT.

Revision 1.164 / (download) - annotate - [select for diffs], Sun Sep 7 03:08:47 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.163: +3 -3 lines
Diff to previous 1.163 (colored)

Do not report a page as arch=any merely because .Dt lacks the third argument.
Pages found outside arch-specific dirs still get arch=any, of course.
Issue reported by justinhenryhaynes at gmail dot com on misc@, thanks!

Revision 1.163 / (download) - annotate - [select for diffs], Sun Sep 7 03:00:21 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.162: +2 -2 lines
Diff to previous 1.162 (colored)

fix debugging output

Revision 1.162 / (download) - annotate - [select for diffs], Wed Sep 3 23:21:47 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.161: +14 -53 lines
Diff to previous 1.161 (colored)

Add *.gz support to apropos(1) -a, man(1), and even mandoc(1).
Implemented by moving the zip code from makewhatis(8) to the parser lib.

Revision 1.161 / (download) - annotate - [select for diffs], Wed Sep 3 18:09:14 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.160: +8 -11 lines
Diff to previous 1.160 (colored)

If a manual page is installed gzip(1)ed, let makewhatis(8) take
note in mandoc.db(5), such that man(1) -w and apropos(1) -w can
report the correct filename.
This is a prerequisite for letting apropos -a and man support
gzip'ed manuals in the future, which doesn't work yet.

Revision 1.160 / (download) - annotate - [select for diffs], Mon Sep 1 23:47:59 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.159: +8 -1 lines
Diff to previous 1.159 (colored)

When makewhatis(8) finds an .so link after the manual being pointed to
has already been processed, add the file names to the names table, too,
not just to the mlinks table.
This fixes a bug where apropos(1) and the new man(1) wouldn't find some
of the Xenocara manuals via some of their .so links.  After rebuilding,
run "makewhatis /usr/X11R6/man" or just wait for weekly(8).

Revision 1.159 / (download) - annotate - [select for diffs], Sat Aug 23 18:13:47 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.158: +3 -1 lines
Diff to previous 1.158 (colored)

do not leak a file descriptor on fdopen(3) failure; from doug@

Revision 1.158 / (download) - annotate - [select for diffs], Sat Aug 16 19:00:01 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.157: +3 -3 lines
Diff to previous 1.157 (colored)

Improve build system and autodetection.
* Make ./configure standalone, that's what people expect.
* Let people write a ./configure.local from scratch, not edit existing files.
* Autodetect wchar, sqlite3, and manpath and act accordingly.
* Autodetect the need for -L/usr/local/lib and -lutil.
* Get rid of config.h.p{re,ost}, let ./configure only write what's needed.
* Let ./configure write a Makefile.local snippet, that's quite flexible.

Revision 1.49.2.18 / (download) - annotate - [select for diffs], Thu Aug 14 04:13:30 2014 UTC (5 years, 11 months ago) by schwarze
Branch: VERSION_1_12
CVS Tags: VERSION_1_12_4
Changes since 1.49.2.17: +3 -3 lines
Diff to previous 1.49.2.17 (colored) next main 1.50 (colored)

Cygwin support; from Yaakov Selkowitz,
https://sourceforge.net/p/cygwin-ports/mdocml/ci/master/tree/

Revision 1.157 / (download) - annotate - [select for diffs], Mon Aug 11 01:39:00 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.156: +5 -1 lines
Diff to previous 1.156 (colored)

Provide a fallback version of fts(3) for systems lacking it.
I chose the OpenBSD version because it apparently contains various
bugfixes that never made it into libnbcompat.  To reduce size and
complexity, i stripped out the features we don't need.

Revision 1.49.2.17 / (download) - annotate - [select for diffs], Mon Aug 11 00:31:13 2014 UTC (5 years, 11 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49.2.16: +1 -3 lines
Diff to previous 1.49.2.16 (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.

Revision 1.156 / (download) - annotate - [select for diffs], Sun Aug 10 23:54:41 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.155: +2 -3 lines
Diff to previous 1.155 (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.155 / (download) - annotate - [select for diffs], Wed Aug 6 15:09:05 2014 UTC (6 years ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_1
Changes since 1.154: +4 -3 lines
Diff to previous 1.154 (colored)

Bring the handling of defective prologues even closer to groff,
in particular relaxing the distinction between prologue and body
and further improving messages.
* The last .Dd wins and the last .Os wins, even in the body.
* The last .Dt before the first body macro wins.
* Missing title in .Dt defaults to UNTITLED.  Warn about it.
* Missing section in .Dt does not default to 1.  But warn about it.
* Do not warn multiple times about the same mdoc(7) prologue macro.
* Warn about missing .Os.
* Incomplete .TH defaults to empty strings.  Warn about it.

Revision 1.154 / (download) - annotate - [select for diffs], Tue Aug 5 14:43:10 2014 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.153: +5 -5 lines
Diff to previous 1.153 (colored)

Absurdly, the return value of sqlite3_column_text()
is "const unsigned char *", which causes warnings with GCC on Linux.
Explicitly cast to "const char *" to avoid this.
Issue noticed by kristaps@.

Revision 1.153 / (download) - annotate - [select for diffs], Sat Jun 21 16:18:25 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.152: +8 -5 lines
Diff to previous 1.152 (colored)

Prefix messages about bad command line options and arguments
with "mandoc: " or "makewhatis: ", respectively,
similar to what we already do for other messages.

Revision 1.152 / (download) - annotate - [select for diffs], Fri Jun 20 02:24:40 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.151: +10 -10 lines
Diff to previous 1.151 (colored)

Merge from OpenBSD - Marc Espie improved the ohash interface:
* rename the halloc callback to calloc, provide overflow protection
* rename the hfree callback to free, drop the useless size argument
* prevent integer overflows in ohash_resize

Revision 1.151 / (download) - annotate - [select for diffs], Fri Jun 20 01:21:48 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.150: +40 -24 lines
Diff to previous 1.150 (colored)

More tweaking of set_basedir().

1) Do not error out when getcwd(3) fails, only fail when inaccessibility
of the cwd prevents processing of relative paths given on the command line.

2) Do not uselessly call set_basedir() twice in a row.
While fts_read(3) in treescan() does cause the cwd to jump around,
fts_close(3) is always called at the end, putting us back
where we came from.  The -d/-u fallback code already relied on this.

3) Fix the man-root-dir indicator in say().

Revision 1.150 / (download) - annotate - [select for diffs], Thu Jun 19 00:45:37 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.149: +21 -17 lines
Diff to previous 1.149 (colored)

Some simple set_basedir() cleanup; more to come.

1) Refrain from calling set_basedir() in the -t case,
and do not attempt to strip anything from the file names in that case.
Testing individual files cannot reasonably have any notion of a base dir.

2) Remove the possibility of passing NULL to set_basedir().
It was dangerous because it was not idempotent, and it served no purpose
except closing a file descriptor right before exit(), which is pointless.
Besides, the file descriptor is likely to be removed completely, soon.

3) Make sure that /foobar isn't treated as a subdirectory of /foo;
this fixes a bug reported by espie@.

Revision 1.149 / (download) - annotate - [select for diffs], Wed Jun 18 19:34:04 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.148: +3 -2 lines
Diff to previous 1.148 (colored)

Merge OpenBSD rev. 1.108 by sthen@; original commit message:
Don't display "unable to open mandoc.db" error messages (SQLITE_CANTOPEN)
in the code which opens mandocdb's sqlite database when updating/deleting
individual files (as used and only really useful for pkg_add/pkg_delete).

Revision 1.148 / (download) - annotate - [select for diffs], Wed May 7 16:19:03 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.147: +11 -2 lines
Diff to previous 1.147 (colored)

Render roff escape sequences contained in manual page descriptions
before putting them into the mpages table.
Issue found by bentley@ in OpenBSD::Getopt(3p).

Revision 1.147 / (download) - annotate - [select for diffs], Wed May 7 15:10:36 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.146: +14 -2 lines
Diff to previous 1.146 (colored)

Fix two memory leaks in makewhatis -n:
1. As found by nigel@, names_check() requires database access.
2. Do not leak names and strings in -n mode.

Revision 1.146 / (download) - annotate - [select for diffs], Sun Apr 27 23:08:56 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.145: +22 -7 lines
Diff to previous 1.145 (colored)

Improve error handling in dbopen().  If PRAGMA SQL statements fail,
report the error, close the database, and return failure from dbopen(),
such that the main program can recover and rebuild the database.

As noticed by stsp@, this can happen when database files are
accessible, but corrupt or in the wrong format, which will now
automatically be repaired.

Besides, use a safer idiom after sqlite3_open*() failure that also
handles out-of-memory situations correctly, and do not forget to
close the database after CREATE TABLE failure.

Revision 1.145 / (download) - annotate - [select for diffs], Fri Apr 25 12:13:15 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.144: +3 -1 lines
Diff to previous 1.144 (colored)

Reduce the verbosity of makewhatis -t:
In the past, it always showed the title lines of the files processed.
Now, it only shows them when called with -D.
That is better because pkg_create calls makewhatis -t.
It is also more consistent with -D behaviour in non- -t modes.
Issue reported by ajacoutot@; ok espie@ ajacoutot@ jasper@.

Revision 1.49.2.16 / (download) - annotate - [select for diffs], Wed Apr 23 21:31:38 2014 UTC (6 years, 3 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49.2.15: +3 -3 lines
Diff to previous 1.49.2.15 (colored)

Audit malloc(3)/calloc(3)/realloc(3) in VERSION_1_12.

Revision 1.144 / (download) - annotate - [select for diffs], Wed Apr 23 21:06:41 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.143: +5 -5 lines
Diff to previous 1.143 (colored)

Audit malloc(3)/calloc(3)/realloc(3) usage.
* Change eight reallocs to reallocarray to be safe from overflows.
* Change one malloc to reallocarray to be safe from overflows.
* Change one calloc to reallocarray, no zeroing needed.
* Change the order of arguments of three callocs (aesthetical).

Revision 1.143 / (download) - annotate - [select for diffs], Wed Apr 23 19:09:16 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.142: +23 -23 lines
Diff to previous 1.142 (colored)

Audit strlcpy(3)/strlcat(3) usage:
* Add missing truncation checks to three calls.
* In four cases where we know that the distination buffer is large enough,
cast the return vailue to (void).

Revision 1.142 / (download) - annotate - [select for diffs], Wed Apr 23 16:34:50 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.141: +3 -2 lines
Diff to previous 1.141 (colored)

improve SQL style: avoid "SELECT *", be explicit in what columns we want;
suggested by espie@.

Revision 1.141 / (download) - annotate - [select for diffs], Sun Apr 20 16:46:04 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.140: +67 -66 lines
Diff to previous 1.140 (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.140 / (download) - annotate - [select for diffs], Sat Apr 19 02:56:54 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.139: +9 -7 lines
Diff to previous 1.139 (colored)

Two minor tweaks regarding the fallback from -u/-d to default mode:
(1) Use all files found on the command line, but do *not* use all stray
files found during fallback tree recursion.
(2) If the fallback works, call that success, i.e. exit(0).
As pointed out by naddy@, the latter is required for ports' happiness.

Revision 1.139 / (download) - annotate - [select for diffs], Sat Apr 19 02:30:19 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.138: +76 -17 lines
Diff to previous 1.138 (colored)

Properly handle symlinks (hardlinks and .so only files were already ok):
Use the file name of the symlink but the inode number of the file pointed to,
such that we get multiple mlinks records but not multiple mpages records.
Also make sure they do not point outside the tree we are processing.

Issue found by kili@ in desktop-file-edit(1), thanks!

Revision 1.138 / (download) - annotate - [select for diffs], Fri Apr 18 21:55:38 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.137: +18 -8 lines
Diff to previous 1.137 (colored)

In update mode, when opening the database fails, probably because it is
missing or corrupt, just rebuild it from scratch.  This also helps when
installing the very first port on a freshly installed machine
and is similar to what espie@'s classical makewhatis(8) did.

Issue reported by naddy@ via kili@.

Revision 1.137 / (download) - annotate - [select for diffs], Wed Apr 16 21:36:18 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.136: +12 -12 lines
Diff to previous 1.136 (colored)

Rename the mpages.id column to mpages.pageid.  There is no good reason
to call this kid by a different name here than in all other tables.

Revision 1.136 / (download) - annotate - [select for diffs], Wed Apr 16 18:59:43 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.135: +4 -2 lines
Diff to previous 1.135 (colored)

Give the mlinks and keys tables a pageid index,
as suggested by jeremy@ and espie@.

The mlinks index speeds up basic apropos(1) searches by around 30%
because it speeds up the final SELECT FROM mlinks query by about 95%.
For large result sets, the overall speedup gets even larger, in the
extreme case of "apropos Nd~." bymore than 90%.
The keys index finally makes the apropos(1) -O option usable: It no longer
incurs relevant extra cost, while in the past it was embarrassingly slow.

This comes at a cost:  Total database build times grow by about 5%,
and each index adds about 10% database size with -Q.  I consider that
acceptable in view of the huge apropos(1) performance gains.
The -Q database for /usr/share/man still remains below 1 MB.

Revision 1.135 / (download) - annotate - [select for diffs], Sun Apr 13 22:03:04 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.134: +4 -9 lines
Diff to previous 1.134 (colored)

Unify description handling across all document types (mdoc, man, cat).
Assert that the description is unset right before calling the parse_*
handler, and assign a default if it's still unset right afterwards.
Remove all stray asserts and default assignments found elsewhere.

This fixes SQL_STEP failures for man(7) pages lacking descriptions.

Revision 1.134 / (download) - annotate - [select for diffs], Sun Apr 13 20:55:45 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.133: +9 -9 lines
Diff to previous 1.133 (colored)

better error reporting in case of SQL errors: mention dir and file

Revision 1.133 / (download) - annotate - [select for diffs], Thu Apr 10 02:46:21 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.132: +65 -27 lines
Diff to previous 1.132 (colored)

Next speed optimization step for the new apropos(1).
Split manual names out of the common "keys" table into their
own "names" table.  This reduces standard apropos(1) search
times (i.e. searching for names and descriptions only) by
typically about 70% for the full /usr/share/man database.
(Yes, that multiplies with the previous optimization step,
so both together have reduced search times by a factor of
more than six.  I'm not done yet, expect more to come.)

Even with the minimal databases built with makewhatis(8) -Q,
this step still reduces search times by 15-20%.  For both cases,
database sizes and build times hardly change (+/-2%).

Revision 1.132 / (download) - annotate - [select for diffs], Wed Apr 9 21:50:08 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.131: +9 -18 lines
Diff to previous 1.131 (colored)

After careful gprof(1)ing of the new apropos(1), move the descriptions
back from the keys table to the mpages table:  I found a good way
to still use them in searches, without complication of the code.

On my notebook, this reduces typical apropos(1) search times by about 40%,
it reduces /usr/share/man database size by 6% in makewhatis(8) -Q mode
and by 2% in standard mode (less overhead storing pointers to mpages),
and it doesn't measurably change database build times (may even be
going down by a percent or so because less data is being copied
around in ohashes).

Revision 1.131 / (download) - annotate - [select for diffs], Fri Apr 4 18:23:30 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.130: +30 -25 lines
Diff to previous 1.130 (colored)

In -p (picky) mode, warn unless each filename (aka mlink)
appears as a name in the NAME section.
While here, garbage collect two unused variables, both called "match".

Revision 1.130 / (download) - annotate - [select for diffs], Fri Apr 4 16:43:16 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.129: +41 -1 lines
Diff to previous 1.129 (colored)

Warn about missing mlinks.
This is really expensive, more than tripling database build times,
so only do it when the -p (picky) option was given, but none of the
following options were given: -Q (quick), -d, -u, or -t.

Revision 1.129 / (download) - annotate - [select for diffs], Fri Apr 4 15:55:19 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.128: +9 -6 lines
Diff to previous 1.128 (colored)

Remember which names are in the NAME section.
This helps to find missing MLINKS.
Database build times do not change and database growth is minimal
(1.2% with -Q, 0.7% without -Q in /usr/share/man),
so making this optional would be pointless.

Revision 1.128 / (download) - annotate - [select for diffs], Fri Apr 4 02:31:07 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.127: +39 -5 lines
Diff to previous 1.127 (colored)

When the -n or -t flag is given to makewhatis(8),
write names and decriptions to stdout,
in a format similar to apropos(1) output.
Inspired by espie@'s makewhatis.

Revision 1.127 / (download) - annotate - [select for diffs], Thu Apr 3 21:45:31 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.126: +6 -1 lines
Diff to previous 1.126 (colored)

Instead of silently doing nothing at all,
warn and return non-zero when the manpath is empty, that is,
when /etc/man.conf is non-existent or unreadable
AND the environment variable MANPATH is unset or empty
AND no directories were given on the command line.

Inspired by the error handling in espie@'s makewhatis(8),
except that one doesn't know about MANPATH.

Revision 1.126 / (download) - annotate - [select for diffs], Thu Apr 3 16:27:28 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.125: +11 -8 lines
Diff to previous 1.125 (colored)

Rename the -W option to -p (mnemonics: picky, print to stderr):
That letter was already chosen by espie@ for OpenBSD 2.7,
so avoid being gratuitiously different more than a decade later.
Accept -v for backward compatibility with espie@'s makewhatis,
even though it does nothing right now.

Revision 1.125 / (download) - annotate - [select for diffs], Thu Apr 3 15:37:19 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.124: +13 -13 lines
Diff to previous 1.124 (colored)

The -v option of mandocdb(8) clashes with the -v option of espie@'s
makewhatis(8), which traditionally does something different,
so rename it to -D (mnemonics: Debug, Dump, Display).

Revision 1.124 / (download) - annotate - [select for diffs], Wed Mar 26 21:39:38 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.123: +81 -17 lines
Diff to previous 1.123 (colored)

Without bloating mandoc(1) itself, let mandocdb(8) support files
called manN/X.N.gz and catN/X.0.gz, reading them through a pipe(2)
from gunzip(1) -c.  Asked for by various people in the past.

Revision 1.123 / (download) - annotate - [select for diffs], Wed Mar 26 20:53:36 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.122: +52 -34 lines
Diff to previous 1.122 (colored)

Improve error reporting.
Simplify combining a custom format string with perror(),
avoiding many manual calls to strerror(errno).
For low-level failures, report attempted function calls.
Do not abuse the say() filename argument for files outside the basedir,
and even less for other text.

Revision 1.122 / (download) - annotate - [select for diffs], Sun Mar 23 12:44:56 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.121: +4 -26 lines
Diff to previous 1.121 (colored)

If an .Nd block contains macros, avoid fragmented entries in mandocdb(8),
instead use the .Nd content recursively.

Revision 1.49.2.15 / (download) - annotate - [select for diffs], Sun Mar 23 12:37:58 2014 UTC (6 years, 4 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49.2.14: +9 -46 lines
Diff to previous 1.49.2.14 (colored)

backport man(7) .Nd improvement

Revision 1.121 / (download) - annotate - [select for diffs], Sun Mar 23 12:26:58 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.120: +8 -47 lines
Diff to previous 1.120 (colored)

If a man(7) NAME section contains macros, avoid truncated or empty
entries for .Nd in mandocdb(8), instead use the macro content
recursively.  This improves indexing of more than 200 manuals
in Xenocara, i.e. more than 15%, in particular GL and some Xkb.

Revision 1.120 / (download) - annotate - [select for diffs], Sun Mar 23 12:11:18 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.119: +2 -5 lines
Diff to previous 1.119 (colored)

avoid repetitive code for asprintf error handling

Revision 1.49.2.14 / (download) - annotate - [select for diffs], Sun Mar 23 12:04:54 2014 UTC (6 years, 4 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49.2.13: +2 -1 lines
Diff to previous 1.49.2.13 (colored)

introduce mandoc_aux to 1.12

Revision 1.119 / (download) - annotate - [select for diffs], Sun Mar 23 11:25:26 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.118: +2 -1 lines
Diff to previous 1.118 (colored)

The files mandoc.c and mandoc.h contained both specialised low-level
functions used for multiple languages (mdoc, man, roff), for example
mandoc_escape(), mandoc_getarg(), mandoc_eos(), and generic auxiliary
functions.  Split the auxiliaries out into their own file and header.
While here, do some #include cleanup.

Revision 1.118 / (download) - annotate - [select for diffs], Wed Mar 19 22:33:09 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.117: +68 -20 lines
Diff to previous 1.117 (colored)

Register pure .so pages as mlinks, not as mpages.
This doesn't affect /usr/share/man, but improves /usr/X11R6/man:
* Eliminates multiple apropos(1) output for such pages.
* Reduces X11R6 database size from 450 kB to 240 kB (-47%).
* Reduces X11R6 database build time from 1.68s to 1.00s (-40%).

Revision 1.49.2.13 / (download) - annotate - [select for diffs], Wed Mar 19 22:24:12 2014 UTC (6 years, 4 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49.2.12: +2 -2 lines
Diff to previous 1.49.2.12 (colored)

cope with the mparse_result() interface change

Revision 1.117 / (download) - annotate - [select for diffs], Wed Mar 19 22:20:43 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.116: +2 -2 lines
Diff to previous 1.116 (colored)

Without the MPARSE_SO option, if the file contains nothing but a
single .so request, do not read the file pointed to, but instead
let mparse_result() provide the file name pointed to as a return
value.  To be used by makewhatis(8) in the future.

Revision 1.49.2.12 / (download) - annotate - [select for diffs], Wed Mar 19 22:09:29 2014 UTC (6 years, 4 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49.2.11: +5 -5 lines
Diff to previous 1.49.2.11 (colored)

cope with mparse_alloc() interface change

Revision 1.116 / (download) - annotate - [select for diffs], Wed Mar 19 21:51:20 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.115: +6 -6 lines
Diff to previous 1.115 (colored)

Generalize the mparse_alloc() and roff_alloc() functions by giving
them an "options" argument, replacing the existing "inttype" and
"quick" arguments, preparing for a future MPARSE_SO option.
Store this argument in struct mparse and struct roff, replacing the
existing "inttype", "parsetype", and "quick" members.
No functional change except one tiny cosmetic fix in roff_TH().

Revision 1.115 / (download) - annotate - [select for diffs], Tue Mar 18 16:56:10 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.114: +95 -21 lines
Diff to previous 1.114 (colored)

Allow checking that databases are up to date even when you have no write
permission on the databases, as requested by espie@ quite some time ago.
But make sure to not slow database generation down when you do have write
permission, and to not delay error reporting in -Q mode.

Revision 1.114 / (download) - annotate - [select for diffs], Wed Jan 22 20:58:39 2014 UTC (6 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.113: +15 -6 lines
Diff to previous 1.113 (colored)

Implement the \: (optional line break) escape sequence,
documented in the Ossanna-Kernighan-Ritter troff manual
and also supported by groff.

Missing feature reported by Steffen Nurpmeso <sdaoden at gmail dot com>.

Revision 1.113 / (download) - annotate - [select for diffs], Sun Jan 19 22:48:16 2014 UTC (6 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.112: +4 -3 lines
Diff to previous 1.112 (colored)

Avoid the risk of trying to modify a literal string.

Revision 1.112 / (download) - annotate - [select for diffs], Sun Jan 19 22:41:25 2014 UTC (6 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.111: +10 -6 lines
Diff to previous 1.111 (colored)

Always store the arch in lower-case only.
Reduces database size by ~0.5%, and by ~1.5% with -Q.

Revision 1.111 / (download) - annotate - [select for diffs], Sun Jan 19 00:09:38 2014 UTC (6 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.110: +17 -2 lines
Diff to previous 1.110 (colored)

Support a second -v on mandocdb(8) to show keys while they are being added;
i need that for debugging, in particular to be used with -t.
To be able to do so, provide a global table of key names, for reuse.

Revision 1.110 / (download) - annotate - [select for diffs], Sat Jan 18 08:55:17 2014 UTC (6 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.109: +10 -1 lines
Diff to previous 1.109 (colored)

Cope with slightly broken NAME sections in man(7) pages
having a trailing comma after the last name, like this:

ASN1_OBJECT_new, ASN1_OBJECT_free, - object allocation functions

Revision 1.109 / (download) - annotate - [select for diffs], Sat Jan 18 08:21:03 2014 UTC (6 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.108: +3 -5 lines
Diff to previous 1.108 (colored)

Drop the AUTOINCREMENT PRIMARY KEYs from the mlinks and keys tables.
They are completely unused, and i cannot imagine what they *could*
ever be used for; but apparently, they are expensive to generate.

Standard DB build time goes down by 10%, now at 1.9x of makewhatis.
Standard DB size goes down by 4%, now at 11x of makewhatis.
DB build time with -Q goes down by 15%, now at 0.28x of makewhatis.
DB size with -Q goes down by 3%, now at 3.35x of makewhatis.

Revision 1.108 / (download) - annotate - [select for diffs], Sat Jan 18 08:19:18 2014 UTC (6 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.107: +2 -4 lines
Diff to previous 1.107 (colored)

Despite some experimenting, i'm unable to find any relevant effect of
creating an index for the keys table on apropos(1) search times;
apparently, adding that index was premature optimization in the first
place; so, stop adding that index.

Its root gone, the following evil is reduced (/usr/share/man on my notebook)
 - DB build time with -Q goes down by 15%, now at 1/3 of makewhatis
 - DB size with -Q goes down by 35%, now at 3.5x of makewhatis
 - full DB build time goes down by 12%, now at 2.1x of makewhatis
 - full DB size goes down by 42%, now at 11.5x of makewhatis

Revision 1.107 / (download) - annotate - [select for diffs], Mon Jan 6 20:53:40 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.106: +7 -5 lines
Diff to previous 1.106 (colored)

Do not sync to disk after each individual manual page (duh!),
only sync to disk one single time when all data is ready.

Rebuild times for /usr/share/man/mandoc.db shrink on my notebook:
In standard mode from 45 seconds to 11 seconds   (75% reduction)
In -Q mode       from 25 seconds to 3.1 seconds  (87% reduction)
For comparison: makewhatis(8):      4.2 seconds

That is, in -Q mode, we are now *faster* than the existing makewhatis(8),
and careful profiling shows there is still a lot of room for improval.

Revision 1.106 / (download) - annotate - [select for diffs], Mon Jan 6 15:32:47 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.105: +36 -15 lines
Diff to previous 1.105 (colored)

Fix mandocdb(8) -d and -u.
It was broken by recent optimizations.

Revision 1.105 / (download) - annotate - [select for diffs], Mon Jan 6 13:54:17 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.104: +6 -6 lines
Diff to previous 1.104 (colored)

Rename dbindex() to dbadd() to be less confusing.
The concept of an index file is gone since the switch to SQLite.
No functional change.

Revision 1.104 / (download) - annotate - [select for diffs], Mon Jan 6 03:52:13 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.103: +2 -4 lines
Diff to previous 1.103 (colored)

Remove the redundant "file" column from the "mlinks" table.
The contents can easily be reconstructed from sec, arch, name, form.
Shrinks the database by another 3% in standard mode and 9% in -Q mode.

Revision 1.103 / (download) - annotate - [select for diffs], Mon Jan 6 03:02:46 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.102: +2 -15 lines
Diff to previous 1.102 (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.49.2.11 / (download) - annotate - [select for diffs], Sun Jan 5 21:30:57 2014 UTC (6 years, 7 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49.2.10: +9 -4 lines
Diff to previous 1.49.2.10 (colored)

Cope with the mparse_alloc() interface change.

Revision 1.102 / (download) - annotate - [select for diffs], Sun Jan 5 20:26:36 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.101: +12 -8 lines
Diff to previous 1.101 (colored)

Add an option -Q (quick) to mandocdb(8)
for accelerated generation of reduced-size databases.

Implement this by allowing the parsers to optionally
abort the parse sequence after the NAME section.

While here, garbage collect the unused void *arg attribute of
struct mparse and mparse_alloc() and fix some errors in mandoc(3).

This reduces the processing time of mandocdb(8) on /usr/share/man
by a factor of 2 and the database size by a factor of 4.
However, it still takes 5 times the time and 6 times the space
of makewhatis(8), so more work is clearly needed.

Revision 1.101 / (download) - annotate - [select for diffs], Sun Jan 5 04:48:40 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.100: +7 -69 lines
Diff to previous 1.100 (colored)

Rip out the complete "reachable" checks, without replacement.
It's a pity i spent time during t2k13 writing this; however,
when an entire concept is busted, let us not look back,

There is no such thing as an unreachable page.  Even if you are crazy
enough to put a page starting with ".Dt NAMEI 9" into a file man1/cat.1,
we now make sure that it can be found by all of the following:
Nm=namei Nm=cat sec=1 sec=9
It will always be displayed as:
cat(1) - pathname lookup
So you know that you have to type `man cat` to get at it.
That obsoletes the concept of "unreachable manuals" for good.

Revision 1.100 / (download) - annotate - [select for diffs], Sun Jan 5 04:13:52 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.99: +2 -14 lines
Diff to previous 1.99 (colored)

Remove the obsolete file name column from the mpages table.
This column wasn't helpful because one manpage can have multiple MLINKS.
Use the file name column in the mlinks table, instead.

Revision 1.99 / (download) - annotate - [select for diffs], Sun Jan 5 03:25:51 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.98: +4 -8 lines
Diff to previous 1.98 (colored)

Remove the obsolete sec and arch columns from the mpages table.
They were confusing because a manpage can have MLINKS in different
sections and architectures.

Revision 1.98 / (download) - annotate - [select for diffs], Sun Jan 5 03:06:43 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.97: +5 -3 lines
Diff to previous 1.97 (colored)

Reimplement apropos -s NUM -S ARCH EXPR by internally converting it to
apropos \( EXPR \) -a 'sec~^NUM$' -a 'arch~^(ARCH|any)$'
in preparation for removal of sec and arch from the mpage table.

Almost no functional change except for the following bonus:
This also makes sure that for cross-section and cross-arch MLINKs,
all of the following work:
apropos -s 1 encrypt
apropos -s 8 encrypt
apropos -s 1 makekey
apropos -s 8 makekey

While here, print error messages about invalid regexps to stderr.

Revision 1.97 / (download) - annotate - [select for diffs], Sun Jan 5 00:29:54 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.96: +10 -2 lines
Diff to previous 1.96 (colored)

Put section and architecture info into the keys table,
in preparation for removing them from the mpages table,
aiming for cleaner and more uniform interfaces.
Database growth is below 4%, part of which will be reclaimed.

As a bonus, this allows searches like:
./obj/apropos An=kettenis -a arch=ppc
./obj/apropos An=kettenis -a sec~[^4]

Revision 1.96 / (download) - annotate - [select for diffs], Thu Jan 2 22:44:10 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.95: +19 -19 lines
Diff to previous 1.95 (colored)

Avoid "utf8" in the names of a function and a struct member
that don't necessarily have anything to do with UTF-8.
Just renaming, no functional change.

Revision 1.95 / (download) - annotate - [select for diffs], Thu Jan 2 22:19:41 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.94: +35 -17 lines
Diff to previous 1.94 (colored)

Do not put UTF-8-encoded strings into the database by default, use ASCII.
Just like for mandoc(1), provide a -Tutf8 option for people who want that.

Revision 1.94 / (download) - annotate - [select for diffs], Thu Jan 2 20:24:39 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.93: +21 -27 lines
Diff to previous 1.93 (colored)

Polish the mlink_add() interface:
Allocate memory inside, not in the callers.
No functional change.

Revision 1.93 / (download) - annotate - [select for diffs], Thu Jan 2 18:52:15 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.92: +60 -43 lines
Diff to previous 1.92 (colored)

Check all MLINKS for consistency with the content of the manual page,
not just the first one.  This doesn't change how the check is done,
but just which MLINKS are checked.

Revision 1.92 / (download) - annotate - [select for diffs], Tue Dec 31 19:40:20 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.91: +6 -34 lines
Diff to previous 1.91 (colored)

Yet another regression introduced by Kristaps when he switched from
Berkeley DB to SQLite3: In the .In parser, the logic got inverted.
The resulting NULL pointer access was found by clang;
scan log provided by Ulrich Spoerlein <uqs at FreeBSD>.

The best fix is to simply remove the whole, pointless custom
handler function for .In and let the framework do its work.
Now searching for included header files actually works.

While here, remove the similarly pointless custom .St handler,
fix the return value of the .Fd handler and disentangle the
spaghetti in the .Nm handler.

Revision 1.91 / (download) - annotate - [select for diffs], Tue Dec 31 18:07:42 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.90: +1 -2 lines
Diff to previous 1.90 (colored)

remove assignments that will be overwritten right afterwards,
and remove pointless local variables;
found in a clang output from Ulrich Spoerlein <uqs at FreeBSD>

Revision 1.90 / (download) - annotate - [select for diffs], Fri Dec 27 23:41:55 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.89: +10 -8 lines
Diff to previous 1.89 (colored)

Oops, that segfaulted after deleting an mlink from the list.
Fix the loop logic in mlinks_undupe().

Revision 1.89 / (download) - annotate - [select for diffs], Fri Dec 27 20:35:51 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.88: +53 -37 lines
Diff to previous 1.88 (colored)

Split mlinks_undupe() out of mpages_merge()
such that the check for source manuals of the same name
can be done for multiple mlinks pointing to the same preformatted mpage.

Revision 1.88 / (download) - annotate - [select for diffs], Fri Dec 27 18:42:25 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.87: +5 -3 lines
Diff to previous 1.87 (colored)

Save the MLINK name into the database, too;
apropos(1) will need it to display its results.

Revision 1.87 / (download) - annotate - [select for diffs], Fri Dec 27 16:40:35 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.86: +11 -8 lines
Diff to previous 1.86 (colored)

Write more than one mlink per mpage to the database.
Not yet used by apropos(1).

Revision 1.86 / (download) - annotate - [select for diffs], Fri Dec 27 16:17:32 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.85: +1 -24 lines
Diff to previous 1.85 (colored)

Allow saving more than one mlink per mpage in the mlinks ohash.
We are still only using one of them for now.
Actually, we are now using a different one,
but the order the mlinks are found is random anyway.

Revision 1.85 / (download) - annotate - [select for diffs], Fri Dec 27 15:48:09 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.84: +4 -3 lines
Diff to previous 1.84 (colored)

Enable the framework code to allow more than one mlink per mpage.
Not used yet.

Revision 1.84 / (download) - annotate - [select for diffs], Fri Dec 27 15:39:03 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.83: +66 -69 lines
Diff to previous 1.83 (colored)

Clean up the interface of mlink_add().
Consistently use "fsec" and "fform" for info derived from the file name.
No functional change.

Revision 1.83 / (download) - annotate - [select for diffs], Fri Dec 27 14:29:28 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.82: +37 -77 lines
Diff to previous 1.82 (colored)

Another step on the way to clear naming, this time regarding mlinks:
* rename global ohash filenames to mlinks
* rename ofadd() to mlink_add()
* fold fileadd() and inoadd() into mlink_add()
* fold filecheck() into mpages_merge()
Still no functional change.

Revision 1.82 / (download) - annotate - [select for diffs], Fri Dec 27 03:06:17 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.81: +124 -83 lines
Diff to previous 1.81 (colored)

Split struct mlink out of struct mpage.
Still a 1:1 relation, no functional change yet.

Revision 1.81 / (download) - annotate - [select for diffs], Fri Dec 27 01:16:54 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.80: +53 -22 lines
Diff to previous 1.80 (colored)

Add an additional mlinks table to the database, redundant for now,
both because it contains nothing but a subset of the data of the
existing mpages table and because the relationship of mpage and mlink
entries is still 1:1.  But all that will eventually change.

Revision 1.80 / (download) - annotate - [select for diffs], Thu Dec 26 23:35:59 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.79: +28 -24 lines
Diff to previous 1.79 (colored)

Drop the mpages_list, use the existing mpages ohash for iteration.
No functional change except that the order of database entries changes,
which doesn't matter anyway.

Revision 1.79 / (download) - annotate - [select for diffs], Thu Dec 26 22:30:41 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.78: +15 -15 lines
Diff to previous 1.78 (colored)

The name "id" is terrible for a struct.
Make this more searchable by calling it "inodev".
No functional change.

Revision 1.78 / (download) - annotate - [select for diffs], Thu Dec 26 22:12:46 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.77: +183 -178 lines
Diff to previous 1.77 (colored)

To better support MLINKS, we will have to split the "docs" database
table into two tables, on for actual files on disk, one for (often
multiple) directory entries pointing to them.  That implies splitting
struct of into two structs, to be called "mpage" and "mlink",
respectively.  As a preparation, globally rename "of" and "inos"
to "mpage".  No functional change.

Revision 1.77 / (download) - annotate - [select for diffs], Thu Dec 26 19:02:04 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.76: +5 -2 lines
Diff to previous 1.76 (colored)

Stop parsing man(7) input when we found all we were searching for,
such that we don't trigger an assertion on a duplicate NAME section.

Revision 1.49.2.10 / (download) - annotate - [select for diffs], Thu Nov 21 01:53:48 2013 UTC (6 years, 8 months ago) by schwarze
Branch: VERSION_1_12
CVS Tags: VERSION_1_12_3
Changes since 1.49.2.9: +2 -2 lines
Diff to previous 1.49.2.9 (colored)

My audit of mandoc revealed one missing (unsigned char) cast
in a tolower() argument containing arbitrary char data.
Thanks to deraadt@ for triggering the audit.

Revision 1.76 / (download) - annotate - [select for diffs], Sun Oct 27 17:01:18 2013 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.75: +12 -11 lines
Diff to previous 1.75 (colored)

The man(7) language has no syntax to specify architectures, but it
can still be used to write architecture-specific manuals, of course.

So just derive the architecture a man(7) manual belongs to from the
directory where it is located and refrain from warning about each and
every architecture-specific man(7) manual found.

While here, delete some trailing whitespace in the neighbourhood.

Revision 1.75 / (download) - annotate - [select for diffs], Sun Oct 27 16:41:31 2013 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.74: +2 -2 lines
Diff to previous 1.74 (colored)

The code in ofmerge() only tried the source parsers if at least one
of the path (/man1/ .. /man9/) or the file name suffix (*.1 .. *.9)
indicated a source manual.  That missed source manuals with unusual
names in unusual locations.

Instead, as the existing comment right above already suggests, try
the source parsers unless both the path and the file name suffix
unambiguously indicate a preformatted manual (/cat*/*.0).

This change is not expensive in practice because no real-world
system will have large numbers of preformatted pages outside
/cat*/*.0.  The only way to make information loss even less probable
would be to try the source parsers on all files, even /cat*/*.0,
which wouldn't buy us much because no real-world system will call
source manuals /cat*/*.0, but it will be expensive in practice,
because many real-world systems have large numbers of preformatted
pages called /cat*/*.0.

Revision 1.74 / (download) - annotate - [select for diffs], Sun Oct 27 16:09:44 2013 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.73: +6 -6 lines
Diff to previous 1.73 (colored)

delete duplicate NULL check and polish style;
no functional change

Revision 1.73 / (download) - annotate - [select for diffs], Fri Oct 18 23:07:23 2013 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (colored)

Fix an assertion in dbindex():  Null strings are never entered into the
string table.  Fortunately, they never need UTF-8 translation either.

Revision 1.72 / (download) - annotate - [select for diffs], Fri Oct 18 21:10:07 2013 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.71: +2 -2 lines
Diff to previous 1.71 (colored)

Manuals to be checked with "mandocdb -t" need not be in the current
directory or one of its subdirectories.

Revision 1.49.2.9 / (download) - annotate - [select for diffs], Thu Oct 10 23:43:04 2013 UTC (6 years, 9 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49.2.8: +11 -9 lines
Diff to previous 1.49.2.8 (colored)

On __sun, use <sys/byteorder.h>, BE_64(x), and <db_185.h>.
Thanks to Thomas Klausner <wiz at NetBSD dot org> for providing
failing SmartOS build logs such that i could write this patch
without access to a __sun system and for confirming that these
patches help.

Revision 1.49.2.8 / (download) - annotate - [select for diffs], Sat Oct 5 20:30:05 2013 UTC (6 years, 10 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49.2.7: +4 -2 lines
Diff to previous 1.49.2.7 (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()
- do not complain about unused variables in test-*.c
- garbage collect a few unused variables elsewhere

Revision 1.49.2.7 / (download) - annotate - [select for diffs], Wed Oct 2 21:03:26 2013 UTC (6 years, 10 months ago) by schwarze
Branch: VERSION_1_12
CVS Tags: VERSION_1_12_2
Changes since 1.49.2.6: +2 -1 lines
Diff to previous 1.49.2.6 (colored)

DragonFly needs explicit #include <sys/endian.h> to use be64toh(),
while most other systems include that indirectly via <sys/types.h>.
Reported by Franco Fichtner <franco at lastsummer dot de>.

Revision 1.49.2.6 / (download) - annotate - [select for diffs], Tue Oct 1 00:52:58 2013 UTC (6 years, 10 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49.2.5: +18 -2 lines
Diff to previous 1.49.2.5 (colored)

Fix build on Solaris.
Initial version for SmartOS by ONODERA Ryo <ryoon at netbsd dot org>.
Generalized for Solaris by Jonathan Perkin <jperkin at netbsd dot org>.
Received via Thomas Klausner <wiz at netbsd dot org>.
Style cleanup by myself.

Revision 1.49.2.5 / (download) - annotate - [select for diffs], Wed Sep 18 00:54:20 2013 UTC (6 years, 10 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49.2.4: +2 -2 lines
Diff to previous 1.49.2.4 (colored)

Fix typo in filenames: mandocdb.{db,index} -> mandoc.{db,index}

Revision 1.49.2.4 / (download) - annotate - [select for diffs], Tue Sep 17 23:12:21 2013 UTC (6 years, 10 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49.2.3: +5 -5 lines
Diff to previous 1.49.2.3 (colored)

Merge OpenBSD rev. 1.43:
Kristaps changed the size member of struct manpaths from int to size_t.
No functional change.

Revision 1.49.2.3 / (download) - annotate - [select for diffs], Tue Sep 17 23:07:22 2013 UTC (6 years, 10 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49.2.2: +52 -13 lines
Diff to previous 1.49.2.2 (colored)

Merge OpenBSD rev. 1.34.
Do not truncate the production database when starting to build a new one.
Suggested by deraadt@.

Revision 1.49.2.2 / (download) - annotate - [select for diffs], Tue Sep 17 22:48:53 2013 UTC (6 years, 10 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49.2.1: +137 -92 lines
Diff to previous 1.49.2.1 (colored)

merge OpenBSD rev. 1.41:
backout non-portable code

Revision 1.49.2.1 / (download) - annotate - [select for diffs], Tue Sep 17 21:32:07 2013 UTC (6 years, 10 months ago) by schwarze
Branch: VERSION_1_12
Changes since 1.49: +34 -34 lines
Diff to previous 1.49 (colored)

Similar to rev. 1.58:
Consistently use the PATH_MAX since it is specified by POSIX.

Revision 1.71 / (download) - annotate - [select for diffs], Tue Jul 2 13:26:52 2013 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.70: +16 -17 lines
Diff to previous 1.70 (colored)

For the strings table, ohash_init is only called in ofmerge(),
so move the str_info structure into that function.
No functional change.

Revision 1.70 / (download) - annotate - [select for diffs], Tue Jul 2 12:58:54 2013 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.69: +12 -10 lines
Diff to previous 1.69 (colored)

Turning off synchronous mode logically belongs to opening the database,
so move the statement into the function dbopen().

Revision 1.69 / (download) - annotate - [select for diffs], Tue Jul 2 11:40:40 2013 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.68: +87 -19 lines
Diff to previous 1.68 (colored)

Restore the check whether each page added to the database
is actually reachable by man(1).  This check got lost when
the database backend was changed from Berkeley to sqlite.

Revision 1.68 / (download) - annotate - [select for diffs], Fri Jun 7 05:27:50 2013 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.67: +124 -127 lines
Diff to previous 1.67 (colored)

The mdoc_handler flags are unused and will never be used.
Having a mask is sufficient to trigger putmdockey.
Simplify by dropping the flags; no functional change.

Revision 1.67 / (download) - annotate - [select for diffs], Fri Jun 7 04:51:26 2013 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.66: +14 -3 lines
Diff to previous 1.66 (colored)

In .Xr database entries, mention the manual section again;
the section was dropped when switching from db to sqlite.
Use the customary format foo(N).

Revision 1.66 / (download) - annotate - [select for diffs], Fri Jun 7 01:01:34 2013 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.65: +68 -110 lines
Diff to previous 1.65 (colored)

The string hash table is only needed to combine multiple occurences
of the same string within the same manual, so initialize and purge
it for each manual in ofmerge() instead of one single time in main().

There is no point in saving manual names and descriptions in that
table because each of them occurs only once, or very few times.
The is no point in saving section numbers there because they are
so much shorter than the descriptions.

Testing with the complete tree /usr/share/man/ on my notebook shows
that this change slightly reduces memory consumption by about 20%
while there is no measurable difference in execution time.

As a bonus, this allows to delete the functions stradd() and stradds(),
the "next" member from struct str, and the global struct str *words.

While adapting the places in the code using stradd(), i noticed that
parsing of the mdoc(7) .Nd macro was completely broken and that for
formatted manual pages with unusable NAME section, the description
was never set in the struct of.  This commit fixes both bugs as well.

Revision 1.65 / (download) - annotate - [select for diffs], Thu Jun 6 19:00:28 2013 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.64: +28 -45 lines
Diff to previous 1.64 (colored)

Optimize stradds() and putkeys() to not call ohash_qlookupi()
and ohash_find() twice.  As a bonus, this allows to drop hashget().
While here, rename index to slot to match the terminology in the ohash
manual; it also prevents potential clashes with index(3).
Drop the slot variable altogether where it is used only once.

Revision 1.64 / (download) - annotate - [select for diffs], Thu Jun 6 17:51:31 2013 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.63: +9 -22 lines
Diff to previous 1.63 (colored)

Drop wordaddbuf() which is identical to putkeys().
Also rename straddbuf() to stradds() to be more similar to putkeys().
Just cleanup, no functional change.

Revision 1.63 / (download) - annotate - [select for diffs], Thu Jun 6 15:15:07 2013 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.62: +15 -22 lines
Diff to previous 1.62 (colored)

In dbopen(), check success of remove("mandoc.db~").
While here, simplify dbopen() and dbclose(): No need for strlcpy()
and strlcat() when dealing with constant strings only.

Revision 1.62 / (download) - annotate - [select for diffs], Thu Jun 6 02:40:37 2013 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.61: +2 -1 lines
Diff to previous 1.61 (colored)

In parse_catpage(), the comment saying that the filename would be
used as a default page description if no usable NAME section was found
was preserved when moving from db to sqlite, but the code line actually
doing that was removed without replacement.  So, put it back.

Revision 1.61 / (download) - annotate - [select for diffs], Wed Jun 5 21:21:08 2013 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +10 -14 lines
Diff to previous 1.60 (colored)

The return value from parse_man() is completely unused,
so make the function void; no functional change.

Revision 1.60 / (download) - annotate - [select for diffs], Wed Jun 5 20:27:11 2013 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.59: +37 -30 lines
Diff to previous 1.59 (colored)

Two sanity checks got lost in treescan()
during the switch from db to sqlite; restore these:

* Warn and skip when directory and file name mismatch.
* Warn and skip when finding special files.
* Warning about "mandocdb.db" is useless, it is always present.
* While here, do not hardcode "mandocdb.db", use MANDOC_DB.

Revision 1.59 / (download) - annotate - [select for diffs], Wed Jun 5 17:48:14 2013 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.58: +160 -122 lines
Diff to previous 1.58 (colored)

Add back the realpath() checks that got lost during the change from
db to sqlite; they are needed to prevent corruption of the database
when paths containing dot, dotdot, or symlinks are given on the
command line.  Also make sure the exit-code is really non-zero on
system errors and use mandoc(1) exit codes.

To make all this simpler,
 * Drop the "basedir" argument from almost every function and make it
   global because it is really state info used all over the place.
 * Move "startdir" and "fd" as local vars into set_basedir() because they
   are only used for this one purpose, i.e. to move out of basedir again.

While here,
 * Clarify the name of path_arg in the main program; in the -C case,
   it is not a dir, and anyway there are lots of different dirs around.
 * Include missing <stdio.h> needed for perror().

Revision 1.58 / (download) - annotate - [select for diffs], Wed Jun 5 02:00:26 2013 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.57: +17 -17 lines
Diff to previous 1.57 (colored)

Some places used PATH_MAX from <limits.h>, some MAXPATHLEN from <sys/param.h>.
Consistently use the PATH_MAX since it is specified by POSIX,
while MAXPATHLEN is not.
In preparation for using this at a few more places.

Revision 1.57 / (download) - annotate - [select for diffs], Mon Jun 3 22:51:14 2013 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.56: +4 -2 lines
Diff to previous 1.56 (colored)

Changing existing SQLite databases was utterly broken:
1) SQL statements were only prepared when creating a new database.
2) We rely heavily on foreign_keys, but never enabled them.

Revision 1.56 / (download) - annotate - [select for diffs], Mon Jun 3 19:01:31 2013 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.55: +65 -44 lines
Diff to previous 1.55 (colored)

Starting the preparations to integrate this into OpenBSD.
As variadic macros are not supported on all architectures,
replace them by a real function.  While here,
* choose a more logical order for "dir" and "file" arguments
* choose a more logical order when printing; as a bonus,
  a simple sed 's/:.*//' will get you valid file names
* in ofmerge(), skip diagnostic string comparisons
  when we don't want warnings anyway

Revision 1.55 / (download) - annotate - [select for diffs], Sat Jun 9 14:11:16 2012 UTC (8 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.54: +2 -2 lines
Diff to previous 1.54 (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.54 / (download) - annotate - [select for diffs], Sat Jun 9 11:21:12 2012 UTC (8 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.53: +3 -1 lines
Diff to previous 1.53 (colored)

Ths SYNCHRONOUS = off optimisation fails on my Mac OSX.  Take it out until
I can test properly for this feature.

Revision 1.53 / (download) - annotate - [select for diffs], Sat Jun 9 11:00:13 2012 UTC (8 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.52: +8 -3 lines
Diff to previous 1.52 (colored)

Add a compatibility interface for ohash.
This include's espie@'s wholesale src/lib/libc/ohash directory from OpenBSD
into compat_ohash.c (with a single copyright/license notice at the top)
and src/include/ohash.h as compat_ohash.h.
The ohash_int.h part of compat_ohash.c has been changed only in that ohash.h
points to compat_ohash.h.
Added HAVE_OHASH test (test-ohash.c) to Makefile.
In mandocdb.c and mansearch.c, check HAVE_OHASH test for inclusion.

Revision 1.52 / (download) - annotate - [select for diffs], Fri Jun 8 15:06:28 2012 UTC (8 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.51: +48 -32 lines
Diff to previous 1.51 (colored)

Turn off sqlite3 synchronous mode when creating a new database.
This makes it run about 5x faster.
While here, wrap some sqlite3 statements in #defines to extract errors.
(Really, the warning/error/etc. macros should be functionified.)

Revision 1.51 / (download) - annotate - [select for diffs], Fri Jun 8 12:05:27 2012 UTC (8 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.50: +4 -4 lines
Diff to previous 1.50 (colored)

Use C99 syntax for declaring the string-hash key array.

Revision 1.50 / (download) - annotate - [select for diffs], Fri Jun 8 10:43:01 2012 UTC (8 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.49: +1412 -1330 lines
Diff to previous 1.49 (colored)

Re-tooled mandocdb using sqlite3 and ohash.
See the tech@ mailing list entries in June 2012 for details, as well as the
discuss@ mailing list entries from March 2012.
Among other changes, this utility now:
 1.  uses a single sqlite3 database instead of several berkeley dbs
 2.  stores utf-8 encoded strings
 3.  using ohash to aggressively hash its contents
 4.  using fts() instead of manually walking directories

Revision 1.49 / (download) - annotate - [select for diffs], Sun May 27 17:48:57 2012 UTC (8 years, 2 months ago) by schwarze
Branch: MAIN
Branch point for: VERSION_1_12
Changes since 1.48: +2 -2 lines
Diff to previous 1.48 (colored)

Support -Ios='OpenBSD 5.1' to override uname(3) as the source of the
default value for the mdoc(7) .Os macro.
Needed for man.cgi on the OpenBSD website.

Problem with man.cgi first noticed by deraadt@;
beck@ and deraadt@ agree with the way to solve the issue.

"Please check them in and I'll look into them later!" kristaps@

Revision 1.48 / (download) - annotate - [select for diffs], Sun May 27 17:39:28 2012 UTC (8 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.47: +3 -3 lines
Diff to previous 1.47 (colored)

update Copyright years according to the CVS logs; no code change

Revision 1.47 / (download) - annotate - [select for diffs], Sun Apr 15 13:30:38 2012 UTC (8 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +9 -9 lines
Diff to previous 1.46 (colored)

Being reluctant to add yet more trailing whitespace, i rather back
it out here than merge it to OpenBSD.  No binary change.

Revision 1.46 / (download) - annotate - [select for diffs], Fri Mar 23 06:52:17 2012 UTC (8 years, 4 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_12_1
Changes since 1.45: +58 -10 lines
Diff to previous 1.45 (colored)

Improve mandocdb's ability to handle NAME sections by sucking the entire
shebang into a buffer and parsing it that way.  This improves on many
cruddy -man manuals in the wild.

Revision 1.45 / (download) - annotate - [select for diffs], Fri Mar 23 05:45:45 2012 UTC (8 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.44: +49 -64 lines
Diff to previous 1.44 (colored)

Clean up code a bit by pushing warnings into WARNING macro.

Revision 1.44 / (download) - annotate - [select for diffs], Fri Mar 23 05:07:35 2012 UTC (8 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.43: +159 -117 lines
Diff to previous 1.43 (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.43 / (download) - annotate - [select for diffs], Sat Dec 31 18:47:52 2011 UTC (8 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.42: +44 -16 lines
Diff to previous 1.42 (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.42 / (download) - annotate - [select for diffs], Wed Dec 28 00:32:13 2011 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.41: +19 -4 lines
Diff to previous 1.41 (colored)

Do not skip manuals shared across architectures when building databases.

Revision 1.41 / (download) - annotate - [select for diffs], Sun Dec 25 19:31:25 2011 UTC (8 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.40: +8 -3 lines
Diff to previous 1.40 (colored)

First memory leak in mandocdb.c freeing "struct of".  Also properly
const-ify several strings.

Revision 1.40 / (download) - annotate - [select for diffs], Sun Dec 25 16:53:51 2011 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (colored)

Use the traditional name "whatis.db" for the mandocdb(8) databases.
Requested by deraadt@, ok kristaps@.

Revision 1.39 / (download) - annotate - [select for diffs], Sun Dec 25 14:58:39 2011 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.38: +9 -9 lines
Diff to previous 1.38 (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.38 / (download) - annotate - [select for diffs], Sun Dec 25 13:08:12 2011 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.37: +332 -216 lines
Diff to previous 1.37 (colored)

Implement test mode (makewhatis -t), required for pkg_create(8).
Always do all consistency checks; when any one fails, decide whether
to print a message, or skip the file, or both, or none.

While here, do some cleanup as well:
* Bail out on conflicting options.
* Do not crash with -a if there are plain files in the root dir.
* Collect some related variables into structs.

Feedback and OK kristaps@.

Revision 1.37 / (download) - annotate - [select for diffs], Tue Dec 20 21:41:11 2011 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.36: +13 -5 lines
Diff to previous 1.36 (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.36 / (download) - annotate - [select for diffs], Fri Dec 16 12:06:35 2011 UTC (8 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.35: +7 -9 lines
Diff to previous 1.35 (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.35 / (download) - annotate - [select for diffs], Fri Dec 16 08:04:34 2011 UTC (8 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.34: +35 -43 lines
Diff to previous 1.34 (colored)

Make paths in the mandocdb(8) index relative to the databases' path
prefix.  This means that an index in, say, /usr/share/man will point to
man1/foo.1 instead of /usr/share/man/man1/foo.1.  Not only does this
save a lot of space, it also allows manual trees to be moved around
without any side effects to the mandocdb(8) databases.

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

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

Revision 1.33 / (download) - annotate - [select for diffs], Sat Dec 10 22:01:06 2011 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.32: +25 -21 lines
Diff to previous 1.32 (colored)

Avoid leaking index records:
Before allocating a record for a file,
first make sure we actually want to use the file.

Revision 1.32 / (download) - annotate - [select for diffs], Sat Dec 10 16:53:39 2011 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.31: +7 -3 lines
Diff to previous 1.31 (colored)

Fix selection of arch-specific manuals:
(1) Correctly compare cat vs. man paths.
(2) Compare arch (and section) names case-insensitively.
Problem noticed by kristaps@.

Revision 1.31 / (download) - annotate - [select for diffs], Fri Dec 9 11:16:34 2011 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.30: +14 -13 lines
Diff to previous 1.30 (colored)

Tweak pformatted():
* If the first section is empty, use the file name as .Nd.
* No need to check (len > 0) after successful fgetln(3).
* Improve some comments and strip trailing whitespace.
ok kristaps@

Revision 1.30 / (download) - annotate - [select for diffs], Fri Dec 9 01:21:10 2011 UTC (8 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored)

Considerably tidy mandocdb(8) catman descriptions by skipping to the first
hyphen-space combo, not the last hyphen as done previously.

Revision 1.29 / (download) - annotate - [select for diffs], Fri Dec 9 00:49:01 2011 UTC (8 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.28: +13 -1 lines
Diff to previous 1.28 (colored)

Strip backspace encoding from preformatted manuals.  This cleans up a lot
of catpage entries in the mandoc databases.

Revision 1.28 / (download) - annotate - [select for diffs], Thu Dec 8 09:19:13 2011 UTC (8 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.27: +36 -29 lines
Diff to previous 1.27 (colored)

Clean up grok of preformatted manual description.
 (1) put fclose() at the end, as line isn't valid afterward (see fgetln())
 (2) clean up loops to be more readable to my old eyes
 (3) mandate trailing newline, nul-terminate, and use strrchr

Revision 1.27 / (download) - annotate - [select for diffs], Thu Dec 8 02:24:31 2011 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.26: +10 -10 lines
Diff to previous 1.26 (colored)

bugfix: make reclaiming of index slots actually work;
index_prune always counted the free slots,
but didn't tell anybody about them, so they weren't reused

Revision 1.26 / (download) - annotate - [select for diffs], Thu Dec 8 01:00:58 2011 UTC (8 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.25: +12 -5 lines
Diff to previous 1.25 (colored)

If arguments are passed to mandocdb(8) in "default" mode, then use
realpath() to convert them into absolute paths before putting the
traversed subdirectory filenames into the index.

Revision 1.25 / (download) - annotate - [select for diffs], Wed Dec 7 01:57:20 2011 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.24: +252 -299 lines
Diff to previous 1.24 (colored)

Implement search support for 24 additional macros, extract more information
from Fn, and lift section restrictions from An Cd Er Ev Fn Fo In Pa St Va Vt
by removing 4 handler functions and 50 lines of code.
ok kristaps@

Revision 1.24 / (download) - annotate - [select for diffs], Sun Dec 4 14:23:29 2011 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.23: +4 -5 lines
Diff to previous 1.23 (colored)

Fix parsing of file names given on the command line; i broke it
when adding support for formatted manual pages.

Revision 1.23 / (download) - annotate - [select for diffs], Sat Dec 3 18:47:09 2011 UTC (8 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.22: +1 -2 lines
Diff to previous 1.22 (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.22 / (download) - annotate - [select for diffs], Sat Dec 3 12:09:07 2011 UTC (8 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.21: +2 -1 lines
Diff to previous 1.21 (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.21 / (download) - annotate - [select for diffs], Fri Dec 2 00:21:56 2011 UTC (8 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.20: +6 -2 lines
Diff to previous 1.20 (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.20 / (download) - annotate - [select for diffs], Thu Dec 1 23:55:58 2011 UTC (8 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.19: +4 -6 lines
Diff to previous 1.19 (colored)

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

Revision 1.19 / (download) - annotate - [select for diffs], Thu Dec 1 23:46:26 2011 UTC (8 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.18: +5 -5 lines
Diff to previous 1.18 (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.18 / (download) - annotate - [select for diffs], Thu Dec 1 21:05:49 2011 UTC (8 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.17: +54 -26 lines
Diff to previous 1.17 (colored)

Fix mandocdb(8) to pass over the type when pruning the database.  This
fixed `-d' perpetually adding the same files.  While here, clean up the
code and document it.  Remove -vv (complain if you want it back in).
Document the error messages in a DIAGNOSTICS section of mandocdb(8).

Revision 1.17 / (download) - annotate - [select for diffs], Tue Nov 29 00:34:50 2011 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.16: +18 -2 lines
Diff to previous 1.16 (colored)

chdir(2) to the right man page tree before parsing manuals;
ok kristaps@

Revision 1.16 / (download) - annotate - [select for diffs], Sun Nov 27 23:27:31 2011 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.15: +21 -27 lines
Diff to previous 1.15 (colored)

Reimplement the global command line options -a and -v
as static global variables, reducing the maze of arguments
passed around among various static functions.
Suggested by kristaps@.

Revision 1.15 / (download) - annotate - [select for diffs], Sun Nov 27 23:11:37 2011 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.14: +2 -1 lines
Diff to previous 1.14 (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.14 / (download) - annotate - [select for diffs], Sun Nov 27 22:57:53 2011 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.13: +206 -31 lines
Diff to previous 1.13 (colored)

Rudimentary handling of formatted manuals ("cat pages").
Coded on the train back from p2k11 in Budapest.
Kristaps has seen the patch and agreed with the direction.

Revision 1.13 / (download) - annotate - [select for diffs], Sat Nov 26 22:38:11 2011 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.12: +10 -5 lines
Diff to previous 1.12 (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.12 / (download) - annotate - [select for diffs], Sat Nov 26 11:23:56 2011 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.11: +191 -39 lines
Diff to previous 1.11 (colored)

Store page titles in the correct case, and by default, only
put stuff into the database that man(1) will be able to retrieve.
However, support an option to use all directories and files.
feedback and ok  kristaps@

Revision 1.11 / (download) - annotate - [select for diffs], Thu Nov 24 12:54:19 2011 UTC (8 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

I say that mandocdb(8) uses "man(1)'s method", but it doesn't.  It just uses
the configuration file and ignores MANPATH.  Everybody else uses MANPATH
(being apropos and man), so why shouldn't we?

Revision 1.10 / (download) - annotate - [select for diffs], Wed Nov 23 09:52:20 2011 UTC (8 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.9: +26 -6 lines
Diff to previous 1.9 (colored)

Have mandocdb(8) take advantage of manpath.h.
This brings it in line with makewhatis(8), which, like apropos(1), will use
man.conf (or manpath(1)) if no manpath entries are provided.

Revision 1.9 / (download) - annotate - [select for diffs], Sun Nov 20 12:39:08 2011 UTC (8 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.8: +14 -14 lines
Diff to previous 1.8 (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.8 / (download) - annotate - [select for diffs], Sun Nov 13 10:49:57 2011 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.7: +19 -36 lines
Diff to previous 1.7 (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.7 / (download) - annotate - [select for diffs], Sun Nov 13 00:53:13 2011 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.6: +5 -5 lines
Diff to previous 1.6 (colored)

Fix two crashes that occur when walking very large (i.e. real-world) trees:
1) Avoid excessive, needless recursion, lest you overflow the stack;
2) Close all dir file descriptors, lest you run out of descriptors.
ok kristaps@

Revision 1.6 / (download) - annotate - [select for diffs], Sat Sep 17 13:54:27 2011 UTC (8 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_0
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)

fix an obvious typo: sz was used uninitialized
found while merging to OpenBSD

Revision 1.5 / (download) - annotate - [select for diffs], Fri Jul 15 17:59:29 2011 UTC (9 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_7, VERSION_1_11_6, VERSION_1_11_5
Changes since 1.4: +185 -55 lines
Diff to previous 1.4 (colored)

Big step forward in bringing mandocdb in line with most makewhatis-type
systems.

Revision 1.4 / (download) - annotate - [select for diffs], Fri Jul 15 10:15:24 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.3: +116 -96 lines
Diff to previous 1.3 (colored)

First step of making mandocdb a true makewhatis/mandb replacement:
accept a set of directories on the command line ("manpaths") that are
recursed for files.  The databases are created in each manpath root.
This temporarily removes OP_UPDATE and OP_DELETE functionality, which
will be added back in.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Jul 15 09:06:23 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.2: +174 -126 lines
Diff to previous 1.2 (colored)

Move parts of mandocdb that "do stuff" to the databases into their own
functions.  This will make it easier to call repeatedly (for different
directoreis) as must be done with the new interfaces being developed.

Revision 1.2 / (download) - annotate - [select for diffs], Thu Jul 14 14:36:37 2011 UTC (9 years ago) by schwarze
Branch: MAIN
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (colored)

move mandocdb(1) to mandocdb(8)
"please make this change" kristaps@

Revision 1.1 / (download) - annotate - [select for diffs], Thu Jul 14 10:57:02 2011 UTC (9 years ago) by kristaps
Branch: MAIN

Rename makewhatis [back] into mandocdb.  This is to maintain consistency
with OpenBSD, which is sandboxing the code for merge.  It makes sense
because it doesn't really make a `makewhatis' file in the traditional
sense, so it may be confusing.

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