History log of /netbsd-current/usr.bin/man/man.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.73 10-May-2022 gutteridge

man.c: minor KNF


# 1.72 08-Mar-2022 rillig

man: remove unused global variable 'instype' (since yesterday)

No functional change.


# 1.71 08-Mar-2022 rillig

man: remove trailing whitespace

No binary change.


# 1.70 08-Mar-2022 rillig

man: fix type mismatch between enum and int (since yesterday)

No binary change.


# 1.69 07-Mar-2022 gutteridge

man.c: fix -m option so it works as documented

Refactoring work in man.c r. 1.40 from twelve years ago introduced a
regression where input from the -m option was appended rather than
prepended to the search paths. Problem reported by C. Chapman on
netbsd-users.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411
# 1.68 06-Apr-2020 maya

Exit successfully after printing the search path, stop further processing.

Continuing to process had the unintended effect that `man` failed to find
a matching manual page for {EMPTY LIST OF REQUESTED MANUAL PAGES}, and
exited with 1.

Prompted by a fish shell snippet that tried and failed to distinguish between
FreeBSD man (-p takes argument) and NetBSD man (-p no argument) by comparing
`man -p` exit code.

ok riastradh, logix (which also pointed out the manual page SYNOPSIS is
saying man -p should be used this way).


Revision tags: is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.67 15-Jun-2018 mrg

branches: 1.67.2; 1.67.4;
move 'utsname' to the main() function scope, so that the reference to
it outside the block remains valid.

should fix an asan reported issue.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2
# 1.66 02-May-2017 abhinav

branches: 1.66.2; 1.66.8;
Teach man -p to respect the MANPATH environment variable and the -M option.

Currently, `man -p` generates its output based on the value of the _default tag
in man.conf. However, man(1) modifies its search path based on the value of the
MANPATH variable and the list of directories specified via the -M option. In such
a case, `man -p` does not represent the correct search path. This commit intends
to fix this.

This change has the side effect that now the output of `man -p` will also include
the machine class specific subdirectories (such as man8/x86), while previously it
did not. The output would include subdirectories only for those machine classes
which are specified in the man.conf file.

Also, with this change, it is possible to run makemandb(8), by setting MANPATH
environment variable (e.g. env MANPATH=/usr/share/man makemandb).

Patch reviewed by wiz@


Revision tags: prg-localcount2-base1
# 1.65 27-Apr-2017 abhinav

Fix comment indentation at couple of places: Use \t instead of space


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.64 16-Jun-2016 abhinav

branches: 1.64.6;
Document -f option for man(1).
Also remove unsupported options for `man -k` from the synopsis and usage.


# 1.63 21-May-2016 abhinav

Remove unused include and unused constant. Ok from christos@.


# 1.62 14-Aug-2014 apb

For an argument to be interpreted as a local file name, bypassing the
search rules in man.conf or MANPATH, it must begin with "/", "./", or
"../". Simply testing whether it contains "/" is wrong, because it
breaks usage like "man 8 vax/boot".

This reverts revision 1.57 dated 2013-10-06,
"Be more permissive in interpreting man pages as filenames".


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.61 17-Feb-2014 uwe

branches: 1.61.4;
config() in manconf.c now verifies _build (and _crunch) command
templates with fmtcheck(3) so annotate the printf that uses these
commands as safe with a __format_arg wrapper and drop
-Wno-format-nonliteral.

XXX: Using local wrapper for now, solving this in general would be
nice, but it raises namespace pollution issues.

XXX^2: catman(8) also uses manconf.c and uses _build and _crunch so it
can also benefit from this (but see above).


# 1.60 28-Oct-2013 christos

Instead of guessing the suffix in the code, use the suffix list previously
loaded via man.conf(5). While there, zap unused iteration code.
(Franco Fichtner)


# 1.59 06-Oct-2013 christos

add more compression suffixes and local suffixes.


# 1.58 06-Oct-2013 christos

Recognize .gz and .bz2 suffixes so $ man ./man.1.gz works. From Franco Fichter
via dfly.


# 1.57 06-Oct-2013 christos

Be more permissive in interpreting man pages as filenames, from Franco
Fichter via dfly. fixes:
$ man usr.bin/man/man.1


# 1.56 30-Jul-2013 joerg

Mark the dead.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.55 19-Jul-2013 uwe

Constify some more.


# 1.54 19-Jul-2013 uwe

Spell "keywords" without space. Fix couple of typos.


# 1.53 19-Jul-2013 uwe

manual_find_buildkeyword() - now that we control the format string, we
may use asterisk precision specification instead of temporary
modifying the _build string itself.


# 1.52 19-Jul-2013 uwe

Fix manual_find_buildkeyword() to not use non-literal printf format.


# 1.51 18-Jul-2013 uwe

Don't access memory outside the array if tmpdirlen == 0.


# 1.50 18-Jul-2013 christos

use -Wno-format and revert "fixstring"


# 1.49 18-Jul-2013 christos

Set the string to NUL instread of providing an new empty string (from uwe)


# 1.48 18-Jul-2013 christos

WARNS=6
- fix cast qual issues
- don't use snprintf on a user-provided buffer


# 1.47 18-Jul-2013 uwe

Revert previous; other errors from WARNS=3 obscured the error in jump().


# 1.46 18-Jul-2013 uwe

Constify jump() arguments appropriately.


# 1.45 18-Jul-2013 uwe

Move manstate::pagerlen so that its "length of the above" comment makes sense.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base
# 1.44 03-Jan-2012 joerg

branches: 1.44.6; 1.44.10;
If the default path doesn't result in a match, bail out early instead of
running into a segmentation fault. Based on patch by Abhinav Upadhyay.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.43 14-Jun-2011 wiz

branches: 1.43.2;
Fix usage in man page and sync usage in executable with it.


# 1.42 14-Jun-2011 joerg

Add support for man -p to print the search path for manual pages (not
including cat page directories).

From Abhinav Upadhyay as part of Google's Summer of Code 2011


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.41 07-Jul-2010 christos

branches: 1.41.4;
get the value of the entry for the class not the key.


# 1.40 23-May-2010 christos

- centralize the snprintf code.
- use err where appropriate.
- add machclass which should be x86 when i386 and amd64 and can be specified
in man.conf as:
_i386 x86
_amd64 x86
so that we can support merged pages. Nothing uses this yet.


Revision tags: matt-premerge-20091211
# 1.39 07-Oct-2009 cegger

Mimic OSX behaviour:

On OS X it is possible to specify the manpage filename
with a full or relative path like this:

man ./foo.5

or

man /cd/foo/bar.1.gz

This is really helpful to view the manpage quickly while editing it.

patch presented on current-users@ and tech-userlevel@:
http://mail-index.netbsd.org/current-users/2009/10/06/msg010767.html
http://mail-index.netbsd.org/tech-userlevel/2009/10/06/msg002675.html

No objections


# 1.38 06-Oct-2009 cegger

- use EXIT_FAILURE/EXIT_SUCCESS
- whitespace nits
- ansify cleanup()/usage()
- remove pointless parenthesis on return


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.37 21-Jul-2008 lukem

branches: 1.37.4; 1.37.10;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.36 05-Oct-2007 lukem

branches: 1.36.8;
Convert to using raise_default_signal(3).


Revision tags: matt-mips64-base
# 1.35 05-Feb-2007 jwise

branches: 1.35.4;
Since MAN_DEBUG is constant, go from if (MAN_DEBUG) to #if MAN_DEBUG


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.34 01-May-2006 christos

Coverity CID 2996: Don't return without closing fp.


# 1.33 10-Apr-2006 chuck

modified man(1):
- avoid double slashes when displaying man pages (got tired
of '/usr/share/man//cat1/man.0').
- got rid of __P() while working on it.
- incorporate some of my old notes explaining how manpath works into the
comments of the code itself.
- renamed some of the vars so that the code is consistent throughout
(and hopefully clearer and easier to understand)
- fixed relative man paths for multiple man pages (man did a chdir()
on the first man page it had to format --- this broke any remaining
relative path man pages left to process). save old directory and
fchdir() back to it after formatting.
- improved doc on "man -h" which does more than just whatis(1) [e.g.
"man -h fopen" prints the required include files and the prototypes
rather than just the one-liner you get with whatis(1)]
- manconf.c now fills in the "len" length field in the TAG/ENTRY
structures (man now uses len).

revise man.conf file reading stuff to return error on failure in
addentry/gettag (fka getlist) rather than just err()ing out. this
allows man(1) to call cleanup and delete its tmp files rather than
just leave them floating. revise other apps using this code
(makewhatis, apropos, catman, whatis) to expect this. also remove
__P on updated files.


# 1.32 08-Apr-2006 christos

change an int to size_t


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.31 05-Jan-2004 jmmv

Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.


# 1.30 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.


Revision tags: fvdl_fs64_base
# 1.29 13-Sep-2002 thorpej

Rename man/config.{c,h} to man/manconf.{c,h}, so we don't have to
worry about problems including "config.h" when building as a host
tool.


# 1.28 11-Jun-2002 lukem

- getlist(): add "int create" arg, which creates list if it's not present
(using guts of now defunct addlist())
- use TAILQ_*() macros appropriately when manipulating tailqs


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.27 14-Mar-2002 groo

branches: 1.27.2;
Fix longstanding misuse of glob(3) and fnmatch(3) in man page search.
glob(3)-special characters are now escaped in the supplied man page names.

