From 3095e1570e1f1d4edf264b07480c256a2691b43c Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Wed, 11 Aug 2010 13:04:13 +0200 Subject: [PATCH] Added the -v option to print the version number. --- dus.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dus.c b/dus.c index 5f481d7..4acc517 100644 --- a/dus.c +++ b/dus.c @@ -394,6 +394,7 @@ void usage(FILE *out) { /**********************************************************************/ static struct option long_options[] = { + { "version", no_argument, 0, 'v' }, { "ignore-dots", no_argument, 0, 'd' }, { "reverse-order", no_argument, 0, 'r' }, { "show-top", no_argument, 0, 't' }, @@ -414,10 +415,15 @@ int main(int argc, char **argv) { setlocale (LC_ALL, ""); - while ((c = getopt_long(argc, argv, "dfrtl:c:m:hd", + while ((c = getopt_long(argc, argv, "vdfrtl:c:m:hd", long_options, NULL)) != -1) { switch (c) { + case 'v': + printf("dus version %s (%s)\n", VERSION_NUMBER, UNAME); + exit(EXIT_SUCCESS); + break; + case 'd': ignore_dotfiles = 1; break; -- 2.20.1