OpenBSD CVS

CVS log for src/usr.bin/mandoc/manpath.c


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.31 / (download) - annotate - [select for diffs], Fri Nov 5 18:03:00 2021 UTC (2 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, HEAD
Changes since 1.30: +38 -49 lines
Diff to previous 1.30 (colored)

Make sure that the configuration file is always read, even when
running with the -M option or with a MANPATH environment variable
that has neither a leading or trailing ":" nor any "::".  If -M or
MANPATH override the configuration file rather than adding to it,
just ignore any "manpath" directives while processing the configuration
file.

This fixes a bug reported by Jan Stary <hans at stare dot cz>
on misc@.

Revision 1.30 / (download) - annotate - [select for diffs], Thu Aug 27 14:59:42 2020 UTC (3 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.29: +18 -10 lines
Diff to previous 1.29 (colored)

Fix a regression caused by the insertion of two new tokens,
which unintentionally made the -O tag= argument mandatory,
breaking commands like "man -akO tag Ic=ulimit".
Noticed while answering questions from Ian Ropers.

Revision 1.29 / (download) - annotate - [select for diffs], Tue Jul 21 15:08:49 2020 UTC (3 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.28: +22 -7 lines
Diff to previous 1.28 (colored)

undocumented options -O outfilename and -O tagfilename
to support regression testing without a tty;
no user visible change intended

Revision 1.28 / (download) - annotate - [select for diffs], Mon Feb 10 14:42:03 2020 UTC (4 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.27: +2 -9 lines
Diff to previous 1.27 (colored)

Finally delete support for the "_whatdb" configuration directive,
which has a misleading syntax.  It was declared obsolete and
superseded by the "manpath" directive five years ago.

Revision 1.27 / (download) - annotate - [select for diffs], Wed Jul 10 19:38:56 2019 UTC (4 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.26: +48 -42 lines
Diff to previous 1.26 (colored)

Some time ago, i simplified mandoc_msg() such that it can be used
everywhere and not only in the parsers.
For more uniform messages, use it at more places instead of err(3),
in particular in the main program.
While here, integrate a few trivial functions called at exactly one
place into the main option parser, and let a few more functions use
the normal convention of returning 0 for success and -1 for error.

Revision 1.26 / (download) - annotate - [select for diffs], Fri May 3 18:38:45 2019 UTC (5 years ago) by schwarze
Branch: MAIN
Changes since 1.25: +2 -3 lines
Diff to previous 1.25 (colored)

avoid duplicate "bad argument" error message, also shortening the code

Revision 1.25 / (download) - annotate - [select for diffs], Fri May 3 17:45:17 2019 UTC (5 years ago) by anton
Branch: MAIN
Changes since 1.24: +4 -3 lines
Diff to previous 1.24 (colored)

When processing unknown output options, prevent passing NULL to printf.

ok schwarze@

Revision 1.24 / (download) - annotate - [select for diffs], Thu Nov 22 11:30:15 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.23: +14 -7 lines
Diff to previous 1.23 (colored)

In -T locale (the default), -T ascii, and -T utf8 mode, provide a new
output option -O tag[=term] to move right to the definition of "term" when
opening the manual page in a pager, effectively porting the -T html
fragment name feature - https://man.openbsd.org/ksh#ulimit - to the
terminal.  Try:

$ man -O tag uvm_sysctl
$ man -O tag=ulimit ksh
$ man -O tag 3 compress

Feature development triggered by a question from kn@.  Klemens also
tested, provided feedback that resulted in improvements, and provided
an OK.

Revision 1.23 / (download) - annotate - [select for diffs], Tue Oct 2 14:56:36 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.22: +6 -3 lines
Diff to previous 1.22 (colored)

Add an option -T html -O toc to add a brief table of contents near
the top of HTML pages containing at least two non-standard sections.
Suggested by Adam Kalisz and discussed with kristaps@ during EuroBSDCon 2018.

Revision 1.22 / (download) - annotate - [select for diffs], Sat Jul 1 09:47:23 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.21: +9 -1 lines
Diff to previous 1.21 (colored)

Basic reporting of .Xrs to manual pages that don't exist
in the base system, inspired by mdoclint(1).

We are able to do this because (1) the -mdoc parser, the -Tlint validator,
and the man(1) manual page lookup code are all in the same program
and (2) the mandoc.db(5) database format allows fast lookup.

Feedback from, previous versions tested by, and OK jmc@.

A few features will be added to this in the tree, step by step.

Revision 1.21 / (download) - annotate - [select for diffs], Tue Jun 13 15:05:22 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

Delete the arbitrary range restriction for -Owidth.
We provide users with tools.  We don't attempt to prevent them from
using them in stupid ways: depending on the context, not every
stupid-looking use is necessarily actually stupid, and not every
stupidity can be automatically detected anyway, so don't even try.

Revision 1.20 / (download) - annotate - [select for diffs], Fri Feb 10 15:44:31 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.19: +5 -2 lines
Diff to previous 1.19 (colored)

In -Ttree output mode, show the BROKEN node flag and
provide a -Onoval output option to show the unvalidated tree.

Revision 1.19 / (download) - annotate - [select for diffs], Fri Jan 27 13:47:17 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.18: +68 -29 lines
Diff to previous 1.18 (colored)

warn about invalid output options
and error out if they occur on the command line;
missing feature found in the TODO file

Revision 1.18 / (download) - annotate - [select for diffs], Mon May 23 18:59:00 2016 UTC (7 years, 11 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.17: +5 -6 lines
Diff to previous 1.17 (colored)

Trim trailing whitespace from man.conf lines.  OK schwarze@.

Revision 1.17 / (download) - annotate - [select for diffs], Sat Nov 7 17:58:52 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.16: +16 -10 lines
Diff to previous 1.16 (colored)

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

Revision 1.16 / (download) - annotate - [select for diffs], Sun Oct 11 21:06:59 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.15: +6 -9 lines
Diff to previous 1.15 (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 also shortens the code by 50 lines.

It's a bad idea to boycott good interfaces merely because standards
committees ignore them.  Instead, it's the job of the portable
distribution to provide compatibility modules for archaic systems
(like commercial Solaris) that still don't have them.  Actually,
the compat code for the portable distribution already exists and
will be committed right after this.

Revision 1.15 / (download) - annotate - [select for diffs], Thu May 7 12:07:29 2015 UTC (9 years ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.14: +8 -6 lines
Diff to previous 1.14 (colored)

Do not let the -m option or MANPATH with leading, trailing, or double
colon override the default manpath, let them add to the default manpath.
Only override the default manpath by the -M option, by MANPATH without
leading, trailing, or double colon, or by "manpath" in man.conf(5).

Problem reported by Jan Stary <hans at stare dot cz>.
Patch OK'ed by millert@.

Revision 1.14 / (download) - annotate - [select for diffs], Fri Mar 27 17:36:56 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.13: +96 -25 lines
Diff to previous 1.13 (colored)

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

Revision 1.13 / (download) - annotate - [select for diffs], Thu Mar 26 22:42:01 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.12: +42 -26 lines
Diff to previous 1.12 (colored)

Add a new directive "manpath path"
to replace the legacy "_whatdb path/whatis.db".
Keep _whatdb support for backward compat, for now.
Discussed with many, jmc@ and ajacoutot@ agree with the general direction.

Revision 1.12 / (download) - annotate - [select for diffs], Sat Mar 21 17:18:17 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.11: +6 -2 lines
Diff to previous 1.11 (colored)

when there is no -m, no -M, no MANPATH and no /etc/man.conf,
fall back to /usr/share/man:/usr/X11R6/man:/usr/local/man

Revision 1.11 / (download) - annotate - [select for diffs], Tue Nov 18 19:40:38 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.10: +32 -16 lines
Diff to previous 1.10 (colored)

Ignore invalid directories in man.conf(5) and MANPATH, even if their
parent directories exist, but complain about invalid directories
given on the command line.
Intended to fix an oddity reported by sthen@.

Revision 1.10 / (download) - annotate - [select for diffs], Wed Apr 23 21:06:33 2014 UTC (10 years ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (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.9 / (download) - annotate - [select for diffs], Sun Apr 20 16:44:44 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.8: +3 -4 lines
Diff to previous 1.8 (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.8 / (download) - annotate - [select for diffs], Fri Mar 21 22:17:01 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (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.7 / (download) - annotate - [select for diffs], Thu Nov 21 01:47:10 2013 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

My audit of mandoc revealed two missing (unsigned char) casts
in isspace() and tolower() arguments containing arbitrary char data.
Thanks to deraadt@ for triggering the audit.

Revision 1.6 / (download) - annotate - [select for diffs], Wed May 29 23:15:11 2013 UTC (10 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.5: +5 -5 lines
Diff to previous 1.5 (colored)

Trivial sync to bsd.lv:
Kristaps changed the size member of struct manpaths from int to size_t.
No functional change.

Revision 1.5 / (download) - annotate - [select for diffs], Tue Dec 4 02:24:47 2012 UTC (11 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.4: +1 -3 lines
Diff to previous 1.4 (colored)

remove some unnecessary sys/param.h inclusions

Revision 1.4 / (download) - annotate - [select for diffs], Sat Dec 24 21:51:40 2011 UTC (12 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.3: +44 -6 lines
Diff to previous 1.3 (colored)

Support leading, trailing and double colons in MANPATH
to prepend, append or insert the man.conf(5) default path;
compatible with GNU manpath(1), implementation by kristaps@,
heavily tweaked by me.

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

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

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

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

Revision 1.1 / (download) - annotate - [select for diffs], Sat Nov 26 16:41:35 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN

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

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.