summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-03-31 10:32:58 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2001-03-31 10:32:58 +0200
commit378db17bee8dd5fcdcb4486900336048a35f7018 (patch)
treef06c03262d751003dd9a6c0539c0b9122d1f78bb
parent6ca89f0eb39999af534f51501775570e64295375 (diff)
downloadvdr-378db17bee8dd5fcdcb4486900336048a35f7018.tar.gz
vdr-378db17bee8dd5fcdcb4486900336048a35f7018.tar.bz2
New command line option -t
-rw-r--r--CONTRIBUTORS3
-rw-r--r--HISTORY3
-rw-r--r--INSTALL5
-rw-r--r--vdr.c18
4 files changed, 26 insertions, 3 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index d3482694..7a409b94 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -66,3 +66,6 @@ Axel Gruber <axel@agm.de>
Arnold Niessen <niessen@iae.nl> <arnold.niessen@philips.com>
for translating the OSD texts to the Dutch language
+
+Jürgen Sauer <jojo@automatix.de>
+ for implementing the -t option to set the controlling terminal
diff --git a/HISTORY b/HISTORY
index 7e0d8ea8..6c4195be 100644
--- a/HISTORY
+++ b/HISTORY
@@ -435,3 +435,6 @@ Video Disk Recorder Revision History
- Fixed a problem with Daylight Saving Time when displaying the times of
recordings.
- Added Dutch language texts (thanks to Arnold Niessen).
+- The new command line option -t can be used to set the controlling terminal
+ (thanks to Jürgen Sauer). This is especially useful when starting VDR through
+ an entry in /etc/inittab (see INSTALL).
diff --git a/INSTALL b/INSTALL
index c334ed6d..6910f6b4 100644
--- a/INSTALL
+++ b/INSTALL
@@ -71,6 +71,11 @@ If the program shall run as a daemon, use the --daemon option. This
will completely detach it from the terminal and will continue as a
background process.
+When starting the program through an entry in /etc/inittab, use the --terminal
+option to set the controlling terminal, as in
+
+vdr:123:respawn:/usr/local/bin/vdr --terminal=/dev/tty8 -w 60
+
Automatic restart in case of hangups:
-------------------------------------
diff --git a/vdr.c b/vdr.c
index 938afcf0..71f3222b 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
- * $Id: vdr.c 1.54 2001/02/24 16:18:43 kls Exp $
+ * $Id: vdr.c 1.55 2001/03/31 10:18:25 kls Exp $
*/
#include <getopt.h>
@@ -74,6 +74,7 @@ int main(int argc, char *argv[])
const char *ConfigDirectory = NULL;
bool DaemonMode = false;
int WatchdogTimeout = DEFAULTWATCHDOG;
+ char *Terminal = NULL;
static struct option long_options[] = {
{ "config", required_argument, NULL, 'c' },
@@ -84,12 +85,13 @@ int main(int argc, char *argv[])
{ "port", required_argument, NULL, 'p' },
{ "video", required_argument, NULL, 'v' },
{ "watchdog", required_argument, NULL, 'w' },
+ { "terminal", required_argument, NULL, 't' },
{ 0 }
};
int c;
int option_index = 0;
- while ((c = getopt_long(argc, argv, "c:dD:hl:p:v:w:", long_options, &option_index)) != -1) {
+ while ((c = getopt_long(argc, argv, "c:dD:hl:p:v:w:t:", long_options, &option_index)) != -1) {
switch (c) {
case 'c': ConfigDirectory = optarg;
break;
@@ -117,9 +119,10 @@ int main(int argc, char *argv[])
" 2 = errors and info, 3 = errors, info and debug\n"
" -p PORT, --port=PORT use PORT for SVDRP (default: %d)\n"
" 0 turns off SVDRP\n"
- " -v DIR, --video=DIR use DIR as video directory (default is %s)\n"
+ " -v DIR, --video=DIR use DIR as video directory (default: %s)\n"
" -w SEC, --watchdog=SEC activate the watchdog timer with a timeout of SEC\n"
" seconds (default: %d); '0' disables the watchdog\n"
+ " -t TTY, --terminal=TTY controlling tty\n"
"\n"
"Report bugs to <vdr-bugs@cadsoft.de>\n",
DEFAULTSVDRPPORT,
@@ -145,6 +148,8 @@ int main(int argc, char *argv[])
abort();
}
break;
+ case 't': Terminal = optarg;
+ break;
case 'v': VideoDirectory = optarg;
while (optarg && *optarg && optarg[strlen(optarg) - 1] == '/')
optarg[strlen(optarg) - 1] = 0;
@@ -195,6 +200,13 @@ int main(int argc, char *argv[])
abort();
#endif
}
+ else if (Terminal) {
+ // Claim new controlling terminal
+ stdin = freopen(Terminal, "r", stdin);
+ stdout = freopen(Terminal, "w", stdout);
+ stderr = freopen(Terminal, "w", stderr);
+ }
+
isyslog(LOG_INFO, "VDR version %s started", VDRVERSION);
// Configuration data: