Now takes the current directory by default is none is provided.
[finddup.git] / finddup.c
index 8f2b6c9..b8a703a 100644 (file)
--- a/finddup.c
+++ b/finddup.c
@@ -503,9 +503,9 @@ void start(const char *dirname1, const char *dirname2) {
 }
 
 void usage(FILE *out) {
-  fprintf(out, "Usage: finddup [OPTION]... DIR1 [[and:|not:]DIR2]\n");
+  fprintf(out, "Usage: finddup [OPTION]... [DIR1 [[and:|not:]DIR2]]\n");
   fprintf(out, "Version %s (%s)\n", VERSION_NUMBER, UNAME);
-  fprintf(out, "Without DIR2, lists duplicated files found in DIR1. With DIR2, lists files common to both directories. With the not: prefix, lists files found in DIR1 which do not exist in DIR2. The and: prefix is the default and should be used only if you have a directory starting with 'not:'\n");
+  fprintf(out, "Without DIR2, lists duplicated files found in DIR1, or the current directory if DIR1 is not provided. With DIR2, lists files common to both directories. With the not: prefix, lists files found in DIR1 which do not exist in DIR2. The and: prefix is the default and should be used only if you have a directory starting with 'not:'\n");
   fprintf(out, "\n");
   /*            01234567890123456789012345678901234567890123456789012345678901234567890123456789*/
   fprintf(out, "   -h, --help                 show this help\n");
@@ -594,6 +594,9 @@ int main(int argc, char **argv) {
   } else if(optind + 1 == argc) {
     same_inodes_are_different = 1;
     start(argv[optind], 0);
+  } else if(optind == argc) {
+    same_inodes_are_different = 1;
+    start(".", 0);
   } else {
     usage(stderr);
     exit(EXIT_FAILURE);