From: Francois Fleuret Date: Thu, 8 Apr 2010 12:11:11 +0000 (+0200) Subject: Now takes the current directory by default is none is provided. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=8c988a4aca00501c9a9d53f4ff228dcb0bce0acb;p=finddup.git Now takes the current directory by default is none is provided. --- diff --git a/finddup.1 b/finddup.1 index c86df1e..2da4ee3 100644 --- a/finddup.1 +++ b/finddup.1 @@ -10,12 +10,13 @@ finddup \- Find files common to two directories (or not) .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 diff --git a/finddup.c b/finddup.c index 8f2b6c9..b8a703a 100644 --- 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);