mirror of
https://github.com/netfun2000/lcd4linux.git
synced 2026-02-27 09:44:34 +08:00
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
This commit is contained in:
@@ -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--)
|
||||
|
||||
Reference in New Issue
Block a user