From: Francois Fleuret Date: Wed, 11 Aug 2010 11:04:13 +0000 (+0200) Subject: Added the -v option to print the version number. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=3095e1570e1f1d4edf264b07480c256a2691b43c;p=dus.git Added the -v option to print the version number. --- 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;