CVS log for mandoc/man_validate.c

[BACK] Up to [cvsweb.bsd.lv] / mandoc

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: HEAD


Revision 1.161 / (download) - annotate - [select for diffs], Wed Jul 9 12:51:06 2025 UTC (2 months, 1 week ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.160: +4 -4 lines
Diff to previous 1.160 (unified)

If the first argument of the .TH macro (the manual page name) is an
empty string (as in: .TH "" ...), which is invalid syntax, use the
fixed string "UNTITLED" instead, in the same was as in mdoc(7).
This is needed because if *both* the first and the second arguments are
empty strings (as in: .TH "" "" ...), makewhatis(8) assumes the file is
not a valid man(7) file at all and marks it as preformatted (FORM_CAT)
in mandoc.db(5) such that man(1) displays it verbatim, without
formatting it.

One subtle difference to mdoc(7) remains: if there is no .Dt macro
at all, -mdoc also sets the title to "UNTITLED", which is OK because
the mdoc(7) parser is only used if the user explicitly requested -mdoc
or choose_parser() in read.c detected mdoc(7) by finding a .Dd macro.
The man(7) parser, on the other hand, is always used as a fallback,
even if neither the user requested it with -man, nor choose_parser()
detected a .TH macro.  Thus, for man(7), the "" -> "UNTITLED"
replacement is only done when the validation module finds a .TH ""
macro, but not when there is no .TH macro at all, in order to not
break verbatim display of preformatted manual pages.

Problem reported by Robert Kirkman <rkirkman at termux dot dev>,
see https://github.com/termux/termux-packages/pull/25294 .

An example of a file triggering the problem is the totally crappy file
https://android.googlesource.com/platform/packages/modules/adb/+show/refs/heads/main/docs/user/adb.1.md
(which is hardly worth calling a "manual page").  When the equally crappy
pandoc(1) program is used to convert that to man(7) format - even though
calling the result a "man(7) file" is quite a stretch - that file
contains this invalid line triggering the issue: .TH "" "" "" ""

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb