From a70f897277adc8ab74ae258a99032d88c86819ef Mon Sep 17 00:00:00 2001 From: Shahrukh khan Date: Fri, 16 Feb 2018 17:33:31 +0530 Subject: [PATCH] cfg read error fixed. "First section must be [net] or [network]" Many users have problems while parsing cfg file when it is copied from other systems due to newline character. --- src/parser.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parser.c b/src/parser.c index da7487b0..b0ee1fb2 100644 --- a/src/parser.c +++ b/src/parser.c @@ -778,6 +778,7 @@ list *read_cfg(char *filename) while((line=fgetl(file)) != 0){ ++ nu; strip(line); + line[ strcspn(line, "\r\n") ] = '\0'; switch(line[0]){ case '[': current = malloc(sizeof(section));