]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
textual: use usage() text element macros
authorSami Kerola <kerolasa@iki.fi>
Sun, 28 Sep 2014 19:51:41 +0000 (20:51 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 1 Oct 2014 10:33:26 +0000 (12:33 +0200)
Translating these text elements should happen only once, which is
more likely when the text macros are used properly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
14 files changed:
disk-utils/mkfs.c
login-utils/chfn.c
misc-utils/getopt.c
misc-utils/look.c
misc-utils/namei.c
misc-utils/uuidd.c
misc-utils/uuidgen.c
misc-utils/wipefs.c
sys-utils/hwclock.c
term-utils/script.c
term-utils/scriptreplay.c
term-utils/write.c
text-utils/colrm.c
text-utils/rev.c

index f10ba2890ad34da70e7030cd49545a9219032c70..dbc938f1a39a467df3a762ac35d6d997533b70e0 100644 (file)
 
 static void __attribute__ ((__noreturn__)) usage(FILE * out)
 {
-       fprintf(out, _("Usage:\n"));
+       fputs(USAGE_HEADER, out);
        fprintf(out, _(" %s [options] [-t <type>] [fs-options] <device> [<size>]\n"),
                     program_invocation_short_name);
-
-       fprintf(out, _("\nOptions:\n"));
+       fputs(USAGE_OPTIONS, out);
        fprintf(out, _(" -t, --type=<type>  filesystem type; when unspecified, ext2 is used\n"));
        fprintf(out, _("     fs-options     parameters for the real filesystem builder\n"));
        fprintf(out, _("     <device>       path to the device to be used\n"));
index ca10fbfdbbe769f7cee68d41379f071466c9c755..25f7e91e3ec3511979d4eaf650845835e67d6ec6 100644 (file)
@@ -87,8 +87,8 @@ static void __attribute__((__noreturn__)) usage(FILE *fp)
        fputs(_(" -p, --office-phone <phone>   office phone number\n"), fp);
        fputs(_(" -h, --home-phone <phone>     home phone number\n"), fp);
        fputs(USAGE_SEPARATOR, fp);
-       fputs(_(" -u, --help     display this help and exit\n"), fp);
-       fputs(_(" -v, --version  output version information and exit\n"), fp);
+       fputs(USAGE_HELP, fp);
+       fputs(USAGE_VERSION, fp);
        fprintf(fp, USAGE_MAN_TAIL("chfn(1)"));
        exit(fp == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
index 74793ee15734b5e1268f6234b300acd19fbcc808..b82b62aa8170f49065de9d3e4e7b91d13ca424fd 100644 (file)
@@ -311,17 +311,15 @@ static void set_shell(const char *new_shell)
 
 static void __attribute__ ((__noreturn__)) print_help(void)
 {
-       fputs(_("\nUsage:\n"), stderr);
-
+       fputs(USAGE_HEADER, stderr);
        fprintf(stderr, _(
                " %1$s optstring parameters\n"
                " %1$s [options] [--] optstring parameters\n"
                " %1$s [options] -o|--options optstring [options] [--] parameters\n"),
                program_invocation_short_name);
 
-       fputs(_("\nOptions:\n"), stderr);
+       fputs(USAGE_OPTIONS, stderr);
        fputs(_(" -a, --alternative            Allow long options starting with single -\n"), stderr);
-       fputs(_(" -h, --help                   This small usage guide\n"), stderr);
        fputs(_(" -l, --longoptions <longopts> Long options to be recognized\n"), stderr);
        fputs(_(" -n, --name <progname>        The name under which errors are reported\n"), stderr);
        fputs(_(" -o, --options <optstring>    Short options to be recognized\n"), stderr);
@@ -330,9 +328,9 @@ static void __attribute__ ((__noreturn__)) print_help(void)
        fputs(_(" -s, --shell <shell>          Set shell quoting conventions\n"), stderr);
        fputs(_(" -T, --test                   Test for getopt(1) version\n"), stderr);
        fputs(_(" -u, --unquoted               Do not quote the output\n"), stderr);
-       fputs(_(" -V, --version                Output version information\n"), stderr);
-       fputc('\n', stderr);
-
+       fputs(USAGE_SEPARATOR, stderr);
+       fputs(USAGE_HELP, stderr);
+       fputs(USAGE_VERSION, stderr);
        fprintf(stderr, USAGE_MAN_TAIL("getopt(1)"));
        exit(PARAMETER_EXIT_CODE);
 }
index d519cf6fa910648ec5b3d08d60d65fb540bacbd3..51938f20b025b303b4c484d705852d127918c87d 100644 (file)
@@ -363,11 +363,10 @@ compare(char *s2, char *s2end) {
 
 static void __attribute__ ((__noreturn__)) usage(FILE * out)
 {
-       fputs(_("\nUsage:\n"), out),
+       fputs(USAGE_HEADER, out);
        fprintf(out,
              _(" %s [options] string [file]\n"), program_invocation_short_name);
-
-       fputs(_("\nOptions:\n"), out);
+       fputs(USAGE_OPTIONS, out);
        fputs(_(" -a, --alternative      use alternative dictionary\n"
                " -d, --alphanum         compare only alphanumeric characters\n"
                " -f, --ignore-case      ignore case differences when comparing\n"
index a4496bcaf5614066596f2fe47154092d172dfca7..ff58c9b4fa9ff1ea96ba0f603fafcd8db41ef15f 100644 (file)
@@ -424,11 +424,10 @@ static void usage(int rc)
        if (!*p)
                p = "namei";
 
-       fputs(_("\nUsage:\n"), out);
+       fputs(USAGE_HEADER, out);
        fprintf(out,
              _(" %s [options] <pathname>...\n"), p);
-
-       fputs(_("\nOptions:\n"), out);
+       fputs(USAGE_OPTIONS, out);
        fputs(_(" -h, --help          displays this help text\n"
                " -V, --version       output version information and exit\n"
                " -x, --mountpoints   show mount point directories with a 'D'\n"
index 8909b5178c9b0829379cdb399daaa2ef151568cc..55aac3534d3a6104c5f0553dfe6785e95d622bc8 100644 (file)
@@ -68,11 +68,11 @@ struct uuidd_cxt_t {
 
 static void __attribute__ ((__noreturn__)) usage(FILE * out)
 {
-       fputs(_("\nUsage:\n"), out);
+       fputs(USAGE_HEADER, out);
        fprintf(out,
              _(" %s [options]\n"), program_invocation_short_name);
 
-       fputs(_("\nOptions:\n"), out);
+       fputs(USAGE_OPTIONS, out);
        fputs(_(" -p, --pid <path>        path to pid file\n"
                " -s, --socket <path>     path to socket\n"
                " -T, --timeout <sec>     specify inactivity timeout\n"
index 3883424e92b6b9fe7417984a5907be89c5130b32..48c6562fd499eb802b035de4dd3769e41f52d1b0 100644 (file)
@@ -28,11 +28,11 @@ extern int optind;
 
 static void __attribute__ ((__noreturn__)) usage(FILE * out)
 {
-       fputs(_("\nUsage:\n"), out);
+       fputs(USAGE_HEADER, out);
        fprintf(out,
              _(" %s [options]\n"), program_invocation_short_name);
 
-       fputs(_("\nOptions:\n"), out);
+       fputs(USAGE_OPTIONS, out);
        fputs(_(" -r, --random     generate random-based uuid\n"
                " -t, --time       generate time-based uuid\n"
                " -V, --version    output version information and exit\n"
index 0671bb4d024a7c6c1741ddb1a8e7435e6fcb6c5c..70c3f238b310491877e95438e96366c656b089aa 100644 (file)
@@ -448,11 +448,10 @@ do_wipe(struct wipe_desc *wp, const char *devname, int flags)
 static void __attribute__((__noreturn__))
 usage(FILE *out)
 {
-       fputs(_("\nUsage:\n"), out);
+       fputs(USAGE_HEADER, out);
        fprintf(out,
              _(" %s [options] <device>\n"), program_invocation_short_name);
-
-       fputs(_("\nOptions:\n"), out);
+       fputs(USAGE_OPTIONS, out);
        fputs(_(" -a, --all           wipe all magic strings (BE CAREFUL!)\n"
                " -b, --backup        create a signature backup in $HOME\n"
                " -f, --force         force erasure\n"
index 9151d246ec443678cb6c0660a9dc2cdae5e33f49..493ee8808f853383577b7e6dfeaf15cb96a4aeb0 100644 (file)
@@ -1563,7 +1563,7 @@ static void usage(const char *fmt, ...)
 
        usageto = fmt ? stderr : stdout;
 
-       fputs(_("\nUsage:\n"), usageto);
+       fputs(USAGE_HEADER, usageto);
        fputs(_(" hwclock [function] [option...]\n"), usageto);
 
        fputs(_("\nFunctions:\n"), usageto);
@@ -1584,7 +1584,7 @@ static void usage(const char *fmt, ...)
        fputs(_("     --predict        predict RTC reading at time given with --date\n"
                " -V, --version        display version information and exit\n"), usageto);
 
-       fputs(_("\nOptions:\n"), usageto);
+       fputs(USAGE_OPTIONS, usageto);
        fputs(_(" -u, --utc            the hardware clock is kept in UTC\n"
                "     --localtime      the hardware clock is kept in local time\n"), usageto);
 #ifdef __linux__
index d2b897416f482759159ead9bea86e1eb0e8ba162..7d3787e96a410403e9dac0c6520855865133d39e 100644 (file)
@@ -138,11 +138,11 @@ die_if_link(char *fn) {
 static void __attribute__((__noreturn__))
 usage(FILE *out)
 {
-       fputs(_("\nUsage:\n"), out);
+       fputs(USAGE_HEADER, out);
        fprintf(out,
              _(" %s [options] [file]\n"), program_invocation_short_name);
 
-       fputs(_("\nOptions:\n"), out);
+       fputs(USAGE_OPTIONS, out);
        fputs(_(" -a, --append            append the output\n"
                " -c, --command <command> run command rather than interactive shell\n"
                " -e, --return            return exit code of the child process\n"
index 7ac50d86864d26c95e046085dfb5511f51b2009e..fb5ded31ed75e1610fe4da76af5a0558611952b5 100644 (file)
 static void __attribute__((__noreturn__))
 usage(FILE *out)
 {
-       fputs(_("\nUsage:\n"), out);
+       fputs(USAGE_HEADER, out);
        fprintf(out,
              _(" %s [-t] timingfile [typescript] [divisor]\n"),
              program_invocation_short_name);
 
-       fputs(_("\nOptions:\n"), out);
+       fputs(USAGE_OPTIONS, out);
        fputs(_(" -t, --timing <file>     script timing output file\n"
                " -s, --typescript <file> script terminal session output file\n"
                " -d, --divisor <num>     speed up or slow down execution with time divisor\n"
index e64bb439c961068fe7b32c43283425bb600be3be..ca40354f723387172d88da61a07fde218eebefbf 100644 (file)
@@ -77,14 +77,14 @@ static gid_t root_access;
 
 static void __attribute__ ((__noreturn__)) usage(FILE * out)
 {
-       fputs(_("\nUsage:\n"), out);
+       fputs(USAGE_HEADER, out);
        fprintf(out,
              _(" %s [options] <user> [<ttyname>]\n"),
              program_invocation_short_name);
 
-       fputs(_("\nOptions:\n"), out);
-       fputs(_(" -V, --version    output version information and exit\n"
-               " -h, --help       display this help and exit\n\n"), out);
+       fputs(USAGE_OPTIONS, out);
+       fputs(USAGE_HELP, out);
+       fputs(USAGE_VERSION, out);
 
        fprintf(out, USAGE_MAN_TAIL("write(1)"));
        exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
index f67524a6a9533510040de2043420dfd8400c2b6c..4264fe6b029cf4e21f2a6a157e7c81c64cae339c 100644 (file)
@@ -59,14 +59,11 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
        fprintf(out, _("\nUsage:\n"
                       " %s [startcol [endcol]]\n"),
                       program_invocation_short_name);
-
-       fprintf(out, _("\nOptions:\n"
-                      " -V, --version   output version information and exit\n"
-                      " -h, --help      display this help and exit\n\n"));
-
+       fputs(USAGE_OPTIONS, out);
+       fputs(USAGE_HELP, out);
+       fputs(USAGE_VERSION, out);
        fprintf(out, _("%s reads from standard input and writes to standard output\n\n"),
                       program_invocation_short_name);
-
        fprintf(out, USAGE_MAN_TAIL("colrm(1)"));
        exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
index 60ad7521bc6d78753bc39b0e4beda33382e214d9..bda31d2d88d44c3898bb6bc4f625adbd0ceb334e 100644 (file)
@@ -76,11 +76,9 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
 {
        fprintf(out, _("Usage: %s [options] [file ...]\n"),
                program_invocation_short_name);
-
-       fprintf(out, _("\nOptions:\n"
-                      " -V, --version   output version information and exit\n"
-                      " -h, --help      display this help and exit\n"));
-
+       fputs(USAGE_OPTIONS, out);
+       fputs(USAGE_HELP, out);
+       fputs(USAGE_VERSION, out);
        fprintf(out, USAGE_MAN_TAIL("rev(1)"));
 
        exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);