Handle commented lines.

This commit is contained in:
Nicholas Marriott
2008-06-19 21:20:27 +00:00
parent 0695db3889
commit 85135221f0
3 changed files with 16 additions and 14 deletions

16
cfg.c
View File

@ -1,4 +1,4 @@
/* $Id: cfg.c,v 1.10 2008-06-19 21:13:56 nicm Exp $ */
/* $Id: cfg.c,v 1.11 2008-06-19 21:20:24 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@ -78,17 +78,11 @@ load_cfg(const char *path, char **cause)
}
n++;
/* Trim spaces from start and end. */
while (*buf != '\0' && (*buf == ' ' || *buf == '\t'))
*buf++ = '\0';
len = strlen(buf);
while (len > 0 && (buf[len - 1] == ' ' || buf[len - 1] == '\t'))
buf[--len] = '\0';
if (*buf == '\0')
continue;
if ((cmd = cmd_string_parse(buf, cause)) == NULL)
if ((cmd = cmd_string_parse(buf, cause)) == NULL) {
if (*cause == NULL)
continue;
goto error;
}
cfg_cause = NULL;
ctx.msgdata = NULL;