char *fs_gets(char *dst, int count, fs_file fh)
{
char *s = dst;
- char *cr = NULL;
int c;
assert(dst);
*s = c;
- /* Normalize possible CRLF and break. */
+ /* Keep a newline and break. */
if (*s == '\n')
{
- if (cr + 1 == s)
- *cr = '\n';
- else
- s++;
-
+ s++;
break;
}
- /* Note carriage return. */
+ /* Ignore carriage returns. */
if (*s == '\r')
- cr = s;
+ {
+ count++;
+ s--;
+ }
s++;
}