head: with --lines=-N (-n-N) reset file pointer on seekable input
authorJim Meyering <meyering@redhat.com>
Tue, 5 Jun 2012 10:24:49 +0000 (12:24 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 5 Jun 2012 17:55:26 +0000 (19:55 +0200)
commit295ee521bc1a4f473ee8b7b5a4be32c5b5c7386f
treeb118600100717eb2b4d653d02f397acf96bc7971
parent5fdd5c6310098c5ce3cbc608450d5c4104f18c2f
head: with --lines=-N (-n-N) reset file pointer on seekable input

* src/head.c (elide_tail_lines_seekable): Reset file pointer
after printing up to an end-relative line-counted offset.
Anoop Sharma reported the problem and suggested the fix.
* tests/misc/head-pos: Add coverage via a very similar, existing test.
Also add coverage for a previously untested block of code.
* tests/misc/head-elide-tail ($READ_BUFSIZE): Update to 8192, to
match the value of BUFSIZ I see today on Fedora 17/x86_64 (unrelated
to this fix).
* NEWS (Bug fixes): Mention it.

Improved-by: Pádraig Brady
NEWS
src/head.c
tests/misc/head-elide-tail
tests/misc/head-pos