uutils/coreutils — pull request #372 by Armavica (2014-07-28 00:48:43+00:00)
Title: Implement unexpand

Implementation of `unexpand`, coming with a bunch of unit tests from the GNU coreutils.

I noted that the `unexpand` manpage only provides a first-order approximation of what the program is actually meant to do: a naive implementation would lead for example to `echo -n "a " | unexpand -t 1` returning `"a\t"`, while the expected behaviour, as enforced by one of the unit tests, is to return `"a "`. My implementation passes all the tests, and I hope that no corner case was left out.

Some parts of the main function could probably be factorized, but in my opinion at the cost of readability.