diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-06-17 15:46:12 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-06-17 15:46:12 +0300 |
commit | cc0b658ce16b321ca7ba7d720bf1c4016d689b89 (patch) | |
tree | 9ef869800286513cc307796f081879e89cec36d6 | |
parent | c81c5df1da0ec4de29a13787b3b116bb71e66ddd (diff) | |
download | smap-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.c | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -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", |