try to fix (dos line endings)
@@ -54,7 +54,7 @@ static char * parseRecord (char ** ptr, char delim, int * isQuoted, int * isCol,
++(*counter);
if (mode == PARSE) return NULL;
}
- else if (*(*ptr + 1) == '\n')
+ else if (*(*ptr + 1) == '\n' || *(*ptr + 1) == '\r')
{
*isQuoted = 0;
*isCol = 0;
@@ -75,7 +75,7 @@ static char * parseRecord (char ** ptr, char delim, int * isQuoted, int * isCol,
if (mode == PARSE) return NULL;
}
}
- else if (**ptr != '\n')
+ else if (**ptr != '\n' || **ptr != '\r')
{
if (!(*isCol))
{
@@ -145,7 +145,7 @@ static char * parseLine (char * origLine, char delim, unsigned long offset, Key
unsigned long len = elektraStrLen (line);
if (isQuoted)
{
- if (line[len - 2] == '\n')
+ if (line[len - 2] == '\n' || line[len - 2] == '\r')
{
line[len - 2] = '\0';
}
@@ -154,7 +154,7 @@ static char * parseLine (char * origLine, char delim, unsigned long offset, Key
}
else if (isCol)
{
- if (line[len - 2] == '\n')
+ if (line[len - 2] == '\n' || line[len - 2] == '\r')
{
line[len - 2] = '\0';
}
@@ -178,7 +178,7 @@ static unsigned long getLineLength (FILE * fp)
char c;
while ((c = fgetc (fp)) && (!feof (fp)))
{
- if (c == '\n') break;
+ if (c == '\n' || c == '\r') break;
}
int endPos = ftell (fp);
fseek (fp, startPos, SEEK_SET);
