diff options
author | Sami Kerola | 2012-03-18 16:46:42 +0100 |
---|---|---|
committer | Karel Zak | 2012-03-30 16:48:12 +0200 |
commit | 584aed6b02cb490f271b9eeb6b229ee0409b3302 (patch) | |
tree | 1c4bb5f8ace49fdfb7081e079c32e778566b430b /sys-utils/fallocate.c | |
parent | swaplabel: add --version and align with howto-usage-function.txt (diff) | |
download | kernel-qcow2-util-linux-584aed6b02cb490f271b9eeb6b229ee0409b3302.tar.gz kernel-qcow2-util-linux-584aed6b02cb490f271b9eeb6b229ee0409b3302.tar.xz kernel-qcow2-util-linux-584aed6b02cb490f271b9eeb6b229ee0409b3302.zip |
fallocate: add --version and align with howto-usage-function.txt
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/fallocate.c')
-rw-r--r-- | sys-utils/fallocate.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sys-utils/fallocate.c b/sys-utils/fallocate.c index 80bb0eabd..5fc13fe62 100644 --- a/sys-utils/fallocate.c +++ b/sys-utils/fallocate.c @@ -55,19 +55,18 @@ static void __attribute__((__noreturn__)) usage(FILE *out) { - - fputs(_("\nUsage:\n"), out); + fputs(USAGE_HEADER, out); fprintf(out, _(" %s [options] <filename>\n"), program_invocation_short_name); - - fputs(_("\nOptions:\n"), out); - fputs(_(" -h, --help this help\n" - " -n, --keep-size don't modify the length of the file\n" + fputs(USAGE_OPTIONS, out); + fputs(_(" -n, --keep-size don't modify the length of the file\n" " -p, --punch-hole punch holes in the file\n" " -o, --offset <num> offset of the allocation, in bytes\n" " -l, --length <num> length of the allocation, in bytes\n"), out); - - fprintf(out, _("\nFor more information see fallocate(1).\n")); + fputs(USAGE_SEPARATOR, out); + fputs(USAGE_HELP, out); + fputs(USAGE_VERSION, out); + fprintf(out, USAGE_MAN_TAIL("fallocate(1)")); exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); } @@ -94,6 +93,7 @@ int main(int argc, char **argv) static const struct option longopts[] = { { "help", 0, 0, 'h' }, + { "version", 0, 0, 'V' }, { "keep-size", 0, 0, 'n' }, { "punch-hole", 0, 0, 'p' }, { "offset", 1, 0, 'o' }, @@ -105,11 +105,14 @@ int main(int argc, char **argv) bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - while ((c = getopt_long(argc, argv, "hnpl:o:", longopts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "hVnpl:o:", longopts, NULL)) != -1) { switch(c) { case 'h': usage(stdout); break; + case 'V': + printf(UTIL_LINUX_VERSION); + return EXIT_SUCCESS; case 'p': mode |= FALLOC_FL_PUNCH_HOLE; /* fall through */ |