changeset 832:b7dbdacaf01d

Import commandline argument parsing fixes from th-libs.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 22 Jun 2014 07:27:56 +0300
parents a855f88f86ee
children 4f3828914890
files src/dmargs_int.c
diffstat 1 files changed, 2 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/dmargs_int.c	Fri May 23 21:31:30 2014 +0300
+++ b/src/dmargs_int.c	Sun Jun 22 07:27:56 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;