summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY2
-rw-r--r--config.c66
-rw-r--r--config.h20
3 files changed, 47 insertions, 41 deletions
diff --git a/HISTORY b/HISTORY
index 02260c47..bcfa549a 100644
--- a/HISTORY
+++ b/HISTORY
@@ -449,4 +449,4 @@ Video Disk Recorder Revision History
of terminating with 'abort()' (which caused a core dump).
- SVDRP now also works with clients that don't do line buffering (like the
Windows 'telnet').
-
+- Empty lines in config files no longer cause error messages.
diff --git a/config.c b/config.c
index 66eb1780..acf1996a 100644
--- a/config.c
+++ b/config.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.c 1.43 2001/02/24 13:20:18 kls Exp $
+ * $Id: config.c 1.44 2001/04/01 14:32:22 kls Exp $
*/
#include "config.h"
@@ -75,37 +75,39 @@ bool cKeys::Load(const char *FileName)
result = true;
while (fgets(buffer, sizeof(buffer), f) > 0) {
line++;
- char *Name = buffer;
- char *p = strpbrk(Name, " \t");
- if (p) {
- *p = 0; // terminates 'Name'
- while (*++p && isspace(*p))
- ;
- if (*p) {
- if (strcasecmp(Name, "Code") == 0)
- code = *p;
- else if (strcasecmp(Name, "Address") == 0)
- address = strtol(p, NULL, 16);
- else {
- for (tKey *k = keys; k->type != kNone; k++) {
- if (strcasecmp(Name, k->name) == 0) {
- k->code = strtol(p, NULL, 16);
- Name = NULL; // to indicate that we found it
+ if (!isempty(buffer)) {
+ char *Name = buffer;
+ char *p = strpbrk(Name, " \t");
+ if (p) {
+ *p = 0; // terminates 'Name'
+ while (*++p && isspace(*p))
+ ;
+ if (*p) {
+ if (strcasecmp(Name, "Code") == 0)
+ code = *p;
+ else if (strcasecmp(Name, "Address") == 0)
+ address = strtol(p, NULL, 16);
+ else {
+ for (tKey *k = keys; k->type != kNone; k++) {
+ if (strcasecmp(Name, k->name) == 0) {
+ k->code = strtol(p, NULL, 16);
+ Name = NULL; // to indicate that we found it
+ break;
+ }
+ }
+ if (Name) {
+ esyslog(LOG_ERR, "unknown key in %s, line %d\n", fileName, line);
+ result = false;
break;
}
}
- if (Name) {
- esyslog(LOG_ERR, "unknown key in %s, line %d\n", fileName, line);
- result = false;
- break;
- }
- }
+ }
+ continue;
}
- continue;
+ esyslog(LOG_ERR, "error in %s, line %d\n", fileName, line);
+ result = false;
+ break;
}
- esyslog(LOG_ERR, "error in %s, line %d\n", fileName, line);
- result = false;
- break;
}
fclose(f);
}
@@ -782,10 +784,12 @@ bool cSetup::Load(const char *FileName)
bool result = true;
while (fgets(buffer, sizeof(buffer), f) > 0) {
line++;
- if (*buffer != '#' && !Parse(buffer)) {
- esyslog(LOG_ERR, "error in %s, line %d\n", fileName, line);
- result = false;
- break;
+ if (!isempty(buffer)) {
+ if (*buffer != '#' && !Parse(buffer)) {
+ esyslog(LOG_ERR, "error in %s, line %d\n", fileName, line);
+ result = false;
+ break;
+ }
}
}
fclose(f);
diff --git a/config.h b/config.h
index 1bc8a535..6c21fb2f 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.43 2001/03/18 16:47:00 kls Exp $
+ * $Id: config.h 1.44 2001/04/01 14:44:40 kls Exp $
*/
#ifndef __CONFIG_H
@@ -184,14 +184,16 @@ public:
result = true;
while (fgets(buffer, sizeof(buffer), f) > 0) {
line++;
- T *l = new T;
- if (l->Parse(buffer))
- Add(l);
- else {
- esyslog(LOG_ERR, "error in %s, line %d\n", fileName, line);
- delete l;
- result = false;
- break;
+ if (!isempty(buffer)) {
+ T *l = new T;
+ if (l->Parse(buffer))
+ Add(l);
+ else {
+ esyslog(LOG_ERR, "error in %s, line %d\n", fileName, line);
+ delete l;
+ result = false;
+ break;
+ }
}
}
fclose(f);