1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

New command line option -t

This commit is contained in:
Klaus Schmidinger 2001-03-31 10:32:58 +02:00
parent 6ca89f0eb3
commit 378db17bee
4 changed files with 26 additions and 3 deletions

View File

@ -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

View File

@ -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).

View File

@ -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:
-------------------------------------

18
vdr.c
View File

@ -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: