On 02/25/2013 07:46 PM, Benno Schulenberg wrote:
> Well, what I meant was [...]

Hi Benno,

here's the updated patch.

For those who lost context, I also included the --help output of
the latest Git version (xargs-help-old.txt) and the new one
(xargs-help-new.txt).

Have a nice day,
Berny
>From ed9284f43e1a8ea1821d3abbad43d7c32e631d9f Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <[email protected]>
Date: Tue, 26 Feb 2013 09:14:09 +0100
Subject: [PATCH] xargs: split usage text to help translators

Smaller chunks are easier to handle for translators, ideally
one msgid per option.  Separate them.

Change "mandatory arguments ..." note: optional arguments to long
options are also optional for their corresponding short option.

Remove the general note about the meaning of square brackets - the
reader has to know this already.

Fix the long --replace option: the equal sign must go into the
square brackets: --replace[=R].

Clarify -l option: separate from -L to emphasize that MAX-LINES
is optional for the -l option; therefore, mention the optional
argument with the option as "-l[MAX-LINES]".

* xargs/xargs.c (usage): Define HTL macro to print one help text
line (or entry).  Split the option descriptions up by using the
above macro.  Refine the messages to adapt to the common way:
change the start of each option's description to lower case,
do not use periods at the end, use semicolons where needed,
indent secondary lines, several other minor improvements.

Reported by Benno Schulenberg in
http://lists.gnu.org/archive/html/bug-findutils/2013-02/msg00017.html
---
 xargs/xargs.c | 86 ++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 44 insertions(+), 42 deletions(-)

diff --git a/xargs/xargs.c b/xargs/xargs.c
index 5fd93cd..e827dfa 100644
--- a/xargs/xargs.c
+++ b/xargs/xargs.c
@@ -1584,46 +1584,48 @@ parse_num (char *str, int option, long int min, long int max, int fatal)
 static void
 usage (FILE *stream)
 {
-  fprintf (stream, _("\
-Usage: %s [OPTION]... COMMAND INITIAL-ARGS...\n\
-Run COMMAND with arguments INITIAL-ARGS and more arguments read from input.\n"),
-	   program_name);
-  fprintf (stream, _("\n\
-Mandatory arguments to long options are mandatory for short options too.\n\
-Non-mandatory arguments are indicated by [square brackets]\n\
-  -0, --null                   Items are separated by a null, not whitespace.\n\
-                               Disables quote and backslash processing\n\
-  -a, --arg-file=FILE          Read arguments from FILE, not standard input\n\
-  -d, --delimiter=CHARACTER    Input items are separated by CHARACTER, not by\n\
-                               blank space. Disables quote and backslash\n\
-                               processing\n\
-  -E END                       If END occurs as a line of input, the rest of\n\
-                               the input is ignored.\n\
-  -e [END], --eof[=END]        Equivalent to -E END if END is specified.\n\
-                               Otherwise, there is no end-of-file string\n\
-  --help                       Print a summary of the options to xargs.\n\
-  -I R                         same as --replace=R (R must be specified)\n\
-  -i,--replace=[R]             Replace R in initial arguments with names\n\
-                               read from standard input. If R is\n\
-                               unspecified, assume {}\n\
-  -L,-l, --max-lines=MAX-LINES Use at most MAX-LINES nonblank input lines per\n\
-                               command line\n\
-  -l                           Use at most one nonblank input line per\n\
-                               command line\n\
-  -n, --max-args=MAX-ARGS      Use at most MAX-ARGS arguments per command\n\
-                               line\n\
-  -P, --max-procs=MAX-PROCS    Run up to max-procs processes at a time\n\
-  -p, --interactive            Prompt before running commands\n\
-  --process-slot-var=VAR       Set environment variable VAR in child\n\
-                               processes\n\
-  -r, --no-run-if-empty        If there are no arguments, run no command.\n\
-                               If this option is not given, COMMAND will be\n\
-                               run at least once.\n\
-  -s, --max-chars=MAX-CHARS    Limit commands to MAX-CHARS at most\n\
-  --show-limits                Show limits on command-line length.\n\
-  -t, --verbose                Print commands before executing them\n\
-  --version                    Print the version number\n\
-  -x, --exit                   Exit if the size (see -s) is exceeded\n\
-"));
-  fputs (_("\nReport bugs to <[email protected]>.\n"), stream);
+  fprintf (stream,
+           _("Usage: %s [OPTION]... COMMAND [INITIAL-ARGS]...\n"),
+           program_name);
+
+#define HTL(t) fputs (t, stream);
+
+  HTL (_("Run COMMAND with arguments INITIAL-ARGS and more arguments read from input.\n"
+         "\n"));
+  HTL (_("Mandatory and optional arguments to long options are also\n"
+         "mandatory or optional for the corresponding short option.\n"));
+  HTL (_("  -0, --null                   items are separated by a null, not whitespace;\n"
+         "                                 disables quote and backslash processing\n"));
+  HTL (_("  -a, --arg-file=FILE          read arguments from FILE, not standard input\n"));
+  HTL (_("  -d, --delimiter=CHARACTER    items in input stream are separated by CHARACTER,\n"
+         "                                 not by whitespace; disables quote and backslash\n"
+         "                                 processing\n"));
+  HTL (_("  -E END                       if END occurs as a line of input, the rest of\n"
+         "                                 the input is ignored\n"));
+  HTL (_("  -e, --eof[=END]              equivalent to -E END if END is specified;\n"
+         "                                 otherwise, there is no end-of-file string\n"));
+  HTL (_("  -I R                         same as --replace=R\n"));
+  HTL (_("  -i, --replace[=R]            replace R in INITIAL-ARGS with names read\n"
+         "                                 from standard input; if R is unspecified,\n"
+         "                                 assume {}\n"));
+  HTL (_("  -L, --max-lines=MAX-LINES    use at most MAX-LINES non-blank input lines per\n"
+         "                                 command line\n"));
+  HTL (_("  -l[MAX-LINES]                similar to -L but defaults to at most one non-\n"
+         "                                 blank input line if MAX-LINES is not specified\n"));
+  HTL (_("  -n, --max-args=MAX-ARGS      use at most MAX-ARGS arguments per command line\n"));
+  HTL (_("  -P, --max-procs=MAX-PROCS    run at most MAX-PROCS processes at a time\n"));
+  HTL (_("  -p, --interactive            prompt before running commands\n"));
+  HTL (_("      --process-slot-var=VAR   set environment variable VAR in child processes\n"));
+  HTL (_("  -r, --no-run-if-empty        if there are no arguments, then do not run COMMAND;\n"
+         "                                 if this option is not given, COMMAND will be\n"
+         "                                 run at least once\n"));
+  HTL (_("  -s, --max-chars=MAX-CHARS    limit length of command line to MAX-CHARS\n"));
+  HTL (_("      --show-limits            show limits on command-line length\n"));
+  HTL (_("  -t, --verbose                print commands before executing them\n"));
+  HTL (_("  -x, --exit                   exit if the size (see -s) is exceeded\n"));
+
+  HTL (_("      --help                   display this help and exit\n"));
+  HTL (_("      --version                output version information and exit\n"));
+  HTL (_("\n"
+         "Report bugs to <[email protected]>.\n"));
 }
