From: Karel Zak Date: Wed, 13 Mar 2013 11:32:30 +0000 (+0100) Subject: fsfreeze: clean up usage(), add -V X-Git-Tag: v2.23-rc1~64 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7de20424b76c397bf05753bfa7c3dfe26323910f;p=thirdparty%2Futil-linux.git fsfreeze: clean up usage(), add -V - clean up usage() - add -V,--version - print usage() if not action specified - update man page Signed-off-by: Karel Zak --- diff --git a/sys-utils/fsfreeze.8 b/sys-utils/fsfreeze.8 index 7693861a39..4a66d7dff8 100644 --- a/sys-utils/fsfreeze.8 +++ b/sys-utils/fsfreeze.8 @@ -3,11 +3,9 @@ .SH NAME fsfreeze \- suspend access to a filesystem (Linux Ext3/4, ReiserFS, JFS, XFS) .SH SYNOPSIS -.B fsfreeze \-f -.I mountpoint - -.B fsfreeze \-u -.I mountpoint +.B fsfreeze +.BR \--freeze | \--unfreeze +.IR mountpoint .SH DESCRIPTION .B fsfreeze @@ -53,6 +51,8 @@ or a clean mount of the snapshot is complete. This option is used to un-freeze the filesystem and allow operations to continue. Any filesystem modifications that were blocked by the freeze are unblocked and allowed to complete. +.IP "\fB\-V, \-\-version\fP" +Show version number and exit. .SH AUTHOR .PP Written by Hajime Taira. diff --git a/sys-utils/fsfreeze.c b/sys-utils/fsfreeze.c index 7161442474..a538ef0ba8 100644 --- a/sys-utils/fsfreeze.c +++ b/sys-utils/fsfreeze.c @@ -38,16 +38,16 @@ static int unfreeze_f(int fd) static void __attribute__((__noreturn__)) usage(FILE *out) { - fputs(_("\nUsage:\n"), out); + fprintf(out, USAGE_HEADER); fprintf(out, - _(" %s [options] \n"), program_invocation_short_name); - - fputs(_("\nOptions:\n"), out); - fputs(_(" -h, --help this help\n" - " -f, --freeze freeze the filesystem\n" - " -u, --unfreeze unfreeze the filesystem\n"), out); - - fputs(_("\nFor more information see fsfreeze(8).\n"), out); + _(" %s [options] \n"), program_invocation_short_name); + fputs(USAGE_OPTIONS, out); + fputs(_(" -f, --freeze freeze the filesystem\n"), out); + fputs(_(" -u, --unfreeze unfreeze the filesystem\n"), out); + fprintf(out, USAGE_SEPARATOR); + fprintf(out, USAGE_HELP); + fprintf(out, USAGE_VERSION); + fprintf(out, USAGE_MAN_TAIL("fsfreeze(8)")); exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); } @@ -63,6 +63,7 @@ int main(int argc, char **argv) { "help", 0, 0, 'h' }, { "freeze", 0, 0, 'f' }, { "unfreeze", 0, 0, 'u' }, + { "version", 0, 0, 'V' }, { NULL, 0, 0, 0 } }; @@ -71,7 +72,7 @@ int main(int argc, char **argv) textdomain(PACKAGE); atexit(close_stdout); - while ((c = getopt_long(argc, argv, "hfu", longopts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "hfuV", longopts, NULL)) != -1) { switch(c) { case 'h': usage(stdout); @@ -82,6 +83,9 @@ int main(int argc, char **argv) case 'u': freeze = FALSE; break; + case 'V': + printf(UTIL_LINUX_VERSION); + exit(EXIT_SUCCESS); default: usage(stderr); break; @@ -89,7 +93,7 @@ int main(int argc, char **argv) } if (freeze == -1) - errx(EXIT_FAILURE, _("no action specified")); + usage(stderr); if (optind == argc) errx(EXIT_FAILURE, _("no filename specified")); path = argv[optind++];