Explorar o código

HPCC-26319 Support --option+ and --option- for eclcc compatibility

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday %!s(int64=3) %!d(string=hai) anos
pai
achega
c1c5f75757
Modificáronse 1 ficheiros con 14 adicións e 2 borrados
  1. 14 2
      system/jlib/jptree.cpp

+ 14 - 2
system/jlib/jptree.cpp

@@ -8485,8 +8485,20 @@ static void applyCommandLineOption(IPropertyTree * config, const char * option,
     }
     else
     {
-        //MORE: Support --x- and --x+?
-        val = "1";
+        unsigned len = strlen(option);
+        if (len == 0)
+            return;
+
+        //support --option+ as --option=1 and --option- as --option=0 for eclcc compatibility
+        char last = option[len-1];
+        if ((last == '+') || (last == '-'))
+        {
+            name.append(len-1, option);
+            option = name;
+            val = (last == '+') ? "1" : "0";
+        }
+        else
+            val = "1";
     }
     if (stdContains(ignoreOptions, option))
         return;