1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-08-05 08:10:15 +02:00
This commit is contained in:
Jim Meyering
1994-05-06 15:28:01 +00:00
parent 3118577120
commit 556cdce5c8
2 changed files with 23 additions and 4 deletions
+2 -1
View File
@@ -968,7 +968,8 @@ tail_forever (names, nfiles)
then keep looping. */
if (i != last)
{
write_header (names[i]);
if (print_headers)
write_header (names[i]);
last = i;
}
changed = 1;
+21 -3
View File
@@ -214,10 +214,28 @@ wc (fd, file)
lines = words = chars = 0;
if (print_chars && !print_words && !print_lines
&& fstat (fd, &stats) == 0 && S_ISREG (stats.st_mode))
/* When counting only bytes, save some line- and word-counting
overhead. If FD is a `regular' Unix file, using fstat is enough
to get its size in bytes. Otherwise, read blocks of BUFFER_SIZE
bytes at a time until EOF. */
if (print_chars && !print_words && !print_lines)
{
chars = stats.st_size;
if (fstat (fd, &stats) == 0 && S_ISREG (stats.st_mode))
{
chars = stats.st_size;
}
else
{
while ((bytes_read = safe_read (fd, buf, BUFFER_SIZE)) > 0)
{
chars += bytes_read;
}
if (bytes_read < 0)
{
error (0, errno, "%s", file);
exit_status = 1;
}
}
}
else
{