// Parse remaining command line options
// These will override anything specified in a config file
- fgParseOptions(argc, argv);
+ fgParseArgs(argc, argv);
return true;
}
// Parse the command line options
void
-fgParseOptions (int argc, char **argv) {
- int i = 1;
- int result;
+fgParseArgs (int argc, char **argv)
+{
+ bool in_options = true;
SG_LOG(SG_GENERAL, SG_INFO, "Processing command line arguments");
- while ( i < argc ) {
- SG_LOG( SG_GENERAL, SG_DEBUG, "argv[" << i << "] = " << argv[i] );
-
- result = parse_option(argv[i]);
- if ( (result == FG_OPTIONS_HELP) || (result == FG_OPTIONS_ERROR) ) {
- fgUsage();
- exit(-1);
+ for (int i = 1; i < argc; i++) {
+ string arg = argv[i];
+
+ if (in_options && (arg.find('-') == 0)) {
+ if (arg == "--") {
+ in_options = false;
+ } else {
+ int result = parse_option(arg);
+ if ( (result == FG_OPTIONS_HELP) ||
+ (result == FG_OPTIONS_ERROR) ) {
+ fgUsage();
+ exit(-1);
+ }
+ }
+ } else {
+ in_options = false;
+ SG_LOG(SG_GENERAL, SG_INFO,
+ "Reading command-line property file " << arg);
+ readProperties(arg, globals->get_props());
}
-
- i++;
}
+
+ SG_LOG(SG_GENERAL, SG_INFO, "Finished command line arguments");
}
extern void fgSetDefaults ();
extern string fgScanForRoot (int argc, char ** argv);
extern string fgScanForRoot (const string &file_path);
-extern void fgParseOptions (int argc, char ** argv);
+extern void fgParseArgs (int argc, char ** argv);
extern void fgParseOptions (const string &file_path);
extern void fgUsage ();