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.
This commit is contained in:
Shahrukh khan 2018-02-16 17:33:31 +05:30 committed by GitHub
parent 80d9bec20f
commit a70f897277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -778,6 +778,7 @@ list *read_cfg(char *filename)
while((line=fgetl(file)) != 0){ while((line=fgetl(file)) != 0){
++ nu; ++ nu;
strip(line); strip(line);
line[ strcspn(line, "\r\n") ] = '\0';
switch(line[0]){ switch(line[0]){
case '[': case '[':
current = malloc(sizeof(section)); current = malloc(sizeof(section));