changeset 138:dab546dfb9b4

Oops, fix the new option handling options.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 25 Sep 2014 03:47:48 +0300
parents 0f43a94516f4
children 4ca0af6dbcf8
files th_args.c
diffstat 1 files changed, 26 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/th_args.c	Thu Sep 25 03:37:08 2014 +0300
+++ b/th_args.c	Thu Sep 25 03:47:48 2014 +0300
@@ -264,36 +264,39 @@
     while (argIndex < argc)
     {
         char *currArg = argv[argIndex];
-        if (*currArg == '-' && !endOptions && (handle == OPTH_ONLY_OPTS || handle == 0))
+        if (*currArg == '-' && !endOptions)
         {
-            newArgIndex = argIndex;
-            currArg++;
-            if (*currArg == '-')
+            if (handle == OPTH_ONLY_OPTS || handle == 0)
             {
-                // Check for "--", which ends the options-list
+                newArgIndex = argIndex;
                 currArg++;
-                if (*currArg == 0)
+                if (*currArg == '-')
                 {
-                    endOptions = TRUE;
-                    continue;
+                    // Check for "--", which ends the options-list
+                    currArg++;
+                    if (*currArg == 0)
+                    {
+                        endOptions = TRUE;
+                        continue;
+                    }
+
+                    // Long options
+                    if (!th_args_process_long(currArg, &newArgIndex,
+                                              argc, argv, optList,
+                                              optListN, handleOpt))
+                        optionsOK = FALSE;
+                }
+                else
+                {
+                    // Short options
+                    if (!th_args_process_short(currArg, &newArgIndex,
+                                               argc, argv, optList,
+                                               optListN, handleOpt))
+                        optionsOK = FALSE;
                 }
 
-                // Long options
-                if (!th_args_process_long(currArg, &newArgIndex,
-                                          argc, argv, optList,
-                                          optListN, handleOpt))
-                    optionsOK = FALSE;
+                argIndex = newArgIndex;
             }
-            else
-            {
-                // Short options
-                if (!th_args_process_short(currArg, &newArgIndex,
-                                           argc, argv, optList,
-                                           optListN, handleOpt))
-                    optionsOK = FALSE;
-            }
-
-            argIndex = newArgIndex;
         }
         else
         if (handle == OPTH_ONLY_OTHER || handle == 0)