Make the command line argument processing a little more robust.

This commit is contained in:
Pavel Krajcevski 2012-09-29 15:35:22 -04:00
parent 8dffb602bf
commit bb9370adaf

View File

@ -38,12 +38,14 @@ int main(int argc, char **argv) {
fileArg++; fileArg++;
knowArg = true; knowArg = true;
continue;
} }
if(strcmp(argv[fileArg], "-s") == 0) { if(strcmp(argv[fileArg], "-s") == 0) {
fileArg++; fileArg++;
bUseSIMD = true; bUseSIMD = true;
knowArg = true; knowArg = true;
continue;
} }
if(strcmp(argv[fileArg], "-t") == 0) { if(strcmp(argv[fileArg], "-t") == 0) {
@ -56,6 +58,7 @@ int main(int argc, char **argv) {
fileArg++; fileArg++;
knowArg = true; knowArg = true;
continue;
} }
if(strcmp(argv[fileArg], "-q") == 0) { if(strcmp(argv[fileArg], "-q") == 0) {
@ -68,6 +71,7 @@ int main(int argc, char **argv) {
fileArg++; fileArg++;
knowArg = true; knowArg = true;
continue;
} }
if(strcmp(argv[fileArg], "-j") == 0) { if(strcmp(argv[fileArg], "-j") == 0) {
@ -80,9 +84,10 @@ int main(int argc, char **argv) {
fileArg++; fileArg++;
knowArg = true; knowArg = true;
continue;
} }
} while(knowArg); } while(knowArg && fileArg < argc);
if(fileArg == argc) { if(fileArg == argc) {
PrintUsage(); PrintUsage();