aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
Diffstat (limited to 'libbb')
-rw-r--r--libbb/get_line_from_file.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c
index 6d12b21c4..a27edc3bd 100644
--- a/libbb/get_line_from_file.c
+++ b/libbb/get_line_from_file.c
@@ -44,7 +44,8 @@ static char *private_get_line_from_file(FILE *file, int c)
44 linebuf = xrealloc(linebuf, linebufsz += GROWBY); 44 linebuf = xrealloc(linebuf, linebufsz += GROWBY);
45 } 45 }
46 linebuf[idx++] = (char)ch; 46 linebuf[idx++] = (char)ch;
47 if (ch == '\n' || ch == '\0') { 47 if (!ch) return linebuf;
48 if (c<2 && ch == '\n') {
48 if (c) { 49 if (c) {
49 --idx; 50 --idx;
50 } 51 }
@@ -71,6 +72,11 @@ extern char *bb_get_chomped_line_from_file(FILE *file)
71 return private_get_line_from_file(file, 1); 72 return private_get_line_from_file(file, 1);
72} 73}
73 74
75extern char *bb_get_chunk_from_file(FILE *file)
76{
77 return private_get_line_from_file(file, 2);
78}
79
74 80
75/* END CODE */ 81/* END CODE */
76/* 82/*