fixed a issue with doubled error outputs on parsing

This commit is contained in:
Marcel 2014-03-09 16:16:01 +00:00
parent 98bd6e23de
commit e02c0a33be
1 changed files with 6 additions and 2 deletions

View File

@ -77,7 +77,7 @@ CONode* CmdLO_SearchNode(char* cmdlineargument) {
if (node->option->optionscount > 0) { if (node->option->optionscount > 0) {
int i = 0; int i = 0;
for (; i < node->option->optionscount; ++i) { for (; i < node->option->optionscount; ++i) {
//printf("addresses 0x%x 0x%x\n",node->option->options, node->option->options[i]); //printf("%s %d\n",node->option->options[i], strlen(node->option->options[i])); // debug
if (strcmp(node->option->options[i], cmdlineargument) if (strcmp(node->option->options[i], cmdlineargument)
== 0) { == 0) {
return node; return node;
@ -95,6 +95,7 @@ int CmdLO_Parse(int argc, char** argv) {
int i = 1; int i = 1;
CONode* cnode = 0; CONode* cnode = 0;
char* carg = 0; char* carg = 0;
char failed = 0;
for (; i < argc; ++i) { for (; i < argc; ++i) {
if (argv[i][0] == cmdoptions.cmdchar) { if (argv[i][0] == cmdoptions.cmdchar) {
if ((cnode = CmdLO_SearchNode(argv[i])) != 0) { if ((cnode = CmdLO_SearchNode(argv[i])) != 0) {
@ -102,8 +103,11 @@ int CmdLO_Parse(int argc, char** argv) {
continue; continue;
} else { } else {
carg = argv[i]; carg = argv[i];
fprintf(stderr, "CmdLineOptions: Unrecognized option '%s'.\n", fprintf(stderr,
"CmdLineOptions: Unrecognized option '%s'.\n",
carg); carg);
cnode = 0;
continue;
} }
} }
if (cnode != 0) { if (cnode != 0) {