diff options
author | michael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2008-12-31 06:12:29 +0000 |
---|---|---|
committer | michael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2008-12-31 06:12:29 +0000 |
commit | 0caadb6ceed0de07fc0b778b77674c06cd115175 (patch) | |
tree | f524cb0dba786fc2279a601578358bdc4d213444 | |
parent | ba0421af855a42e4319472db22586d4d28125391 (diff) | |
download | lcd4linux-0caadb6ceed0de07fc0b778b77674c06cd115175.tar.gz |
handle config files with <CR><LF> (DOS line ending) ported from volker_dev (r826)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@920 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to '')
-rw-r--r-- | cfg.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -132,15 +132,19 @@ static char *strip(char *s, const int strip_comments) if (*p == '"') do p++; - while (*p && *p != '\n' && *p != '"'); + while (*p && *p != '\n' && *p != '\r' && *p != '"'); if (*p == '\'') do p++; - while (*p && *p != '\n' && *p != '\''); + while (*p && *p != '\n' && *p != '\r' && *p != '\''); if (*p == '\n' || (strip_comments && *p == '#' && (p == s || *(p - 1) != '\\'))) { *p = '\0'; break; } + if (*p == '\r' && *(p + 1) == '\n') { + /* replace <CR> from DOS <CR><LF> with blank */ + *p = ' '; + } } for (p--; p > s && isblank(*p); p--) |