A patch from Erik Meusel <erik@wh58-709.st.uni-magdeburg.de>
to fix the behavior of 'tail -f -n 0 FILE'
This commit is contained in:
parent
78b0e379d7
commit
ce98c19dfe
@ -127,6 +127,10 @@ int tail_main(int argc, char **argv)
|
|||||||
for (i = 0; i < nfiles; i++) {
|
for (i = 0; i < nfiles; i++) {
|
||||||
if (fds[i] == -1)
|
if (fds[i] == -1)
|
||||||
continue;
|
continue;
|
||||||
|
if (!count) {
|
||||||
|
lseek(fds[i], 0, SEEK_END);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
seen = 0;
|
seen = 0;
|
||||||
if (show_headers || (!hide_headers && nfiles > 1))
|
if (show_headers || (!hide_headers && nfiles > 1))
|
||||||
printf("%s==> %s <==\n", i == 0 ? "" : "\n", argv[optind + i]);
|
printf("%s==> %s <==\n", i == 0 ? "" : "\n", argv[optind + i]);
|
||||||
|
4
tail.c
4
tail.c
@ -127,6 +127,10 @@ int tail_main(int argc, char **argv)
|
|||||||
for (i = 0; i < nfiles; i++) {
|
for (i = 0; i < nfiles; i++) {
|
||||||
if (fds[i] == -1)
|
if (fds[i] == -1)
|
||||||
continue;
|
continue;
|
||||||
|
if (!count) {
|
||||||
|
lseek(fds[i], 0, SEEK_END);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
seen = 0;
|
seen = 0;
|
||||||
if (show_headers || (!hide_headers && nfiles > 1))
|
if (show_headers || (!hide_headers && nfiles > 1))
|
||||||
printf("%s==> %s <==\n", i == 0 ? "" : "\n", argv[optind + i]);
|
printf("%s==> %s <==\n", i == 0 ? "" : "\n", argv[optind + i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user