From: Collin Funk Date: Wed, 6 Aug 2025 01:46:04 +0000 (-0700) Subject: maint: use consistent references to standard files in messages X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=HEAD;p=thirdparty%2Fcoreutils.git maint: use consistent references to standard files in messages * cfg.mk (sc_standard_outputs): Add a grep command for source files. * src/du.c (main): Use standard input instead of stdin, standard output instead of stdout, and standard error instead of stderr in messages. * src/nohup.c (main): Likewise. * src/sort.c (main): Likewise. * src/split.c (main): Likewise. * src/stdbuf.c (main): Likewise. * src/wc.c (main): Likewise. * tests/du/files0-from.pl (@Tests): Adjust test case to new messages. * tests/sort/sort-files0-from.pl: Likewise. * tests/wc/wc-files0-from.pl: Likewise. --- diff --git a/cfg.mk b/cfg.mk index eecec2d727..2115b8441a 100644 --- a/cfg.mk +++ b/cfg.mk @@ -341,6 +341,8 @@ sc_standard_outputs: $(ALL_MANS) && { echo 1>&2 '$@: use "standard ....." in user docs'; exit 1; } || : @grep -E '[Ss]tandard (in|out|err)([^op]|$$)' man/*.1 doc/*.texi \ && { echo 1>&2 '$@: use "standard ..put" in user docs'; exit 1; } || : + @grep -E '_\("[^"]*std(in|out|err)' src/*.c \ + && { echo 1>&2 '$@: use "standard ..put" in messages'; exit 1; } || : # Option descriptions should not start with a capital letter. # One could grep source directly as follows: diff --git a/src/du.c b/src/du.c index c93d7f71b4..e8ad3e93c0 100644 --- a/src/du.c +++ b/src/du.c @@ -1070,7 +1070,7 @@ main (int argc, char **argv) { /* Give a better diagnostic in an unusual case: printf - | du --files0-from=- */ - error (0, 0, _("when reading file names from stdin, " + error (0, 0, _("when reading file names from standard input, " "no file name of %s allowed"), quoteaf (file_name)); skip_file = true; diff --git a/src/nohup.c b/src/nohup.c index 5b590fbb5e..d062d2cb88 100644 --- a/src/nohup.c +++ b/src/nohup.c @@ -191,8 +191,9 @@ main (int argc, char **argv) if (!redirecting_stdout) error (0, 0, _(ignoring_input - ? N_("ignoring input and redirecting stderr to stdout") - : N_("redirecting stderr to stdout"))); + ? N_("ignoring input and redirecting standard error " + "to standard output") + : N_("redirecting standard error to standard output"))); if (dup2 (out_fd, STDERR_FILENO) < 0) error (exit_internal_failure, errno, diff --git a/src/sort.c b/src/sort.c index 7f1b51dd55..8363d2d1d9 100644 --- a/src/sort.c +++ b/src/sort.c @@ -4760,7 +4760,8 @@ main (int argc, char **argv) for (size_t i = 0; i < nfiles; i++) { if (STREQ (files[i], "-")) - error (SORT_FAILURE, 0, _("when reading file names from stdin, " + error (SORT_FAILURE, 0, _("when reading file names from " + "standard input, " "no file name of %s allowed"), quoteaf (files[i])); else if (files[i][0] == '\0') diff --git a/src/split.c b/src/split.c index 22a83ad5c8..e5f6947f81 100644 --- a/src/split.c +++ b/src/split.c @@ -1558,7 +1558,8 @@ main (int argc, char **argv) if (k_units != 0 && filter_command) { - error (0, 0, _("--filter does not process a chunk extracted to stdout")); + error (0, 0, _("--filter does not process a chunk extracted to " + "standard output")); usage (EXIT_FAILURE); } diff --git a/src/stdbuf.c b/src/stdbuf.c index 9fa9d01f41..b61ddf6a46 100644 --- a/src/stdbuf.c +++ b/src/stdbuf.c @@ -343,7 +343,7 @@ main (int argc, char **argv) /* -oL will be by far the most common use of this utility, but one could easily think -iL might have the same affect, so disallow it as it could be confusing. */ - error (0, 0, _("line buffering stdin is meaningless")); + error (0, 0, _("line buffering standard input is meaningless")); usage (EXIT_CANCELED); } diff --git a/src/wc.c b/src/wc.c index 24dc4b3a98..05e78676e3 100644 --- a/src/wc.c +++ b/src/wc.c @@ -876,7 +876,7 @@ main (int argc, char **argv) { /* Give a better diagnostic in an unusual case: printf - | wc --files0-from=- */ - error (0, 0, _("when reading file names from stdin, " + error (0, 0, _("when reading file names from standard input, " "no file name of %s allowed"), quoteaf (file_name)); skip_file = true; diff --git a/tests/du/files0-from.pl b/tests/du/files0-from.pl index 77057aa46b..fe053f6481 100755 --- a/tests/du/files0-from.pl +++ b/tests/du/files0-from.pl @@ -42,8 +42,8 @@ my @Tests = # input file name of '-' ['minus-in-stdin', '--files0-from=-', '<', {IN=>{f=>'-'}}, {EXIT=>1}, - {ERR => "$prog: when reading file names from stdin, no file name of" - . " '-' allowed\n"}], + {ERR => "$prog: when reading file names from standard input, " + . "no file name of '-' allowed\n"}], # empty input, regular file ['empty', '--files0-from=@AUX@', {AUX=>''}], diff --git a/tests/sort/sort-files0-from.pl b/tests/sort/sort-files0-from.pl index eb36e2118c..d91924aac7 100755 --- a/tests/sort/sort-files0-from.pl +++ b/tests/sort/sort-files0-from.pl @@ -42,8 +42,8 @@ my @Tests = # input file name of '-' ['minus-in-stdin', '--files0-from=-', '<', {IN=>{f=>'-'}}, {EXIT=>2}, - {ERR => "$prog: when reading file names from stdin, no file name of" - . " '-' allowed\n"}], + {ERR => "$prog: when reading file names from standard input, " + . "no file name of '-' allowed\n"}], # empty input, regular file ['empty', '--files0-from=@AUX@', {AUX=>''}, {EXIT=>2}, diff --git a/tests/wc/wc-files0-from.pl b/tests/wc/wc-files0-from.pl index bf6b6f85b7..5d803083e0 100755 --- a/tests/wc/wc-files0-from.pl +++ b/tests/wc/wc-files0-from.pl @@ -42,8 +42,8 @@ my @Tests = # input file name of '-' ['minus-in-stdin', '--files0-from=-', '<', {IN=>{f=>'-'}}, {EXIT=>1}, - {ERR => "$prog: when reading file names from stdin, no file name of" - . " '-' allowed\n"}], + {ERR => "$prog: when reading file names from standard input, " + . "no file name of '-' allowed\n"}], # empty input, regular file ['empty', '--files0-from=@AUX@', {AUX=>''}],