From 240e20b5a6cbfd12a9064fa451fd2075f2f41f6f Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 26 Nov 2007 13:07:40 +0100 Subject: [PATCH] swapon: cleanup usage output --- mount/swapon.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/mount/swapon.c b/mount/swapon.c index ce3597e5..6c2c4866 100644 --- a/mount/swapon.c +++ b/mount/swapon.c @@ -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" \ + " swap file\n" \ + " 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] 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] disable given swap\n" + " %1$s [-h] display help\n" + " %1$s [-V] display version\n\n"), progname); + + PRINT_USAGE_SPECIAL(fp); + exit(n); } -- 2.39.5