Empty lines in config files no longer cause error messages

This commit is contained in:
Klaus Schmidinger 2001-04-01 14:44:40 +02:00
parent ab626eecd3
commit eb8bd1e754
3 changed files with 47 additions and 41 deletions

View File

@ -449,4 +449,4 @@ Video Disk Recorder Revision History
of terminating with 'abort()' (which caused a core dump). of terminating with 'abort()' (which caused a core dump).
- SVDRP now also works with clients that don't do line buffering (like the - SVDRP now also works with clients that don't do line buffering (like the
Windows 'telnet'). Windows 'telnet').
- Empty lines in config files no longer cause error messages.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "config.h"
@ -75,6 +75,7 @@ bool cKeys::Load(const char *FileName)
result = true; result = true;
while (fgets(buffer, sizeof(buffer), f) > 0) { while (fgets(buffer, sizeof(buffer), f) > 0) {
line++; line++;
if (!isempty(buffer)) {
char *Name = buffer; char *Name = buffer;
char *p = strpbrk(Name, " \t"); char *p = strpbrk(Name, " \t");
if (p) { if (p) {
@ -107,6 +108,7 @@ bool cKeys::Load(const char *FileName)
result = false; result = false;
break; break;
} }
}
fclose(f); fclose(f);
} }
else else
@ -782,12 +784,14 @@ bool cSetup::Load(const char *FileName)
bool result = true; bool result = true;
while (fgets(buffer, sizeof(buffer), f) > 0) { while (fgets(buffer, sizeof(buffer), f) > 0) {
line++; line++;
if (!isempty(buffer)) {
if (*buffer != '#' && !Parse(buffer)) { if (*buffer != '#' && !Parse(buffer)) {
esyslog(LOG_ERR, "error in %s, line %d\n", fileName, line); esyslog(LOG_ERR, "error in %s, line %d\n", fileName, line);
result = false; result = false;
break; break;
} }
} }
}
fclose(f); fclose(f);
return result; return result;
} }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __CONFIG_H
@ -184,6 +184,7 @@ public:
result = true; result = true;
while (fgets(buffer, sizeof(buffer), f) > 0) { while (fgets(buffer, sizeof(buffer), f) > 0) {
line++; line++;
if (!isempty(buffer)) {
T *l = new T; T *l = new T;
if (l->Parse(buffer)) if (l->Parse(buffer))
Add(l); Add(l);
@ -194,6 +195,7 @@ public:
break; break;
} }
} }
}
fclose(f); fclose(f);
} }
else else