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.
int main(int argc, char *argv[])
{
- string backup_source = ".";
string backup_dest = "";
string localdb_dir = "";
string backup_scheme = "";
}
}
- 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,