diff --git a/CONTRIBUTORS b/CONTRIBUTORS index de023cd0..4d079797 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -317,6 +317,8 @@ Rainer Zocholl for reporting a bug in skipping the next hit of a repeating timer for reporting a problem with staying off the end of an ongoing recording while replaying in time shift mode + for suggesting that VDR should stop if one of the configuration files can't be + read correctly at program startup Oleg Assovski for adding EPG scanning for another 4 days diff --git a/HISTORY b/HISTORY index d5143176..873344c8 100644 --- a/HISTORY +++ b/HISTORY @@ -2300,3 +2300,5 @@ Video Disk Recorder Revision History to Reinhard Nissl for reporting this one). - Fixed staying off the end of an ongoing recording while replaying in time shift mode (thanks to Rainer Zocholl for reporting this one). +- VDR now stops with exit status 2 if one of the configuration files can't be + read correctly at program startup (suggested by Rainer Zocholl). diff --git a/channels.c b/channels.c index c68b4ee3..58577296 100644 --- a/channels.c +++ b/channels.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.c 1.12 2003/04/26 09:57:48 kls Exp $ + * $Id: channels.c 1.13 2003/08/16 09:12:26 kls Exp $ */ #include "channels.h" @@ -390,9 +390,9 @@ bool cChannel::Save(FILE *f) cChannels Channels; -bool cChannels::Load(const char *FileName, bool AllowComments) +bool cChannels::Load(const char *FileName, bool AllowComments, bool MustExist) { - if (cConfig::Load(FileName, AllowComments)) { + if (cConfig::Load(FileName, AllowComments, MustExist)) { ReNumber(); return true; } diff --git a/channels.h b/channels.h index c82fc282..ca76af16 100644 --- a/channels.h +++ b/channels.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.h 1.7 2003/04/26 09:15:40 kls Exp $ + * $Id: channels.h 1.8 2003/08/16 09:12:15 kls Exp $ */ #ifndef __CHANNELS_H @@ -130,7 +130,7 @@ protected: int maxNumber; public: cChannels(void) { maxNumber = 0; } - virtual bool Load(const char *FileName, bool AllowComments = false); + virtual bool Load(const char *FileName, bool AllowComments = false, bool MustExist = false); int GetNextGroup(int Idx); // Get next channel group int GetPrevGroup(int Idx); // Get previous channel group int GetNextNormal(int Idx); // Get next normal channel (not group) diff --git a/config.h b/config.h index 9e6f6e2e..c4590a77 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.166 2003/08/06 14:45:10 kls Exp $ + * $Id: config.h 1.167 2003/08/16 09:08:33 kls Exp $ */ #ifndef __CONFIG_H @@ -87,7 +87,7 @@ public: cConfig(void) { fileName = NULL; } virtual ~cConfig() { free(fileName); } const char *FileName(void) { return fileName; } - bool Load(const char *FileName = NULL, bool AllowComments = false) + bool Load(const char *FileName = NULL, bool AllowComments = false, bool MustExist = false) { Clear(); if (FileName) { @@ -95,7 +95,7 @@ public: fileName = strdup(FileName); allowComments = AllowComments; } - bool result = false; + bool result = !MustExist; if (fileName && access(fileName, F_OK) == 0) { isyslog("loading %s", fileName); FILE *f = fopen(fileName, "r"); @@ -125,9 +125,13 @@ public: } fclose(f); } - else + else { LOG_ERROR_STR(fileName); + result = false; + } } + if (!result) + fprintf(stderr, "vdr: error while reading '%s'\n", fileName); return result; } bool Save(void) diff --git a/vdr.c b/vdr.c index 16e8bdd4..c973e88b 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/vdr * - * $Id: vdr.c 1.162 2003/08/02 14:01:32 kls Exp $ + * $Id: vdr.c 1.163 2003/08/16 09:15:28 kls Exp $ */ #include @@ -341,17 +341,19 @@ int main(int argc, char *argv[]) cPlugin::SetConfigDirectory(ConfigDirectory); - Setup.Load(AddDirectory(ConfigDirectory, "setup.conf")); - Sources.Load(AddDirectory(ConfigDirectory, "sources.conf"), true); - Diseqcs.Load(AddDirectory(ConfigDirectory, "diseqc.conf"), true); - Channels.Load(AddDirectory(ConfigDirectory, "channels.conf")); - Timers.Load(AddDirectory(ConfigDirectory, "timers.conf")); - Commands.Load(AddDirectory(ConfigDirectory, "commands.conf"), true); - RecordingCommands.Load(AddDirectory(ConfigDirectory, "reccmds.conf"), true); - SVDRPhosts.Load(AddDirectory(ConfigDirectory, "svdrphosts.conf"), true); - CaDefinitions.Load(AddDirectory(ConfigDirectory, "ca.conf"), true); - Keys.Load(AddDirectory(ConfigDirectory, "remote.conf")); - KeyMacros.Load(AddDirectory(ConfigDirectory, "keymacros.conf"), true); + if (!(Setup.Load(AddDirectory(ConfigDirectory, "setup.conf")) && + Sources.Load(AddDirectory(ConfigDirectory, "sources.conf"), true, true) && + Diseqcs.Load(AddDirectory(ConfigDirectory, "diseqc.conf"), true, true) && + Channels.Load(AddDirectory(ConfigDirectory, "channels.conf"), false, true) && + Timers.Load(AddDirectory(ConfigDirectory, "timers.conf")) && + Commands.Load(AddDirectory(ConfigDirectory, "commands.conf"), true) && + RecordingCommands.Load(AddDirectory(ConfigDirectory, "reccmds.conf"), true) && + SVDRPhosts.Load(AddDirectory(ConfigDirectory, "svdrphosts.conf"), true) && + CaDefinitions.Load(AddDirectory(ConfigDirectory, "ca.conf"), true) && + Keys.Load(AddDirectory(ConfigDirectory, "remote.conf")) && + KeyMacros.Load(AddDirectory(ConfigDirectory, "keymacros.conf"), true) + )) + return 2; // DVB interfaces: