Commit Graph

67 Commits

Author SHA1 Message Date
Kyle Evans
f555b39e6b man: reset OPTIND before parsing args
From jilles: POSIX requires that a script set `OPTIND=1` before using
different sets of parameters with `getopts`, or the results will be
unspecified.

The specific problem observed here is that we would execute `man -f` or
`man -k` without cleaning up state from man_parse_args()' `getopts`
loop.  FreeBSD's /bin/sh seems to reset OPTIND to 1 after we hit the
second getopts loop, rendering the following shift harmless; other
/bin/sh implementations will leave it at what we came into the loop at
(e.g., bash as /bin/sh), shifting off any keywords that we had.

Input from:	jilles
Reviewed by:	allanjude, bapt, imp
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32063
2021-09-23 14:13:34 -05:00
Fernando Apesteguía
9e23004023 man(1): Bump .Dd
From commit df965a6829
2021-01-09 18:22:08 +01:00
Fernando Apesteguía
df965a6829 man(1): Add EXAMPLES section
Add some examples showing the use of the flags: a, k, P, w

Reviewed by: gbe@, yuripv@
Approved by: manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D27545
2021-01-09 17:57:47 +01:00
Mateusz Piotrowski
e4c79332a0 Update the list of searched manual sections after r367013 2020-10-28 16:54:37 +00:00
Ryan Moeller
73577bf01d flua: Add a libjail module
libjail is pretty small, so it makes for a good proof of concept demonstrating
how a system library can be wrapped to create a loadable Lua module for flua.

* Introduce 3lua section for man pages
* Add libjail module

Reviewed by:	kevans, manpages
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D26080
2020-10-24 17:08:59 +00:00
Yuri Pankov
9508f8c05c Teach man(1) about C.UTF-8.
While here, use LANG as the proper source to select man pages language/encoding,
falling back to LC_CTYPE.

