mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-08-05 08:10:15 +02:00
.
This commit is contained in:
+2
-1
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user