1 #include "configreader.h"
3 int main(
int argc,
char **argv)
5 if(argc != 3)
return(-1);
9 const char *filename = argv[1];
10 const char *key = argv[2];
12 config.init(watch_files);
13 config.addFile(
"config/nonexist.cfg",ConfigReader::Optional);
14 config.addFile(filename);
15 if(!config.readFiles()){
16 printf(
"Failed to read config\n");
24 const char *value = config.getStr(key,
"");
25 printf(
"%s = \"%s\"\n",key,value);
29 while(watch_files.getEvents() == 0) usleep(100*1000);
30 if(config.isFileModified()) config.readFiles();
31 watch_files.clearEvents();