MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / FProcessCommandLine

Function FProcessCommandLine

astrolog.cpp:367–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365// change program settings. Basically a wrapper for other functions.
366
367flag 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

Callers 15

ActionFunction · 0.85
FProcessSwitchesFunction · 0.85
FEvalFunctionFunction · 0.85
CastRelationFunction · 0.85
DrawRingFunction · 0.85
xscreen.cppFile · 0.85
XChartWheelFunction · 0.85
XChartSectorFunction · 0.85
XChartMidpointFunction · 0.85
XChartSphereFunction · 0.85
DlgCommandFunction · 0.85
WinMainFunction · 0.85

Calls 5

CchSzFunction · 0.85
CopyRgbFunction · 0.85
NParseCommandLineFunction · 0.85
FProcessSwitchesFunction · 0.85
PrintWarningFunction · 0.85

Tested by

no test coverage detected