From f021aca3f7d9c32248637edbcbac575d34e1f2a5 Mon Sep 17 00:00:00 2001 From: "G. Branden Robinson" Date: Sat, 25 Oct 2025 19:17:12 -0500 Subject: [PATCH 1/4] doc/makedefs.6: Fix formatting error Starting a text line with leading spaces causes a break when filling. Usually this is not what is intended. Fixes: $ nroff -ww -z -rCHECKSTYLE=4 -man doc/*.[67] an.tmac:doc/makedefs.6:102: style: 1 leading space(s) on input line --- doc/makedefs.6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/makedefs.6 b/doc/makedefs.6 index 136084473..5e24242fa 100644 --- a/doc/makedefs.6 +++ b/doc/makedefs.6 @@ -99,7 +99,7 @@ only if it is present, to obtain .B githash= and .B gitbranch= - info and include related preprocessor #defines in +info and include related preprocessor #defines in .I date.h file. .br From 6a8edddcb9e9871dc5114c7a088371882e011419 Mon Sep 17 00:00:00 2001 From: "G. Branden Robinson" Date: Sat, 7 Feb 2026 04:07:50 -0600 Subject: [PATCH 2/4] doc/tmac.nh: Drop space after `\c` escape sequence Fixes warning in category "syntax" from the forthcoming groff 1.24. troff::790: warning: ignoring a space on input line after output line continuation escape sequence [94 more occurrences] --- doc/tmac.nh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/tmac.nh b/doc/tmac.nh index 86bc643b4..f8c30c2d0 100644 --- a/doc/tmac.nh +++ b/doc/tmac.nh @@ -29,7 +29,7 @@ .\" labeled paragraph label (and first line) .de PL .br -\\h'|-\\n(PYu'\\$1\\h'|-\\n(PXu'\ -\ \\c \" back up, output the label, then +\\h'|-\\n(PYu'\\$1\\h'|-\\n(PXu'\ -\ \\c\" back up, output the label, then . \" skip to width-of(" - ") before the . \" normal indentation, output the " - " . \" then attach the next line (the From b4bd6fb2b86072ab8c7da6dfdc93f13c67787009 Mon Sep 17 00:00:00 2001 From: "G. Branden Robinson" Date: Fri, 6 Feb 2026 09:02:42 -0600 Subject: [PATCH 3/4] Guidebook: Improve package loading for groff 1.24 groff 1.24 is in its second release candidate of this writing and features a noteworthy revision to its syntax. ---snip--- NEWS: * If your roff(7) documents follow any of the requests ... `so`, ... with a comment after their file name argument, and did not place that comment immediately after the file name, you are likely to get a diagnostic message resembling the following. warning: cannot open macro file 'e.tmac ': No such file or directory Or, less likely, the formatter will open the wrong file, one with spaces at the end of its name. That is because these requests are now able to process file names containing space characters. (This change also makes the request syntax consistent with that of `ds`, `as`, and others.) A quick fix is to place the comment escape sequence as early as possible. For example, we would change: .mso e.tmac \" Load Eric Allman's package. to: .mso e.tmac\" Load Eric Allman's package. to tell the formatter to load the "e.tmac" file rather than "e.tmac ". See the items below for further details. ---end snip--- Work around this change while maintaining with older groff and other *roff formatters. 1. Stop using space to separate comments from the argument to `so`. 2. Temporarily define a `So` macro to wrap the `soquiet` request (for groff 1.23 and later) or `so` request (for everything else). 3. Abort formatting with an error diagnostic if the `nh` macro package the Guidebook requires cannot be located. Fixes: $ (cd doc && rm -f Guidebook && make Guidebook) troff::34: error: cannot open 'tmac.nh ': No such file or directory troff::35: error: cannot open 'doc/tmac.nh': No such file or directory --- doc/Guidebook.mn | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index a8f739d5a..89f581285 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -31,8 +31,21 @@ .lt 70n .\} . -.so tmac.nh \" extra macros which aren't in tmac.n -.if !\n(nH .so doc/tmac.nh +.\" Load extra macros that "tmac.n" doesn't define. +.de So +.ie \n(.g&(\n(.x=1)&(\n(.y>22) .soquiet \\$1 +.el .so \\$1 +.. +. +.So tmac.nh +.if !\n(nH So doc/tmac.nh +. +.if !\n(nH \{\ +.tm fatal error: cannot locate "tmac.nh" macro package +.ab +.\} +. +.rm So . .\" building Guidebook.txt doesn't have CR font available; groff 1.23 issues .\" a warning each time any font can't be loaded; earlier versions silently From a8253dda0008f4ba04c7b2c2101c474a6dcaf596 Mon Sep 17 00:00:00 2001 From: "G. Branden Robinson" Date: Sat, 7 Feb 2026 04:30:06 -0600 Subject: [PATCH 4/4] Update Unix hints to revise groff detection The existing detection logic was not working on any groff since at least 1.22.3 (November 2014), as could be seen by uncommenting the "$(info ...)" line. The regex used to match "nroff --version" output was insufficiently flexible. Fixes: $ (cd doc && rm -f Guidebook && PATH=$HOME/groff-1.22.3/usr/bin:/bin make Guidebook) | grep NROFF NROFFISGROFF= $ (cd doc && rm -f Guidebook && PATH=$HOME/groff-1.22.4/usr/bin:/bin make Guidebook) | grep NROFF NROFFISGROFF= $ (cd doc && rm -f Guidebook && PATH=$HOME/groff-1.23.0/usr/bin:/bin make Guidebook) | grep NROFF NROFFISGROFF= $ (cd doc && rm -f Guidebook && PATH=$HOME/groff-HEAD/usr/bin:/bin make Guidebook) | grep NROFF NROFFISGROFF= Use a different approach in Make to recording groff detection. Use "grep -c" (which is POSIX-conforming) to count the number of matches so that we can use the contents of the Make macro `NROFFISGROFF` as a sort of Boolean, which reads more idiomatically (in my opinion). Further, instead of trying to lexically analyze a matched line in the output of "nroff --version" and parse components of a version number out of it, use GNU troff's built-in facility for extracting its minor version number by storing the output of a tiny *roff document that reports that datum (and nothing else). Ignore warnings in category "scale" in any version of groff, because the `tmac.n` macro package provokes them. Clarify comments. --- sys/unix/hints/include/misc.370 | 38 ++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/sys/unix/hints/include/misc.370 b/sys/unix/hints/include/misc.370 index 6608cf45a..7f57697b4 100644 --- a/sys/unix/hints/include/misc.370 +++ b/sys/unix/hints/include/misc.370 @@ -70,34 +70,38 @@ NROFF = mandoc MAN2TXTPRE = -T ascii MAN2TXTPOST= | col -b else -#detection of groff -NROFFISGROFF := $(shell echo `nroff --version | grep "GNU groff version"`) +# +# Detect groff. +NROFFISGROFF := $(shell echo `nroff --version | grep -c 'GNU.*groff.*version'`) #$(info NROFFISGROFF=$(NROFFISGROFF)) -ifneq "$(NROFFISGROFF)" "" -# get the version of groff and flag if it is gt or eq to 1.23 -GROFFGE123 := $(shell expr `echo $(NROFFISGROFF) | cut -f2 -d.` \>= 23) -# or less than 1.24 -GROFFLT124 := $(shell expr `echo $(NROFFISGROFF) | cut -f2 -d.` \< 24) -# -Wtab -Wrange are for the sake of tmac.n. -NROFF_FLAGS := -wall -Wtab -Wrange -ifneq "$(GROFFLT124)" "" -NROFF_FLAGS += -Wel -Wscale -endif -endif # NROFFISGROFF +ifneq "$(NROFFISGROFF)" "0" +# Gather groff's minor version number (register `.y`). +GROFFMINORVERSION := $(shell printf '.tm \\n[.y]\n' | nroff 2>&1) +#$(info GROFFMINORVERSION=$(GROFFMINORVERSION)) +# Silence warnings produced by tmac.n, which NetHack does not modify. +NROFF_FLAGS := -wall -Wrange -Wscale -Wtab +# groff <= 1.23 also supported an "el" warning category that was buggy. +GROFFLE123 := $(shell expr $(GROFFMINORVERSION) \<= 23) +#$(info GROFFLE123=$(GROFFLE123)) +ifeq "$(GROFFLE123)" "1" +NROFF_FLAGS += -Wel +endif # end groff less than 1.23 +endif # end NROFFISGROFF +# $(info NROFF_FLAGS=$(NROFF_FLAGS)) ifneq "$(NROFFISGROFF)" "" # It's groff # add the -Tascii flag used by groff MAN2TXTPRE += -Tascii -ifneq "$(GROFFGE123)" "" # It's groff 1.23 or greater -#$(info GROFFGE123=$(GROFFGE123)) # nroff in groff 1.23 supports the -P option to pass arguments to the # output driver. -cbou are flags to grotty(1). +GROFFGE123 := $(shell expr $(GROFFMINORVERSION) \>= 23) +#$(info GROFFGE123=$(GROFFGE123)) +ifeq "$(GROFFGE123)" "1" MAN2TXTPRE += -P -cbou MAN2TXTPOST= else MAN2TXTPRE += -c -# groff less than 1.23 -endif +endif # end groff less than 1.23 endif # end groff-specific endif # not USE_MANDOC