Added the -v option to print the version number.
[dus.git] / dus.c
diff --git a/dus.c b/dus.c
index 6557c7f..4acc517 100644 (file)
--- a/dus.c
+++ b/dus.c
@@ -385,7 +385,8 @@ void usage(FILE *out) {
   fprintf(out, "                              same as -c for number of lines.\n");
   fprintf(out, "   -h, --help                 show this help.\n");
   fprintf(out, "   -m <size>, --size-min <size>\n");
-  fprintf(out, "                              set the listed entries minimum size.\n");
+  fprintf(out, "                              set the listed entries minimum size. The size\n");
+  fprintf(out, "                              can be specified using the G, M, K, and B units.\n");
   fprintf(out, "\n");
   fprintf(out, "Report bugs and comments to <francois@fleuret.org>.\n");
 }
@@ -393,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' },
@@ -413,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;