Mercurial > hg > th-libs
changeset 127:37bf3d8766b7
Fix long option parsing. I wonder how long that has been broken.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 22 Jun 2014 06:20:26 +0300 |
parents | 8efebf863404 |
children | c22caa6e3fcb |
files | th_args.c |
diffstat | 1 files changed, 2 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/th_args.c Sun Jun 22 06:20:03 2014 +0300 +++ b/th_args.c Sun Jun 22 06:20:26 2014 +0300 @@ -226,7 +226,7 @@ if (optList[i].optLong) { optLen = strlen(optList[i].optLong); - if (strcmp(currArg, optList[i].optLong) == 0) + if (strncmp(currArg, optList[i].optLong, optLen) == 0) optN = i; } @@ -234,12 +234,7 @@ if (optN >= 0) { if ((optList[optN].flags & OPT_ARGMASK) != 0) - { - if (currArg[optLen] == '=') - optArg = &currArg[optLen + 1]; - else - optArg = NULL; - } + optArg = (currArg[optLen] == '=') ? &currArg[optLen + 1] : NULL; else optArg = NULL;