aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cfg.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/cfg.c b/cfg.c
index cef48d4..d712db9 100644
--- a/cfg.c
+++ b/cfg.c
@@ -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--)