From b117ac74742986ce592071719cf1eb3660c19049 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Thu, 22 Jan 2015 00:22:15 -0600 Subject: [PATCH] wmfsm: Impove version number handling. In particular, - Add new --version command line option. (This was already documented in the manpage.) Remove this information from the --help text. Also took the opportunity to properly align the --fire line in the --help text. - Remove WMFSM_VERSION macro in favor of PACKAGE_VERSION from autconf. - Remove hard-coded version number at top of source file for maintainability. --- wmfsm/wmfsm/wmfsm.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/wmfsm/wmfsm/wmfsm.c b/wmfsm/wmfsm/wmfsm.c index 9f57aae..1eb5185 100644 --- a/wmfsm/wmfsm/wmfsm.c +++ b/wmfsm/wmfsm/wmfsm.c @@ -1,6 +1,6 @@ /* * - * wmfsm-0.33 (C) 1999 Stefan Eilemann (Stefan.Eilemann@dlr.de) + * wmfsm (C) 1999 Stefan Eilemann (Stefan.Eilemann@dlr.de) * * - Shows file system usage ala mfsm * @@ -100,7 +100,6 @@ * coz irix has max of 100000L :(. */ #define DELAY_10 99999L -#define WMFSM_VERSION "0.33" #define LENMP 5 /*max 10, number char for mountpoint */ /*modes for drawing*/ @@ -418,10 +417,11 @@ ParseCMDLine(int argc, char *argv[]) {"delay", required_argument, 0, 'd'}, {"appearance", required_argument, 0, 'a'}, {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'v'}, {0, 0, 0, 0} }; while (1) { - c = getopt_long(argc, argv, "a:bd:fhn", long_options, &option_index); + c = getopt_long(argc, argv, "a:bd:fhnv", long_options, &option_index); if (c == -1) break; switch (c) { @@ -445,6 +445,9 @@ ParseCMDLine(int argc, char *argv[]) case 'n': mode = NORMAL; break; + case 'v': + printf("wmfsm version: %s\n", PACKAGE_VERSION); + exit(0); case '?': break; default: @@ -459,10 +462,9 @@ void print_usage() { - printf("\nwmfsm version: %s\n", WMFSM_VERSION); - printf("\nusage: wmfsm \n"); + printf("usage: wmfsm \n"); printf("\t--normal, -n\t\tDraw bars in normal mode.\n"); - printf("\t--fire, -f\t\t\tDraw bars in fire mode.\n"); + printf("\t--fire, -f\t\tDraw bars in fire mode.\n"); printf("\t--[no]blink\t\tBlinks if a filesystem is 95 percent full.\n"); printf("\t-display \tUse alternate X display.\n"); printf("\t--delay , -d\tUse a delay that is not the default.\n");