summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/howto-usage-function.txt6
-rw-r--r--include/c.h4
-rw-r--r--sys-utils/arch.c5
-rw-r--r--sys-utils/ctrlaltdel.c4
-rw-r--r--sys-utils/ipcmk.c4
-rw-r--r--sys-utils/ipcrm.c4
-rw-r--r--sys-utils/ipcs.c3
-rw-r--r--sys-utils/pivot_root.c4
8 files changed, 16 insertions, 18 deletions
diff --git a/Documentation/howto-usage-function.txt b/Documentation/howto-usage-function.txt
index f717293d9..18ee3de86 100644
--- a/Documentation/howto-usage-function.txt
+++ b/Documentation/howto-usage-function.txt
@@ -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
diff --git a/include/c.h b/include/c.h
index 975cc1bf4..ba274f45f 100644
--- a/include/c.h
+++ b/include/c.h
@@ -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
diff --git a/sys-utils/arch.c b/sys-utils/arch.c
index 47aad7c97..f8b795cea 100644
--- a/sys-utils/arch.c
+++ b/sys-utils/arch.c
@@ -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);
}
diff --git a/sys-utils/ctrlaltdel.c b/sys-utils/ctrlaltdel.c
index 8805435d4..db96fccc4 100644
--- a/sys-utils/ctrlaltdel.c
+++ b/sys-utils/ctrlaltdel.c
@@ -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);
}
diff --git a/sys-utils/ipcmk.c b/sys-utils/ipcmk.c
index c91908bde..f4bee83f7 100644
--- a/sys-utils/ipcmk.c
+++ b/sys-utils/ipcmk.c
@@ -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);
}
diff --git a/sys-utils/ipcrm.c b/sys-utils/ipcrm.c
index ab06cd3cd..90767d611 100644
--- a/sys-utils/ipcrm.c
+++ b/sys-utils/ipcrm.c
@@ -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);
}
diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c
index 09764b656..c21792141 100644
--- a/sys-utils/ipcs.c
+++ b/sys-utils/ipcs.c
@@ -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);
}
diff --git a/sys-utils/pivot_root.c b/sys-utils/pivot_root.c
index 8669748a1..db8e02f0c 100644
--- a/sys-utils/pivot_root.c
+++ b/sys-utils/pivot_root.c
@@ -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);
}