49 cout <<
"Usage: " <<
progname <<
" <ini file>\n";
54 char *defines = getenv(
"CONFIG_DEFINES");
57 while ((c = strchr(c,
' ')) != NULL) {
67 main(
int argc,
char *argv[])
73 for (
int i = 1;
i < argc; ++
i) {
74 char *arg_str = argv[
i];
78 if (arg_str[0] ==
'-') {
85 if (!simConfigDB.
add(arg_str + 2)) {
88 "Could not parse configuration argument '%s'\n"
89 "Expecting --<section>:<parameter>=<value>\n",
102 if (!simConfigDB.
load(arg_str)) {
103 cprintf(
"Error processing file %s\n", arg_str);
112 if (simConfigDB.find(C, E, value)) \
113 cout << ">" << value << "<\n"; \
115 cout << "Not Found!\n"
117 FIND(
"General",
"Test2");
118 FIND(
"Junk",
"Test3");
119 FIND(
"Junk",
"Test4");
120 FIND(
"General",
"Test1");
121 FIND(
"Junk2",
"test3");
122 FIND(
"General",
"Test3");
void ccprintf(cp::Print &print)
bool add(const std::string &s)
Take string of the form "<section>:<parameter>=<value>" or "<section>:<parameter>+=<value>" and add t...
bool load(std::istream &f)
Load parameter settings from given istream.
Declaration of IniFile object.
void dump()
Dump contents to cout. For debugging.
int main(int argc, char *argv[])
This class represents the contents of a ".ini" file.
void cprintf(const char *format, const Args &...args)