summaryrefslogtreecommitdiff
path: root/misc/config.cpp
diff options
context:
space:
mode:
authorDenis Loh <denis.loh@gmail.com>2009-11-19 12:21:55 +0100
committerDenis Loh <denis.loh@gmail.com>2009-11-19 12:21:55 +0100
commit2d245fcabb385347359759de8e6c40ce16e43cab (patch)
treeee6d718e2be089c50a1f0f6ca6fb89cc3c3161b0 /misc/config.cpp
parent4510b4d123a4f62c49c55fa517f15df4fa90ebec (diff)
downloadvdr-plugin-upnp-2d245fcabb385347359759de8e6c40ce16e43cab.tar.gz
vdr-plugin-upnp-2d245fcabb385347359759de8e6c40ce16e43cab.tar.bz2
Added options for verbosity level and auto detect settings
Diffstat (limited to 'misc/config.cpp')
-rw-r--r--misc/config.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/misc/config.cpp b/misc/config.cpp
index 59bf4a6..1fa0ccb 100644
--- a/misc/config.cpp
+++ b/misc/config.cpp
@@ -32,6 +32,7 @@ cUPnPConfig* cUPnPConfig::get(){
}
cUPnPConfig* cUPnPConfig::mInstance = NULL;
+int cUPnPConfig::verbosity = 0;
bool cUPnPConfig::processArgs(int argc, char* argv[]){
// Implement command line argument processing here if applicable.
@@ -39,7 +40,9 @@ bool cUPnPConfig::processArgs(int argc, char* argv[]){
{"int", required_argument, NULL, 'i'},
{"address", required_argument, NULL, 'a'},
{"port", required_argument, NULL, 'p'},
- {"autodetect", no_argument, NULL, 'd'}
+ {"autodetect", no_argument, NULL, 'd'},
+ {"verbose", no_argument, NULL, 'v'},
+ {0, 0, 0, 0}
};
int c = 0;
@@ -55,8 +58,9 @@ bool cUPnPConfig::processArgs(int argc, char* argv[]){
bool success = true;
bool ifaceExcistent = false;
bool addExcistent = false;
+ static int verbose = 0;
- while((c = getopt_long(argc, argv, "i:a:p:v",long_options, NULL)) != -1){
+ while((c = getopt_long(argc, argv, "i:a:p:dv",long_options, NULL)) != -1){
switch(c){
case 'i':
if(addExcistent) { ERROR("Address given but must be absent!"); return false; }
@@ -78,6 +82,12 @@ bool cUPnPConfig::processArgs(int argc, char* argv[]){
break;
case 'd':
success = this->parseSetup(SETUP_SERVER_AUTO, optarg) && success;
+ break;
+ case 'v':
+ cUPnPConfig::verbosity++;
+ verbose++;
+ WARNING("Verbosity level: %i ", verbose);
+ break;
default:
return false;
}
@@ -90,11 +100,11 @@ bool cUPnPConfig::parseSetup(const char *Name, const char *Value)
{
const char* ptr;
if(*this->mParsedArgs && (ptr = strstr(this->mParsedArgs,Name))!=NULL){
- MESSAGE("Skipping %s=%s, was overridden in command line.",Name, Value);
+ MESSAGE(VERBOSE_SDK, "Skipping %s=%s, was overridden in command line.",Name, Value);
return true;
}
- MESSAGE("VARIABLE %s has value %s", Name, Value);
+ MESSAGE(VERBOSE_SDK, "VARIABLE %s has value %s", Name, Value);
// Parse your own setup parameters and store their values.
if (!strcasecmp(Name, SETUP_SERVER_ENABLED)) this->mEnable = atoi(Value);
else if (!strcasecmp(Name, SETUP_SERVER_AUTO)) this->mAutoSetup = atoi(Value);