aboutsummaryrefslogtreecommitdiff
path: root/editors/awk.c
diff options
context:
space:
mode:
Diffstat (limited to 'editors/awk.c')
-rw-r--r--editors/awk.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/editors/awk.c b/editors/awk.c
index b4f6a3741..41a57ea0c 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -735,7 +735,11 @@ static char *skip_spaces(char *p)
735 if (*p == '\\' && p[1] == '\n') { 735 if (*p == '\\' && p[1] == '\n') {
736 p++; 736 p++;
737 t_lineno++; 737 t_lineno++;
738#if !ENABLE_PLATFORM_MINGW32
738 } else if (*p != ' ' && *p != '\t') { 739 } else if (*p != ' ' && *p != '\t') {
740#else
741 } else if (*p != ' ' && *p != '\t' && *p != '\r') {
742#endif
739 break; 743 break;
740 } 744 }
741 p++; 745 p++;
@@ -2031,6 +2035,21 @@ static int ptest(node *pattern)
2031 return istrue(evaluate(pattern, &G.ptest__v)); 2035 return istrue(evaluate(pattern, &G.ptest__v));
2032} 2036}
2033 2037
2038#if ENABLE_PLATFORM_MINGW32
2039static ssize_t FAST_FUNC safe_read_strip_cr(int fd, void *buf, size_t count)
2040{
2041 ssize_t n;
2042
2043 do {
2044 n = safe_read(fd, buf, count);
2045 } while (n > 0 && (n=remove_cr((char *)buf, n)) == 0);
2046
2047 return n;
2048}
2049
2050#define safe_read safe_read_strip_cr
2051#endif
2052
2034/* read next record from stream rsm into a variable v */ 2053/* read next record from stream rsm into a variable v */
2035static int awk_getline(rstream *rsm, var *v) 2054static int awk_getline(rstream *rsm, var *v)
2036{ 2055{
@@ -2140,7 +2159,7 @@ static int fmt_num(char *b, int size, const char *format, double n, int int_as_i
2140 const char *s = format; 2159 const char *s = format;
2141 2160
2142 if (int_as_int && n == (long long)n) { 2161 if (int_as_int && n == (long long)n) {
2143 r = snprintf(b, size, "%lld", (long long)n); 2162 r = snprintf(b, size, "%"LL_FMT"d", (long long)n);
2144 } else { 2163 } else {
2145 do { c = *s; } while (c && *++s); 2164 do { c = *s; } while (c && *++s);
2146 if (strchr("diouxX", c)) { 2165 if (strchr("diouxX", c)) {