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

New option '-c'; config files in video directory by default

This commit is contained in:
Klaus Schmidinger 2000-09-15 15:09:15 +02:00
parent 3960085761
commit 7fbf9e6c49
5 changed files with 42 additions and 17 deletions

View File

@ -173,3 +173,9 @@ Video Disk Recorder Revision History
- Video files now have the 'group read' bit set.
- Fixed handling errors in 'readstring()'.
- Handling SIGPIPE and re-establishing handler after intercepting a signal.
- The configuration files are now by default read from the video directory.
This can be changed by using the new '-c' option. Make sure you copy your
current '*.conf' files to your video directory ('/video' by default), or
use "-c ." to get the old behaviour of loading the configuration files
from the current directory.

17
INSTALL
View File

@ -102,14 +102,15 @@ Configuration files:
--------------------
There are three configuration files that hold information about
channels, remote control keys and timers. These files are currrently
assumed to be located in the directory from which the 'vdr' program
was started (this will become configurable later). The configuration
files can be edited with any text editor, or will be written by the
'vdr' program if any changes are made inside the on-screen menus.
The meaning of the data entries may still vary in future releases,
so for the moment please look at the source code (config.c) to see
the meaning of the various fields.
channels, remote control keys and timers. By default these files are
assumed to be located in the video directory, but a different directory
can be used with the '-c' option.
The configuration files can be edited with any text editor, or will be written
by the 'vdr' program if any changes are made inside the on-screen menus.
The meaning of the data entries may still vary in future releases, so for the
moment please look at the source code (config.c) to see the meaning of the
various fields.
The files that come with this package contain the author's selections,
so please make sure you adapt these to your personal taste. Also make sure

10
tools.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: tools.c 1.15 2000/09/15 13:30:24 kls Exp $
* $Id: tools.c 1.16 2000/09/15 14:45:31 kls Exp $
*/
#define _GNU_SOURCE
@ -153,6 +153,14 @@ bool isnumber(const char *s)
return true;
}
const char *AddDirectory(const char *DirName, const char *FileName)
{
static char *buf = NULL;
delete buf;
asprintf(&buf, "%s/%s", DirName && *DirName ? DirName : ".", FileName);
return buf;
}
#define DFCMD "df -m %s"
uint FreeDiskSpaceMB(const char *Directory)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: tools.h 1.13 2000/09/09 12:53:10 kls Exp $
* $Id: tools.h 1.14 2000/09/15 14:23:29 kls Exp $
*/
#ifndef __TOOLS_H
@ -44,6 +44,7 @@ char *skipspace(char *s);
int time_ms(void);
void delay_ms(int ms);
bool isnumber(const char *s);
const char *AddDirectory(const char *DirName, const char *FileName);
uint FreeDiskSpaceMB(const char *Directory);
bool DirectoryOk(const char *DirName, bool LogErrors = false);
bool MakeDirs(const char *FileName, bool IsDirectory = false);

23
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.31 2000/09/15 13:55:39 kls Exp $
* $Id: vdr.c 1.32 2000/09/15 15:01:08 kls Exp $
*/
#include <getopt.h>
@ -60,9 +60,11 @@ int main(int argc, char *argv[])
#define DEFAULTSVDRPPORT 2001
int SVDRPport = DEFAULTSVDRPPORT;
const char *ConfigDirectory = NULL;
bool DaemonMode = false;
static struct option long_options[] = {
{ "config", required_argument, NULL, 'c' },
{ "daemon", no_argument, NULL, 'd' },
{ "help", no_argument, NULL, 'h' },
{ "log", required_argument, NULL, 'l' },
@ -73,10 +75,14 @@ int main(int argc, char *argv[])
int c;
int option_index = 0;
while ((c = getopt_long(argc, argv, "dhl:p:v:", long_options, &option_index)) != -1) {
while ((c = getopt_long(argc, argv, "c:dhl:p:v:", long_options, &option_index)) != -1) {
switch (c) {
case 'c': ConfigDirectory = optarg;
break;
case 'd': DaemonMode = true; break;
case 'h': printf("Usage: vdr [OPTION]\n\n"
case 'h': printf("Usage: vdr [OPTION]\n\n" // for easier orientation, this is column 80|
" -c DIR, --config=DIR read config files from DIR (default is to read them\n"
" from the video directory)\n"
" -h, --help display this help and exit\n"
" -d, --daemon run in daemon mode\n"
" -l LEVEL, --log=LEVEL set log level (default: 3)\n"
@ -156,13 +162,16 @@ int main(int argc, char *argv[])
// Configuration data:
Setup.Load("setup.conf");
Channels.Load("channels.conf");
Timers.Load("timers.conf");
if (!ConfigDirectory)
ConfigDirectory = VideoDirectory;
Setup.Load(AddDirectory(ConfigDirectory, "setup.conf"));
Channels.Load(AddDirectory(ConfigDirectory, "channels.conf"));
Timers.Load(AddDirectory(ConfigDirectory, "timers.conf"));
#ifdef REMOTE_LIRC
Keys.SetDummyValues();
#else
if (!Keys.Load(KEYS_CONF))
if (!Keys.Load(AddDirectory(ConfigDirectory, KEYS_CONF)))
Interface.LearnKeys();
#endif
Interface.Init();