]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
doc: --help: --disable-bold-man-page-references configures bold refs
authorPádraig Brady <P@draigBrady.com>
Mon, 29 Dec 2025 16:34:47 +0000 (16:34 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 21 Jan 2026 13:51:39 +0000 (13:51 +0000)
* configure.ac: Adjust help text for --disable-bold-man-page-references,
and also define BOLD_MAN_REFS.
* src/ls.c (oputs): Output bold iff BOLD_MAN_REFS is defined.

configure.ac
src/ls.c

index 3c03ddd03641f5c030cd74e4f9af6a681993fbd6..b605d5ab7a78a96ec452e0ebd4289ae91e15c3d7 100644 (file)
@@ -138,8 +138,8 @@ AM_CONDITIONAL([SINGLE_BINARY_HARD], [test "$gl_single_binary" == hardlinks])
 
 AC_ARG_ENABLE([bold-man-page-references],
   [AS_HELP_STRING([--disable-bold-man-page-references],
-     [When generating man pages, do not apply bold style around any
-      references like name(1) etc.])],
+     [When generating man pages, or displaying --help, do not apply bold style
+      around any references like name(1) or --option references etc.])],
   [gl_bold_manpages=yes ;
    case $enableval in
      no|yes) gl_bold_manpages=$enableval ;;
@@ -148,6 +148,9 @@ AC_ARG_ENABLE([bold-man-page-references],
    esac],
   [gl_bold_manpages=yes]
 )
+if test "$gl_bold_manpages" != no; then
+  AC_DEFINE([BOLD_MAN_REFS], [1], [Whether to markup references as bold])
+fi
 AM_CONDITIONAL([BOLD_MAN_REFS], [test "$gl_bold_manpages" != no])
 
 AC_ARG_ENABLE([gcc-warnings],
index 8b56bd808598d08313a4028c770ddbec6f1a0e47..e6f5995dc8567d938d8da9e10d553e259865180f 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -5376,7 +5376,14 @@ oputs (char const *option)
               url_program, (int) anchor_len, option_text);
     }
   fputs ("\a", stdout);
+#ifdef BOLD_MAN_REFS
+  /* Note help2man strips this and will reinstate with --bold-refs.  */
+  fputs ("\033[1m", stdout);
+#endif
   fwrite (option_text, 1, desc_text - option_text, stdout);
+#ifdef BOLD_MAN_REFS
+  fputs ("\033[0m", stdout);
+#endif
   fputs ("\033]8;;\a", stdout);
 
   fputs (desc_text, stdout);