| 365 | // change program settings. Basically a wrapper for other functions. |
| 366 | |
| 367 | flag FProcessCommandLine(CONST char *szLine) |
| 368 | { |
| 369 | char szCommandLine[cchSzLine], *rgsz[MAXSWITCHES]; |
| 370 | int argc, cb; |
| 371 | flag fT = fFalse; |
| 372 | FILE *fileT; |
| 373 | |
| 374 | if (szLine == NULL || *szLine == chNull) |
| 375 | return fTrue; |
| 376 | cb = CchSz(szLine)+1; |
| 377 | |
| 378 | // Check for filename on command line. |
| 379 | if (!FChSwitch(szLine[0])) { |
| 380 | fileT = fopen(szLine, "r"); |
| 381 | if (fileT != NULL) { |
| 382 | fclose(fileT); |
| 383 | sprintf(szCommandLine, "-i \"%s\"", szLine); |
| 384 | fT = fTrue; |
| 385 | } |
| 386 | } |
| 387 | |
| 388 | // Parse and process the command line. |
| 389 | if (!fT) |
| 390 | CopyRgb((byte *)szLine, (byte *)szCommandLine, cb); |
| 391 | argc = NParseCommandLine(szCommandLine, rgsz); |
| 392 | fT = FProcessSwitches(argc, rgsz); |
| 393 | if (!fT) { |
| 394 | sprintf(szCommandLine, "Failed to parse command line: %s", szLine); |
| 395 | PrintWarning(szCommandLine); |
| 396 | } |
| 397 | return fT; |
| 398 | } |
| 399 | |
| 400 | |
| 401 | // Given a string representing a command line, convert it to an "argv" format |
no test coverage detected