From: Michael Vrable Date: Fri, 3 Aug 2007 05:14:37 +0000 (-0700) Subject: Print a help message if no paths are specified to back up. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=3b18234b6b9247f6e5943af0fca8d3fc0b50b593;p=cumulus.git Print a help message if no paths are specified to back up. Rather than defaulting to backing up the current directory, always require that a path be specified. If no paths are specified, print the usage message and exit. Also, fix a crash that previously occurred when no paths were specified. --- diff --git a/scandir.cc b/scandir.cc index db0961b..841dc91 100644 --- a/scandir.cc +++ b/scandir.cc @@ -572,7 +572,6 @@ void usage(const char *program) int main(int argc, char *argv[]) { - string backup_source = "."; string backup_dest = ""; string localdb_dir = ""; string backup_scheme = ""; @@ -627,15 +626,14 @@ int main(int argc, char *argv[]) } } - searches.push_back("."); if (optind == argc) { - add_include("."); - } else { - for (int i = optind; i < argc; i++) - add_include(argv[i]); + usage(argv[0]); + return 1; } - backup_source = argv[optind]; + searches.push_back("."); + for (int i = optind; i < argc; i++) + add_include(argv[i]); if (backup_dest == "") { fprintf(stderr,