}
static void
-xwrite (int fd, char const *buffer, size_t n_bytes)
+xwrite_stdout (char const *buffer, size_t n_bytes)
{
- assert (fd == STDOUT_FILENO);
if (n_bytes > 0 && fwrite (buffer, 1, n_bytes, stdout) == 0)
error (EXIT_FAILURE, errno, _("write error"));
}
}
if (bytes_read == 0)
break;
- xwrite (STDOUT_FILENO, buffer, bytes_read);
+ xwrite_stdout (buffer, bytes_read);
n_written += bytes_read;
if (n_bytes != COPY_TO_EOF)
{
/* If this newline isn't the last character in the buffer,
output the part that is after it. */
if (n != bytes_read - 1)
- xwrite (STDOUT_FILENO, nl + 1, bytes_read - (n + 1));
+ xwrite_stdout (nl + 1, bytes_read - (n + 1));
*read_pos += dump_remainder (pretty_filename, fd,
end_pos - (pos + bytes_read));
return true;
}
}
- xwrite (STDOUT_FILENO, beg, buffer_end - beg);
+ xwrite_stdout (beg, buffer_end - beg);
}
for (tmp = tmp->next; tmp; tmp = tmp->next)
- xwrite (STDOUT_FILENO, tmp->buffer, tmp->nbytes);
+ xwrite_stdout (tmp->buffer, tmp->nbytes);
free_lbuffers:
while (first)
i = total_bytes - n_bytes;
else
i = 0;
- xwrite (STDOUT_FILENO, &tmp->buffer[i], tmp->nbytes - i);
+ xwrite_stdout (&tmp->buffer[i], tmp->nbytes - i);
for (tmp = tmp->next; tmp; tmp = tmp->next)
- xwrite (STDOUT_FILENO, tmp->buffer, tmp->nbytes);
+ xwrite_stdout (tmp->buffer, tmp->nbytes);
free_cbuffers:
while (first)
{
size_t n_remaining = bytes_read - n_bytes;
if (n_remaining)
- xwrite (STDOUT_FILENO, &buffer[n_bytes], n_remaining);
+ xwrite_stdout (&buffer[n_bytes], n_remaining);
break;
}
}
if (--n_lines == 0)
{
if (p < buffer_end)
- xwrite (STDOUT_FILENO, p, buffer_end - p);
+ xwrite_stdout (p, buffer_end - p);
return 0;
}
}