Reviewed by:	bapt
Approved by:	kib (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D17835
2018-11-04 16:58:55 +00:00
Alan Somers
47cc9ee1b1 Switch the default pager for most commands to less
Finally, a pager for the nineties.

MFC after:	Never
Relnotes:	Yes
Differential Revision:	https://reviews.freebsd.org/D13465
Poll:		https://reviews.freebsd.org/V7
2018-08-08 19:24:20 +00:00
Edward Tomasz Napierala
dcea542b0a Clean up .Xrs in man(1).
MFC after:	2 weeks
2018-04-25 15:39:36 +00:00
Eitan Adler
03cd714fc5 man(1): document exit code
man(1) uses standard exit codes, document that.

PR:		223517
Reported by:	wosch
MFC after:	1 week
2017-12-31 00:35:11 +00:00
Baptiste Daroussin
625490e842 Only skip looking for manpages if both man directory and cat directory
are not existing.

This allows man(1) to read catpages when no man directories are available at all

PR:		223559
Reported by:	wosch
MFC after:	3 days
2017-12-04 12:51:05 +00:00
Baptiste Daroussin
d9405a926c In case man(1) found a catpage to display skip looking ".so" which is manpage
only.

In case we are trying to read a catpage, the manpage variable is not defined.
It results in the "cattool" having no arguments.

In case the catpage is compressed, the cattool used is "zcat" which dies if the
standard input is a terminal, meaning the function calling it is exiting as if
there were no ".so"
In case the catpage is uncompressed, the cattool used is "zcat -f" which waits
reading standard input, making the man(1) command hang.

PR:		223560
Reported by:	wosch
MFC after:	3 days
2017-12-04 12:33:46 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Baptiste Daroussin
451c2bec47 man(1): silent the output of mandoc when testing
This reduce the spam a user may face when mandoc tries to
figure out if it can renders a manpage or fallback on groff(1)

Reported by:	bdrewery
MFC after:	3 days
2017-09-29 07:44:48 +00:00
Tijl Coosemans
971c1c4219 - Remove separate handling of /bin and /usr/bin in manpath. They are no
longer a special case.
- Prefer PREFIX/share/man over PREFIX/man.
- Add /usr/local/share/man to man_default_path.
- Update manpath man page.

Reviewed by:	bapt
2017-03-12 10:56:19 +00:00
Baptiste Daroussin
97ab006d51 Remove the WITHOUT_MANDOCDB option
mandoc database is activated since FreeBSD 11.0, let's remove the previous
database format for FreeBSD 12.0
2017-03-11 06:51:21 +00:00
Baptiste Daroussin
6970ca8f1e Remove the warning when MANPATH is set in the environment
The MANPATH environment variable behaviour is documented properly in the manpage
and it now has extended to new feature that allows to make MANPATH env variable
extending the default search path rather than overwriting it making the warning
painful

Reported by:	kargl
MFC after:	1 week
2017-03-11 06:31:16 +00:00
Baptiste Daroussin
b2394e73fc Extend functionality MANPATH in man(1) to followup with apropos(1) from
mandoc.

If MANPATH begins with a colon, it is appended to the default list; if it ends
with a colon, it is prepended to the default list; or if it contains two
adjacent colons, the standard search path is inserted between the colons.  If
none of these conditions are met, it overrides the standard search path.

Import the MANPATH description from mandoc into the man(1) man page

Reported by:	kargl
MFC after:	1 week
2017-03-11 06:24:49 +00:00
Baptiste Daroussin
61d5f2d162 Add share/man if it exists to the MANPATH
localbase is not consistent with base for manpages:
/usr/local/man vs /usr/share/man adding share/man allows to fix that
inconsistency and would permit to remove tons of patches/modifications in the
ports tree
2017-03-11 05:56:50 +00:00
Enji Cooper
dad206bd67 Update MACHINE/MACHINE_ARCH examples to use arm64/aarch64 instead of i386/pc98
pc98 support was removed in r312910
2017-01-29 00:24:34 +00:00
Baptiste Daroussin
449a792dd5 Restore man -t for manpages rendered by mandoc
Reported by:	swills
2015-09-19 16:00:50 +00:00
Baptiste Daroussin
24ef74209a inode should be different to actually mean mandocdb is in used
Sponsored by:	gandi.net
2015-07-24 09:20:02 +00:00
Baptiste Daroussin
772246ef18 Fix man -k with mandocdb
If apropos(1) and whatis(1) are not hardlinks to man(1) that means the system is
using mandocdb, then man -k should spawn apropos(1) and/or whatis(1) directly

Reported by:	kevlo
Tested by:	kevlo
Sponsored by:	gandi.net
2015-07-24 09:10:03 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Baptiste Daroussin
8faa40d1a0 Switch to mandoc's version of makewhatis(8), whatis(1), apropos(1) utilities.
This change among other things improve search capabilities over the manpages
allowing fine grain query.

A new build option WITHOUT_MANDOCDB has been added to keep the ancient version
of the database and the tools. The plan is to entirely remove this option before
11.0-RELEASE.

Differential Revision:	https://reviews.freebsd.org/D2603
2015-05-30 17:41:37 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Baptiste Daroussin
d433cf9a8a Allow MANWIDTH to work with mandoc(1)
Reported by:	bdrewery
2015-05-15 15:56:28 +00:00
Baptiste Daroussin
849684b013 Update mandoc to cvs snaphot from 20150302
Use the new unsupp warning level to detect the unsupported manpages in man(1)
2015-03-02 16:58:57 +00:00
Baptiste Daroussin
0489fbcd33 Only manpages with fatal errors should be rendered by groff(1) 2015-01-03 23:39:44 +00:00
Joel Dahl
914f6e6290 mdoc: sort SEE ALSO. 2014-12-26 21:56:23 +00:00
Baptiste Daroussin
fd83961f72 mandoc -Tlocale is now the default, no need to enforce it anymore 2014-12-25 22:04:16 +00:00
Baptiste Daroussin
1fb816da82 Update to mandoc cvs version as of 20141201
- Compatiblity with existing manpages has been improved
- Now support ".so" directive with compressed manpages (which fixes a regression
we have since we have new man(1))
2014-12-02 23:24:57 +00:00
Baptiste Daroussin
b43edc06e6 Fix comments 2014-11-23 00:30:32 +00:00
Baptiste Daroussin
f17575acc9 Fix typo 2014-11-23 00:08:43 +00:00
Baptiste Daroussin
d6096801f1 Change man(1) to use mandoc to render manpages
man(1) now first test the manpage to run with mandoc to make sure it can be
rendered.
In case groff cannot be found (because base has been built WITHOUT_GROFF) it
recommands to install groff from the packages
2014-11-23 00:08:04 +00:00
Edward Tomasz Napierala
aca4343c62 Fix improper .Fx macro usage.
Differential Revision:	https://reviews.freebsd.org/D1158
Reviewed by:	wblock@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-11-19 18:19:21 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Allan Jude
b58e1deace Replace the macros used in the previous man(1) commit with literal text,
because the macros seem to be specific to groff, and do not render in
mandoc

Approved by:	bcr (mentor)
Sponsored by:	ScaleEngine Inc.
2014-09-26 11:48:29 +00:00
Allan Jude
84907ef05c Update man(1) to list the different sections of the manual
Add each of the intro sections to the 'Also See' list

PR:		193460
Differential Revision:	D834
Approved by:	bcr (mentor)
Sponsored by:	ScaleEngine Inc.
2014-09-25 21:34:57 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Brooks Davis
40449c74c4 Remove default support for 1aout section manpages. There haven't been
any since at least July 2002.
2013-01-16 23:20:24 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Joel Dahl
8cc9f126ee Minor mdoc improvements. 2012-06-03 11:09:51 +00:00
Joel Dahl
bea977e7f6 mdoc: sort prologue macros. 2012-03-26 19:23:57 +00:00
Ulrich Spörlein
487ac9ac21 Spelling fixes for usr.bin/ 2011-12-30 11:02:40 +00:00
Ruslan Ermilov
9f0f0b4d4c Clean up markup.
Approved by:	re (kib)
2011-08-04 08:50:33 +00:00
Ruslan Ermilov
a6a3e8561d When MANCOLOR environment variable is set, enable ANSI color escapes
in grotty(1).  This makes it possible to view colorized manpages in
color.

When MANPAGER environment variable is set, use it instead of PAGER.

Why another environment variable, one might ask?  With color output
enabled, both a terminal and a pager should support the ANSI color
escapes.  On a supporting terminal, less(1) with option -R would be
such a pager, while "more -s" (the current default pager for man(1))
will show garbage.  It means a different default pager is needed when
color output is enabled, but many people have PAGER set customary,
and it's unlikely to support ANSI color escapes, so introducing yet
another variable (MANPAGER) seemed like a good option to me:

- if MANPAGER is set, use that unconditionally;

- if you disable color support (it is by default), and don't set
  MANPAGER, you get an old behavior: -P pager, $PAGER, "more -s",
  in that order;

- if you enable color support (by setting MANCOLOR), and don't set
  MANPAGER, we ignore PAGER which is unlikely to support ANSI color
  escapes, and you get: -P pager, "less -Rs", in that order;

- you might have good reasons for different man(1) and general
  purpose pagers;

- later versions of GNU man(1) support MANPAGER.
2011-06-03 14:34:38 +00:00
Ruslan Ermilov
b70e20257c Don't use col(1) since grotty(1) never outputs reverse line feeds,
and because col(1) mangles ANSI color escapes if enabled.  Spaces
to tabs compression is now done by passing -h to grotty(1).

Discussed with:	uqs
2011-06-03 13:45:11 +00:00