]> git.ipfire.org Git - thirdparty/coreutils.git/commit
head: port to Darwin and use simpler seeks
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 31 Mar 2014 19:16:44 +0000 (12:16 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 2 Apr 2014 14:45:58 +0000 (07:45 -0700)
commit9111dd2499ca5c26d2658bf85966e8160f51d280
tree0e25c140b0dec0fcec211c5b698d465f47cf276c
parentd08381bc261d95502a205f7214686f80383c9692
head: port to Darwin and use simpler seeks

This removes an unportable assumption that if lseek succeeds, the
file is capable of seeking.  See: http://bugs.gnu.org/17145
* src/head.c (elseek): New function, for consistency in reporting
lseek failures.
(elide_tail_bytes_file, elide_tail_lines_seekable)
(elide_tail_lines_file, head_lines, head): Use it.
(elide_tail_bytes_file, elide_tail_lines_file):
New args CURRENT_POS and SIZE.  All uses changed.  Don't bother
invoking lseek, since we know the file's pos and size now.
(elide_tail_bytes_file): Change a local from uintmax_t to off_t,
since it fits.
(head): Use lseek only on regular files, since its behavior on
unseekable devices is implementation-defined.
* NEWS: Document this.
NEWS
THANKS.in
src/head.c