summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorMatti Lehtimäki <matti.lehtimaki@gmail.com>2013-01-07 21:29:45 +0200
committerMatti Lehtimäki <matti.lehtimaki@gmail.com>2013-01-07 21:29:45 +0200
commitc6ffcc01aa82582b119de294ff40aac915c88e19 (patch)
treeac6881e6c72f9f2511bcbff7d5d29607a9ff9711 /config.c
downloadvdr-plugin-history-c6ffcc01aa82582b119de294ff40aac915c88e19.tar.gz
vdr-plugin-history-c6ffcc01aa82582b119de294ff40aac915c88e19.tar.bz2
Initial commit. Version 0.0.3.v0.0.3
Diffstat (limited to 'config.c')
-rwxr-xr-xconfig.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/config.c b/config.c
new file mode 100755
index 0000000..01b2fea
--- /dev/null
+++ b/config.c
@@ -0,0 +1,51 @@
+/*
+ * config.c: Global configuration
+ *
+ * See the README file for copyright information and how to reach the author.
+ *
+ */
+
+#include "config.h"
+#include <string.h>
+
+/* Global instance */
+cHistorySetup HistorySetup;
+
+cHistorySetup::cHistorySetup()
+{
+ allow_delete = 1;
+ replay_history_size = 10;
+}
+
+cString cHistorySetup::m_ProcessedArgs;
+
+bool cHistorySetup::ProcessArg(const char *Name, const char *Value)
+{
+ if (SetupParse(Name, Value)) {
+ m_ProcessedArgs = cString::sprintf("%s%s ", *m_ProcessedArgs ? *m_ProcessedArgs : " ", Name);
+ return true;
+ }
+ return false;
+}
+
+bool cHistorySetup::ProcessArgs(int argc, char *argv[])
+{
+ return true;
+}
+
+bool cHistorySetup::SetupParse(const char *Name, const char *Value)
+{
+ const char *pt;
+ if (*m_ProcessedArgs && NULL != (pt = strstr(m_ProcessedArgs + 1, Name)) &&
+ *(pt - 1) == ' ' && *(pt + strlen(Name)) == ' ') {
+ dsyslog("Skipping configuration entry %s=%s (overridden in command line)", Name, Value);
+ return true;
+ }
+
+ if (!strcasecmp(Name, "ReplayHistorySize")) replay_history_size = atoi(Value);
+ else if (!strcasecmp(Name, "AllowDelete")) allow_delete = atoi(Value);
+ else
+ return false;
+
+ return true;
+}