]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fsfreeze: clean up usage(), add -V
authorKarel Zak <kzak@redhat.com>
Wed, 13 Mar 2013 11:32:30 +0000 (12:32 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 13 Mar 2013 11:32:30 +0000 (12:32 +0100)
 - clean up usage()
 - add -V,--version
 - print usage() if not action specified
 - update man page

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/fsfreeze.8
sys-utils/fsfreeze.c

index 7693861a397c99e6ee87213cac3246916c66951e..4a66d7dff808bd74f8eb431c176ea9e8915b1058 100644 (file)
@@ -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.
index 7161442474d8778213baa555c7ee19109106776c..a538ef0ba895414059d9cde9305266adbb6f5821 100644 (file)
@@ -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] <mount point>\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] <mountpoint>\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++];