syncing commonlibs with Many thanks to Michael Iedema for these patches, makes config a lot better.

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@5655 19bc5d8c-e614-43d4-8b26-e1612bc8e597
This commit is contained in:
Kurtis Heimerl
2013-05-31 21:47:25 +00:00
parent 40e14f52a3
commit 7178e8367e
31 changed files with 2068 additions and 242 deletions

View File

@@ -515,23 +515,30 @@ int config(int argc, char** argv, ostream& os)
return SUCCESS;
}
/** Remove a configiuration value. */
/** Disable a configuration key. */
int unconfig(int argc, char** argv, ostream& os)
{
if (argc!=2) return BAD_NUM_ARGS;
if (gConfig.unset(argv[1])) {
os << "\"" << argv[1] << "\" removed from the configuration table" << endl;
return SUCCESS;
if (!gConfig.defines(argv[1])) {
os << argv[1] << " is not in the table" << endl;
return BAD_VALUE;
}
if (gConfig.defines(argv[1])) {
os << "\"" << argv[1] << "\" could not be removed" << endl;
} else {
os << "\"" << argv[1] << "\" was not in the table" << endl;
}
return BAD_VALUE;
}
if (gConfig.keyDefinedInSchema(argv[1]) && !gConfig.isValidValue(argv[1], "")) {
os << argv[1] << " is not disableable" << endl;
return BAD_VALUE;
}
if (!gConfig.set(argv[1], "")) {
os << "DB ERROR: " << argv[1] << " could not be disabled" << endl;
return FAILURE;
}
os << argv[1] << " disabled" << endl;
return SUCCESS;
}
/** Dump current configuration to a file. */
int configsave(int argc, char** argv, ostream& os)