--- dash-0.5.5.1/src/miscbltin.c.orig   2009-01-14 00:37:13.000000000 +0100
+++ dash-0.5.5.1/src/miscbltin.c        2010-09-02 16:54:29.330830859 +0200
@@ -58,6 +58,34 @@

 #undef rflag

+#define CHUNK_READ_SIZE 32
+
+/*
+ * Reads from fd 0, with a CHUNK_READ_SIZE,
+ * but emitting one char at a time
+ */
+static int _read_bufferred(char* c) {
+       static char buffer[CHUNK_READ_SIZE];
+       static int buffer_offset = 0;
+       static int buffer_len = 0;
+
+       if (buffer_len == 0) {
+               // No caracter left, resetting buffer & read some more
+               buffer_offset = 0;
+               buffer_len = read(0, buffer, CHUNK_READ_SIZE);
+
+               if (buffer_len == 0) {
+                       // Nothing to read anymore
+                       return 0;
+               }
+       }
+
+       // Still some character left
+       *c = buffer[buffer_offset++];
+       buffer_len--;
+
+       return 1;
+}


 /*
@@ -65,6 +93,7 @@
  * following character.
  *
  * This uses unbuffered input, which may be avoidable in some cases.
+ * XXX - Uses _read_bufferred() that chunks read(), but emits one char at a time
  */

 int
@@ -104,7 +133,7 @@
        backslash = 0;
        STARTSTACKSTR(p);
        for (;;) {
-               if (read(0, &c, 1) != 1) {
+               if (_read_bufferred(&c) != 1) {
                        status = 1;
                        break;
                }
