fix printf warning
[oweals/busybox.git] / libbb / get_line_from_file.c
index 6d12b21c477283f4e4f5ae0b977ceca997e76924..a27edc3bd96e973cd9e41772a51ee43fb2a3a2c3 100644 (file)
@@ -44,7 +44,8 @@ static char *private_get_line_from_file(FILE *file, int c)
                        linebuf = xrealloc(linebuf, linebufsz += GROWBY);
                }
                linebuf[idx++] = (char)ch;
-               if (ch == '\n' || ch == '\0') {
+               if (!ch) return linebuf;
+               if (c<2 && ch == '\n') {
                        if (c) {
                                --idx;
                        }
@@ -71,6 +72,11 @@ extern char *bb_get_chomped_line_from_file(FILE *file)
        return private_get_line_from_file(file, 1);
 }
 
+extern char *bb_get_chunk_from_file(FILE *file)
+{
+       return private_get_line_from_file(file, 2);
+}
+
 
 /* END CODE */
 /*