summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2012-02-11 08:30:23 +0100
committerDan McGee <dan@archlinux.org>2012-02-11 21:58:28 +0100
commit294f0fdf4df361e0d553eb650e1aacdb83f7bdf5 (patch)
tree266cd18e11ff81e73913b8e88182e9294b4b7d63
parent31432edcbe484a5fca01abff77359061ae813fcc (diff)
downloadpacman-294f0fdf4df361e0d553eb650e1aacdb83f7bdf5.tar.gz
pacman-294f0fdf4df361e0d553eb650e1aacdb83f7bdf5.tar.xz
pactree: allow comments after repo section header
Duplicate the fix in config file parsing from d95c0494. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--src/util/pactree.c12
1 files changed, 6 insertions, 6 deletions
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);