Makes ``man ['' work without mysterious quoting.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.25 12-Jun-2000 simonb

Allow "-s" to specify a section name, ala the SysV man command.
Unlike the SysV man command, this doesn't allow for the -s argument
to be a list.


# 1.24 07-Jun-2000 thorpej

check_pager() was using an uninitialized variable; fix it.


# 1.23 27-May-2000 jdolecek

allow to specify relative paths for sections in man.conf - they are used
similarily to _subdir, but only when appropriate
fix -m handling, so that e.g. "man -m . 3 printf" works as it should
add new -S flag, to specify a string the result path has to contain
g/c some unused stuff

Written by Chuck Cranor, with only cosmetic changes & const poisoning by me.


Revision tags: minoura-xpg4dl-base
# 1.22 09-Jan-2000 tsutsui

branches: 1.22.2;
Use uname(3) to determine MACHINE type.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.21 02-Nov-1999 lukem

revert previous


# 1.20 02-Nov-1999 lukem

remove superfluous '-' in getopt string


# 1.19 22-Jul-1999 kleink

branches: 1.19.2;
Try $TMPDIR first, then fall back to _PATH_TMP.


# 1.18 22-Jul-1999 itohy

A caught signal is blocked in the handler and
must be unblocked to do the default action.
The old code may generate weird exit status
on signals.


# 1.17 19-Jun-1999 itohy

Remove temp file on SIGPIPE (such as "man sh | head").


# 1.16 13-Jun-1999 kleink

Fall back to more(1) if PAGER is set but null.


Revision tags: netbsd-1-4-RELEASE netbsd-1-4-base
# 1.15 06-Nov-1998 christos

branches: 1.15.2;
char -> unsigned char


# 1.14 08-Oct-1998 wsanchez

We can't define MACHINE from a makefile in Rhapsody, because you might be cross
compiling, or building a fat (multi-architecture) binary. Our compiler
defines __ARCHITECTURE__ for this use.
Fixed an off-by-one error that may occasionally cause man to seg fault. Found
by using a special strict malloc() implementation.


# 1.13 25-Aug-1998 ross

Add { and } to shut up egcs. Reformat the more questionable code.


# 1.12 06-Jul-1998 kleink

Since GLOB_NOCHECK is not set, explicitly check for a return value of
GLOB_NOMATCH from glob(). Noticed by Juergen Hannken-Illjes.


# 1.11 19-Jun-1998 kleink

GLOB_QUOTE is dead; per POSIX, backslash quoting of special characters being
enabled is the default behaviour.


# 1.10 23-Nov-1997 tv

When man was "fixed" to chdir() to the man root as historical man does,
it broke the -M option on relative paths (the chdir works as it should,
but the relative man page path is still used whole in nroff). This
repairs the situation by chopping the full pathname in half--one part
for the chdir, one part for the filename.


Revision tags: netbsd-1-3-base
# 1.9 17-Oct-1997 mikel

branches: 1.9.2;
cleanup for WARNS=1


# 1.8 10-Sep-1997 mikel

resize a pathname buffer to MAXPATHLEN; from Matthias Scheler in PR 4101


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.7 28-Sep-1995 tls

Sync with 4.4BSD-Lite2


# 1.6 20-Apr-1995 mycroft

Pay attention to the section number, even if MANPATH or -M is specified.


# 1.5 16-Jan-1995 mycroft

Sync with 4.4-Lite, plus local changes.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.4 03-Jun-1994 jtc

Fix from Christos Zoulas which makes relative paths in .so lines work when
man pages are formatted.


# 1.3 17-Apr-1994 cgd

fix from bostic for multiple match problem


# 1.2 18-Mar-1994 cgd

fix from Keith White <kwhite@csi.UOttawa.CA>, to DTRT when man -w's output
is redirected.


Revision tags: BOSTIC-1
# 1.1 21-Dec-1993 cgd

branches: 1.1.1;
add man(1) ; part of new man(1) package from Bostic


# 1.72 08-Mar-2022 rillig

man: remove unused global variable 'instype' (since yesterday)

No functional change.


# 1.71 08-Mar-2022 rillig

man: remove trailing whitespace

No binary change.


# 1.70 08-Mar-2022 rillig

man: fix type mismatch between enum and int (since yesterday)

No binary change.


# 1.69 07-Mar-2022 gutteridge

man.c: fix -m option so it works as documented

Refactoring work in man.c r. 1.40 from twelve years ago introduced a
regression where input from the -m option was appended rather than
prepended to the search paths. Problem reported by C. Chapman on
netbsd-users.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411
# 1.68 06-Apr-2020 maya

Exit successfully after printing the search path, stop further processing.

Continuing to process had the unintended effect that `man` failed to find
a matching manual page for {EMPTY LIST OF REQUESTED MANUAL PAGES}, and
exited with 1.

Prompted by a fish shell snippet that tried and failed to distinguish between
FreeBSD man (-p takes argument) and NetBSD man (-p no argument) by comparing
`man -p` exit code.

ok riastradh, logix (which also pointed out the manual page SYNOPSIS is
saying man -p should be used this way).


Revision tags: is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.67 15-Jun-2018 mrg

branches: 1.67.2; 1.67.4;
move 'utsname' to the main() function scope, so that the reference to
it outside the block remains valid.

should fix an asan reported issue.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2
# 1.66 02-May-2017 abhinav

branches: 1.66.8;
Teach man -p to respect the MANPATH environment variable and the -M option.

Currently, `man -p` generates its output based on the value of the _default tag
in man.conf. However, man(1) modifies its search path based on the value of the
MANPATH variable and the list of directories specified via the -M option. In such
a case, `man -p` does not represent the correct search path. This commit intends
to fix this.

This change has the side effect that now the output of `man -p` will also include
the machine class specific subdirectories (such as man8/x86), while previously it
did not. The output would include subdirectories only for those machine classes
which are specified in the man.conf file.

Also, with this change, it is possible to run makemandb(8), by setting MANPATH
environment variable (e.g. env MANPATH=/usr/share/man makemandb).

Patch reviewed by wiz@


Revision tags: prg-localcount2-base1
# 1.65 27-Apr-2017 abhinav

Fix comment indentation at couple of places: Use \t instead of space


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.64 16-Jun-2016 abhinav

branches: 1.64.6;
Document -f option for man(1).
Also remove unsupported options for `man -k` from the synopsis and usage.


# 1.63 21-May-2016 abhinav

Remove unused include and unused constant. Ok from christos@.


# 1.62 14-Aug-2014 apb

For an argument to be interpreted as a local file name, bypassing the
search rules in man.conf or MANPATH, it must begin with "/", "./", or
"../". Simply testing whether it contains "/" is wrong, because it
breaks usage like "man 8 vax/boot".

This reverts revision 1.57 dated 2013-10-06,
"Be more permissive in interpreting man pages as filenames".


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.61 17-Feb-2014 uwe

branches: 1.61.4;
config() in manconf.c now verifies _build (and _crunch) command
templates with fmtcheck(3) so annotate the printf that uses these
commands as safe with a __format_arg wrapper and drop
-Wno-format-nonliteral.

XXX: Using local wrapper for now, solving this in general would be
nice, but it raises namespace pollution issues.

XXX^2: catman(8) also uses manconf.c and uses _build and _crunch so it
can also benefit from this (but see above).


# 1.60 28-Oct-2013 christos

Instead of guessing the suffix in the code, use the suffix list previously
loaded via man.conf(5). While there, zap unused iteration code.
(Franco Fichtner)


# 1.59 06-Oct-2013 christos

add more compression suffixes and local suffixes.


# 1.58 06-Oct-2013 christos

Recognize .gz and .bz2 suffixes so $ man ./man.1.gz works. From Franco Fichter
via dfly.


# 1.57 06-Oct-2013 christos

Be more permissive in interpreting man pages as filenames, from Franco
Fichter via dfly. fixes:
$ man usr.bin/man/man.1


# 1.56 30-Jul-2013 joerg

Mark the dead.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.55 19-Jul-2013 uwe

Constify some more.


# 1.54 19-Jul-2013 uwe

Spell "keywords" without space. Fix couple of typos.


# 1.53 19-Jul-2013 uwe

manual_find_buildkeyword() - now that we control the format string, we
may use asterisk precision specification instead of temporary
modifying the _build string itself.


# 1.52 19-Jul-2013 uwe

Fix manual_find_buildkeyword() to not use non-literal printf format.


# 1.51 18-Jul-2013 uwe

Don't access memory outside the array if tmpdirlen == 0.


# 1.50 18-Jul-2013 christos

use -Wno-format and revert "fixstring"


# 1.49 18-Jul-2013 christos

Set the string to NUL instread of providing an new empty string (from uwe)


# 1.48 18-Jul-2013 christos

WARNS=6
- fix cast qual issues
- don't use snprintf on a user-provided buffer


# 1.47 18-Jul-2013 uwe

Revert previous; other errors from WARNS=3 obscured the error in jump().


# 1.46 18-Jul-2013 uwe

Constify jump() arguments appropriately.


# 1.45 18-Jul-2013 uwe

Move manstate::pagerlen so that its "length of the above" comment makes sense.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base
# 1.44 03-Jan-2012 joerg

branches: 1.44.6; 1.44.10;
If the default path doesn't result in a match, bail out early instead of
running into a segmentation fault. Based on patch by Abhinav Upadhyay.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.43 14-Jun-2011 wiz

branches: 1.43.2;
Fix usage in man page and sync usage in executable with it.


# 1.42 14-Jun-2011 joerg

Add support for man -p to print the search path for manual pages (not
including cat page directories).

From Abhinav Upadhyay as part of Google's Summer of Code 2011


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.41 07-Jul-2010 christos

branches: 1.41.4;
get the value of the entry for the class not the key.


# 1.40 23-May-2010 christos

- centralize the snprintf code.
- use err where appropriate.
- add machclass which should be x86 when i386 and amd64 and can be specified
in man.conf as:
_i386 x86
_amd64 x86
so that we can support merged pages. Nothing uses this yet.


Revision tags: matt-premerge-20091211
# 1.39 07-Oct-2009 cegger

Mimic OSX behaviour:

On OS X it is possible to specify the manpage filename
with a full or relative path like this:

man ./foo.5

or

man /cd/foo/bar.1.gz

This is really helpful to view the manpage quickly while editing it.

patch presented on current-users@ and tech-userlevel@:
http://mail-index.netbsd.org/current-users/2009/10/06/msg010767.html
http://mail-index.netbsd.org/tech-userlevel/2009/10/06/msg002675.html

No objections


# 1.38 06-Oct-2009 cegger

- use EXIT_FAILURE/EXIT_SUCCESS
- whitespace nits
- ansify cleanup()/usage()
- remove pointless parenthesis on return


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.37 21-Jul-2008 lukem

branches: 1.37.4; 1.37.10;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.36 05-Oct-2007 lukem

branches: 1.36.8;
Convert to using raise_default_signal(3).


Revision tags: matt-mips64-base
# 1.35 05-Feb-2007 jwise

branches: 1.35.4;
Since MAN_DEBUG is constant, go from if (MAN_DEBUG) to #if MAN_DEBUG


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.34 01-May-2006 christos

Coverity CID 2996: Don't return without closing fp.


# 1.33 10-Apr-2006 chuck

modified man(1):
- avoid double slashes when displaying man pages (got tired
of '/usr/share/man//cat1/man.0').
- got rid of __P() while working on it.
- incorporate some of my old notes explaining how manpath works into the
comments of the code itself.
- renamed some of the vars so that the code is consistent throughout
(and hopefully clearer and easier to understand)
- fixed relative man paths for multiple man pages (man did a chdir()
on the first man page it had to format --- this broke any remaining
relative path man pages left to process). save old directory and
fchdir() back to it after formatting.
- improved doc on "man -h" which does more than just whatis(1) [e.g.
"man -h fopen" prints the required include files and the prototypes
rather than just the one-liner you get with whatis(1)]
- manconf.c now fills in the "len" length field in the TAG/ENTRY
structures (man now uses len).

revise man.conf file reading stuff to return error on failure in
addentry/gettag (fka getlist) rather than just err()ing out. this
allows man(1) to call cleanup and delete its tmp files rather than
just leave them floating. revise other apps using this code
(makewhatis, apropos, catman, whatis) to expect this. also remove
__P on updated files.


# 1.32 08-Apr-2006 christos

change an int to size_t


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.31 05-Jan-2004 jmmv

Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.


# 1.30 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.


Revision tags: fvdl_fs64_base
# 1.29 13-Sep-2002 thorpej

Rename man/config.{c,h} to man/manconf.{c,h}, so we don't have to
worry about problems including "config.h" when building as a host
tool.


# 1.28 11-Jun-2002 lukem

- getlist(): add "int create" arg, which creates list if it's not present
(using guts of now defunct addlist())
- use TAILQ_*() macros appropriately when manipulating tailqs


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.27 14-Mar-2002 groo

branches: 1.27.2;
Fix longstanding misuse of glob(3) and fnmatch(3) in man page search.
glob(3)-special characters are now escaped in the supplied man page names.

Makes ``man ['' work without mysterious quoting.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.25 12-Jun-2000 simonb

Allow "-s" to specify a section name, ala the SysV man command.
Unlike the SysV man command, this doesn't allow for the -s argument
to be a list.


# 1.24 07-Jun-2000 thorpej

check_pager() was using an uninitialized variable; fix it.


# 1.23 27-May-2000 jdolecek

allow to specify relative paths for sections in man.conf - they are used
similarily to _subdir, but only when appropriate
fix -m handling, so that e.g. "man -m . 3 printf" works as it should
add new -S flag, to specify a string the result path has to contain
g/c some unused stuff

Written by Chuck Cranor, with only cosmetic changes & const poisoning by me.


Revision tags: minoura-xpg4dl-base
# 1.22 09-Jan-2000 tsutsui

branches: 1.22.2;
Use uname(3) to determine MACHINE type.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.21 02-Nov-1999 lukem

revert previous


# 1.20 02-Nov-1999 lukem

remove superfluous '-' in getopt string


# 1.19 22-Jul-1999 kleink

branches: 1.19.2;
Try $TMPDIR first, then fall back to _PATH_TMP.


# 1.18 22-Jul-1999 itohy

A caught signal is blocked in the handler and
must be unblocked to do the default action.
The old code may generate weird exit status
on signals.


# 1.17 19-Jun-1999 itohy

Remove temp file on SIGPIPE (such as "man sh | head").


# 1.16 13-Jun-1999 kleink

Fall back to more(1) if PAGER is set but null.


Revision tags: netbsd-1-4-RELEASE netbsd-1-4-base
# 1.15 06-Nov-1998 christos

branches: 1.15.2;
char -> unsigned char


# 1.14 08-Oct-1998 wsanchez

We can't define MACHINE from a makefile in Rhapsody, because you might be cross
compiling, or building a fat (multi-architecture) binary. Our compiler
defines __ARCHITECTURE__ for this use.
Fixed an off-by-one error that may occasionally cause man to seg fault. Found
by using a special strict malloc() implementation.


# 1.13 25-Aug-1998 ross

Add { and } to shut up egcs. Reformat the more questionable code.


# 1.12 06-Jul-1998 kleink

Since GLOB_NOCHECK is not set, explicitly check for a return value of
GLOB_NOMATCH from glob(). Noticed by Juergen Hannken-Illjes.


# 1.11 19-Jun-1998 kleink

GLOB_QUOTE is dead; per POSIX, backslash quoting of special characters being
enabled is the default behaviour.


# 1.10 23-Nov-1997 tv

When man was "fixed" to chdir() to the man root as historical man does,
it broke the -M option on relative paths (the chdir works as it should,
but the relative man page path is still used whole in nroff). This
repairs the situation by chopping the full pathname in half--one part
for the chdir, one part for the filename.


Revision tags: netbsd-1-3-base
# 1.9 17-Oct-1997 mikel

branches: 1.9.2;
cleanup for WARNS=1


# 1.8 10-Sep-1997 mikel

resize a pathname buffer to MAXPATHLEN; from Matthias Scheler in PR 4101


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.7 28-Sep-1995 tls

Sync with 4.4BSD-Lite2


# 1.6 20-Apr-1995 mycroft

Pay attention to the section number, even if MANPATH or -M is specified.


# 1.5 16-Jan-1995 mycroft

Sync with 4.4-Lite, plus local changes.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.4 03-Jun-1994 jtc

Fix from Christos Zoulas which makes relative paths in .so lines work when
man pages are formatted.


# 1.3 17-Apr-1994 cgd

fix from bostic for multiple match problem


# 1.2 18-Mar-1994 cgd

fix from Keith White <kwhite@csi.UOttawa.CA>, to DTRT when man -w's output
is redirected.


Revision tags: BOSTIC-1
# 1.1 21-Dec-1993 cgd

branches: 1.1.1;
add man(1) ; part of new man(1) package from Bostic


# 1.69 07-Mar-2022 gutteridge

man.c: fix -m option so it works as documented

Refactoring work in man.c r. 1.40 from twelve years ago introduced a
regression where input from the -m option was appended rather than
prepended to the search paths. Problem reported by C. Chapman on
netbsd-users.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411
# 1.68 06-Apr-2020 maya

Exit successfully after printing the search path, stop further processing.

Continuing to process had the unintended effect that `man` failed to find
a matching manual page for {EMPTY LIST OF REQUESTED MANUAL PAGES}, and
exited with 1.

Prompted by a fish shell snippet that tried and failed to distinguish between
FreeBSD man (-p takes argument) and NetBSD man (-p no argument) by comparing
`man -p` exit code.

ok riastradh, logix (which also pointed out the manual page SYNOPSIS is
saying man -p should be used this way).


Revision tags: is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.67 15-Jun-2018 mrg

branches: 1.67.2; 1.67.4;
move 'utsname' to the main() function scope, so that the reference to
it outside the block remains valid.

should fix an asan reported issue.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2
# 1.66 02-May-2017 abhinav

branches: 1.66.8;
Teach man -p to respect the MANPATH environment variable and the -M option.

Currently, `man -p` generates its output based on the value of the _default tag
in man.conf. However, man(1) modifies its search path based on the value of the
MANPATH variable and the list of directories specified via the -M option. In such
a case, `man -p` does not represent the correct search path. This commit intends
to fix this.

This change has the side effect that now the output of `man -p` will also include
the machine class specific subdirectories (such as man8/x86), while previously it
did not. The output would include subdirectories only for those machine classes
which are specified in the man.conf file.

Also, with this change, it is possible to run makemandb(8), by setting MANPATH
environment variable (e.g. env MANPATH=/usr/share/man makemandb).

Patch reviewed by wiz@


Revision tags: prg-localcount2-base1
# 1.65 27-Apr-2017 abhinav

Fix comment indentation at couple of places: Use \t instead of space


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.64 16-Jun-2016 abhinav

branches: 1.64.6;
Document -f option for man(1).
Also remove unsupported options for `man -k` from the synopsis and usage.


# 1.63 21-May-2016 abhinav

Remove unused include and unused constant. Ok from christos@.


# 1.62 14-Aug-2014 apb

For an argument to be interpreted as a local file name, bypassing the
search rules in man.conf or MANPATH, it must begin with "/", "./", or
"../". Simply testing whether it contains "/" is wrong, because it
breaks usage like "man 8 vax/boot".

This reverts revision 1.57 dated 2013-10-06,
"Be more permissive in interpreting man pages as filenames".


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.61 17-Feb-2014 uwe

branches: 1.61.4;
config() in manconf.c now verifies _build (and _crunch) command
templates with fmtcheck(3) so annotate the printf that uses these
commands as safe with a __format_arg wrapper and drop
-Wno-format-nonliteral.

XXX: Using local wrapper for now, solving this in general would be
nice, but it raises namespace pollution issues.

XXX^2: catman(8) also uses manconf.c and uses _build and _crunch so it
can also benefit from this (but see above).


# 1.60 28-Oct-2013 christos

Instead of guessing the suffix in the code, use the suffix list previously
loaded via man.conf(5). While there, zap unused iteration code.
(Franco Fichtner)


# 1.59 06-Oct-2013 christos

add more compression suffixes and local suffixes.


# 1.58 06-Oct-2013 christos

Recognize .gz and .bz2 suffixes so $ man ./man.1.gz works. From Franco Fichter
via dfly.


# 1.57 06-Oct-2013 christos

Be more permissive in interpreting man pages as filenames, from Franco
Fichter via dfly. fixes:
$ man usr.bin/man/man.1


# 1.56 30-Jul-2013 joerg

Mark the dead.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.55 19-Jul-2013 uwe

Constify some more.


# 1.54 19-Jul-2013 uwe

Spell "keywords" without space. Fix couple of typos.


# 1.53 19-Jul-2013 uwe

manual_find_buildkeyword() - now that we control the format string, we
may use asterisk precision specification instead of temporary
modifying the _build string itself.


# 1.52 19-Jul-2013 uwe

Fix manual_find_buildkeyword() to not use non-literal printf format.


# 1.51 18-Jul-2013 uwe

Don't access memory outside the array if tmpdirlen == 0.


# 1.50 18-Jul-2013 christos

use -Wno-format and revert "fixstring"


# 1.49 18-Jul-2013 christos

Set the string to NUL instread of providing an new empty string (from uwe)


# 1.48 18-Jul-2013 christos

WARNS=6
- fix cast qual issues
- don't use snprintf on a user-provided buffer


# 1.47 18-Jul-2013 uwe

Revert previous; other errors from WARNS=3 obscured the error in jump().


# 1.46 18-Jul-2013 uwe

Constify jump() arguments appropriately.


# 1.45 18-Jul-2013 uwe

Move manstate::pagerlen so that its "length of the above" comment makes sense.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base
# 1.44 03-Jan-2012 joerg

branches: 1.44.6; 1.44.10;
If the default path doesn't result in a match, bail out early instead of
running into a segmentation fault. Based on patch by Abhinav Upadhyay.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.43 14-Jun-2011 wiz

branches: 1.43.2;
Fix usage in man page and sync usage in executable with it.


# 1.42 14-Jun-2011 joerg

Add support for man -p to print the search path for manual pages (not
including cat page directories).

From Abhinav Upadhyay as part of Google's Summer of Code 2011


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.41 07-Jul-2010 christos

branches: 1.41.4;
get the value of the entry for the class not the key.


# 1.40 23-May-2010 christos

- centralize the snprintf code.
- use err where appropriate.
- add machclass which should be x86 when i386 and amd64 and can be specified
in man.conf as:
_i386 x86
_amd64 x86
so that we can support merged pages. Nothing uses this yet.


Revision tags: matt-premerge-20091211
# 1.39 07-Oct-2009 cegger

Mimic OSX behaviour:

On OS X it is possible to specify the manpage filename
with a full or relative path like this:

man ./foo.5

or

man /cd/foo/bar.1.gz

This is really helpful to view the manpage quickly while editing it.

patch presented on current-users@ and tech-userlevel@:
http://mail-index.netbsd.org/current-users/2009/10/06/msg010767.html
http://mail-index.netbsd.org/tech-userlevel/2009/10/06/msg002675.html

No objections


# 1.38 06-Oct-2009 cegger

- use EXIT_FAILURE/EXIT_SUCCESS
- whitespace nits
- ansify cleanup()/usage()
- remove pointless parenthesis on return


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.37 21-Jul-2008 lukem

branches: 1.37.4; 1.37.10;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.36 05-Oct-2007 lukem

branches: 1.36.8;
Convert to using raise_default_signal(3).


Revision tags: matt-mips64-base
# 1.35 05-Feb-2007 jwise

branches: 1.35.4;
Since MAN_DEBUG is constant, go from if (MAN_DEBUG) to #if MAN_DEBUG


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.34 01-May-2006 christos

Coverity CID 2996: Don't return without closing fp.


# 1.33 10-Apr-2006 chuck

modified man(1):
- avoid double slashes when displaying man pages (got tired
of '/usr/share/man//cat1/man.0').
- got rid of __P() while working on it.
- incorporate some of my old notes explaining how manpath works into the
comments of the code itself.
- renamed some of the vars so that the code is consistent throughout
(and hopefully clearer and easier to understand)
- fixed relative man paths for multiple man pages (man did a chdir()
on the first man page it had to format --- this broke any remaining
relative path man pages left to process). save old directory and
fchdir() back to it after formatting.
- improved doc on "man -h" which does more than just whatis(1) [e.g.
"man -h fopen" prints the required include files and the prototypes
rather than just the one-liner you get with whatis(1)]
- manconf.c now fills in the "len" length field in the TAG/ENTRY
structures (man now uses len).

revise man.conf file reading stuff to return error on failure in
addentry/gettag (fka getlist) rather than just err()ing out. this
allows man(1) to call cleanup and delete its tmp files rather than
just leave them floating. revise other apps using this code
(makewhatis, apropos, catman, whatis) to expect this. also remove
__P on updated files.


# 1.32 08-Apr-2006 christos

change an int to size_t


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.31 05-Jan-2004 jmmv

Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.


# 1.30 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.


Revision tags: fvdl_fs64_base
# 1.29 13-Sep-2002 thorpej

Rename man/config.{c,h} to man/manconf.{c,h}, so we don't have to
worry about problems including "config.h" when building as a host
tool.


# 1.28 11-Jun-2002 lukem

- getlist(): add "int create" arg, which creates list if it's not present
(using guts of now defunct addlist())
- use TAILQ_*() macros appropriately when manipulating tailqs


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.27 14-Mar-2002 groo

branches: 1.27.2;
Fix longstanding misuse of glob(3) and fnmatch(3) in man page search.
glob(3)-special characters are now escaped in the supplied man page names.

Makes ``man ['' work without mysterious quoting.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.25 12-Jun-2000 simonb

Allow "-s" to specify a section name, ala the SysV man command.
Unlike the SysV man command, this doesn't allow for the -s argument
to be a list.


# 1.24 07-Jun-2000 thorpej

check_pager() was using an uninitialized variable; fix it.


# 1.23 27-May-2000 jdolecek

allow to specify relative paths for sections in man.conf - they are used
similarily to _subdir, but only when appropriate
fix -m handling, so that e.g. "man -m . 3 printf" works as it should
add new -S flag, to specify a string the result path has to contain
g/c some unused stuff

Written by Chuck Cranor, with only cosmetic changes & const poisoning by me.


Revision tags: minoura-xpg4dl-base
# 1.22 09-Jan-2000 tsutsui

branches: 1.22.2;
Use uname(3) to determine MACHINE type.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.21 02-Nov-1999 lukem

revert previous


# 1.20 02-Nov-1999 lukem

remove superfluous '-' in getopt string


# 1.19 22-Jul-1999 kleink

branches: 1.19.2;
Try $TMPDIR first, then fall back to _PATH_TMP.


# 1.18 22-Jul-1999 itohy

A caught signal is blocked in the handler and
must be unblocked to do the default action.
The old code may generate weird exit status
on signals.


# 1.17 19-Jun-1999 itohy

Remove temp file on SIGPIPE (such as "man sh | head").


# 1.16 13-Jun-1999 kleink

Fall back to more(1) if PAGER is set but null.


Revision tags: netbsd-1-4-RELEASE netbsd-1-4-base
# 1.15 06-Nov-1998 christos

branches: 1.15.2;
char -> unsigned char


# 1.14 08-Oct-1998 wsanchez

We can't define MACHINE from a makefile in Rhapsody, because you might be cross
compiling, or building a fat (multi-architecture) binary. Our compiler
defines __ARCHITECTURE__ for this use.
Fixed an off-by-one error that may occasionally cause man to seg fault. Found
by using a special strict malloc() implementation.


# 1.13 25-Aug-1998 ross

Add { and } to shut up egcs. Reformat the more questionable code.


# 1.12 06-Jul-1998 kleink

Since GLOB_NOCHECK is not set, explicitly check for a return value of
GLOB_NOMATCH from glob(). Noticed by Juergen Hannken-Illjes.


# 1.11 19-Jun-1998 kleink

GLOB_QUOTE is dead; per POSIX, backslash quoting of special characters being
enabled is the default behaviour.


# 1.10 23-Nov-1997 tv

When man was "fixed" to chdir() to the man root as historical man does,
it broke the -M option on relative paths (the chdir works as it should,
but the relative man page path is still used whole in nroff). This
repairs the situation by chopping the full pathname in half--one part
for the chdir, one part for the filename.


Revision tags: netbsd-1-3-base
# 1.9 17-Oct-1997 mikel

branches: 1.9.2;
cleanup for WARNS=1


# 1.8 10-Sep-1997 mikel

resize a pathname buffer to MAXPATHLEN; from Matthias Scheler in PR 4101


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.7 28-Sep-1995 tls

Sync with 4.4BSD-Lite2


# 1.6 20-Apr-1995 mycroft

Pay attention to the section number, even if MANPATH or -M is specified.


# 1.5 16-Jan-1995 mycroft

Sync with 4.4-Lite, plus local changes.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.4 03-Jun-1994 jtc

Fix from Christos Zoulas which makes relative paths in .so lines work when
man pages are formatted.


# 1.3 17-Apr-1994 cgd

fix from bostic for multiple match problem


# 1.2 18-Mar-1994 cgd

fix from Keith White <kwhite@csi.UOttawa.CA>, to DTRT when man -w's output
is redirected.


Revision tags: BOSTIC-1
# 1.1 21-Dec-1993 cgd

branches: 1.1.1;
add man(1) ; part of new man(1) package from Bostic


# 1.68 06-Apr-2020 maya

Exit successfully after printing the search path, stop further processing.

Continuing to process had the unintended effect that `man` failed to find
a matching manual page for {EMPTY LIST OF REQUESTED MANUAL PAGES}, and
exited with 1.

Prompted by a fish shell snippet that tried and failed to distinguish between
FreeBSD man (-p takes argument) and NetBSD man (-p no argument) by comparing
`man -p` exit code.

ok riastradh, logix (which also pointed out the manual page SYNOPSIS is
saying man -p should be used this way).


Revision tags: phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.67 15-Jun-2018 mrg

move 'utsname' to the main() function scope, so that the reference to
it outside the block remains valid.

should fix an asan reported issue.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2
# 1.66 02-May-2017 abhinav

branches: 1.66.8;
Teach man -p to respect the MANPATH environment variable and the -M option.

Currently, `man -p` generates its output based on the value of the _default tag
in man.conf. However, man(1) modifies its search path based on the value of the
MANPATH variable and the list of directories specified via the -M option. In such
a case, `man -p` does not represent the correct search path. This commit intends
to fix this.

This change has the side effect that now the output of `man -p` will also include
the machine class specific subdirectories (such as man8/x86), while previously it
did not. The output would include subdirectories only for those machine classes
which are specified in the man.conf file.

Also, with this change, it is possible to run makemandb(8), by setting MANPATH
environment variable (e.g. env MANPATH=/usr/share/man makemandb).

Patch reviewed by wiz@


Revision tags: prg-localcount2-base1
# 1.65 27-Apr-2017 abhinav

Fix comment indentation at couple of places: Use \t instead of space


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.64 16-Jun-2016 abhinav

branches: 1.64.6;
Document -f option for man(1).
Also remove unsupported options for `man -k` from the synopsis and usage.


# 1.63 21-May-2016 abhinav

Remove unused include and unused constant. Ok from christos@.


# 1.62 14-Aug-2014 apb

For an argument to be interpreted as a local file name, bypassing the
search rules in man.conf or MANPATH, it must begin with "/", "./", or
"../". Simply testing whether it contains "/" is wrong, because it
breaks usage like "man 8 vax/boot".

This reverts revision 1.57 dated 2013-10-06,
"Be more permissive in interpreting man pages as filenames".


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.61 17-Feb-2014 uwe

branches: 1.61.4;
config() in manconf.c now verifies _build (and _crunch) command
templates with fmtcheck(3) so annotate the printf that uses these
commands as safe with a __format_arg wrapper and drop
-Wno-format-nonliteral.

XXX: Using local wrapper for now, solving this in general would be
nice, but it raises namespace pollution issues.

XXX^2: catman(8) also uses manconf.c and uses _build and _crunch so it
can also benefit from this (but see above).


# 1.60 28-Oct-2013 christos

Instead of guessing the suffix in the code, use the suffix list previously
loaded via man.conf(5). While there, zap unused iteration code.
(Franco Fichtner)


# 1.59 06-Oct-2013 christos

add more compression suffixes and local suffixes.


# 1.58 06-Oct-2013 christos

Recognize .gz and .bz2 suffixes so $ man ./man.1.gz works. From Franco Fichter
via dfly.


# 1.57 06-Oct-2013 christos

Be more permissive in interpreting man pages as filenames, from Franco
Fichter via dfly. fixes:
$ man usr.bin/man/man.1


# 1.56 30-Jul-2013 joerg

Mark the dead.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.55 19-Jul-2013 uwe

Constify some more.


# 1.54 19-Jul-2013 uwe

Spell "keywords" without space. Fix couple of typos.


# 1.53 19-Jul-2013 uwe

manual_find_buildkeyword() - now that we control the format string, we
may use asterisk precision specification instead of temporary
modifying the _build string itself.


# 1.52 19-Jul-2013 uwe

Fix manual_find_buildkeyword() to not use non-literal printf format.


# 1.51 18-Jul-2013 uwe

Don't access memory outside the array if tmpdirlen == 0.


# 1.50 18-Jul-2013 christos

use -Wno-format and revert "fixstring"


# 1.49 18-Jul-2013 christos

Set the string to NUL instread of providing an new empty string (from uwe)


# 1.48 18-Jul-2013 christos

WARNS=6
- fix cast qual issues
- don't use snprintf on a user-provided buffer


# 1.47 18-Jul-2013 uwe

Revert previous; other errors from WARNS=3 obscured the error in jump().


# 1.46 18-Jul-2013 uwe

Constify jump() arguments appropriately.


# 1.45 18-Jul-2013 uwe

Move manstate::pagerlen so that its "length of the above" comment makes sense.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base
# 1.44 03-Jan-2012 joerg

branches: 1.44.6; 1.44.10;
If the default path doesn't result in a match, bail out early instead of
running into a segmentation fault. Based on patch by Abhinav Upadhyay.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.43 14-Jun-2011 wiz

branches: 1.43.2;
Fix usage in man page and sync usage in executable with it.


# 1.42 14-Jun-2011 joerg

Add support for man -p to print the search path for manual pages (not
including cat page directories).

From Abhinav Upadhyay as part of Google's Summer of Code 2011


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.41 07-Jul-2010 christos

branches: 1.41.4;
get the value of the entry for the class not the key.


# 1.40 23-May-2010 christos

- centralize the snprintf code.
- use err where appropriate.
- add machclass which should be x86 when i386 and amd64 and can be specified
in man.conf as:
_i386 x86
_amd64 x86
so that we can support merged pages. Nothing uses this yet.


Revision tags: matt-premerge-20091211
# 1.39 07-Oct-2009 cegger

Mimic OSX behaviour:

On OS X it is possible to specify the manpage filename
with a full or relative path like this:

man ./foo.5

or

man /cd/foo/bar.1.gz

This is really helpful to view the manpage quickly while editing it.

patch presented on current-users@ and tech-userlevel@:
http://mail-index.netbsd.org/current-users/2009/10/06/msg010767.html
http://mail-index.netbsd.org/tech-userlevel/2009/10/06/msg002675.html

No objections


# 1.38 06-Oct-2009 cegger

- use EXIT_FAILURE/EXIT_SUCCESS
- whitespace nits
- ansify cleanup()/usage()
- remove pointless parenthesis on return


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.37 21-Jul-2008 lukem

branches: 1.37.4; 1.37.10;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.36 05-Oct-2007 lukem

branches: 1.36.8;
Convert to using raise_default_signal(3).


Revision tags: matt-mips64-base
# 1.35 05-Feb-2007 jwise

branches: 1.35.4;
Since MAN_DEBUG is constant, go from if (MAN_DEBUG) to #if MAN_DEBUG


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.34 01-May-2006 christos

Coverity CID 2996: Don't return without closing fp.


# 1.33 10-Apr-2006 chuck

modified man(1):
- avoid double slashes when displaying man pages (got tired
of '/usr/share/man//cat1/man.0').
- got rid of __P() while working on it.
- incorporate some of my old notes explaining how manpath works into the
comments of the code itself.
- renamed some of the vars so that the code is consistent throughout
(and hopefully clearer and easier to understand)
- fixed relative man paths for multiple man pages (man did a chdir()
on the first man page it had to format --- this broke any remaining
relative path man pages left to process). save old directory and
fchdir() back to it after formatting.
- improved doc on "man -h" which does more than just whatis(1) [e.g.
"man -h fopen" prints the required include files and the prototypes
rather than just the one-liner you get with whatis(1)]
- manconf.c now fills in the "len" length field in the TAG/ENTRY
structures (man now uses len).

revise man.conf file reading stuff to return error on failure in
addentry/gettag (fka getlist) rather than just err()ing out. this
allows man(1) to call cleanup and delete its tmp files rather than
just leave them floating. revise other apps using this code
(makewhatis, apropos, catman, whatis) to expect this. also remove
__P on updated files.


# 1.32 08-Apr-2006 christos

change an int to size_t


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.31 05-Jan-2004 jmmv

Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.


# 1.30 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.


Revision tags: fvdl_fs64_base
# 1.29 13-Sep-2002 thorpej

Rename man/config.{c,h} to man/manconf.{c,h}, so we don't have to
worry about problems including "config.h" when building as a host
tool.


# 1.28 11-Jun-2002 lukem

- getlist(): add "int create" arg, which creates list if it's not present
(using guts of now defunct addlist())
- use TAILQ_*() macros appropriately when manipulating tailqs


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.27 14-Mar-2002 groo

branches: 1.27.2;
Fix longstanding misuse of glob(3) and fnmatch(3) in man page search.
glob(3)-special characters are now escaped in the supplied man page names.

Makes ``man ['' work without mysterious quoting.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.25 12-Jun-2000 simonb

Allow "-s" to specify a section name, ala the SysV man command.
Unlike the SysV man command, this doesn't allow for the -s argument
to be a list.


# 1.24 07-Jun-2000 thorpej

check_pager() was using an uninitialized variable; fix it.


# 1.23 27-May-2000 jdolecek

allow to specify relative paths for sections in man.conf - they are used
similarily to _subdir, but only when appropriate
fix -m handling, so that e.g. "man -m . 3 printf" works as it should
add new -S flag, to specify a string the result path has to contain
g/c some unused stuff

Written by Chuck Cranor, with only cosmetic changes & const poisoning by me.


Revision tags: minoura-xpg4dl-base
# 1.22 09-Jan-2000 tsutsui

branches: 1.22.2;
Use uname(3) to determine MACHINE type.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.21 02-Nov-1999 lukem

revert previous


# 1.20 02-Nov-1999 lukem

remove superfluous '-' in getopt string


# 1.19 22-Jul-1999 kleink

branches: 1.19.2;
Try $TMPDIR first, then fall back to _PATH_TMP.


# 1.18 22-Jul-1999 itohy

A caught signal is blocked in the handler and
must be unblocked to do the default action.
The old code may generate weird exit status
on signals.


# 1.17 19-Jun-1999 itohy

Remove temp file on SIGPIPE (such as "man sh | head").


# 1.16 13-Jun-1999 kleink

Fall back to more(1) if PAGER is set but null.


Revision tags: netbsd-1-4-RELEASE netbsd-1-4-base
# 1.15 06-Nov-1998 christos

branches: 1.15.2;
char -> unsigned char


# 1.14 08-Oct-1998 wsanchez

We can't define MACHINE from a makefile in Rhapsody, because you might be cross
compiling, or building a fat (multi-architecture) binary. Our compiler
defines __ARCHITECTURE__ for this use.
Fixed an off-by-one error that may occasionally cause man to seg fault. Found
by using a special strict malloc() implementation.


# 1.13 25-Aug-1998 ross

Add { and } to shut up egcs. Reformat the more questionable code.


# 1.12 06-Jul-1998 kleink

Since GLOB_NOCHECK is not set, explicitly check for a return value of
GLOB_NOMATCH from glob(). Noticed by Juergen Hannken-Illjes.


# 1.11 19-Jun-1998 kleink

GLOB_QUOTE is dead; per POSIX, backslash quoting of special characters being
enabled is the default behaviour.


# 1.10 23-Nov-1997 tv

When man was "fixed" to chdir() to the man root as historical man does,
it broke the -M option on relative paths (the chdir works as it should,
but the relative man page path is still used whole in nroff). This
repairs the situation by chopping the full pathname in half--one part
for the chdir, one part for the filename.


Revision tags: netbsd-1-3-base
# 1.9 17-Oct-1997 mikel

branches: 1.9.2;
cleanup for WARNS=1


# 1.8 10-Sep-1997 mikel

resize a pathname buffer to MAXPATHLEN; from Matthias Scheler in PR 4101


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.7 28-Sep-1995 tls

Sync with 4.4BSD-Lite2


# 1.6 20-Apr-1995 mycroft

Pay attention to the section number, even if MANPATH or -M is specified.


# 1.5 16-Jan-1995 mycroft

Sync with 4.4-Lite, plus local changes.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.4 03-Jun-1994 jtc

Fix from Christos Zoulas which makes relative paths in .so lines work when
man pages are formatted.


# 1.3 17-Apr-1994 cgd

fix from bostic for multiple match problem


# 1.2 18-Mar-1994 cgd

fix from Keith White <kwhite@csi.UOttawa.CA>, to DTRT when man -w's output
is redirected.


Revision tags: BOSTIC-1
# 1.1 21-Dec-1993 cgd

branches: 1.1.1;
add man(1) ; part of new man(1) package from Bostic


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.67 15-Jun-2018 mrg

move 'utsname' to the main() function scope, so that the reference to
it outside the block remains valid.

should fix an asan reported issue.


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2
# 1.66 02-May-2017 abhinav

branches: 1.66.8;
Teach man -p to respect the MANPATH environment variable and the -M option.

Currently, `man -p` generates its output based on the value of the _default tag
in man.conf. However, man(1) modifies its search path based on the value of the
MANPATH variable and the list of directories specified via the -M option. In such
a case, `man -p` does not represent the correct search path. This commit intends
to fix this.

This change has the side effect that now the output of `man -p` will also include
the machine class specific subdirectories (such as man8/x86), while previously it
did not. The output would include subdirectories only for those machine classes
which are specified in the man.conf file.

Also, with this change, it is possible to run makemandb(8), by setting MANPATH
environment variable (e.g. env MANPATH=/usr/share/man makemandb).

Patch reviewed by wiz@


Revision tags: prg-localcount2-base1
# 1.65 27-Apr-2017 abhinav

Fix comment indentation at couple of places: Use \t instead of space


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.64 16-Jun-2016 abhinav

branches: 1.64.6;
Document -f option for man(1).
Also remove unsupported options for `man -k` from the synopsis and usage.


# 1.63 21-May-2016 abhinav

Remove unused include and unused constant. Ok from christos@.


# 1.62 14-Aug-2014 apb

For an argument to be interpreted as a local file name, bypassing the
search rules in man.conf or MANPATH, it must begin with "/", "./", or
"../". Simply testing whether it contains "/" is wrong, because it
breaks usage like "man 8 vax/boot".

This reverts revision 1.57 dated 2013-10-06,
"Be more permissive in interpreting man pages as filenames".


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.61 17-Feb-2014 uwe

branches: 1.61.4;
config() in manconf.c now verifies _build (and _crunch) command
templates with fmtcheck(3) so annotate the printf that uses these
commands as safe with a __format_arg wrapper and drop
-Wno-format-nonliteral.

XXX: Using local wrapper for now, solving this in general would be
nice, but it raises namespace pollution issues.

XXX^2: catman(8) also uses manconf.c and uses _build and _crunch so it
can also benefit from this (but see above).


# 1.60 28-Oct-2013 christos

Instead of guessing the suffix in the code, use the suffix list previously
loaded via man.conf(5). While there, zap unused iteration code.
(Franco Fichtner)


# 1.59 06-Oct-2013 christos

add more compression suffixes and local suffixes.


# 1.58 06-Oct-2013 christos

Recognize .gz and .bz2 suffixes so $ man ./man.1.gz works. From Franco Fichter
via dfly.


# 1.57 06-Oct-2013 christos

Be more permissive in interpreting man pages as filenames, from Franco
Fichter via dfly. fixes:
$ man usr.bin/man/man.1


# 1.56 30-Jul-2013 joerg

Mark the dead.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.55 19-Jul-2013 uwe

Constify some more.


# 1.54 19-Jul-2013 uwe

Spell "keywords" without space. Fix couple of typos.


# 1.53 19-Jul-2013 uwe

manual_find_buildkeyword() - now that we control the format string, we
may use asterisk precision specification instead of temporary
modifying the _build string itself.


# 1.52 19-Jul-2013 uwe

Fix manual_find_buildkeyword() to not use non-literal printf format.


# 1.51 18-Jul-2013 uwe

Don't access memory outside the array if tmpdirlen == 0.


# 1.50 18-Jul-2013 christos

use -Wno-format and revert "fixstring"


# 1.49 18-Jul-2013 christos

Set the string to NUL instread of providing an new empty string (from uwe)


# 1.48 18-Jul-2013 christos

WARNS=6
- fix cast qual issues
- don't use snprintf on a user-provided buffer


# 1.47 18-Jul-2013 uwe

Revert previous; other errors from WARNS=3 obscured the error in jump().


# 1.46 18-Jul-2013 uwe

Constify jump() arguments appropriately.


# 1.45 18-Jul-2013 uwe

Move manstate::pagerlen so that its "length of the above" comment makes sense.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base
# 1.44 03-Jan-2012 joerg

branches: 1.44.6; 1.44.10;
If the default path doesn't result in a match, bail out early instead of
running into a segmentation fault. Based on patch by Abhinav Upadhyay.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.43 14-Jun-2011 wiz

branches: 1.43.2;
Fix usage in man page and sync usage in executable with it.


# 1.42 14-Jun-2011 joerg

Add support for man -p to print the search path for manual pages (not
including cat page directories).

From Abhinav Upadhyay as part of Google's Summer of Code 2011


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.41 07-Jul-2010 christos

branches: 1.41.4;
get the value of the entry for the class not the key.


# 1.40 23-May-2010 christos

- centralize the snprintf code.
- use err where appropriate.
- add machclass which should be x86 when i386 and amd64 and can be specified
in man.conf as:
_i386 x86
_amd64 x86
so that we can support merged pages. Nothing uses this yet.


Revision tags: matt-premerge-20091211
# 1.39 07-Oct-2009 cegger

Mimic OSX behaviour:

On OS X it is possible to specify the manpage filename
with a full or relative path like this:

man ./foo.5

or

man /cd/foo/bar.1.gz

This is really helpful to view the manpage quickly while editing it.

patch presented on current-users@ and tech-userlevel@:
http://mail-index.netbsd.org/current-users/2009/10/06/msg010767.html
http://mail-index.netbsd.org/tech-userlevel/2009/10/06/msg002675.html

No objections


# 1.38 06-Oct-2009 cegger

- use EXIT_FAILURE/EXIT_SUCCESS
- whitespace nits
- ansify cleanup()/usage()
- remove pointless parenthesis on return


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.37 21-Jul-2008 lukem

branches: 1.37.4; 1.37.10;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.36 05-Oct-2007 lukem

branches: 1.36.8;
Convert to using raise_default_signal(3).


Revision tags: matt-mips64-base
# 1.35 05-Feb-2007 jwise

branches: 1.35.4;
Since MAN_DEBUG is constant, go from if (MAN_DEBUG) to #if MAN_DEBUG


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.34 01-May-2006 christos

Coverity CID 2996: Don't return without closing fp.


# 1.33 10-Apr-2006 chuck

modified man(1):
- avoid double slashes when displaying man pages (got tired
of '/usr/share/man//cat1/man.0').
- got rid of __P() while working on it.
- incorporate some of my old notes explaining how manpath works into the
comments of the code itself.
- renamed some of the vars so that the code is consistent throughout
(and hopefully clearer and easier to understand)
- fixed relative man paths for multiple man pages (man did a chdir()
on the first man page it had to format --- this broke any remaining
relative path man pages left to process). save old directory and
fchdir() back to it after formatting.
- improved doc on "man -h" which does more than just whatis(1) [e.g.
"man -h fopen" prints the required include files and the prototypes
rather than just the one-liner you get with whatis(1)]
- manconf.c now fills in the "len" length field in the TAG/ENTRY
structures (man now uses len).

revise man.conf file reading stuff to return error on failure in
addentry/gettag (fka getlist) rather than just err()ing out. this
allows man(1) to call cleanup and delete its tmp files rather than
just leave them floating. revise other apps using this code
(makewhatis, apropos, catman, whatis) to expect this. also remove
__P on updated files.


# 1.32 08-Apr-2006 christos

change an int to size_t


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.31 05-Jan-2004 jmmv

Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.


# 1.30 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.


Revision tags: fvdl_fs64_base
# 1.29 13-Sep-2002 thorpej

Rename man/config.{c,h} to man/manconf.{c,h}, so we don't have to
worry about problems including "config.h" when building as a host
tool.


# 1.28 11-Jun-2002 lukem

- getlist(): add "int create" arg, which creates list if it's not present
(using guts of now defunct addlist())
- use TAILQ_*() macros appropriately when manipulating tailqs


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.27 14-Mar-2002 groo

branches: 1.27.2;
Fix longstanding misuse of glob(3) and fnmatch(3) in man page search.
glob(3)-special characters are now escaped in the supplied man page names.

Makes ``man ['' work without mysterious quoting.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.25 12-Jun-2000 simonb

Allow "-s" to specify a section name, ala the SysV man command.
Unlike the SysV man command, this doesn't allow for the -s argument
to be a list.


# 1.24 07-Jun-2000 thorpej

check_pager() was using an uninitialized variable; fix it.


# 1.23 27-May-2000 jdolecek

allow to specify relative paths for sections in man.conf - they are used
similarily to _subdir, but only when appropriate
fix -m handling, so that e.g. "man -m . 3 printf" works as it should
add new -S flag, to specify a string the result path has to contain
g/c some unused stuff

Written by Chuck Cranor, with only cosmetic changes & const poisoning by me.


Revision tags: minoura-xpg4dl-base
# 1.22 09-Jan-2000 tsutsui

branches: 1.22.2;
Use uname(3) to determine MACHINE type.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.21 02-Nov-1999 lukem

revert previous


# 1.20 02-Nov-1999 lukem

remove superfluous '-' in getopt string


# 1.19 22-Jul-1999 kleink

branches: 1.19.2;
Try $TMPDIR first, then fall back to _PATH_TMP.


# 1.18 22-Jul-1999 itohy

A caught signal is blocked in the handler and
must be unblocked to do the default action.
The old code may generate weird exit status
on signals.


# 1.17 19-Jun-1999 itohy

Remove temp file on SIGPIPE (such as "man sh | head").


# 1.16 13-Jun-1999 kleink

Fall back to more(1) if PAGER is set but null.


Revision tags: netbsd-1-4-RELEASE netbsd-1-4-base
# 1.15 06-Nov-1998 christos

branches: 1.15.2;
char -> unsigned char


# 1.14 08-Oct-1998 wsanchez

We can't define MACHINE from a makefile in Rhapsody, because you might be cross
compiling, or building a fat (multi-architecture) binary. Our compiler
defines __ARCHITECTURE__ for this use.
Fixed an off-by-one error that may occasionally cause man to seg fault. Found
by using a special strict malloc() implementation.


# 1.13 25-Aug-1998 ross

Add { and } to shut up egcs. Reformat the more questionable code.


# 1.12 06-Jul-1998 kleink

Since GLOB_NOCHECK is not set, explicitly check for a return value of
GLOB_NOMATCH from glob(). Noticed by Juergen Hannken-Illjes.


# 1.11 19-Jun-1998 kleink

GLOB_QUOTE is dead; per POSIX, backslash quoting of special characters being
enabled is the default behaviour.


# 1.10 23-Nov-1997 tv

When man was "fixed" to chdir() to the man root as historical man does,
it broke the -M option on relative paths (the chdir works as it should,
but the relative man page path is still used whole in nroff). This
repairs the situation by chopping the full pathname in half--one part
for the chdir, one part for the filename.


Revision tags: netbsd-1-3-base
# 1.9 17-Oct-1997 mikel

branches: 1.9.2;
cleanup for WARNS=1


# 1.8 10-Sep-1997 mikel

resize a pathname buffer to MAXPATHLEN; from Matthias Scheler in PR 4101


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.7 28-Sep-1995 tls

Sync with 4.4BSD-Lite2


# 1.6 20-Apr-1995 mycroft

Pay attention to the section number, even if MANPATH or -M is specified.


# 1.5 16-Jan-1995 mycroft

Sync with 4.4-Lite, plus local changes.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.4 03-Jun-1994 jtc

Fix from Christos Zoulas which makes relative paths in .so lines work when
man pages are formatted.


# 1.3 17-Apr-1994 cgd

fix from bostic for multiple match problem


# 1.2 18-Mar-1994 cgd

fix from Keith White <kwhite@csi.UOttawa.CA>, to DTRT when man -w's output
is redirected.


Revision tags: BOSTIC-1
# 1.1 21-Dec-1993 cgd

branches: 1.1.1;
add man(1) ; part of new man(1) package from Bostic


# 1.66 02-May-2017 abhinav

Teach man -p to respect the MANPATH environment variable and the -M option.

Currently, `man -p` generates its output based on the value of the _default tag
in man.conf. However, man(1) modifies its search path based on the value of the
MANPATH variable and the list of directories specified via the -M option. In such
a case, `man -p` does not represent the correct search path. This commit intends
to fix this.

This change has the side effect that now the output of `man -p` will also include
the machine class specific subdirectories (such as man8/x86), while previously it
did not. The output would include subdirectories only for those machine classes
which are specified in the man.conf file.

Also, with this change, it is possible to run makemandb(8), by setting MANPATH
environment variable (e.g. env MANPATH=/usr/share/man makemandb).

Patch reviewed by wiz@


Revision tags: prg-localcount2-base1
# 1.65 27-Apr-2017 abhinav

Fix comment indentation at couple of places: Use \t instead of space


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.64 16-Jun-2016 abhinav

branches: 1.64.6;
Document -f option for man(1).
Also remove unsupported options for `man -k` from the synopsis and usage.


# 1.63 21-May-2016 abhinav

Remove unused include and unused constant. Ok from christos@.


# 1.62 14-Aug-2014 apb

For an argument to be interpreted as a local file name, bypassing the
search rules in man.conf or MANPATH, it must begin with "/", "./", or
"../". Simply testing whether it contains "/" is wrong, because it
breaks usage like "man 8 vax/boot".

This reverts revision 1.57 dated 2013-10-06,
"Be more permissive in interpreting man pages as filenames".


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.61 17-Feb-2014 uwe

branches: 1.61.4;
config() in manconf.c now verifies _build (and _crunch) command
templates with fmtcheck(3) so annotate the printf that uses these
commands as safe with a __format_arg wrapper and drop
-Wno-format-nonliteral.

XXX: Using local wrapper for now, solving this in general would be
nice, but it raises namespace pollution issues.

XXX^2: catman(8) also uses manconf.c and uses _build and _crunch so it
can also benefit from this (but see above).


# 1.60 28-Oct-2013 christos

Instead of guessing the suffix in the code, use the suffix list previously
loaded via man.conf(5). While there, zap unused iteration code.
(Franco Fichtner)


# 1.59 06-Oct-2013 christos

add more compression suffixes and local suffixes.


# 1.58 06-Oct-2013 christos

Recognize .gz and .bz2 suffixes so $ man ./man.1.gz works. From Franco Fichter
via dfly.


# 1.57 06-Oct-2013 christos

Be more permissive in interpreting man pages as filenames, from Franco
Fichter via dfly. fixes:
$ man usr.bin/man/man.1


# 1.56 30-Jul-2013 joerg

Mark the dead.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.55 19-Jul-2013 uwe

Constify some more.


# 1.54 19-Jul-2013 uwe

Spell "keywords" without space. Fix couple of typos.


# 1.53 19-Jul-2013 uwe

manual_find_buildkeyword() - now that we control the format string, we
may use asterisk precision specification instead of temporary
modifying the _build string itself.


# 1.52 19-Jul-2013 uwe

Fix manual_find_buildkeyword() to not use non-literal printf format.


# 1.51 18-Jul-2013 uwe

Don't access memory outside the array if tmpdirlen == 0.


# 1.50 18-Jul-2013 christos

use -Wno-format and revert "fixstring"


# 1.49 18-Jul-2013 christos

Set the string to NUL instread of providing an new empty string (from uwe)


# 1.48 18-Jul-2013 christos

WARNS=6
- fix cast qual issues
- don't use snprintf on a user-provided buffer


# 1.47 18-Jul-2013 uwe

Revert previous; other errors from WARNS=3 obscured the error in jump().


# 1.46 18-Jul-2013 uwe

Constify jump() arguments appropriately.


# 1.45 18-Jul-2013 uwe

Move manstate::pagerlen so that its "length of the above" comment makes sense.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base
# 1.44 03-Jan-2012 joerg

branches: 1.44.6; 1.44.10;
If the default path doesn't result in a match, bail out early instead of
running into a segmentation fault. Based on patch by Abhinav Upadhyay.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.43 14-Jun-2011 wiz

branches: 1.43.2;
Fix usage in man page and sync usage in executable with it.


# 1.42 14-Jun-2011 joerg

Add support for man -p to print the search path for manual pages (not
including cat page directories).

From Abhinav Upadhyay as part of Google's Summer of Code 2011


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.41 07-Jul-2010 christos

branches: 1.41.4;
get the value of the entry for the class not the key.


# 1.40 23-May-2010 christos

- centralize the snprintf code.
- use err where appropriate.
- add machclass which should be x86 when i386 and amd64 and can be specified
in man.conf as:
_i386 x86
_amd64 x86
so that we can support merged pages. Nothing uses this yet.


Revision tags: matt-premerge-20091211
# 1.39 07-Oct-2009 cegger

Mimic OSX behaviour:

On OS X it is possible to specify the manpage filename
with a full or relative path like this:

man ./foo.5

or

man /cd/foo/bar.1.gz

This is really helpful to view the manpage quickly while editing it.

patch presented on current-users@ and tech-userlevel@:
http://mail-index.netbsd.org/current-users/2009/10/06/msg010767.html
http://mail-index.netbsd.org/tech-userlevel/2009/10/06/msg002675.html

No objections


# 1.38 06-Oct-2009 cegger

- use EXIT_FAILURE/EXIT_SUCCESS
- whitespace nits
- ansify cleanup()/usage()
- remove pointless parenthesis on return


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.37 21-Jul-2008 lukem

branches: 1.37.4; 1.37.10;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.36 05-Oct-2007 lukem

branches: 1.36.8;
Convert to using raise_default_signal(3).


Revision tags: matt-mips64-base
# 1.35 05-Feb-2007 jwise

branches: 1.35.4;
Since MAN_DEBUG is constant, go from if (MAN_DEBUG) to #if MAN_DEBUG


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.34 01-May-2006 christos

Coverity CID 2996: Don't return without closing fp.


# 1.33 10-Apr-2006 chuck

modified man(1):
- avoid double slashes when displaying man pages (got tired
of '/usr/share/man//cat1/man.0').
- got rid of __P() while working on it.
- incorporate some of my old notes explaining how manpath works into the
comments of the code itself.
- renamed some of the vars so that the code is consistent throughout
(and hopefully clearer and easier to understand)
- fixed relative man paths for multiple man pages (man did a chdir()
on the first man page it had to format --- this broke any remaining
relative path man pages left to process). save old directory and
fchdir() back to it after formatting.
- improved doc on "man -h" which does more than just whatis(1) [e.g.
"man -h fopen" prints the required include files and the prototypes
rather than just the one-liner you get with whatis(1)]
- manconf.c now fills in the "len" length field in the TAG/ENTRY
structures (man now uses len).

revise man.conf file reading stuff to return error on failure in
addentry/gettag (fka getlist) rather than just err()ing out. this
allows man(1) to call cleanup and delete its tmp files rather than
just leave them floating. revise other apps using this code
(makewhatis, apropos, catman, whatis) to expect this. also remove
__P on updated files.


# 1.32 08-Apr-2006 christos

change an int to size_t


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.31 05-Jan-2004 jmmv

Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.


# 1.30 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.


Revision tags: fvdl_fs64_base
# 1.29 13-Sep-2002 thorpej

Rename man/config.{c,h} to man/manconf.{c,h}, so we don't have to
worry about problems including "config.h" when building as a host
tool.


# 1.28 11-Jun-2002 lukem

- getlist(): add "int create" arg, which creates list if it's not present
(using guts of now defunct addlist())
- use TAILQ_*() macros appropriately when manipulating tailqs


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.27 14-Mar-2002 groo

branches: 1.27.2;
Fix longstanding misuse of glob(3) and fnmatch(3) in man page search.
glob(3)-special characters are now escaped in the supplied man page names.

Makes ``man ['' work without mysterious quoting.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.25 12-Jun-2000 simonb

Allow "-s" to specify a section name, ala the SysV man command.
Unlike the SysV man command, this doesn't allow for the -s argument
to be a list.


# 1.24 07-Jun-2000 thorpej

check_pager() was using an uninitialized variable; fix it.


# 1.23 27-May-2000 jdolecek

allow to specify relative paths for sections in man.conf - they are used
similarily to _subdir, but only when appropriate
fix -m handling, so that e.g. "man -m . 3 printf" works as it should
add new -S flag, to specify a string the result path has to contain
g/c some unused stuff

Written by Chuck Cranor, with only cosmetic changes & const poisoning by me.


Revision tags: minoura-xpg4dl-base
# 1.22 09-Jan-2000 tsutsui

branches: 1.22.2;
Use uname(3) to determine MACHINE type.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.21 02-Nov-1999 lukem

revert previous


# 1.20 02-Nov-1999 lukem

remove superfluous '-' in getopt string


# 1.19 22-Jul-1999 kleink

branches: 1.19.2;
Try $TMPDIR first, then fall back to _PATH_TMP.


# 1.18 22-Jul-1999 itohy

A caught signal is blocked in the handler and
must be unblocked to do the default action.
The old code may generate weird exit status
on signals.


# 1.17 19-Jun-1999 itohy

Remove temp file on SIGPIPE (such as "man sh | head").


# 1.16 13-Jun-1999 kleink

Fall back to more(1) if PAGER is set but null.


Revision tags: netbsd-1-4-RELEASE netbsd-1-4-base
# 1.15 06-Nov-1998 christos

branches: 1.15.2;
char -> unsigned char


# 1.14 08-Oct-1998 wsanchez

We can't define MACHINE from a makefile in Rhapsody, because you might be cross
compiling, or building a fat (multi-architecture) binary. Our compiler
defines __ARCHITECTURE__ for this use.
Fixed an off-by-one error that may occasionally cause man to seg fault. Found
by using a special strict malloc() implementation.


# 1.13 25-Aug-1998 ross

Add { and } to shut up egcs. Reformat the more questionable code.


# 1.12 06-Jul-1998 kleink

Since GLOB_NOCHECK is not set, explicitly check for a return value of
GLOB_NOMATCH from glob(). Noticed by Juergen Hannken-Illjes.


# 1.11 19-Jun-1998 kleink

GLOB_QUOTE is dead; per POSIX, backslash quoting of special characters being
enabled is the default behaviour.


# 1.10 23-Nov-1997 tv

When man was "fixed" to chdir() to the man root as historical man does,
it broke the -M option on relative paths (the chdir works as it should,
but the relative man page path is still used whole in nroff). This
repairs the situation by chopping the full pathname in half--one part
for the chdir, one part for the filename.


Revision tags: netbsd-1-3-base
# 1.9 17-Oct-1997 mikel

branches: 1.9.2;
cleanup for WARNS=1


# 1.8 10-Sep-1997 mikel

resize a pathname buffer to MAXPATHLEN; from Matthias Scheler in PR 4101


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.7 28-Sep-1995 tls

Sync with 4.4BSD-Lite2


# 1.6 20-Apr-1995 mycroft

Pay attention to the section number, even if MANPATH or -M is specified.


# 1.5 16-Jan-1995 mycroft

Sync with 4.4-Lite, plus local changes.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.4 03-Jun-1994 jtc

Fix from Christos Zoulas which makes relative paths in .so lines work when
man pages are formatted.


# 1.3 17-Apr-1994 cgd

fix from bostic for multiple match problem


# 1.2 18-Mar-1994 cgd

fix from Keith White <kwhite@csi.UOttawa.CA>, to DTRT when man -w's output
is redirected.


Revision tags: BOSTIC-1
# 1.1 21-Dec-1993 cgd

branches: 1.1.1;
add man(1) ; part of new man(1) package from Bostic


# 1.65 27-Apr-2017 abhinav

Fix comment indentation at couple of places: Use \t instead of space


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.64 16-Jun-2016 abhinav

Document -f option for man(1).
Also remove unsupported options for `man -k` from the synopsis and usage.


# 1.63 21-May-2016 abhinav

Remove unused include and unused constant. Ok from christos@.


# 1.62 14-Aug-2014 apb

For an argument to be interpreted as a local file name, bypassing the
search rules in man.conf or MANPATH, it must begin with "/", "./", or
"../". Simply testing whether it contains "/" is wrong, because it
breaks usage like "man 8 vax/boot".

This reverts revision 1.57 dated 2013-10-06,
"Be more permissive in interpreting man pages as filenames".


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.61 17-Feb-2014 uwe

branches: 1.61.4;
config() in manconf.c now verifies _build (and _crunch) command
templates with fmtcheck(3) so annotate the printf that uses these
commands as safe with a __format_arg wrapper and drop
-Wno-format-nonliteral.

XXX: Using local wrapper for now, solving this in general would be
nice, but it raises namespace pollution issues.

XXX^2: catman(8) also uses manconf.c and uses _build and _crunch so it
can also benefit from this (but see above).


# 1.60 28-Oct-2013 christos

Instead of guessing the suffix in the code, use the suffix list previously
loaded via man.conf(5). While there, zap unused iteration code.
(Franco Fichtner)


# 1.59 06-Oct-2013 christos

add more compression suffixes and local suffixes.


# 1.58 06-Oct-2013 christos

Recognize .gz and .bz2 suffixes so $ man ./man.1.gz works. From Franco Fichter
via dfly.


# 1.57 06-Oct-2013 christos

Be more permissive in interpreting man pages as filenames, from Franco
Fichter via dfly. fixes:
$ man usr.bin/man/man.1


# 1.56 30-Jul-2013 joerg

Mark the dead.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.55 19-Jul-2013 uwe

Constify some more.


# 1.54 19-Jul-2013 uwe

Spell "keywords" without space. Fix couple of typos.


# 1.53 19-Jul-2013 uwe

manual_find_buildkeyword() - now that we control the format string, we
may use asterisk precision specification instead of temporary
modifying the _build string itself.


# 1.52 19-Jul-2013 uwe

Fix manual_find_buildkeyword() to not use non-literal printf format.


# 1.51 18-Jul-2013 uwe

Don't access memory outside the array if tmpdirlen == 0.


# 1.50 18-Jul-2013 christos

use -Wno-format and revert "fixstring"


# 1.49 18-Jul-2013 christos

Set the string to NUL instread of providing an new empty string (from uwe)


# 1.48 18-Jul-2013 christos

WARNS=6
- fix cast qual issues
- don't use snprintf on a user-provided buffer


# 1.47 18-Jul-2013 uwe

Revert previous; other errors from WARNS=3 obscured the error in jump().


# 1.46 18-Jul-2013 uwe

Constify jump() arguments appropriately.


# 1.45 18-Jul-2013 uwe

Move manstate::pagerlen so that its "length of the above" comment makes sense.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base
# 1.44 03-Jan-2012 joerg

branches: 1.44.6; 1.44.10;
If the default path doesn't result in a match, bail out early instead of
running into a segmentation fault. Based on patch by Abhinav Upadhyay.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.43 14-Jun-2011 wiz

branches: 1.43.2;
Fix usage in man page and sync usage in executable with it.


# 1.42 14-Jun-2011 joerg

Add support for man -p to print the search path for manual pages (not
including cat page directories).

From Abhinav Upadhyay as part of Google's Summer of Code 2011


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.41 07-Jul-2010 christos

branches: 1.41.4;
get the value of the entry for the class not the key.


# 1.40 23-May-2010 christos

- centralize the snprintf code.
- use err where appropriate.
- add machclass which should be x86 when i386 and amd64 and can be specified
in man.conf as:
_i386 x86
_amd64 x86
so that we can support merged pages. Nothing uses this yet.


Revision tags: matt-premerge-20091211
# 1.39 07-Oct-2009 cegger

Mimic OSX behaviour:

On OS X it is possible to specify the manpage filename
with a full or relative path like this:

man ./foo.5

or

man /cd/foo/bar.1.gz

This is really helpful to view the manpage quickly while editing it.

patch presented on current-users@ and tech-userlevel@:
http://mail-index.netbsd.org/current-users/2009/10/06/msg010767.html
http://mail-index.netbsd.org/tech-userlevel/2009/10/06/msg002675.html

No objections


# 1.38 06-Oct-2009 cegger

- use EXIT_FAILURE/EXIT_SUCCESS
- whitespace nits
- ansify cleanup()/usage()
- remove pointless parenthesis on return


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.37 21-Jul-2008 lukem

branches: 1.37.4; 1.37.10;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.36 05-Oct-2007 lukem

branches: 1.36.8;
Convert to using raise_default_signal(3).


Revision tags: matt-mips64-base
# 1.35 05-Feb-2007 jwise

branches: 1.35.4;
Since MAN_DEBUG is constant, go from if (MAN_DEBUG) to #if MAN_DEBUG


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.34 01-May-2006 christos

Coverity CID 2996: Don't return without closing fp.


# 1.33 10-Apr-2006 chuck

modified man(1):
- avoid double slashes when displaying man pages (got tired
of '/usr/share/man//cat1/man.0').
- got rid of __P() while working on it.
- incorporate some of my old notes explaining how manpath works into the
comments of the code itself.
- renamed some of the vars so that the code is consistent throughout
(and hopefully clearer and easier to understand)
- fixed relative man paths for multiple man pages (man did a chdir()
on the first man page it had to format --- this broke any remaining
relative path man pages left to process). save old directory and
fchdir() back to it after formatting.
- improved doc on "man -h" which does more than just whatis(1) [e.g.
"man -h fopen" prints the required include files and the prototypes
rather than just the one-liner you get with whatis(1)]
- manconf.c now fills in the "len" length field in the TAG/ENTRY
structures (man now uses len).

revise man.conf file reading stuff to return error on failure in
addentry/gettag (fka getlist) rather than just err()ing out. this
allows man(1) to call cleanup and delete its tmp files rather than
just leave them floating. revise other apps using this code
(makewhatis, apropos, catman, whatis) to expect this. also remove
__P on updated files.


# 1.32 08-Apr-2006 christos

change an int to size_t


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.31 05-Jan-2004 jmmv

Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.


# 1.30 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.


Revision tags: fvdl_fs64_base
# 1.29 13-Sep-2002 thorpej

Rename man/config.{c,h} to man/manconf.{c,h}, so we don't have to
worry about problems including "config.h" when building as a host
tool.


# 1.28 11-Jun-2002 lukem

- getlist(): add "int create" arg, which creates list if it's not present
(using guts of now defunct addlist())
- use TAILQ_*() macros appropriately when manipulating tailqs


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.27 14-Mar-2002 groo

branches: 1.27.2;
Fix longstanding misuse of glob(3) and fnmatch(3) in man page search.
glob(3)-special characters are now escaped in the supplied man page names.

Makes ``man ['' work without mysterious quoting.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.25 12-Jun-2000 simonb

Allow "-s" to specify a section name, ala the SysV man command.
Unlike the SysV man command, this doesn't allow for the -s argument
to be a list.


# 1.24 07-Jun-2000 thorpej

check_pager() was using an uninitialized variable; fix it.


# 1.23 27-May-2000 jdolecek

allow to specify relative paths for sections in man.conf - they are used
similarily to _subdir, but only when appropriate
fix -m handling, so that e.g. "man -m . 3 printf" works as it should
add new -S flag, to specify a string the result path has to contain
g/c some unused stuff

Written by Chuck Cranor, with only cosmetic changes & const poisoning by me.


Revision tags: minoura-xpg4dl-base
# 1.22 09-Jan-2000 tsutsui

branches: 1.22.2;
Use uname(3) to determine MACHINE type.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.21 02-Nov-1999 lukem

revert previous


# 1.20 02-Nov-1999 lukem

remove superfluous '-' in getopt string


# 1.19 22-Jul-1999 kleink

branches: 1.19.2;
Try $TMPDIR first, then fall back to _PATH_TMP.


# 1.18 22-Jul-1999 itohy

A caught signal is blocked in the handler and
must be unblocked to do the default action.
The old code may generate weird exit status
on signals.


# 1.17 19-Jun-1999 itohy

Remove temp file on SIGPIPE (such as "man sh | head").


# 1.16 13-Jun-1999 kleink

Fall back to more(1) if PAGER is set but null.


Revision tags: netbsd-1-4-RELEASE netbsd-1-4-base
# 1.15 06-Nov-1998 christos

branches: 1.15.2;
char -> unsigned char


# 1.14 08-Oct-1998 wsanchez

We can't define MACHINE from a makefile in Rhapsody, because you might be cross
compiling, or building a fat (multi-architecture) binary. Our compiler
defines __ARCHITECTURE__ for this use.
Fixed an off-by-one error that may occasionally cause man to seg fault. Found
by using a special strict malloc() implementation.


# 1.13 25-Aug-1998 ross

Add { and } to shut up egcs. Reformat the more questionable code.


# 1.12 06-Jul-1998 kleink

Since GLOB_NOCHECK is not set, explicitly check for a return value of
GLOB_NOMATCH from glob(). Noticed by Juergen Hannken-Illjes.


# 1.11 19-Jun-1998 kleink

GLOB_QUOTE is dead; per POSIX, backslash quoting of special characters being
enabled is the default behaviour.


# 1.10 23-Nov-1997 tv

When man was "fixed" to chdir() to the man root as historical man does,
it broke the -M option on relative paths (the chdir works as it should,
but the relative man page path is still used whole in nroff). This
repairs the situation by chopping the full pathname in half--one part
for the chdir, one part for the filename.


Revision tags: netbsd-1-3-base
# 1.9 17-Oct-1997 mikel

branches: 1.9.2;
cleanup for WARNS=1


# 1.8 10-Sep-1997 mikel

resize a pathname buffer to MAXPATHLEN; from Matthias Scheler in PR 4101


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.7 28-Sep-1995 tls

Sync with 4.4BSD-Lite2


# 1.6 20-Apr-1995 mycroft

Pay attention to the section number, even if MANPATH or -M is specified.


# 1.5 16-Jan-1995 mycroft

Sync with 4.4-Lite, plus local changes.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.4 03-Jun-1994 jtc

Fix from Christos Zoulas which makes relative paths in .so lines work when
man pages are formatted.


# 1.3 17-Apr-1994 cgd

fix from bostic for multiple match problem


# 1.2 18-Mar-1994 cgd

fix from Keith White <kwhite@csi.UOttawa.CA>, to DTRT when man -w's output
is redirected.


Revision tags: BOSTIC-1
# 1.1 21-Dec-1993 cgd

branches: 1.1.1;
add man(1) ; part of new man(1) package from Bostic


Revision tags: pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.64 16-Jun-2016 abhinav

Document -f option for man(1).
Also remove unsupported options for `man -k` from the synopsis and usage.


# 1.63 21-May-2016 abhinav

Remove unused include and unused constant. Ok from christos@.


# 1.62 14-Aug-2014 apb

For an argument to be interpreted as a local file name, bypassing the
search rules in man.conf or MANPATH, it must begin with "/", "./", or
"../". Simply testing whether it contains "/" is wrong, because it
breaks usage like "man 8 vax/boot".

This reverts revision 1.57 dated 2013-10-06,
"Be more permissive in interpreting man pages as filenames".


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.61 17-Feb-2014 uwe

branches: 1.61.4;
config() in manconf.c now verifies _build (and _crunch) command
templates with fmtcheck(3) so annotate the printf that uses these
commands as safe with a __format_arg wrapper and drop
-Wno-format-nonliteral.

XXX: Using local wrapper for now, solving this in general would be
nice, but it raises namespace pollution issues.

XXX^2: catman(8) also uses manconf.c and uses _build and _crunch so it
can also benefit from this (but see above).


# 1.60 28-Oct-2013 christos

Instead of guessing the suffix in the code, use the suffix list previously
loaded via man.conf(5). While there, zap unused iteration code.
(Franco Fichtner)


# 1.59 06-Oct-2013 christos

add more compression suffixes and local suffixes.


# 1.58 06-Oct-2013 christos

Recognize .gz and .bz2 suffixes so $ man ./man.1.gz works. From Franco Fichter
via dfly.


# 1.57 06-Oct-2013 christos

Be more permissive in interpreting man pages as filenames, from Franco
Fichter via dfly. fixes:
$ man usr.bin/man/man.1


# 1.56 30-Jul-2013 joerg

Mark the dead.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.55 19-Jul-2013 uwe

Constify some more.


# 1.54 19-Jul-2013 uwe

Spell "keywords" without space. Fix couple of typos.


# 1.53 19-Jul-2013 uwe

manual_find_buildkeyword() - now that we control the format string, we
may use asterisk precision specification instead of temporary
modifying the _build string itself.


# 1.52 19-Jul-2013 uwe

Fix manual_find_buildkeyword() to not use non-literal printf format.


# 1.51 18-Jul-2013 uwe

Don't access memory outside the array if tmpdirlen == 0.


# 1.50 18-Jul-2013 christos

use -Wno-format and revert "fixstring"


# 1.49 18-Jul-2013 christos

Set the string to NUL instread of providing an new empty string (from uwe)


# 1.48 18-Jul-2013 christos

WARNS=6
- fix cast qual issues
- don't use snprintf on a user-provided buffer


# 1.47 18-Jul-2013 uwe

Revert previous; other errors from WARNS=3 obscured the error in jump().


# 1.46 18-Jul-2013 uwe

Constify jump() arguments appropriately.


# 1.45 18-Jul-2013 uwe

Move manstate::pagerlen so that its "length of the above" comment makes sense.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base
# 1.44 03-Jan-2012 joerg

branches: 1.44.6; 1.44.10;
If the default path doesn't result in a match, bail out early instead of
running into a segmentation fault. Based on patch by Abhinav Upadhyay.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.43 14-Jun-2011 wiz

branches: 1.43.2;
Fix usage in man page and sync usage in executable with it.


# 1.42 14-Jun-2011 joerg

Add support for man -p to print the search path for manual pages (not
including cat page directories).

From Abhinav Upadhyay as part of Google's Summer of Code 2011


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.41 07-Jul-2010 christos

branches: 1.41.4;
get the value of the entry for the class not the key.


# 1.40 23-May-2010 christos

- centralize the snprintf code.
- use err where appropriate.
- add machclass which should be x86 when i386 and amd64 and can be specified
in man.conf as:
_i386 x86
_amd64 x86
so that we can support merged pages. Nothing uses this yet.


Revision tags: matt-premerge-20091211
# 1.39 07-Oct-2009 cegger

Mimic OSX behaviour:

On OS X it is possible to specify the manpage filename
with a full or relative path like this:

man ./foo.5

or

man /cd/foo/bar.1.gz

This is really helpful to view the manpage quickly while editing it.

patch presented on current-users@ and tech-userlevel@:
http://mail-index.netbsd.org/current-users/2009/10/06/msg010767.html
http://mail-index.netbsd.org/tech-userlevel/2009/10/06/msg002675.html

No objections


# 1.38 06-Oct-2009 cegger

- use EXIT_FAILURE/EXIT_SUCCESS
- whitespace nits
- ansify cleanup()/usage()
- remove pointless parenthesis on return


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.37 21-Jul-2008 lukem

branches: 1.37.4; 1.37.10;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.36 05-Oct-2007 lukem

branches: 1.36.8;
Convert to using raise_default_signal(3).


Revision tags: matt-mips64-base
# 1.35 05-Feb-2007 jwise

branches: 1.35.4;
Since MAN_DEBUG is constant, go from if (MAN_DEBUG) to #if MAN_DEBUG


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.34 01-May-2006 christos

Coverity CID 2996: Don't return without closing fp.


# 1.33 10-Apr-2006 chuck

modified man(1):
- avoid double slashes when displaying man pages (got tired
of '/usr/share/man//cat1/man.0').
- got rid of __P() while working on it.
- incorporate some of my old notes explaining how manpath works into the
comments of the code itself.
- renamed some of the vars so that the code is consistent throughout
(and hopefully clearer and easier to understand)
- fixed relative man paths for multiple man pages (man did a chdir()
on the first man page it had to format --- this broke any remaining
relative path man pages left to process). save old directory and
fchdir() back to it after formatting.
- improved doc on "man -h" which does more than just whatis(1) [e.g.
"man -h fopen" prints the required include files and the prototypes
rather than just the one-liner you get with whatis(1)]
- manconf.c now fills in the "len" length field in the TAG/ENTRY
structures (man now uses len).

revise man.conf file reading stuff to return error on failure in
addentry/gettag (fka getlist) rather than just err()ing out. this
allows man(1) to call cleanup and delete its tmp files rather than
just leave them floating. revise other apps using this code
(makewhatis, apropos, catman, whatis) to expect this. also remove
__P on updated files.


# 1.32 08-Apr-2006 christos

change an int to size_t


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.31 05-Jan-2004 jmmv

Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.


# 1.30 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.


Revision tags: fvdl_fs64_base
# 1.29 13-Sep-2002 thorpej

Rename man/config.{c,h} to man/manconf.{c,h}, so we don't have to
worry about problems including "config.h" when building as a host
tool.


# 1.28 11-Jun-2002 lukem

- getlist(): add "int create" arg, which creates list if it's not present
(using guts of now defunct addlist())
- use TAILQ_*() macros appropriately when manipulating tailqs


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.27 14-Mar-2002 groo

branches: 1.27.2;
Fix longstanding misuse of glob(3) and fnmatch(3) in man page search.
glob(3)-special characters are now escaped in the supplied man page names.

Makes ``man ['' work without mysterious quoting.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.25 12-Jun-2000 simonb

Allow "-s" to specify a section name, ala the SysV man command.
Unlike the SysV man command, this doesn't allow for the -s argument
to be a list.


# 1.24 07-Jun-2000 thorpej

check_pager() was using an uninitialized variable; fix it.


# 1.23 27-May-2000 jdolecek

allow to specify relative paths for sections in man.conf - they are used
similarily to _subdir, but only when appropriate
fix -m handling, so that e.g. "man -m . 3 printf" works as it should
add new -S flag, to specify a string the result path has to contain
g/c some unused stuff

Written by Chuck Cranor, with only cosmetic changes & const poisoning by me.


Revision tags: minoura-xpg4dl-base
# 1.22 09-Jan-2000 tsutsui

branches: 1.22.2;
Use uname(3) to determine MACHINE type.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.21 02-Nov-1999 lukem

revert previous


# 1.20 02-Nov-1999 lukem

remove superfluous '-' in getopt string


# 1.19 22-Jul-1999 kleink

branches: 1.19.2;
Try $TMPDIR first, then fall back to _PATH_TMP.


# 1.18 22-Jul-1999 itohy

A caught signal is blocked in the handler and
must be unblocked to do the default action.
The old code may generate weird exit status
on signals.


# 1.17 19-Jun-1999 itohy

Remove temp file on SIGPIPE (such as "man sh | head").


# 1.16 13-Jun-1999 kleink

Fall back to more(1) if PAGER is set but null.


Revision tags: netbsd-1-4-RELEASE netbsd-1-4-base
# 1.15 06-Nov-1998 christos

branches: 1.15.2;
char -> unsigned char


# 1.14 08-Oct-1998 wsanchez

We can't define MACHINE from a makefile in Rhapsody, because you might be cross
compiling, or building a fat (multi-architecture) binary. Our compiler
defines __ARCHITECTURE__ for this use.
Fixed an off-by-one error that may occasionally cause man to seg fault. Found
by using a special strict malloc() implementation.


# 1.13 25-Aug-1998 ross

Add { and } to shut up egcs. Reformat the more questionable code.


# 1.12 06-Jul-1998 kleink

Since GLOB_NOCHECK is not set, explicitly check for a return value of
GLOB_NOMATCH from glob(). Noticed by Juergen Hannken-Illjes.


# 1.11 19-Jun-1998 kleink

GLOB_QUOTE is dead; per POSIX, backslash quoting of special characters being
enabled is the default behaviour.


# 1.10 23-Nov-1997 tv

When man was "fixed" to chdir() to the man root as historical man does,
it broke the -M option on relative paths (the chdir works as it should,
but the relative man page path is still used whole in nroff). This
repairs the situation by chopping the full pathname in half--one part
for the chdir, one part for the filename.


Revision tags: netbsd-1-3-base
# 1.9 17-Oct-1997 mikel

branches: 1.9.2;
cleanup for WARNS=1


# 1.8 10-Sep-1997 mikel

resize a pathname buffer to MAXPATHLEN; from Matthias Scheler in PR 4101


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.7 28-Sep-1995 tls

Sync with 4.4BSD-Lite2


# 1.6 20-Apr-1995 mycroft

Pay attention to the section number, even if MANPATH or -M is specified.


# 1.5 16-Jan-1995 mycroft

Sync with 4.4-Lite, plus local changes.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.4 03-Jun-1994 jtc

Fix from Christos Zoulas which makes relative paths in .so lines work when
man pages are formatted.


# 1.3 17-Apr-1994 cgd

fix from bostic for multiple match problem


# 1.2 18-Mar-1994 cgd

fix from Keith White <kwhite@csi.UOttawa.CA>, to DTRT when man -w's output
is redirected.


Revision tags: BOSTIC-1
# 1.1 21-Dec-1993 cgd

branches: 1.1.1;
add man(1) ; part of new man(1) package from Bostic