]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: fixes to USAGE_* macros
authorSami Kerola <kerolasa@iki.fi>
Sat, 17 Sep 2011 10:52:32 +0000 (12:52 +0200)
committerSami Kerola <kerolasa@iki.fi>
Sat, 17 Sep 2011 13:07:52 +0000 (15:07 +0200)
The USAGE_BEGIN_TAIL is removed as unnecessary.

In between command specific options and --help & --version
USAGE_SEPARATOR is inserted. For now the separator is empty line.

The USAGE_MAN_TAIL is changed to take an argument.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Documentation/howto-usage-function.txt
include/c.h
sys-utils/arch.c
sys-utils/ctrlaltdel.c
sys-utils/ipcmk.c
sys-utils/ipcrm.c
sys-utils/ipcs.c
sys-utils/pivot_root.c

index f717293d9aff5354838c1eeafedc9eaefd2bec90..18ee3de865b46173e46e7ad087534915e223716f 100644 (file)
@@ -56,6 +56,7 @@ Options:
                            description on two, or multiple lines, where the
                            consecutive lines are intended by two spaces
  -f, --foobar            next option description resets indent
+
  -h, --help     display this help and exit
  -V, --version  output version information and exit
 
@@ -83,9 +84,8 @@ translation work.
 The argument, e.g. `arg', can be better. For example if an option is
 expecting number as argument a `num' is suitable argument description.
 
-Order of the options has no special meaning. It is good idea to write
-options that are somehow related next to each other. Usually --help and
---version, in this order, are last options in print out.
+Order of the options has no special meaning, with a exception of --help and
+--version which are expected to be last ones of the list.
 
 Last line of the usage print out is either empty, or a message informing
 about manual page. For example: `For more details see example(1).' In
index 975cc1bf4c54998921b7b94f864cd1047db2bdf2..ba274f45fd7df0d6da28d10b02409a4a4401693b 100644 (file)
@@ -216,10 +216,10 @@ static inline int dirfd(DIR *d)
  */
 #define USAGE_HEADER     _("\nUsage:\n")
 #define USAGE_OPTIONS    _("\nOptions:\n")
+#define USAGE_SEPARATOR  _("\n")
 #define USAGE_HELP       _(" -h, --help     display this help and exit\n")
 #define USAGE_VERSION    _(" -V, --version  output version information and exit\n")
-#define USAGE_BEGIN_TAIL _("\n")
-#define USAGE_MAN_TAIL   _("For more details see %s.\n")
+#define USAGE_MAN_TAIL(_man)   _("\nFor more details see %s.\n"), _man
 
 #define UTIL_LINUX_VERSION _("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING
 
index 47aad7c975fd2273bcfcd7f88ffe3cb99630cb8a..f8b795ceaecdeb508a605bf0e25960527e71c90d 100644 (file)
@@ -33,11 +33,10 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
        fprintf(out, " %s\n", program_invocation_short_name);
        fprintf(out, USAGE_OPTIONS);
        /* Additional options to here. */
+       fprintf(out, USAGE_SEPARATOR);
        fprintf(out, USAGE_HELP);
        fprintf(out, USAGE_VERSION);
-       fprintf(out, USAGE_BEGIN_TAIL);
-       /* Remove USAGE_MAN_TAIL line when man page does not exist. */
-       fprintf(out, USAGE_MAN_TAIL, "arch(1)");
+       fprintf(out, USAGE_MAN_TAIL("arch(1)"));
        exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
index 8805435d4da6ca7a5123a8f9e1fbb2dfb93059ce..db96fccc4dc66c3cb1eb3281a465e38b0328cb28 100644 (file)
@@ -19,10 +19,10 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
        fprintf(out, USAGE_HEADER);
        fprintf(out, _(" %s <hard|soft>\n"), program_invocation_short_name);
        fprintf(out, USAGE_OPTIONS);
+       fprintf(out, USAGE_SEPARATOR);
        fprintf(out, USAGE_HELP);
        fprintf(out, USAGE_VERSION);
-       fprintf(out, USAGE_BEGIN_TAIL);
-       fprintf(out, USAGE_MAN_TAIL, "ctrlaltdel(8)");
+       fprintf(out, USAGE_MAN_TAIL("ctrlaltdel(8)"));
        exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
index c91908bde895e59670018cb2e06b137860a29529..f4bee83f74453b01fb6f1ef058941364a7b777f1 100644 (file)
@@ -71,10 +71,10 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
        fputs(_(" -Q, --queue              create message queue\n"), out);
        fputs(_(" -p, --mode <mode>        permission for the resource (default is 0644)\n"), out);
 
+       fprintf(out, USAGE_SEPARATOR);
        fprintf(out, USAGE_HELP);
        fprintf(out, USAGE_VERSION);
-       fprintf(out, USAGE_BEGIN_TAIL);
-       fprintf(out, USAGE_MAN_TAIL, "ipcmk(1)");
+       fprintf(out, USAGE_MAN_TAIL("ipcmk(1)"));
        exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
index ab06cd3cd6141ddad85cb6d839540a2e29b3e25f..90767d611e5a459ebc5eb3b1a60fe3d7b758682c 100644 (file)
@@ -57,10 +57,10 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
        fputs(_(" -S, --semaphore-key <key>  remove semaprhore by key\n"), out);
        fputs(_(" -a, --all[=<shm|msg|sem>]  remove all\n"), out);
        fputs(_(" -v, --verbose              explain what is being done\n"), out);
+       fprintf(out, USAGE_SEPARATOR);
        fprintf(out, USAGE_HELP);
        fprintf(out, USAGE_VERSION);
-       fprintf(out, USAGE_BEGIN_TAIL);
-       fprintf(out, USAGE_MAN_TAIL, "ipcrm(1)");
+       fprintf(out, USAGE_MAN_TAIL("ipcrm(1)"));
        exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
index 09764b656aaafd84d43fcd588985fc8d36fc9ed5..c217921414ff4e8afaeabc90fdf75b8af736273f 100644 (file)
@@ -134,8 +134,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
        fputs(_(" -c, --creator     show creator and owner\n"), out);
        fputs(_(" -l, --limits      show resource limits\n"), out);
        fputs(_(" -u, --summary     show status summary\n"), out);
-       fprintf(out, USAGE_BEGIN_TAIL);
-       fprintf(out, USAGE_MAN_TAIL, "ipcs(1)");
+       fprintf(out, USAGE_MAN_TAIL("ipcs(1)"));
        exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
index 8669748a1adbb78b36b69ea10fa3dcacfac02887..db8e02f0c900c09942f42f93fb583657161af791 100644 (file)
@@ -31,10 +31,10 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
        fprintf(out, USAGE_HEADER);
        fprintf(out, _(" %s [options] new_root put_old\n"),
                program_invocation_short_name);
+       fprintf(out, USAGE_SEPARATOR);
        fprintf(out, USAGE_HELP);
        fprintf(out, USAGE_VERSION);
-       fprintf(out, USAGE_BEGIN_TAIL);
-       fprintf(out, USAGE_MAN_TAIL, "pivot_root(8)");
+       fprintf(out, USAGE_MAN_TAIL("pivot_root(8)"));
        exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }