From 2ff3c65e940f152a7b56395a5828c052f30dba50 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sun, 3 Aug 2025 12:33:55 -0700 Subject: [PATCH] readlink: improve documentation for POSIXLY_CORRECT in --help * NEWS: Improve wording to not imply POSIXLY_CORRECT=1 readlink -q will be verbose. * src/readlink.c (usage): Mention the affect of POSIXLY_CORRECT on -s (--silent), -q (--quiet), and -v (--verbose) in the help message. (main): Remove spurious newline added by previous commit. * doc/coreutils.texi (readlink invocation): Mention that -s (--silent) and -q (--quiet) are not the default when POSIXLY_CORRECT is set. --- NEWS | 4 ++-- doc/coreutils.texi | 6 +++++- src/readlink.c | 7 ++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 9839aeb87b..a9132bbcfd 100644 --- a/NEWS +++ b/NEWS @@ -7,8 +7,8 @@ GNU coreutils NEWS -*- outline -*- 'factor' is now much faster at identifying large prime numbers, and significantly faster on composite numbers greater than 2^128. - readlink will behave as if the -v option is used if the - POSIXLY_CORRECT environment variable is defined. + readlink now defaults to being verbose if the POSIXLY_CORRECT + environment variable is set. ** Bug fixes diff --git a/doc/coreutils.texi b/doc/coreutils.texi index f268c9249b..c5ecf23769 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -11462,7 +11462,11 @@ Print a warning if specified along with multiple @var{file}s. @opindex -q @opindex --silent @opindex --quiet -Suppress most error messages. On by default. +Suppress most error messages. + +@vindex POSIXLY_CORRECT +This option is on by default if the @env{POSIXLY_CORRECT} environment +variable is not set. @item -v @itemx --verbose diff --git a/src/readlink.c b/src/readlink.c index 9e7f2320a5..e778185926 100644 --- a/src/readlink.c +++ b/src/readlink.c @@ -78,8 +78,10 @@ usage (int status) without requirements on components existence\n\ -n, --no-newline do not output the trailing delimiter\n\ -q, --quiet\n\ - -s, --silent suppress most error messages (on by default)\n\ - -v, --verbose report error messages\n\ + -s, --silent suppress most error messages (on by default\n\ + if POSIXLY_CORRECT is not set)\n\ + -v, --verbose report error messages (on by default if\n\ + POSIXLY_CORRECT is set)\n\ -z, --zero end each output line with NUL, not newline\n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); @@ -163,7 +165,6 @@ main (int argc, char **argv) char *value = (can_mode != -1 ? canonicalize_filename_mode (fname, can_mode) : areadlink_with_size (fname, 63)); - if (value) { fputs (value, stdout); -- 2.47.2