>From 4eaadb47430f21aee83eb920378be01945845a9a Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Wed, 23 Jan 2013 01:03:38 +0100 Subject: [PATCH] maint: define usage note about mandatory args centrally Each program with at least one long option which is marked as 'required_argument' and which has also a short option for that option, should print a note about mandatory arguments. Define that well-known note centrally and use it rather than literal printf/fputs, and add it where it was missing. * src/system.h (emit_mandatory_arg_note): Add new function. * src/cp.c (usage): Use it rather than literal printf/fputs. * src/csplit.c, src/cut.c, src/date.c, src/df.c, src/du.c: * src/expand.c, src/fmt.c, src/fold.c, src/head.c, src/install.c: * src/kill.c, src/ln.c, src/ls.c, src/mkdir.c, src/mkfifo.c: * src/mknod.c, src/mv.c, src/nl.c, src/od.c, src/paste.c: * src/pr.c, src/ptx.c, src/shred.c, src/shuf.c, src/sort.c: * src/split.c, src/stdbuf.c, src/tac.c, src/tail.c, src/timeout.c: * src/touch.c, src/truncate.c, src/unexpand.c, src/uniq.c: Likewise. * src/base64.c (usage): Add call of the above new function because at least one long option has a required argument. * src/basename.c, src/chcon.c, src/date.c, src/env.c: * src/nice.c, src/runcon.c, src/seq.c, src/stat.c, src/stty.c: Likewise. --- src/base64.c | 5 ++++- src/basename.c | 3 ++- src/chcon.c | 4 +++- src/cp.c | 7 +++---- src/csplit.c | 7 +++---- src/cut.c | 7 +++---- src/date.c | 6 +++++- src/df.c | 7 +++---- src/du.c | 7 +++---- src/env.c | 6 +++++- src/expand.c | 7 +++---- src/fmt.c | 7 +++---- src/fold.c | 7 +++---- src/head.c | 7 +++---- src/install.c | 7 +++---- src/kill.c | 7 +++---- src/ln.c | 7 +++---- src/ls.c | 7 +++---- src/mkdir.c | 7 +++---- src/mkfifo.c | 7 +++---- src/mknod.c | 7 +++---- src/mv.c | 7 +++---- src/nice.c | 8 ++++++-- src/nl.c | 7 +++---- src/od.c | 7 +++---- src/paste.c | 7 +++---- src/pr.c | 7 +++---- src/ptx.c | 7 +++---- src/runcon.c | 6 +++++- src/seq.c | 6 +++++- src/shred.c | 7 +++---- src/shuf.c | 7 +++---- src/sort.c | 7 +++---- src/split.c | 7 +++---- src/stat.c | 6 +++++- src/stdbuf.c | 7 +++---- src/stty.c | 6 +++++- src/system.h | 8 ++++++++ src/tac.c | 7 +++---- src/tail.c | 7 +++---- src/timeout.c | 5 +++-- src/touch.c | 7 +++---- src/truncate.c | 7 +++---- src/unexpand.c | 7 +++---- src/uniq.c | 7 +++---- 45 files changed, 155 insertions(+), 145 deletions(-) diff --git a/src/base64.c b/src/base64.c index 675519f..0a40068 100644 --- a/src/base64.c +++ b/src/base64.c @@ -60,7 +60,10 @@ usage (int status) printf (_("\ Usage: %s [OPTION]... [FILE]\n\ Base64 encode or decode FILE, or standard input, to standard output.\n\ -\n"), program_name); +"), program_name); + + emit_mandatory_arg_note (); + fputs (_("\ -d, --decode decode data\n\ -i, --ignore-garbage when decoding, ignore non-alphabet characters\n\ diff --git a/src/basename.c b/src/basename.c index 79ce1df..074d284 100644 --- a/src/basename.c +++ b/src/basename.c @@ -53,9 +53,10 @@ Usage: %s NAME [SUFFIX]\n\ fputs (_("\ Print NAME with any leading directory components removed.\n\ If specified, also remove a trailing SUFFIX.\n\ -\n\ "), stdout); + emit_mandatory_arg_note (); + fputs (_("\ -a, --multiple support multiple arguments and treat each as a NAME\n\ -s, --suffix=SUFFIX remove a trailing SUFFIX\n\ diff --git a/src/chcon.c b/src/chcon.c index 9051ec6..56f2caa 100644 --- a/src/chcon.c +++ b/src/chcon.c @@ -357,8 +357,10 @@ Usage: %s [OPTION]... CONTEXT FILE...\n\ fputs (_("\ Change the security context of each FILE to CONTEXT.\n\ With --reference, change the security context of each FILE to that of RFILE.\n\ -\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ --dereference affect the referent of each symbolic link (this is\n\ the default), rather than the symbolic link itself\n\ diff --git a/src/cp.c b/src/cp.c index 625ea0b..0d64f9f 100644 --- a/src/cp.c +++ b/src/cp.c @@ -161,11 +161,10 @@ Usage: %s [OPTION]... [-T] SOURCE DEST\n\ program_name, program_name, program_name); fputs (_("\ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -a, --archive same as -dR --preserve=all\n\ --attributes-only don't copy the file data, just the attributes\n\ diff --git a/src/csplit.c b/src/csplit.c index a8b5694..22f3ad4 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -1455,11 +1455,10 @@ Usage: %s [OPTION]... FILE PATTERN...\n\ fputs (_("\ Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ...,\n\ and output byte counts of each piece to standard output.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -b, --suffix-format=FORMAT use sprintf FORMAT instead of %02d\n\ -f, --prefix=PREFIX use PREFIX instead of 'xx'\n\ diff --git a/src/cut.c b/src/cut.c index 7e877cb..4059ecc 100644 --- a/src/cut.c +++ b/src/cut.c @@ -192,11 +192,10 @@ Usage: %s OPTION... [FILE]...\n\ program_name); fputs (_("\ Print selected parts of lines from each FILE to standard output.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -b, --bytes=LIST select only these bytes\n\ -c, --characters=LIST select only these characters\n\ diff --git a/src/date.c b/src/date.c index 0a434a6..ec66f76 100644 --- a/src/date.c +++ b/src/date.c @@ -127,7 +127,11 @@ Usage: %s [OPTION]... [+FORMAT]\n\ program_name, program_name); fputs (_("\ Display the current time in the given FORMAT, or set the system date.\n\ -\n\ +"), stdout); + + emit_mandatory_arg_note (); + + fputs (_("\ -d, --date=STRING display time described by STRING, not 'now'\n\ -f, --file=DATEFILE like --date once for each line of DATEFILE\n\ -I[TIMESPEC], --iso-8601[=TIMESPEC] output date/time in ISO 8601 format.\n\ diff --git a/src/df.c b/src/df.c index 6c4d653..9523cc1 100644 --- a/src/df.c +++ b/src/df.c @@ -1175,11 +1175,10 @@ usage (int status) fputs (_("\ Show information about the file system on which each FILE resides,\n\ or all file systems by default.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -a, --all include dummy file systems\n\ -B, --block-size=SIZE scale sizes by SIZE before printing them. E.g.,\n\ diff --git a/src/du.c b/src/du.c index 9b7f8de..5388466 100644 --- a/src/du.c +++ b/src/du.c @@ -273,11 +273,10 @@ Usage: %s [OPTION]... [FILE]...\n\ "), program_name, program_name); fputs (_("\ Summarize disk usage of each FILE, recursively for directories.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -a, --all write counts for all files, not just directories\n\ --apparent-size print apparent sizes, rather than disk usage; although\ diff --git a/src/env.c b/src/env.c index 4a3f924..c31d165 100644 --- a/src/env.c +++ b/src/env.c @@ -54,7 +54,11 @@ Usage: %s [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]\n"), program_name); fputs (_("\ Set each NAME to VALUE in the environment and run COMMAND.\n\ -\n\ +"), stdout); + + emit_mandatory_arg_note (); + + fputs (_("\ -i, --ignore-environment start with an empty environment\n\ -0, --null end each output line with 0 byte rather than newline\n\ -u, --unset=NAME remove variable from the environment\n\ diff --git a/src/expand.c b/src/expand.c index 11cbacf..0b12b02 100644 --- a/src/expand.c +++ b/src/expand.c @@ -107,11 +107,10 @@ Usage: %s [OPTION]... [FILE]...\n\ fputs (_("\ Convert tabs in each FILE to spaces, writing to standard output.\n\ With no FILE, or when FILE is -, read standard input.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -i, --initial do not convert tabs after non blanks\n\ -t, --tabs=NUMBER have tabs NUMBER characters apart, not 8\n\ diff --git a/src/fmt.c b/src/fmt.c index 750401d..d3f5369 100644 --- a/src/fmt.c +++ b/src/fmt.c @@ -271,11 +271,10 @@ usage (int status) fputs (_("\ Reformat each paragraph in the FILE(s), writing to standard output.\n\ The option -WIDTH is an abbreviated form of --width=DIGITS.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -c, --crown-margin preserve indentation of first two lines\n\ -p, --prefix=STRING reformat only lines beginning with STRING,\n\ diff --git a/src/fold.c b/src/fold.c index c741da2..e235865 100644 --- a/src/fold.c +++ b/src/fold.c @@ -70,11 +70,10 @@ Usage: %s [OPTION]... [FILE]...\n\ fputs (_("\ Wrap input lines in each FILE (standard input by default), writing to\n\ standard output.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -b, --bytes count bytes rather than columns\n\ -s, --spaces break at spaces\n\ diff --git a/src/head.c b/src/head.c index cf84a95..306c1b8 100644 --- a/src/head.c +++ b/src/head.c @@ -110,11 +110,10 @@ Usage: %s [OPTION]... [FILE]...\n\ Print the first 10 lines of each FILE to standard output.\n\ With more than one FILE, precede each with a header giving the file name.\n\ With no FILE, or when FILE is -, read standard input.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -c, --bytes=[-]K print the first K bytes of each file;\n\ with the leading '-', print all but the last\n\ diff --git a/src/install.c b/src/install.c index cefee0c..55333c2 100644 --- a/src/install.c +++ b/src/install.c @@ -608,11 +608,10 @@ like yum(1) or apt-get(1).\n\ In the first three forms, copy SOURCE to DEST or multiple SOURCE(s) to\n\ the existing DIRECTORY, while setting permission modes and owner/group.\n\ In the 4th form, create all components of the given DIRECTORY(ies).\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ --backup[=CONTROL] make a backup of each existing destination file\n\ -b like --backup but does not accept an argument\n\ diff --git a/src/kill.c b/src/kill.c index 76f013c..d1b836b 100644 --- a/src/kill.c +++ b/src/kill.c @@ -81,11 +81,10 @@ Usage: %s [-s SIGNAL | -SIGNAL] PID...\n\ program_name, program_name, program_name); fputs (_("\ Send signals to processes, or list signals.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -s, --signal=SIGNAL, -SIGNAL\n\ specify the name or number of the signal to be sent\n\ diff --git a/src/ln.c b/src/ln.c index c85fc96..e6c01b3 100644 --- a/src/ln.c +++ b/src/ln.c @@ -387,11 +387,10 @@ By default, each destination (name of new link) should not already exist.\n\ When creating hard links, each TARGET must exist. Symbolic links\n\ can hold arbitrary text; if later resolved, a relative link is\n\ interpreted in relation to its parent directory.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ --backup[=CONTROL] make a backup of each existing destination file\n\ -b like --backup but does not accept an argument\n\ diff --git a/src/ls.c b/src/ls.c index 37f6109..f1ed43b 100644 --- a/src/ls.c +++ b/src/ls.c @@ -4721,11 +4721,10 @@ usage (int status) fputs (_("\ List information about the FILEs (the current directory by default).\n\ Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -a, --all do not ignore entries starting with .\n\ -A, --almost-all do not list implied . and ..\n\ diff --git a/src/mkdir.c b/src/mkdir.c index 5f49395..a94f96e 100644 --- a/src/mkdir.c +++ b/src/mkdir.c @@ -56,11 +56,10 @@ usage (int status) printf (_("Usage: %s [OPTION]... DIRECTORY...\n"), program_name); fputs (_("\ Create the DIRECTORY(ies), if they do not already exist.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -m, --mode=MODE set file mode (as in chmod), not a=rwx - umask\n\ -p, --parents no error if existing, make parent directories as needed\n\ diff --git a/src/mkfifo.c b/src/mkfifo.c index 06ce5e9..76291e5 100644 --- a/src/mkfifo.c +++ b/src/mkfifo.c @@ -51,11 +51,10 @@ usage (int status) printf (_("Usage: %s [OPTION]... NAME...\n"), program_name); fputs (_("\ Create named pipes (FIFOs) with the given NAMEs.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -m, --mode=MODE set file permission bits to MODE, not a=rw - umask\n\ "), stdout); diff --git a/src/mknod.c b/src/mknod.c index 14fcec7..7cfc708 100644 --- a/src/mknod.c +++ b/src/mknod.c @@ -53,11 +53,10 @@ usage (int status) program_name); fputs (_("\ Create the special file NAME of the given TYPE.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -m, --mode=MODE set file permission bits to MODE, not a=rw - umask\n\ "), stdout); diff --git a/src/mv.c b/src/mv.c index cb5cb32..a5e8e08 100644 --- a/src/mv.c +++ b/src/mv.c @@ -291,11 +291,10 @@ Usage: %s [OPTION]... [-T] SOURCE DEST\n\ program_name, program_name, program_name); fputs (_("\ Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ --backup[=CONTROL] make a backup of each existing destination file\ \n\ diff --git a/src/nice.c b/src/nice.c index ce2b6e7..04fd3bf 100644 --- a/src/nice.c +++ b/src/nice.c @@ -74,10 +74,14 @@ usage (int status) Run COMMAND with an adjusted niceness, which affects process scheduling.\n\ With no COMMAND, print the current niceness. Niceness values range from\n\ %d (most favorable to the process) to %d (least favorable to the process).\n\ -\n\ - -n, --adjustment=N add integer N to the niceness (default 10)\n\ "), - NZERO, NZERO - 1); + + emit_mandatory_arg_note (); + + fputs (_("\ + -n, --adjustment=N add integer N to the niceness (default 10)\n\ +"), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME); diff --git a/src/nl.c b/src/nl.c index a701340..96716aa 100644 --- a/src/nl.c +++ b/src/nl.c @@ -179,11 +179,10 @@ Usage: %s [OPTION]... [FILE]...\n\ fputs (_("\ Write each FILE to standard output, with line numbers added.\n\ With no FILE, or when FILE is -, read standard input.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -b, --body-numbering=STYLE use STYLE for numbering body lines\n\ -d, --section-delimiter=CC use CC for separating logical pages\n\ diff --git a/src/od.c b/src/od.c index e7ec59a..ffccd74 100644 --- a/src/od.c +++ b/src/od.c @@ -311,11 +311,10 @@ An OFFSET operand means -j OFFSET. LABEL is the pseudo-address\n\ at first byte printed, incremented when dump is progressing.\n\ For OFFSET and LABEL, a 0x or 0X prefix indicates hexadecimal;\n\ suffixes may be . for octal and b for multiply by 512.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -A, --address-radix=RADIX output format for file offsets. RADIX is one\n\ of [doxn], for Decimal, Octal, Hex or None\n\ diff --git a/src/paste.c b/src/paste.c index a48eda8..bc9fa76 100644 --- a/src/paste.c +++ b/src/paste.c @@ -440,11 +440,10 @@ Usage: %s [OPTION]... [FILE]...\n\ Write lines consisting of the sequentially corresponding lines from\n\ each FILE, separated by TABs, to standard output.\n\ With no FILE, or when FILE is -, read standard input.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -d, --delimiters=LIST reuse characters from LIST instead of TABs\n\ -s, --serial paste one file at a time instead of in parallel\n\ diff --git a/src/pr.c b/src/pr.c index ac6ec50..f4b0b69 100644 --- a/src/pr.c +++ b/src/pr.c @@ -2756,11 +2756,10 @@ Usage: %s [OPTION]... [FILE]...\n\ fputs (_("\ Paginate or columnate FILE(s) for printing.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ +FIRST_PAGE[:LAST_PAGE], --pages=FIRST_PAGE[:LAST_PAGE]\n\ begin [stop] printing with page FIRST_[LAST_]PAGE\n\ diff --git a/src/ptx.c b/src/ptx.c index fb28b0e..f993673 100644 --- a/src/ptx.c +++ b/src/ptx.c @@ -1820,11 +1820,10 @@ Usage: %s [OPTION]... [INPUT]... (without -G)\n\ program_name, program_name); fputs (_("\ Output a permuted index, including context, of the words in the input files.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -A, --auto-reference output automatically generated references\n\ -G, --traditional behave more like System V 'ptx'\n\ diff --git a/src/runcon.c b/src/runcon.c index 5548776..8a0b34e 100644 --- a/src/runcon.c +++ b/src/runcon.c @@ -87,7 +87,11 @@ Usage: %s CONTEXT COMMAND [args]\n\ fputs (_("\ Run a program in a different security context.\n\ With neither CONTEXT nor COMMAND, print the current security context.\n\ -\n\ +"), stdout); + + emit_mandatory_arg_note (); + + fputs (_("\ CONTEXT Complete security context\n\ -c, --compute compute process transition context before modifying\n\ -t, --type=TYPE type (for same role as parent)\n\ diff --git a/src/seq.c b/src/seq.c index e1b467c..22e5ec5 100644 --- a/src/seq.c +++ b/src/seq.c @@ -72,7 +72,11 @@ Usage: %s [OPTION]... LAST\n\ "), program_name, program_name, program_name); fputs (_("\ Print numbers from FIRST to LAST, in steps of INCREMENT.\n\ -\n\ +"), stdout); + + emit_mandatory_arg_note (); + + fputs (_("\ -f, --format=FORMAT use printf style floating-point FORMAT\n\ -s, --separator=STRING use STRING to separate numbers (default: \\n)\n\ -w, --equal-width equalize width by padding with leading zeroes\n\ diff --git a/src/shred.c b/src/shred.c index 3b5bd3f..9b869cd 100644 --- a/src/shred.c +++ b/src/shred.c @@ -148,11 +148,10 @@ usage (int status) fputs (_("\ Overwrite the specified FILE(s) repeatedly, in order to make it harder\n\ for even very expensive hardware probing to recover the data.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + printf (_("\ -f, --force change permissions to allow writing if necessary\n\ -n, --iterations=N overwrite N times instead of the default (%d)\n\ diff --git a/src/shuf.c b/src/shuf.c index 09d245a..71ac3e6 100644 --- a/src/shuf.c +++ b/src/shuf.c @@ -53,11 +53,10 @@ Usage: %s [OPTION]... [FILE]\n\ program_name, program_name, program_name); fputs (_("\ Write a random permutation of the input lines to standard output.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -e, --echo treat each ARG as an input line\n\ -i, --input-range=LO-HI treat each number LO through HI as an input line\n\ diff --git a/src/sort.c b/src/sort.c index 43f8f51..7410abc 100644 --- a/src/sort.c +++ b/src/sort.c @@ -398,11 +398,10 @@ Usage: %s [OPTION]... [FILE]...\n\ program_name, program_name); fputs (_("\ Write sorted concatenation of all FILE(s) to standard output.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ Ordering options:\n\ \n\ diff --git a/src/split.c b/src/split.c index 9774cc6..e5e75f0 100644 --- a/src/split.c +++ b/src/split.c @@ -209,11 +209,10 @@ Usage: %s [OPTION]... [INPUT [PREFIX]]\n\ Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...; default\n\ size is 1000 lines, and default PREFIX is 'x'. With no INPUT, or when INPUT\n\ is -, read standard input.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fprintf (stdout, _("\ -a, --suffix-length=N generate suffixes of length N (default %d)\n\ --additional-suffix=SUFFIX append an additional SUFFIX to file names.\n\ diff --git a/src/stat.c b/src/stat.c index 92567ba..dd210d1 100644 --- a/src/stat.c +++ b/src/stat.c @@ -1349,7 +1349,11 @@ usage (int status) printf (_("Usage: %s [OPTION]... FILE...\n"), program_name); fputs (_("\ Display file or file system status.\n\ -\n\ +"), stdout); + + emit_mandatory_arg_note (); + + fputs (_("\ -L, --dereference follow links\n\ -f, --file-system display file system status instead of file status\n\ "), stdout); diff --git a/src/stdbuf.c b/src/stdbuf.c index bdea0b1..38e9bee 100644 --- a/src/stdbuf.c +++ b/src/stdbuf.c @@ -90,11 +90,10 @@ usage (int status) printf (_("Usage: %s OPTION... COMMAND\n"), program_name); fputs (_("\ Run COMMAND, with modified buffering operations for its standard streams.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -i, --input=MODE adjust standard input stream buffering\n\ -o, --output=MODE adjust standard output stream buffering\n\ diff --git a/src/stty.c b/src/stty.c index 578696c..fe0f22f 100644 --- a/src/stty.c +++ b/src/stty.c @@ -515,7 +515,11 @@ Usage: %s [-F DEVICE | --file=DEVICE] [SETTING]...\n\ program_name, program_name, program_name); fputs (_("\ Print or change terminal characteristics.\n\ -\n\ +"), stdout); + + emit_mandatory_arg_note (); + + fputs (_("\ -a, --all print all current settings in human-readable form\n\ -g, --save print all current settings in a stty-readable form\n\ -F, --file=DEVICE open and use the specified DEVICE instead of stdin\n\ diff --git a/src/system.h b/src/system.h index a13a566..1677999 100644 --- a/src/system.h +++ b/src/system.h @@ -539,6 +539,14 @@ is_nul (const char *buf, size_t bufsize) ) static inline void +emit_mandatory_arg_note (void) +{ + fputs (_("\n\ +Mandatory arguments to long options are mandatory for short options too.\n\ +"), stdout); +} + +static inline void emit_size_note (void) { fputs (_("\n\ diff --git a/src/tac.c b/src/tac.c index 20a45bf..c6a8cf6 100644 --- a/src/tac.c +++ b/src/tac.c @@ -137,11 +137,10 @@ Usage: %s [OPTION]... [FILE]...\n\ fputs (_("\ Write each FILE to standard output, last line first.\n\ With no FILE, or when FILE is -, read standard input.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -b, --before attach the separator before instead of after\n\ -r, --regex interpret the separator as a regular expression\n\ diff --git a/src/tail.c b/src/tail.c index ba8443c..ca851ee 100644 --- a/src/tail.c +++ b/src/tail.c @@ -263,11 +263,10 @@ Usage: %s [OPTION]... [FILE]...\n\ Print the last %d lines of each FILE to standard output.\n\ With more than one FILE, precede each with a header giving the file name.\n\ With no FILE, or when FILE is -, read standard input.\n\ -\n\ "), DEFAULT_N_LINES); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ -"), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -c, --bytes=K output the last K bytes; alternatively, use -c +K\n\ to output bytes starting with the Kth of each file\n\ diff --git a/src/timeout.c b/src/timeout.c index 1598dd2..b163a0e 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -213,9 +213,10 @@ Usage: %s [OPTION] DURATION COMMAND [ARG]...\n\ fputs (_("\ Start COMMAND, and kill it if still running after DURATION.\n\ -\n\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ --preserve-status\n\ exit with the same status as COMMAND, even when the\n\ diff --git a/src/touch.c b/src/touch.c index d4e4bff..2806ef7 100644 --- a/src/touch.c +++ b/src/touch.c @@ -218,11 +218,10 @@ is supplied.\n\ \n\ A FILE argument string of - is handled specially and causes touch to\n\ change the times of the file associated with standard output.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -a change only the access time\n\ -c, --no-create do not create any files\n\ diff --git a/src/truncate.c b/src/truncate.c index bb095fe..44ff1cf 100644 --- a/src/truncate.c +++ b/src/truncate.c @@ -102,11 +102,10 @@ A FILE argument that does not exist is created.\n\ If a FILE is larger than the specified size, the extra data is lost.\n\ If a FILE is shorter, it is extended and the extended part (hole)\n\ reads as zero bytes.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -c, --no-create do not create any files\n\ "), stdout); diff --git a/src/unexpand.c b/src/unexpand.c index 1fcb0fd..1803cd5 100644 --- a/src/unexpand.c +++ b/src/unexpand.c @@ -117,11 +117,10 @@ Usage: %s [OPTION]... [FILE]...\n\ fputs (_("\ Convert blanks in each FILE to tabs, writing to standard output.\n\ With no FILE, or when FILE is -, read standard input.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -a, --all convert all blanks, instead of just initial blanks\n\ --first-only convert only leading sequences of blanks (overrides -a)\n\ diff --git a/src/uniq.c b/src/uniq.c index 7073958..5efdad7 100644 --- a/src/uniq.c +++ b/src/uniq.c @@ -140,11 +140,10 @@ Filter adjacent matching lines from INPUT (or standard input),\n\ writing to OUTPUT (or standard output).\n\ \n\ With no options, matching lines are merged to the first occurrence.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -c, --count prefix lines by the number of occurrences\n\ -d, --repeated only print duplicate lines\n\ -- 1.7.7