diff options
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | coreutils/tail.c | 5 |
2 files changed, 4 insertions, 6 deletions
@@ -127,11 +127,6 @@ patch | |||
127 | 127 | ||
128 | And while we're at it, a new patch filename quoting format is apparently | 128 | And while we're at it, a new patch filename quoting format is apparently |
129 | coming soon: http://marc.theaimsgroup.com/?l=git&m=112927316408690&w=2 | 129 | coming soon: http://marc.theaimsgroup.com/?l=git&m=112927316408690&w=2 |
130 | --- | ||
131 | tail | ||
132 | ./busybox tail -f foo.c~ TODO | ||
133 | should not print fmt=header_fmt for subsequent date >> TODO; i.e. only | ||
134 | fmt+ if another (not the current) file did change | ||
135 | 130 | ||
136 | Architectural issues: | 131 | Architectural issues: |
137 | 132 | ||
diff --git a/coreutils/tail.c b/coreutils/tail.c index 07c71ca4b..eab502beb 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
@@ -105,6 +105,7 @@ int tail_main(int argc, char **argv) | |||
105 | 105 | ||
106 | int *fds; | 106 | int *fds; |
107 | const char *fmt; | 107 | const char *fmt; |
108 | int prev_fd; | ||
108 | 109 | ||
109 | INIT_G(); | 110 | INIT_G(); |
110 | 111 | ||
@@ -309,6 +310,7 @@ int tail_main(int argc, char **argv) | |||
309 | xwrite(STDOUT_FILENO, tailbuf, taillen); | 310 | xwrite(STDOUT_FILENO, tailbuf, taillen); |
310 | } | 311 | } |
311 | } while (++i < nfiles); | 312 | } while (++i < nfiles); |
313 | prev_fd = fds[i-1]; | ||
312 | 314 | ||
313 | tailbuf = xrealloc(tailbuf, BUFSIZ); | 315 | tailbuf = xrealloc(tailbuf, BUFSIZ); |
314 | 316 | ||
@@ -365,9 +367,10 @@ int tail_main(int argc, char **argv) | |||
365 | nread = tail_read(fd, tailbuf, BUFSIZ); | 367 | nread = tail_read(fd, tailbuf, BUFSIZ); |
366 | if (nread <= 0) | 368 | if (nread <= 0) |
367 | break; | 369 | break; |
368 | if (fmt) { | 370 | if (fmt && (fd != prev_fd)) { |
369 | tail_xprint_header(fmt, filename); | 371 | tail_xprint_header(fmt, filename); |
370 | fmt = NULL; | 372 | fmt = NULL; |
373 | prev_fd = fd; | ||
371 | } | 374 | } |
372 | xwrite(STDOUT_FILENO, tailbuf, nread); | 375 | xwrite(STDOUT_FILENO, tailbuf, nread); |
373 | } | 376 | } |