From 2eac88f904b6f292a65d909e40e48eae62e3f8ac Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Sun, 7 Mar 2010 23:31:25 +0100 Subject: [PATCH] Rewrote the help. --- finddup.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/finddup.c b/finddup.c index 39a3df6..9a6e6be 100644 --- a/finddup.c +++ b/finddup.c @@ -22,6 +22,8 @@ * */ +#define VERSION_NUMBER "0.5" + #define _BSD_SOURCE #include @@ -269,6 +271,17 @@ void start(const char *dirname1, const char *dirname2) { file_list_delete(list2); } +void print_help(FILE *out) { + fprintf(out, "Usage: finddup [OPTION]... DIR1 [[^]DIR2]\n"); + fprintf(out, "Version %s (%s)\n", VERSION_NUMBER, UNAME); + fprintf(out, "Without DIR2, lists duplicated files in DIR1. With DIR2, list files common to both directories. With DIR2 starting with a ^, list files found in DIR1 which do not exist in DIR2.\n"); + fprintf(out, "\n"); + fprintf(out, " -h show this help.\n"); + fprintf(out, " -r show the real file paths.\n"); + fprintf(out, "\n"); + fprintf(out, "Report bugs and comments to \n"); +} + /**********************************************************************/ int main(int argc, char **argv) { @@ -287,8 +300,7 @@ int main(int argc, char **argv) { switch (c) { case 'h': - printf("Usage: finddup [OPTION]... [FILE]...\n"); - printf("Report bugs and comments to \n"); + print_help(stdout); exit(EXIT_SUCCESS); break; @@ -307,7 +319,7 @@ int main(int argc, char **argv) { } else if(optind < argc) { start(argv[optind], argv[optind]); } else { - fprintf(stderr, "%s [OPTIONS] [[^]]\n", argv[0]); + print_help(stderr); exit(EXIT_FAILURE); } -- 2.20.1