summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2000-09-15 15:09:15 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2000-09-15 15:09:15 +0200
commit7fbf9e6c49430ca2de4683dc7319aa32d247a0f6 (patch)
tree07f63040bdf138c88c96fca5bb019e2ab22d71a1
parent39600857613d85e035ab1f93ad8360d9eaf00fe0 (diff)
downloadvdr-7fbf9e6c49430ca2de4683dc7319aa32d247a0f6.tar.gz
vdr-7fbf9e6c49430ca2de4683dc7319aa32d247a0f6.tar.bz2
New option '-c'; config files in video directory by default
-rw-r--r--HISTORY6
-rw-r--r--INSTALL17
-rw-r--r--tools.c10
-rw-r--r--tools.h3
-rw-r--r--vdr.c23
5 files changed, 42 insertions, 17 deletions
diff --git a/HISTORY b/HISTORY
index 35aa7aa4..e93ab7cb 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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.
+
diff --git a/INSTALL b/INSTALL
index 1ebffa1b..7e102d4e 100644
--- a/INSTALL
+++ b/INSTALL
@@ -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
diff --git a/tools.c b/tools.c
index bd35f928..d854dfb1 100644
--- a/tools.c
+++ b/tools.c
@@ -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)
diff --git a/tools.h b/tools.h
index 1ef955c5..b9f3b6c0 100644
--- a/tools.h
+++ b/tools.h
@@ -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);
diff --git a/vdr.c b/vdr.c
index 26c3693a..943ff766 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.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();