mantoc/mantoc.1
2025-12-28 13:39:12 +01:00

60 lines
1.3 KiB
Groff

.Dd December 28, 2025
.Dt MANTOC 1
.Os
.Sh NAME
.Nm mantoc
.Nd display the table of contents for a manual page
.Sh SYNOPSIS
.Nm
.Op Ar section
.Ar name
.Sh DESCRIPTION
.Nm
displays the section and subsection headings of the manual page
.Ar name .
.Pp
If a
.Ar section
argument is specified,
.Nm
will only look for the page in the given section.
Otherwise, it will look for it in any section.
.Pp
If the manual page is available in multiple sections,
.Nm
prefers sections in order of: 1, 8, 6, 2, 3, 5, 7, 4, 9, 3p.
This is the same order as mandoc's implementation of
.Xr man 1 .
.Sh IMPLEMENTATION NOTES
.Nm
is implemented as a wrapper script around
.Xr man 1 .
The
.Xr man 1
implementation must support the non-POSIX
.Fl w
and
.Fl l
flags.
At least man-db and mandoc are known to work.
.Sh EXIT STATUS
.Ex -std
.Sh SEE ALSO
.Xr man 1 ,
.Xr man 7 ,
.Xr mdoc 7
.Sh BUGS
The
.Ar section
argument must begin with a number to be accepted by
.Nm .
There is no portable way to specify to
.Xr man 1
that you are looking for a single manual page in a given section, rather than
two manual pages.
As such,
.Nm
must choose between diagnosing errors like
.Ql mantoc foo bar
and support for the rare manual sections that don't begin with a number.
Diagnosing these errors was considered more important.