summaryrefslogtreecommitdiff
path: root/src/tail.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-11-13 10:23:44 +0000
committerJim Meyering <jim@meyering.net>2001-11-13 10:23:44 +0000
commit9a628d390809bdcfbe777f751b1019182fefb951 (patch)
tree591299fb5db984c461b316de0378d8f216a65af4 /src/tail.c
parent513813de35aea27cae64d6275f2ccf2d6fafaf45 (diff)
downloadcoreutils-9a628d390809bdcfbe777f751b1019182fefb951.tar.gz
coreutils-9a628d390809bdcfbe777f751b1019182fefb951.tar.bz2
coreutils-9a628d390809bdcfbe777f751b1019182fefb951.zip
(tail_lines): Move declaration of local `length' into scope where it's used.
(tail_file): Likewise for local `stats'.
Diffstat (limited to 'src/tail.c')
-rw-r--r--src/tail.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tail.c b/src/tail.c
index 375e6316b..c6d422572 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -1073,7 +1073,6 @@ static int
tail_lines (const char *pretty_filename, int fd, long int n_lines)
{
struct stat stats;
- off_t length;
/* We need binary input, since `tail' relies on `lseek' and byte counts,
while binary output will preserve the style (Unix/DOS) of text file. */
@@ -1093,6 +1092,8 @@ tail_lines (const char *pretty_filename, int fd, long int n_lines)
}
else
{
+ off_t length;
+
/* Use file_lines only if FD refers to a regular file with
its file pointer positioned at beginning of file. */
/* FIXME: this first lseek conjunct is a kludge.
@@ -1132,7 +1133,6 @@ static int
tail_file (struct File_spec *f, off_t n_units)
{
int fd, errors;
- struct stat stats;
int is_stdin = (STREQ (f->name, "-"));
@@ -1168,6 +1168,8 @@ tail_file (struct File_spec *f, off_t n_units)
errors = tail (pretty_name (f), fd, n_units);
if (forever)
{
+ struct stat stats;
+
f->errnum = 0;
/* FIXME: duplicate code */
if (fstat (fd, &stats) < 0)