#! /bin/sh /usr/share/dpatch/dpatch-run ## 03_command_from_cli.dpatch by Thomas Schmidt <tschmidt@debian.org> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Added commandline option --command to be able to specify which ## DP: command should be called when starting the plugin. @DPATCH@ diff -urNad vdr-plugin-console-0.6.0/console.c /tmp/dpep.7Ca0hf/vdr-plugin-console-0.6.0/console.c --- vdr-plugin-console-0.6.0/console.c 2004-09-11 23:44:25.000000000 +0200 +++ /tmp/dpep.7Ca0hf/vdr-plugin-console-0.6.0/console.c 2005-04-11 19:55:48.583455832 +0200 @@ -60,14 +60,34 @@ const char *cPluginConsole::CommandLineHelp() { - return NULL; + // Return a string that describes all known command line options. + return " -c prog, --command=prog specify the programm which is\n" + " called when you start the plugin\n"; } bool cPluginConsole::ProcessArgs(int argc, char *argv[]) { - return true; + // Implement command line argument processing here if applicable. + static struct option long_options[] = { + { "command", required_argument, NULL, 'c' }, + { NULL, no_argument, NULL, 0 }, + }; + + int c; + while ((c = getopt_long(argc, argv, "c:", long_options, NULL)) != -1) { + switch (c) { + case 'c': + fprintf(stderr, "arg: %s\n", optarg); + ConsoleCmd = strdup(optarg); + break; + default: + fprintf(stderr, "arg char: %c\n", c); + return false; + } + } + return true; } diff -urNad vdr-plugin-console-0.6.0/virtualconsoles.c /tmp/dpep.7Ca0hf/vdr-plugin-console-0.6.0/virtualconsoles.c --- vdr-plugin-console-0.6.0/virtualconsoles.c 2004-09-11 23:40:18.000000000 +0200 +++ /tmp/dpep.7Ca0hf/vdr-plugin-console-0.6.0/virtualconsoles.c 2005-04-11 20:11:07.817766136 +0200 @@ -20,6 +20,17 @@ #include "i18n.h" +// This program will be used to realize a console. +// Be carefull! If your VDR runs as root, then every +// user can kill your machine if you don't protect +// the cnsoles. +// So the default is "/bin/login". + +#ifdef CONSOLE_USE_SHELL_INSTEAD_LOGIN +const char *ConsoleCmd="/bin/sh"; +#else +const char *ConsoleCmd="/bin/login"; +#endif cConsConsoles::cConsConsoles() @@ -128,9 +139,9 @@ int cConsConsoles::CreateConsole() { - char* const args[] = {PROG_FOR_CONSOLE, NULL}; + char* const args[] = { (char*)ConsoleCmd, NULL }; - cConsVirtualConsole* p = new cConsVirtualConsole(tr("Console"), PROG_FOR_CONSOLE, args); + cConsVirtualConsole* p = new cConsVirtualConsole( tr("Console"), ConsoleCmd, args ); if (p) { diff -urNad vdr-plugin-console-0.6.0/virtualconsoles.h /tmp/dpep.7Ca0hf/vdr-plugin-console-0.6.0/virtualconsoles.h --- vdr-plugin-console-0.6.0/virtualconsoles.h 2004-09-11 23:40:18.000000000 +0200 +++ /tmp/dpep.7Ca0hf/vdr-plugin-console-0.6.0/virtualconsoles.h 2005-04-11 19:55:48.584455680 +0200 @@ -21,19 +21,7 @@ -// This program will be used to realize a console. -// Be carefull! If your VDR runs as root, then every -// user can kill your machine if you don't protect -// the cnsoles. -// So the default is "/bin/login". - -#ifdef CONSOLE_USE_SHELL_INSTEAD_LOGIN -#define PROG_FOR_CONSOLE "/bin/sh" -#else -#define PROG_FOR_CONSOLE "/bin/login" -#endif - - +extern const char *ConsoleCmd; class cConsVirtualConsole;