On 10/23/2014 10:39 AM, Eric Blake wrote: > POSIX is considering standardizing the Solaris/BSD behavior of 'tail -r' > rather than adding the GNU extension of 'tac' as a separate utility: > http://austingroupbugs.net/view.php?id=877 > > This bug report serves as a reminder that we need to add 'tail -r' > support to coreutils, as well as a request for reviewers for the current > state of the proposal to make sure that it is not an onerous burden for > adding that code. > Implementation-wise, I'm thinking the easiest thing might be to turn tac.c into a shared library-style file (similar to how copy.c is shared among multiple programs), add a 'tac -n' option that limits output to a fixed number of "lines" (or rather, a fixed number of occurrences of '--separator'-delimited segments), then have the new 'tail -r' call into the library code with separator hard-coded to newline, along with sufficient checks that tail's new -r can only be used with -n with no sign on the number (at least, as a first cut; we can certainly support more combinations than what POSIX wants to require, if we can determine sane semantics and easy implementations for those combinations). -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org