Annotation of /trunk/busybox/patches/busybox-1.19.2-tail.patch
Parent Directory | Revision Log
Revision 1541 -
(hide annotations)
(download)
Mon Sep 26 15:52:03 2011 UTC (13 years ago) by niro
File size: 1320 byte(s)
Mon Sep 26 15:52:03 2011 UTC (13 years ago) by niro
File size: 1320 byte(s)
-added upstream patches
1 | niro | 1541 | --- busybox-1.19.2/coreutils/tail.c |
2 | +++ busybox-1.19.2-tail/coreutils/tail.c | ||
3 | @@ -203,7 +203,7 @@ int tail_main(int argc, char **argv) | ||
4 | int fd = fds[i]; | ||
5 | |||
6 | if (ENABLE_FEATURE_FANCY_TAIL && fd < 0) | ||
7 | - continue; /* may happen with -E */ | ||
8 | + continue; /* may happen with -F */ | ||
9 | |||
10 | if (nfiles > header_threshhold) { | ||
11 | tail_xprint_header(fmt, argv[i]); | ||
12 | @@ -252,14 +252,14 @@ int tail_main(int argc, char **argv) | ||
13 | * Used only by +N code ("start from Nth", 1-based): */ | ||
14 | seen = 1; | ||
15 | newlines_seen = 0; | ||
16 | - while ((nread = tail_read(fd, buf, tailbufsize-taillen)) > 0) { | ||
17 | + while ((nread = tail_read(fd, buf, tailbufsize - taillen)) > 0) { | ||
18 | if (G.from_top) { | ||
19 | int nwrite = nread; | ||
20 | if (seen < count) { | ||
21 | /* We need to skip a few more bytes/lines */ | ||
22 | if (COUNT_BYTES) { | ||
23 | nwrite -= (count - seen); | ||
24 | - seen = count; | ||
25 | + seen += nread; | ||
26 | } else { | ||
27 | char *s = buf; | ||
28 | do { | ||
29 | --- busybox-1.19.2/testsuite/tail.tests | ||
30 | +++ busybox-1.19.2-tail/testsuite/tail.tests | ||
31 | @@ -14,4 +14,12 @@ testing "tail: +N with N > file length" | ||
32 | "0\n" \ | ||
33 | "" "qw" | ||
34 | |||
35 | +testing "tail: -c +N with largish N" \ | ||
36 | + " | ||
37 | + dd if=/dev/zero bs=16k count=1 2>/dev/null | tail -c +8200 | wc -c; | ||
38 | + dd if=/dev/zero bs=16k count=1 2>/dev/null | tail -c +8208 | wc -c; | ||
39 | + " \ | ||
40 | + "8185\n8177\n" \ | ||
41 | + "" "" | ||
42 | + | ||
43 | exit $FAILCOUNT |