# HG changeset patch # User Matti Hamalainen # Date 1411606068 -10800 # Node ID dab546dfb9b40d63ee80596811b7c025a75c4eab # Parent 0f43a94516f4757252f839647a2cd785e0a96337 Oops, fix the new option handling options. diff -r 0f43a94516f4 -r dab546dfb9b4 th_args.c --- 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)