🚑 Fix segmentation fault is supplying an unknown long argument
This commit is contained in:
parent
71e4681d5c
commit
e36cc18893
2 changed files with 5 additions and 2 deletions
|
@ -116,6 +116,8 @@ int main(int argc, char *argv[]) {
|
||||||
//Optionally perform xdelta3
|
//Optionally perform xdelta3
|
||||||
if (state.prevFile) {
|
if (state.prevFile) {
|
||||||
//TODO
|
//TODO
|
||||||
|
fprintf(stderr, "xdelta3 is not yet implemented.\n");
|
||||||
|
errorAndExit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ static struct option long_options[] = {
|
||||||
{"size", required_argument, 0, 's'},
|
{"size", required_argument, 0, 's'},
|
||||||
{"keys", required_argument, 0, 'k'},
|
{"keys", required_argument, 0, 'k'},
|
||||||
{"prev", required_argument, 0, 'p'},
|
{"prev", required_argument, 0, 'p'},
|
||||||
|
{NULL, 0, 0, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,7 +75,7 @@ struct arguments parseArguments(int argc, char *argv[]) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'p': //prev file for xdelta3
|
case 'p': //prev file for xdelta3
|
||||||
//TODO
|
state.prevFile = optarg;
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
errorAndExit();
|
errorAndExit();
|
||||||
|
@ -101,7 +102,7 @@ struct arguments parseArguments(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optind < argc) {
|
if (optind < argc) {
|
||||||
fprintf(stderr, "Found %i arguments without an option. All arguments must be preceded by an option.\n", argc - optind);
|
fprintf(stderr, "Found %i argument(s) without an option. All arguments must be preceded by an option.\n", argc - optind);
|
||||||
errorAndExit();
|
errorAndExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue