From: Pádraig Brady
Date: Sat, 3 Jan 2026 17:15:12 +0000 (+0000) Subject: doc: optimize logic to disable SGR output in --help X-Git-Tag: v9.10~69 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cc002057b3a33d79db6ff3330783e5118b6f4479;p=thirdparty%2Fcoreutils.git doc: optimize logic to disable SGR output in --help * src/system.h (oputs_): Simplify processing if neither MANUAL_URL or BOLD_MAN_REFS is defined. Also ensure we only lookup the HELP_NO_MARKUP env var once per process. --- diff --git a/src/system.h b/src/system.h index 3c18641348..e77a8fe9f9 100644 --- a/src/system.h +++ b/src/system.h @@ -545,8 +545,14 @@ is_nul (void const *buf, size_t length) static inline void oputs_ (MAYBE_UNUSED char const* program, char const *option) { - static int help_no_sgr = -1; - if (help_no_sgr && (help_no_sgr = !!getenv ("HELP_NO_MARKUP"))) + static int help_no_sgr = +#if ! defined MANUAL_URL && ! defined BOLD_MAN_REFS + 1; /* Disable. */ +#else + -1; /* Lookup. */ +#endif + if (help_no_sgr == 1 + || (help_no_sgr == -1 && (help_no_sgr = !!getenv ("HELP_NO_MARKUP")))) { fputs (option, stdout); return;