]> err.no Git - util-linux/commitdiff
swapon: cleanup usage output
authorKarel Zak <kzak@redhat.com>
Mon, 26 Nov 2007 12:07:40 +0000 (13:07 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 26 Nov 2007 12:07:40 +0000 (13:07 +0100)
mount/swapon.c

index ce3597e578695c64a97283ff2dad490187a303d3..6c2c4866c59c489006562aced2a6857df00d4a0f 100644 (file)
@@ -58,22 +58,38 @@ static struct option *longswapoffopts = &longswaponopts[2];
 
 static int cannot_find(const char *special);
 
+#define PRINT_USAGE_SPECIAL(_fp) \
+               fprintf(_fp, _( \
+       "Special parameter:\n" \
+       " {-L label | LABEL=label}             volume LABEL\n" \
+       " {-U uuid  | UUID=uuid}               volume UUID\n" \
+       " <file>                               swap file\n" \
+       " <device>                             swap device\n\n"))
+
 static void
 swapon_usage(FILE *fp, int n) {
-       fprintf(fp, _("usage: %1$s [-hV]\n"
-                     "       %1$s -a [-e] [-v]\n"
-                     "       %1$s [-v] [-p priority] special|LABEL=volume_name ...\n"
-                     "       %1$s [-s]\n"),
-               progname);
+       fprintf(fp, _("\nUsage:\n"
+       " %1$s -a [-e] [-v]                  enable all swaps from /etc/fstab\n"
+       " %1$s [-v] [-p priority] <special>  enable swap\n"
+       " %1$s [-s]                          display swap usage summary\n"
+       " %1$s [-h]                          display help\n"
+       " %1$s [-V]                          display version\n\n"), progname);
+
+       PRINT_USAGE_SPECIAL(fp);
+
        exit(n);
 }
 
 static void
 swapoff_usage(FILE *fp, int n) {
-       fprintf(fp, _("usage: %1$s [-hV]\n"
-                     "       %1$s -a [-v]\n"
-                     "       %1$s [-v] special ...\n"),
-               progname);
+       fprintf(fp, _("\nUsage:\n"
+       " %1$s -a [-v]                       disable all swaps\n"
+       " %1$s [-v] <special>                disable given swap\n"
+       " %1$s [-h]                          display help\n"
+       " %1$s [-V]                          display version\n\n"), progname);
+
+       PRINT_USAGE_SPECIAL(fp);
+
        exit(n);
 }