Commit Graph

142 Commits

Author SHA1 Message Date
abhinav 5652c781e4 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@
2017-05-02 14:19:23 +00:00
abhinav bf229e85c5 Fix comment indentation at couple of places: Use \t instead of space 2017-04-27 09:31:50 +00:00
abhinav f2d77fdf32 Replace makewhatis(8) with makemandb(8) in SEE ALSO. 2016-06-16 15:11:43 +00:00
abhinav edcef964c4 Document -f option for man(1).
Also remove unsupported options for `man -k` from the synopsis and usage.
2016-06-16 15:10:58 +00:00
christos 8ed051d1e1 put back _PATH_WHATIS, it is used. 2016-05-21 20:54:34 +00:00
abhinav aa0cdec039 Remove unused include and unused constant. Ok from christos@. 2016-05-21 17:21:40 +00:00
plunky 312b53dde5 change _whatdb => _mandb as that is the correct keyword here,
and move it to the correct position in the list.
2015-04-07 10:17:21 +00:00
christos c7da06e6d1 there is no more makewhatis; it has been replaced by makemandb 2015-03-03 17:59:32 +00:00
apb 3453b7f9d9 More detail about treating a local file as a man page,
and about how to request machine-specific man pages.
re
2014-08-14 15:44:47 +00:00
apb ee28f0e59d 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".
2014-08-14 15:31:12 +00:00
riastradh 6cb10275d0 Merge riastradh-drm2 to HEAD. 2014-03-18 18:20:35 +00:00
uwe 28b0656f7c 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).
2014-02-17 03:10:12 +00:00
uwe 20ec07777a Check _build and _crunch commands with fmtcheck(3), warn about and
ignore bad ones.
2014-02-17 02:53:48 +00:00
christos 094fa0251a 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)
2013-10-28 23:46:17 +00:00
christos 8818316ba3 add more compression suffixes and local suffixes. 2013-10-06 17:14:49 +00:00
christos b496a26a9d Recognize .gz and .bz2 suffixes so $ man ./man.1.gz works. From Franco Fichter
via dfly.
2013-10-06 16:43:41 +00:00
christos 7d79a7ccd9 Be more permissive in interpreting man pages as filenames, from Franco
Fichter via dfly. fixes:
	$ man usr.bin/man/man.1
2013-10-06 16:29:26 +00:00
joerg 349a581e92 Mark the dead. 2013-07-30 15:10:04 +00:00
uwe 2a44517182 Constify some more. 2013-07-19 05:05:59 +00:00
uwe 4e29a793cc Spell "keywords" without space. Fix couple of typos. 2013-07-19 04:59:46 +00:00
uwe 6a118683e9 manual_find_buildkeyword() - now that we control the format string, we
may use asterisk precision specification instead of temporary
modifying the _build string itself.
2013-07-19 04:55:05 +00:00
uwe 6fed3e8105 Fix manual_find_buildkeyword() to not use non-literal printf format. 2013-07-19 04:18:10 +00:00
uwe fd25be260e Use -Wno-format-nonliteral instead of blanket -Wno-format. 2013-07-19 04:17:02 +00:00
uwe 887d84a8cf Don't access memory outside the array if tmpdirlen == 0. 2013-07-18 16:33:31 +00:00
christos f75400a6b8 use -Wno-format and revert "fixstring" 2013-07-18 16:28:52 +00:00
christos 532207c739 Set the string to NUL instread of providing an new empty string (from uwe) 2013-07-18 16:01:25 +00:00
christos ef965bff9b WARNS=6
- fix cast qual issues
- don't use snprintf on a user-provided buffer
2013-07-18 15:39:08 +00:00
uwe a2ec5e5863 Revert previous; other errors from WARNS=3 obscured the error in jump(). 2013-07-18 04:05:32 +00:00
uwe d7a42acd68 Constify jump() arguments appropriately. 2013-07-18 04:02:31 +00:00
uwe e0d6c9b51f Move manstate::pagerlen so that its "length of the above" comment makes sense. 2013-07-18 03:48:22 +00:00
uwe 3403b722b4 whatis.db is no more, so don't mention its location in FILES. 2013-07-18 03:40:31 +00:00
uwe db23d137fa Remove unnecessary line wrap. 2013-07-18 03:38:25 +00:00
wiz a87a4e005d Prefer Aq to \*[Lt] etc. 2013-06-28 10:13:18 +00:00
jdf eb2a9790dd * adjust indentation of list block
* fix capitalization
 * remove superfluous word ('The')

Patch supplied by Bug Hunting.
2013-06-27 21:55:10 +00:00
christos 6d6339ce42 document _machine 2012-04-29 03:46:43 +00:00
joerg c09f2f1d25 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.
2012-01-03 17:49:57 +00:00
apb 25998b2e56 Document the reality that the _build and _crunch commands should each
contain exactly one "%s".  The previous description allowed any number
of "%s" in the _build command, but that does not match the actual
behaviour of either man(1) or catman(8).
2011-12-27 13:15:55 +00:00
mbalmer 947c965b88 Refer to X11R7. 2011-10-07 10:52:31 +00:00
wiz 6d765c9977 Fix usage in man page and sync usage in executable with it. 2011-06-14 20:08:45 +00:00
joerg 2d9f8bf04f 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
2011-06-14 18:53:48 +00:00
christos e2d47bd7fa get the value of the entry for the class not the key. 2010-07-07 21:24:34 +00:00
christos cbc22ad229 - 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.
2010-05-23 22:04:36 +00:00
cegger 656e85b2f1 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
2009-10-07 08:30:31 +00:00
cegger 58b5db465d - use EXIT_FAILURE/EXIT_SUCCESS
- whitespace nits
- ansify cleanup()/usage()
- remove pointless parenthesis on return
2009-10-06 06:43:15 +00:00
lukem c1ceae17f0 Enable WARNS=4 by default for usr.bin, except for:
awk  bdes  checknr  compile_et  error  gss  hxtool  kgetcred  kinit
	klist  ldd  less  lex  locale  login  m4  man  menuc  mk_cmds
	mklocale  msgc  openssl  rpcgen  rpcinfo  sdiff  spell  ssh
	string2key  telnet  tn3270  verify_krb5_conf  xlint
2009-04-14 22:15:16 +00:00
lukem 98e5374ccb Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 14:19:20 +00:00
christos 6f6f89d28a pass lint, from anon ymous 2008-03-08 15:48:27 +00:00
lukem c9c455bf1d Convert to using raise_default_signal(3). 2007-10-05 07:36:45 +00:00
reed a87b66bd95 Add "catman" to the SEE ALSO. 2007-02-10 19:27:39 +00:00
jwise b6bad2e5f2 Since MAN_DEBUG is constant, go from if (MAN_DEBUG) to #if MAN_DEBUG 2007-02-05 19:46:24 +00:00