forked from len0rd/rockbox
Fix fast_readline to handle windows line endings (\r\n)
Change-Id: I3561eff9bc4e244a84ef4afee26a40432d1073dd
This commit is contained in:
parent
4c94b98422
commit
f6d6a4602c
1 changed files with 7 additions and 0 deletions
|
|
@ -198,6 +198,13 @@ int fast_readline(int fd, char *buf, int buf_size, void *parameters,
|
||||||
next = ++p;
|
next = ++p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( (p = strchr(buf, '\r')) != NULL)
|
||||||
|
{
|
||||||
|
*p = '\0';
|
||||||
|
if (!next)
|
||||||
|
next = ++p;
|
||||||
|
}
|
||||||
|
|
||||||
rc = callback(count, buf, parameters);
|
rc = callback(count, buf, parameters);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue