aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/tail
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2005-02-04 14:01:06 +0000
committerXin LI <delphij@FreeBSD.org>2005-02-04 14:01:06 +0000
commit76628ce773bf1b5fc444cc38f3490da4b4d1960f (patch)
tree467ce5d5c88f9c537fcfa365350e40049896dcc6 /usr.bin/tail
parentf787023e5aebf5b560e5a34809171b3929f52adb (diff)
Notes
Diffstat (limited to 'usr.bin/tail')
-rw-r--r--usr.bin/tail/forward.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c
index 0d9ff8d3e1b77..1a3c6580714d0 100644
--- a/usr.bin/tail/forward.c
+++ b/usr.bin/tail/forward.c
@@ -72,6 +72,8 @@ struct kevent *ev;
int action = USE_SLEEP;
int kq;
+static const file_info_t *last;
+
/*
* forward -- display the file, from an offset, forward.
*
@@ -238,16 +240,10 @@ rlines(fp, off, sbp)
}
}
-/*
- * follow -- display the file, from an offset, forward.
- *
- */
-
static void
show(file_info_t *file)
{
int ch;
- static file_info_t *last;
while ((ch = getc(file->fp)) != EOF) {
if (last != file && no_files > 1) {
@@ -295,6 +291,10 @@ set_events(file_info_t *files)
}
}
+/*
+ * follow -- display the file, from an offset, forward.
+ *
+ */
void
follow(file_info_t *files, enum STYLE style, off_t off)
{
@@ -322,6 +322,8 @@ follow(file_info_t *files, enum STYLE style, off_t off)
if (! active)
return;
+ last = --file;
+
kq = kqueue();
if (kq < 0)
err(1, "kqueue");