From 294f0fdf4df361e0d553eb650e1aacdb83f7bdf5 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sat, 11 Feb 2012 17:30:23 +1000 Subject: pactree: allow comments after repo section header Duplicate the fix in config file parsing from d95c0494. Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- src/util/pactree.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/util') diff --git a/src/util/pactree.c b/src/util/pactree.c index 997ba466..cee5433a 100644 --- a/src/util/pactree.c +++ b/src/util/pactree.c @@ -167,17 +167,17 @@ static int register_syncs(void) { } while(fgets(line, LINE_MAX, fp)) { + /* ignore whole line and end of line comments */ + if((ptr = strchr(line, '#'))) { + *ptr = '\0'; + } + strtrim(line); - if(line[0] == '#' || !strlen(line)) { + if(strlen(line) == 0) { continue; } - if((ptr = strchr(line, '#'))) { - *ptr = '\0'; - strtrim(line); - } - if(line[0] == '[' && line[strlen(line) - 1] == ']') { free(section); section = strndup(&line[1], strlen(line) - 2); -- cgit v1.2.3-2-g168b