void ProcessArgVect(int argc, char *argv[]) { for (int iArgIndex = 0; iArgIndex < argc; ) { const char *Arg = argv[iArgIndex]; if (Arg[0] != '-') { fprintf(stderr, "Command-line option \"%s\" must start with '-'\n", Arg); exit(EXIT_NotStarted); } const char *ArgName = Arg + 1; if (TestSetFlagOpt(ArgName)) { ++iArgIndex; continue; } char *Value = 0; if (iArgIndex < argc - 1) Value = argv[iArgIndex+1]; if (TestSetValueOpt(ArgName, Value)) { iArgIndex += 2; continue; } fprintf(stderr, "Invalid command line option \"%s\"\n", ArgName); Usage(); exit(EXIT_NotStarted); } }
void ProcessArgVect(int argc, char *argv[]) { for (int iArgIndex = 0; iArgIndex < argc; ) { const char *Arg = argv[iArgIndex]; if (Arg[0] != '-') Quit("Command-line option \"%s\" must start with '-'\n", Arg); const char *ArgName = Arg + 1; if (TestSetFlagOpt(ArgName)) { ++iArgIndex; continue; } char *Value = 0; if (iArgIndex < argc - 1) Value = argv[iArgIndex+1]; if (TestSetValueOpt(ArgName, Value)) { iArgIndex += 2; continue; } CommandLineError("Invalid command line option \"%s\"\n", ArgName); } }
void ProcessArgVect(int argc, char *argv[]) { for (int iArgIndex = 0; iArgIndex < argc; ) { const char *Arg = argv[iArgIndex]; //if (Arg[0] != '-') // { // Rprintf("Command-line option \"%s\" must start with '-'\n", Arg); // return; // } const char *ArgName = Arg; if (TestSetFlagOpt(ArgName)) { ++iArgIndex; continue; } char *Value = 0; if (iArgIndex < argc - 1) Value = argv[iArgIndex+1]; if (TestSetValueOpt(ArgName, Value)) { iArgIndex += 2; continue; } Rprintf("Invalid option \"%s\"\n", ArgName); Usage(); return; } }