🚑 Fix segmentation fault is supplying an unknown long argument

This commit is contained in:
C-3PO 2018-09-14 01:57:49 +02:00
parent 71e4681d5c
commit e36cc18893
Signed by: c3po
GPG key ID: 62993C4BB4D86F24
2 changed files with 5 additions and 2 deletions

View file

@ -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();
} }
} }

View file

@ -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();
} }