.SH "SYNOPSIS"
-\fBfinddup\fP [OPTION]... DIR1 [[and:|not:]DIR2]
+\fBfinddup\fP [OPTION]... [DIR1 [[and:|not:]DIR2]]
.SH "DESCRIPTION"
-With a single directory argument, \fBfinddup\fP prints the duplicated
-files found in it.
+With one directory as argument, \fBfinddup\fP prints the duplicated
+files found in it. If no directory is provided, it uses the current
+one as default.
With two directories, it prints either the files common to both DIR1
and DIR2 or, with the `not:' prefix, the ones present in DIR1 and not
}
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");
} 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);