summaryrefslogtreecommitdiff
path: root/vdr-vdrmanager/vdrmanager.cpp
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2013-04-01 00:57:44 +0200
committerlado <herrlado@gmail.com>2013-04-01 00:57:44 +0200
commit3a9ff0e81ab7b93e64a00e1f2823a5b4f480ae32 (patch)
tree92df4484b3803ba57e872c22c7328dea18cabd1f /vdr-vdrmanager/vdrmanager.cpp
parentda1c6058c56059c064f55b81586d6079677fa1b4 (diff)
downloadvdr-manager-3a9ff0e81ab7b93e64a00e1f2823a5b4f480ae32.tar.gz
vdr-manager-3a9ff0e81ab7b93e64a00e1f2823a5b4f480ae32.tar.bz2
command line handling c::
Diffstat (limited to 'vdr-vdrmanager/vdrmanager.cpp')
-rw-r--r--vdr-vdrmanager/vdrmanager.cpp38
1 files changed, 20 insertions, 18 deletions
diff --git a/vdr-vdrmanager/vdrmanager.cpp b/vdr-vdrmanager/vdrmanager.cpp
index 0d26963..6542c89 100644
--- a/vdr-vdrmanager/vdrmanager.cpp
+++ b/vdr-vdrmanager/vdrmanager.cpp
@@ -16,7 +16,7 @@
#define VDRMANAGER_PORT 6420
-static const char *VERSION = "0.9";
+static const char *VERSION = "0.10";
static const char *DESCRIPTION = "VDR-Manager support plugin";
class cVdrManager: public cPlugin {
@@ -25,8 +25,8 @@ private:
cVdrManagerThread * Thread;
int port;
const char * password;
- bool forceCheckSvdrp = false;
- int compressionMode = COMPRESSION_NONE;
+ bool forceCheckSvdrp;
+ int compressionMode;
protected:
public:
cVdrManager(void);
@@ -73,16 +73,15 @@ cMenuSetupPage * cVdrManager::SetupMenu(void) {
}
const char * cVdrManager::CommandLineHelp(void) {
- return
- " -p port port number to listen to\n"
- " -P password password (none if not given). No password forces check against svdrphosts.conf.\n"
- " -s force check against svdrphosts.conf, even if a password was given\n"
- " -c compression selects the compression mode to use (zlib or gzip). Default is zlib";
+ return " -p port port number to listen to\n"
+ " -P password password (none if not given). No password forces check against svdrphosts.conf.\n"
+ " -s force check against svdrphosts.conf, even if a password was given\n"
+ " -c compression selects the compression mode to use (zlib or gzip). Default is zlib";
}
bool cVdrManager::ProcessArgs(int argc, char *argv[]) {
int c;
- while ((c = getopt(argc, argv, "c:p:P:sf")) != -1)
+ while ((c = getopt(argc, argv, "c::p:P:s")) != -1)
switch (c) {
case 'p':
port = atoi(optarg);
@@ -94,14 +93,16 @@ bool cVdrManager::ProcessArgs(int argc, char *argv[]) {
forceCheckSvdrp = true;
break;
case 'c':
- if (optarg[0] == 'g') {
- compressionMode = COMPRESSION_GZIP;
- } else if (optarg[0] == 'z') {
- compressionMode = COMPRESSION_ZLIB;
- } else {
- compressionMode = COMPRESSION_ZLIB;
- }
- break;
+ if (!optarg) {
+ compressionMode = COMPRESSION_ZLIB;
+ } else if (optarg[0] == 'g') {
+ compressionMode = COMPRESSION_GZIP;
+ } else if (optarg[0] == 'z') {
+ compressionMode = COMPRESSION_ZLIB;
+ } else {
+ return false;
+ }
+ break;
case '?':
return false;
default:
@@ -119,7 +120,8 @@ bool cVdrManager::Initialize(void) {
// Initialize any background activities the plugin shall perform.
// Start any background activities the plugin shall perform.
- Thread = new cVdrManagerThread(port, password, forceCheckSvdrp, compressionMode);
+ Thread = new cVdrManagerThread(port, password, forceCheckSvdrp,
+ compressionMode);
return Thread != NULL;
}