-- 
1.8.1.3.619.g7b6e784

Usage: ./xargs/xargs [OPTION]... COMMAND [INITIAL-ARGS]...
Run COMMAND with arguments INITIAL-ARGS and more arguments read from input.

Mandatory and optional arguments to long options are also
mandatory or optional for the corresponding short option.
  -0, --null                   items are separated by a null, not whitespace;
                                 disables quote and backslash processing
  -a, --arg-file=FILE          read arguments from FILE, not standard input
  -d, --delimiter=CHARACTER    items in input stream are separated by CHARACTER,
                                 not by whitespace; disables quote and backslash
                                 processing
  -E END                       if END occurs as a line of input, the rest of
                                 the input is ignored
  -e, --eof[=END]              equivalent to -E END if END is specified;
                                 otherwise, there is no end-of-file string
  -I R                         same as --replace=R
  -i, --replace[=R]            replace R in INITIAL-ARGS with names read
                                 from standard input; if R is unspecified,
                                 assume {}
  -L, --max-lines=MAX-LINES    use at most MAX-LINES non-blank input lines per
                                 command line
  -l[MAX-LINES]                similar to -L but defaults to at most one non-
                                 blank input line if MAX-LINES is not specified
  -n, --max-args=MAX-ARGS      use at most MAX-ARGS arguments per command line
  -P, --max-procs=MAX-PROCS    run at most MAX-PROCS processes at a time
  -p, --interactive            prompt before running commands
      --process-slot-var=VAR   set environment variable VAR in child processes
  -r, --no-run-if-empty        if there are no arguments, then do not run 
COMMAND;
                                 if this option is not given, COMMAND will be
                                 run at least once
  -s, --max-chars=MAX-CHARS    limit length of command line to MAX-CHARS
      --show-limits            show limits on command-line length
  -t, --verbose                print commands before executing them
  -x, --exit                   exit if the size (see -s) is exceeded
      --help                   display this help and exit
      --version                output version information and exit

Report bugs to <[email protected]>.
Usage: ./xargs/xargs [OPTION]... COMMAND INITIAL-ARGS...
Run COMMAND with arguments INITIAL-ARGS and more arguments read from input.

Mandatory arguments to long options are mandatory for short options too.
Non-mandatory arguments are indicated by [square brackets]
  -0, --null                   Items are separated by a null, not whitespace.
                               Disables quote and backslash processing
  -a, --arg-file=FILE          Read arguments from FILE, not standard input
  -d, --delimiter=CHARACTER    Input items are separated by CHARACTER, not by
                               blank space. Disables quote and backslash
                               processing
  -E END                       If END occurs as a line of input, the rest of
                               the input is ignored.
  -e [END], --eof[=END]        Equivalent to -E END if END is specified.
                               Otherwise, there is no end-of-file string
  --help                       Print a summary of the options to xargs.
  -I R                         same as --replace=R (R must be specified)
  -i,--replace=[R]             Replace R in initial arguments with names
                               read from standard input. If R is
                               unspecified, assume {}
  -L,-l, --max-lines=MAX-LINES Use at most MAX-LINES nonblank input lines per
                               command line
  -l                           Use at most one nonblank input line per
                               command line
  -n, --max-args=MAX-ARGS      Use at most MAX-ARGS arguments per command
                               line
  -P, --max-procs=MAX-PROCS    Run up to max-procs processes at a time
  -p, --interactive            Prompt before running commands
  --process-slot-var=VAR       Set environment variable VAR in child
                               processes
  -r, --no-run-if-empty        If there are no arguments, run no command.
                               If this option is not given, COMMAND will be
                               run at least once.
  -s, --max-chars=MAX-CHARS    Limit commands to MAX-CHARS at most
  --show-limits                Show limits on command-line length.
  -t, --verbose                Print commands before executing them
  --version                    Print the version number
  -x, --exit                   Exit if the size (see -s) is exceeded

Report bugs to <[email protected]>.

Reply via email to