summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'config.c')
-rw-r--r--config.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/config.c b/config.c
index 24c1438..d9cdb43 100644
--- a/config.c
+++ b/config.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.c 1.107 2002/10/03 10:06:55 kls Exp $
+ * $Id: config.c 1.109 2002/10/13 10:03:49 kls Exp $
*/
#include "config.h"
@@ -360,6 +360,7 @@ char *cCommand::result = NULL;
cCommand::cCommand(void)
{
title = command = NULL;
+ confirm = false;
}
cCommand::~cCommand()
@@ -374,9 +375,14 @@ bool cCommand::Parse(const char *s)
if (p) {
int l = p - s;
if (l > 0) {
- title = new char[l + 1];
- strn0cpy(title, s, l + 1);
+ title = MALLOC(char, l + 1);
+ stripspace(strn0cpy(title, s, l + 1));
if (!isempty(title)) {
+ int l = strlen(title);
+ if (l > 1 && title[l - 1] == '?') {
+ confirm = true;
+ title[l - 1] = 0;
+ }
command = stripspace(strdup(skipspace(p + 1)));
return !isempty(command);
}
@@ -385,12 +391,16 @@ bool cCommand::Parse(const char *s)
return false;
}
-const char *cCommand::Execute(void)
+const char *cCommand::Execute(const char *Parameters)
{
- dsyslog("executing command '%s'", command);
free(result);
result = NULL;
- FILE *p = popen(command, "r");
+ char *cmdbuf = NULL;
+ if (Parameters)
+ asprintf(&cmdbuf, "%s %s", command, Parameters);
+ const char *cmd = cmdbuf ? cmdbuf : command;
+ dsyslog("executing command '%s'", cmd);
+ FILE *p = popen(cmd, "r");
if (p) {
int l = 0;
int c;
@@ -404,7 +414,8 @@ const char *cCommand::Execute(void)
pclose(p);
}
else
- esyslog("ERROR: can't open pipe for command '%s'", command);
+ esyslog("ERROR: can't open pipe for command '%s'", cmd);
+ free(cmdbuf);
return result;
}
@@ -463,6 +474,7 @@ bool cCaDefinition::Parse(const char *s)
// -- cCommands --------------------------------------------------------------
cCommands Commands;
+cCommands RecordingCommands;
// -- cTimers ----------------------------------------------------------------