aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-06-17 15:46:12 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2010-06-17 15:46:12 +0300
commitcc0b658ce16b321ca7ba7d720bf1c4016d689b89 (patch)
tree9ef869800286513cc307796f081879e89cec36d6
parentc81c5df1da0ec4de29a13787b3b116bb71e66ddd (diff)
downloadsmap-cc0b658ce16b321ca7ba7d720bf1c4016d689b89.tar.gz
smap-cc0b658ce16b321ca7ba7d720bf1c4016d689b89.tar.bz2
Bugfix.
* src/cfg.c (ISWS, skipws): Remove macros. (parse_config_loop): Rely on wordsplit to detect empty lines.
-rw-r--r--src/cfg.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/cfg.c b/src/cfg.c
index a818f3f..b365a43 100644
--- a/src/cfg.c
+++ b/src/cfg.c
@@ -16,9 +16,6 @@
#include "smapd.h"
-#define ISWS(c) (strchr(" \t\f\r",c))
-#define skipws(p) do { while (ISWS(*(p))) (p)++; } while (0)
-
FILE *infile;
const char *cfg_file_name;
unsigned cfg_line;
@@ -190,20 +187,18 @@ parse_config_loop(struct cfg_kw *kwtab, void *data)
ws.ws_comment = "#";
while (!eof && read_line(&buf, &size)) {
- char *p = buf;
struct cfg_kw *kwp;
- skipws(p);
- if (!*p || *p == '#')
- continue;
-
- if (wordsplit(p, &ws, wsflags)) {
+ if (wordsplit(buf, &ws, wsflags)) {
smap_error("%s:%u: cannot parse line",
cfg_file_name, cfg_line);
exit(EX_SOFTWARE);
}
wsflags |= WRDSF_REUSE;
+ if (ws.ws_wordc == 0)
+ continue;
+
kwp = find_cfg_kw(kwtab, ws.ws_wordv[0]);
if (!kwp) {
smap_error("%s:%u: unrecognized line",

Return to:

Send suggestions and report system problems to the System administrator.