+static bool
+parse_colon (const string &s, double * val1, double * val2)
+{
+ string::size_type pos = s.find(':');
+ if (pos == string::npos) {
+ *val2 = atof(s);
+ return false;
+ } else {
+ *val1 = atof(s.substr(0, pos).c_str());
+ *val2 = atof(s.substr(pos+1).c_str());
+ return true;
+ }
+}
+
+
+static int
+fgOptFailure( const char * arg )
+{
+ string a = arg;
+ if (a == "pitot") {
+ fgSetBool("/systems/pitot/serviceable", false);
+ } else if (a == "static") {
+ fgSetBool("/systems/static/serviceable", false);
+ } else if (a == "vacuum") {
+ fgSetBool("/systems/vacuum/serviceable", false);
+ } else if (a == "electrical") {
+ fgSetBool("/systems/electrical/serviceable", false);
+ } else {
+ SG_LOG(SG_INPUT, SG_ALERT, "Unknown failure mode: " << a);
+ return FG_OPTIONS_ERROR;
+ }
+
+ return FG_OPTIONS_OK;
+}
+
+
+static int
+fgOptNAV1( const char * arg )
+{
+ double radial, freq;
+ if (parse_colon(arg, &radial, &freq))
+ fgSetDouble("/radios/nav[0]/radials/selected-deg", radial);
+ fgSetDouble("/radios/nav[0]/frequencies/selected-mhz", freq);
+ return FG_OPTIONS_OK;
+}
+
+static int
+fgOptNAV2( const char * arg )
+{
+ double radial, freq;
+ if (parse_colon(arg, &radial, &freq))
+ fgSetDouble("/radios/nav[1]/radials/selected-deg", radial);
+ fgSetDouble("/radios/nav[1]/frequencies/selected-mhz", freq);
+ return FG_OPTIONS_OK;
+}
+
+static int
+fgOptADF( const char * arg )
+{
+ double rot, freq;
+ if (parse_colon(arg, &rot, &freq))
+ fgSetDouble("/instrumentation/adf/rotation-deg", rot);
+ fgSetDouble("/instrumentation/adf/frequencies/selected-khz", freq);
+ return FG_OPTIONS_OK;
+}
+
+static int
+fgOptDME( const char *arg )
+{
+ string opt = arg;
+ if (opt == "nav1") {
+ fgSetInt("/instrumentation/dme/switch-position", 1);
+ fgSetString("/instrumentation/dme/frequencies/source",
+ "/radios/nav[0]/frequencies/selected-mhz");
+ } else if (opt == "nav2") {
+ fgSetInt("/instrumentation/dme/switch-position", 3);
+ fgSetString("/instrumentation/dme/frequencies/source",
+ "/radios/nav[1]/frequencies/selected-mhz");
+ } else {
+ fgSetInt("/instrumentation/dme/switch-position", 2);
+ fgSetString("/instrumentation/dme/frequencies/source",
+ "/instrumentation/dme/frequencies/selected-mhz");
+ fgSetString("/instrumentation/dme/frequencies/selected-mhz", arg);
+ }
+ return FG_OPTIONS_OK;
+}
+