Skip to content

Commit

Permalink
fix totally ParseArgs bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
whitedragon0000 committed Dec 31, 2017
1 parent 1967957 commit 6a80b70
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions engine/openbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -3675,13 +3675,7 @@ size_t ParseArgs(ArgList *list, char *input, char *output)
{
double_apex_flag = 0;
output[pos] = input[pos];
if (wordstart != pos)
{
list->args[item] = output + wordstart;
list->arglen[item] = pos - wordstart + 1;
item++;
}
wordstart = pos + 1;
// continue to get inputs
break;
}
else
Expand Down Expand Up @@ -3720,13 +3714,7 @@ size_t ParseArgs(ArgList *list, char *input, char *output)
{
single_apex_flag = 0;
output[pos] = input[pos];
if (wordstart != pos)
{
list->args[item] = output + wordstart;
list->arglen[item] = pos - wordstart + 1;
item++;
}
wordstart = pos + 1;
// continue to get inputs
break;
}
else
Expand Down Expand Up @@ -3795,6 +3783,15 @@ size_t ParseArgs(ArgList *list, char *input, char *output)
pos++;
}
list->count = item;

// TEST
/*printf("found: ");
int i;
for (i = 0; i < list->count; i++) {
printf("|%s|:%d",list->args[i],list->arglen[i]);
if (i < list->count - 1) printf(" ");
}
printf("\n");*/

return item;
}
Expand Down

0 comments on commit 6a80b70

Please sign in to comment.