# HG changeset patch # User Matti Hamalainen # Date 1403407226 -10800 # Node ID 37bf3d8766b79ed10c3aca2e534a8ecbf3ca6538 # Parent 8efebf863404fbbad8aa04ef7fbfa7a32582358f Fix long option parsing. I wonder how long that has been broken. diff -r 8efebf863404 -r 37bf3d8766b7 th_args.c --- 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;