diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/awk.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/editors/awk.c b/editors/awk.c index dbb26068d..c4553728d 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
@@ -1998,20 +1998,11 @@ static int ptest(node *pattern) | |||
1998 | #if ENABLE_PLATFORM_MINGW32 | 1998 | #if ENABLE_PLATFORM_MINGW32 |
1999 | static ssize_t FAST_FUNC safe_read_strip_cr(int fd, void *buf, size_t count) | 1999 | static ssize_t FAST_FUNC safe_read_strip_cr(int fd, void *buf, size_t count) |
2000 | { | 2000 | { |
2001 | ssize_t n, i, j; | 2001 | ssize_t n; |
2002 | char *b = (char *)buf; | 2002 | |
2003 | 2003 | do { | |
2004 | retry: | 2004 | n = safe_read(fd, buf, count); |
2005 | n = safe_read(fd, buf, count); | 2005 | } while (n > 0 && (n=remove_cr((char *)buf, n)) == 0); |
2006 | if (n > 0) { | ||
2007 | for (i=j=0; i<n; ++i) { | ||
2008 | if (b[i] != '\r') | ||
2009 | b[j++] = b[i]; | ||
2010 | } | ||
2011 | if (j == 0) | ||
2012 | goto retry; | ||
2013 | n = j; | ||
2014 | } | ||
2015 | 2006 | ||
2016 | return n; | 2007 | return n; |
2017 | } | 2008 | } |