aboutsummaryrefslogtreecommitdiff
path: root/coreutils/tail.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-05-21 20:30:51 +0000
committerEric Andersen <andersen@codepoet.org>2001-05-21 20:30:51 +0000
commit004015e9c4e8ff98bcbaf955cf42147218204da4 (patch)
treeb6f1eb9281b70d0723d82a68ed090e619dbbf606 /coreutils/tail.c
parentabec344ab7060d940f133d93b76e6bbe5881e205 (diff)
downloadbusybox-w32-004015e9c4e8ff98bcbaf955cf42147218204da4.tar.gz
busybox-w32-004015e9c4e8ff98bcbaf955cf42147218204da4.tar.bz2
busybox-w32-004015e9c4e8ff98bcbaf955cf42147218204da4.zip
Patch from Lars Kellogg-Stedman <lars@larsshack.org> to fix bug
#1130 (i.e. When you turn on features it should always ADD features)
Diffstat (limited to 'coreutils/tail.c')
-rw-r--r--coreutils/tail.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/coreutils/tail.c b/coreutils/tail.c
index ff77bde77..4fe92ba5e 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -73,7 +73,7 @@ int tail_main(int argc, char **argv)
73 case 'f': 73 case 'f':
74 follow = 1; 74 follow = 1;
75 break; 75 break;
76#ifndef BB_FEATURE_SIMPLE_TAIL 76#ifdef BB_FEATURE_FANCY_TAIL
77 case 'c': 77 case 'c':
78 units = BYTES; 78 units = BYTES;
79 /* FALLS THROUGH */ 79 /* FALLS THROUGH */
@@ -85,7 +85,7 @@ int tail_main(int argc, char **argv)
85 if (optarg[0] == '+') 85 if (optarg[0] == '+')
86 from_top = 1; 86 from_top = 1;
87 break; 87 break;
88#ifndef BB_FEATURE_SIMPLE_TAIL 88#ifdef BB_FEATURE_FANCY_TAIL
89 case 'q': 89 case 'q':
90 hide_headers = 1; 90 hide_headers = 1;
91 break; 91 break;
@@ -118,7 +118,7 @@ int tail_main(int argc, char **argv)
118 } 118 }
119 } 119 }
120 120
121#ifndef BB_FEATURE_SIMPLE_TAIL 121#ifdef BB_FEATURE_FANCY_TAIL
122 /* tail the files */ 122 /* tail the files */
123 if (!from_top && units == BYTES) 123 if (!from_top && units == BYTES)
124 tailbuf = xmalloc(count); 124 tailbuf = xmalloc(count);
@@ -132,7 +132,7 @@ int tail_main(int argc, char **argv)
132 printf("%s==> %s <==\n", i == 0 ? "" : "\n", argv[optind + i]); 132 printf("%s==> %s <==\n", i == 0 ? "" : "\n", argv[optind + i]);
133 while ((nread = safe_read(fds[i], buf, sizeof(buf))) > 0) { 133 while ((nread = safe_read(fds[i], buf, sizeof(buf))) > 0) {
134 if (from_top) { 134 if (from_top) {
135#ifndef BB_FEATURE_SIMPLE_TAIL 135#ifdef BB_FEATURE_FANCY_TAIL
136 if (units == BYTES) { 136 if (units == BYTES) {
137 if (count - 1 <= seen) 137 if (count - 1 <= seen)
138 nwrite = nread; 138 nwrite = nread;
@@ -165,7 +165,7 @@ int tail_main(int argc, char **argv)
165 break; 165 break;
166 } 166 }
167 } else { 167 } else {
168#ifndef BB_FEATURE_SIMPLE_TAIL 168#ifdef BB_FEATURE_FANCY_TAIL
169 if (units == BYTES) { 169 if (units == BYTES) {
170 if (nread < count) { 170 if (nread < count) {
171 memmove(tailbuf, tailbuf + nread, count - nread); 171 memmove(tailbuf, tailbuf + nread, count - nread);
@@ -199,7 +199,7 @@ int tail_main(int argc, char **argv)
199 status = EXIT_FAILURE; 199 status = EXIT_FAILURE;
200 } 200 }
201 201
202#ifndef BB_FEATURE_SIMPLE_TAIL 202#ifdef BB_FEATURE_FANCY_TAIL
203 if (!from_top && units == BYTES) { 203 if (!from_top && units == BYTES) {
204 if (count < seen) 204 if (count < seen)
205 seen = count; 205 seen = count;