summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2012-07-05 23:00:31 +1000
committerJonathan Gordon <rockbox@jdgordon.info>2012-07-05 23:00:31 +1000
commitf6d6a4602c9bb94565f8bb421b465a06f215fb7d (patch)
treeeea2ad95cd2099c3e888061bfa8836d3b03052b7 /apps
parent4c94b98422b7a0e0ef1eb93eac2f3abd7fdfa9b8 (diff)
Fix fast_readline to handle windows line endings (\r\n)
Change-Id: I3561eff9bc4e244a84ef4afee26a40432d1073dd
Diffstat (limited to 'apps')
-rw-r--r--apps/misc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/misc.c b/apps/misc.c
index 3bee0772a6..5b20b35c17 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -198,6 +198,13 @@ int fast_readline(int fd, char *buf, int buf_size, void *parameters,
next = ++p;
}
+ if ( (p = strchr(buf, '\r')) != NULL)
+ {
+ *p = '\0';
+ if (!next)
+ next = ++p;
+ }
+
rc = callback(count, buf, parameters);
if (rc < 0)
return rc;