@@ -460,6 +460,7 @@ void ParseParameters(int argc, const char* const argv[])
460
460
{
461
461
mapArgs.clear ();
462
462
mapMultiArgs.clear ();
463
+
463
464
for (int i = 1 ; i < argc; i++)
464
465
{
465
466
std::string str (argv[i]);
@@ -475,29 +476,24 @@ void ParseParameters(int argc, const char* const argv[])
475
476
if (boost::algorithm::starts_with (str, " /" ))
476
477
str = " -" + str.substr (1 );
477
478
#endif
479
+
478
480
if (str[0 ] != ' -' )
479
481
break ;
480
482
483
+ // Interpret --foo as -foo.
484
+ // If both --foo and -foo are set, the last takes effect.
485
+ if (str.length () > 1 && str[1 ] == ' -' )
486
+ str = str.substr (1 );
487
+
481
488
mapArgs[str] = strValue;
482
489
mapMultiArgs[str].push_back (strValue);
483
490
}
484
491
485
492
// New 0.6 features:
486
493
BOOST_FOREACH (const PAIRTYPE (string,string)& entry, mapArgs)
487
494
{
488
- string name = entry.first ;
489
-
490
- // interpret --foo as -foo (as long as both are not set)
491
- if (name.find (" --" ) == 0 )
492
- {
493
- std::string singleDash (name.begin ()+1 , name.end ());
494
- if (mapArgs.count (singleDash) == 0 )
495
- mapArgs[singleDash] = entry.second ;
496
- name = singleDash;
497
- }
498
-
499
495
// interpret -nofoo as -foo=0 (and -nofoo=0 as -foo=1) as long as -foo not set
500
- InterpretNegativeSetting (name , mapArgs);
496
+ InterpretNegativeSetting (entry. first , mapArgs);
501
497
}
502
498
}
503
499
0 commit comments