aqhome-react: generalize command handling.
This commit is contained in:
@@ -75,8 +75,10 @@ int AqHomeReact_Init(AQHOME_REACT *aqh, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
s=GWEN_DB_GetCharValue(dbArgs, "params", 0, NULL);
|
s=GWEN_DB_GetCharValue(dbArgs, "params", 0, NULL);
|
||||||
if (s && *s && strcasecmp(s, "modtest")==0)
|
if (s && *s && strcasecmp(s, "modtest")==0) {
|
||||||
|
aqh->dbArgs=dbArgs;
|
||||||
return rv;
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
AQH_MergeConfigFileIntoConfig(dbArgs, "ConfigFile");
|
AQH_MergeConfigFileIntoConfig(dbArgs, "ConfigFile");
|
||||||
aqh->dbArgs=dbArgs;
|
aqh->dbArgs=dbArgs;
|
||||||
@@ -358,7 +360,7 @@ int _readArgs(int argc, char **argv, GWEN_DB_NODE *dbArgs)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
rv=GWEN_Args_Check(argc, argv, 1, GWEN_ARGS_MODE_ALLOW_FREEPARAM, args, dbArgs);
|
rv=GWEN_Args_Check(argc, argv, 1, GWEN_ARGS_MODE_ALLOW_FREEPARAM | GWEN_ARGS_MODE_STOP_AT_FREEPARAM, args, dbArgs);
|
||||||
if (rv==GWEN_ARGS_RESULT_ERROR) {
|
if (rv==GWEN_ARGS_RESULT_ERROR) {
|
||||||
fprintf(stderr, "ERROR: Could not parse arguments main\n");
|
fprintf(stderr, "ERROR: Could not parse arguments main\n");
|
||||||
return GWEN_ERROR_INVALID;
|
return GWEN_ERROR_INVALID;
|
||||||
|
|||||||
@@ -125,7 +125,14 @@ int main(int argc, char **argv)
|
|||||||
else if (rv>0) {
|
else if (rv>0) {
|
||||||
argc-=rv;
|
argc-=rv;
|
||||||
argv+=rv;
|
argv+=rv;
|
||||||
|
|
||||||
|
s=GWEN_DB_GetCharValue(dbArgs, "params", 0, NULL);
|
||||||
|
if (s && *s && strcasecmp(s, "modtest")==0)
|
||||||
rv=_testModules(argc, argv);
|
rv=_testModules(argc, argv);
|
||||||
|
else {
|
||||||
|
DBG_ERROR(NULL, "Invalid command \"%s\"", s?s:"<no command>");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
s=GWEN_DB_GetCharValue(dbArgs, "charset", 0, NULL);
|
s=GWEN_DB_GetCharValue(dbArgs, "charset", 0, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user