| 368 | } |
| 369 | |
| 370 | void ParseParameters(int argc, const char* const argv[]) |
| 371 | { |
| 372 | mapArgs.clear(); |
| 373 | mapMultiArgs.clear(); |
| 374 | |
| 375 | for (int i = 1; i < argc; i++) { |
| 376 | std::string str(argv[i]); |
| 377 | std::string strValue; |
| 378 | size_t is_index = str.find('='); |
| 379 | if (is_index != std::string::npos) { |
| 380 | strValue = str.substr(is_index + 1); |
| 381 | str = str.substr(0, is_index); |
| 382 | } |
| 383 | #ifdef WIN32 |
| 384 | boost::to_lower(str); |
| 385 | if (boost::algorithm::starts_with(str, "/")) |
| 386 | str = "-" + str.substr(1); |
| 387 | #endif |
| 388 | |
| 389 | if (str[0] != '-') |
| 390 | break; |
| 391 | |
| 392 | // Interpret --foo as -foo. |
| 393 | // If both --foo and -foo are set, the last takes effect. |
| 394 | if (str.length() > 1 && str[1] == '-') |
| 395 | str = str.substr(1); |
| 396 | |
| 397 | mapArgs[str] = strValue; |
| 398 | mapMultiArgs[str].push_back(strValue); |
| 399 | } |
| 400 | |
| 401 | // New 0.6 features: |
| 402 | for (const PAIRTYPE(string, string) & entry : mapArgs) { |
| 403 | // interpret -nofoo as -foo=0 (and -nofoo=0 as -foo=1) as long as -foo not set |
| 404 | InterpretNegativeSetting(entry.first, mapArgs); |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | bool IsArgSet(const std::string& strArg) |
| 409 | { |