summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2014-11-15 12:19:12 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-15 06:05:22 -0800
commit70939a1d84730b41224a4dfefed3b6635f1de2e0 (patch)
tree69a0acf6e0d00a9acd6d455b3566ca9752c40b41 /file.c
parent744e14b4505796a5465c03ee77422aaa4d8cae30 (diff)
downloadsubsurface-70939a1d84730b41224a4dfefed3b6635f1de2e0.tar.gz
Fix parsing of Windows new lines on Mk6 import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r--file.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/file.c b/file.c
index 29bbea5a8..5e8ab381f 100644
--- a/file.c
+++ b/file.c
@@ -423,9 +423,14 @@ char *parse_mkvi_value(const char *haystack, const char *needle)
valueptr += 2;
}
if ((endptr = strstr(lineptr, "\n")) != NULL) {
+ char terminator = '\n';
+ if (*(endptr - 1) == '\r') {
+ --endptr;
+ terminator = '\r';
+ }
*endptr = 0;
ret = strdup(valueptr);
- *endptr = '\n';
+ *endptr = terminator;
}
}