From: Jim Meyering Date: Mon, 7 Aug 2000 13:27:24 +0000 (+0000) Subject: (head): Call write_header here. X-Git-Tag: FILEUTILS-4_0y~96 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=0ae67ef6a81cae9ebf73f9d0513d79f6180a78ec;p=thirdparty%2Fcoreutils.git (head): Call write_header here. (head_file): ... not here. --- diff --git a/src/head.c b/src/head.c index 30dfd99053..7bc3cad17a 100644 --- a/src/head.c +++ b/src/head.c @@ -175,6 +175,9 @@ head_lines (const char *filename, int fd, uintmax_t lines_to_write) static int head (const char *filename, int fd, uintmax_t n_units, int count_lines) { + if (print_headers) + write_header (filename); + if (count_lines) return head_lines (filename, fd, n_units); else @@ -189,10 +192,7 @@ head_file (const char *filename, uintmax_t n_units, int count_lines) if (STREQ (filename, "-")) { have_read_stdin = 1; - filename = _("standard input"); - if (print_headers) - write_header (filename); - return head (filename, STDIN_FILENO, n_units, count_lines); + return head (_("standard input"), STDIN_FILENO, n_units, count_lines); } else { @@ -201,8 +201,6 @@ head_file (const char *filename, uintmax_t n_units, int count_lines) { int errors; - if (print_headers) - write_header (filename); errors = head (filename, fd, n_units, count_lines); if (close (fd) == 0) return errors;