From f6d6a4602c9bb94565f8bb421b465a06f215fb7d Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Thu, 5 Jul 2012 23:00:31 +1000 Subject: [PATCH] Fix fast_readline to handle windows line endings (\r\n) Change-Id: I3561eff9bc4e244a84ef4afee26a40432d1073dd --- apps/misc.c | 7 +++++++ 1 file changed, 7 insertions(+) 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;