]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Use full path when trying to load config from build structure
authorAndreas Öman <andreas@lonelycoder.com>
Sun, 19 Aug 2007 08:43:57 +0000 (08:43 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Sun, 19 Aug 2007 08:43:57 +0000 (08:43 +0000)
Makefile
main.c

index 9746c5f2a70ceb8edbfbeffa2e50470c568c3ff8..99c4dcd6f506942e499f22d0196cc99205009f5a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,9 +12,9 @@ SRCS += iptv_input.c iptv_output.c
 
 SRCS +=        htsclient.c
 
-PROG = tvhead
+PROG = tvheadend
 CFLAGS += -g -Wall -Werror -O2
-CFLAGS += -I$(INCLUDES_INSTALL_BASE)
+CFLAGS += -I$(INCLUDES_INSTALL_BASE) $(HTS_CFLAGS)
 CFLAGS += -Wno-deprecated-declarations
 CFLAGS += -D_LARGEFILE64_SOURCE
 CFLAGS += -DENABLE_INPUT_IPTV -DENABLE_INPUT_DVB
diff --git a/main.c b/main.c
index 79e2f266b1fead7dd08e6feab9e0514eea3aebc2..4709cabcf211de86d820b55b8ad854c7c25b2c0e 100644 (file)
--- a/main.c
+++ b/main.c
@@ -46,6 +46,7 @@
 #include "pvr.h"
 #include "dispatch.h"
 #include "iptv_output.h"
+#include "config.h"
 
 int running;
 int xmltvreload;
@@ -100,8 +101,7 @@ main(int argc, char **argv)
   const char *groupnam = NULL;
   char *cfgfile;
   int logfacility = LOG_DAEMON;
-
-  
+  int r;
 
   signal(SIGPIPE, handle_sigpipe);
 
@@ -124,7 +124,22 @@ main(int argc, char **argv)
     }
   }
 
-  config_read_file(cfgfile);
+  if((r = config_read_file(cfgfile)) < 0) {
+    fprintf(stderr, 
+           "configfile \"%s\" not found, trying from build structure\n",
+           cfgfile);
+
+    cfgfile = HTS_BUILD_ROOT "/etc/tvheadend.cfg";
+    r = config_read_file(cfgfile);
+  }
+
+
+  if(r < 0)
+    fprintf(stderr, 
+           "configfile \"%s\" not found, running with defaults\n",
+           cfgfile);
+  else
+    fprintf(stderr, "Config from \"%s\" loaded\n", cfgfile);
 
   if(forkaway) {
     if(daemon(0, 0)) {