[Toybox] [toybox] fold implementation

Robert Thompson robertt.thompson at gmail.com
Wed Apr 2 21:16:24 PDT 2014


I personally would also find a pure simple single-purpose "unfold" useful.

If you feel like going just a touch beyond a simple "unfold", you might
want to look at the fmt utility. I've seen several scripts in the wild that
used fold and/or fmt. A couple of them used fold to do the folding and fmt
(with really long maximum line specified) to unfold, which I thought was
strange... after all, if you've got fmt, you can use it to do both
"folding" and "unfolding", but whatever.


One thing to be aware of, it seems that there isn't a lot of consensus in
terms of the fmt arguments. If there's a standard, it looks like it's
mostly ignored.

http://en.wikipedia.org/wiki/Fmt

http://www.freebsd.org/cgi/man.cgi?query=fmt&sektion=1&apropos=0&manpath=FreeBSD+6.2-RELEASE

http://www.gnu.org/software/coreutils/manual/html_node/fmt-invocation.html


For what it's worth...


On Wed, Apr 2, 2014 at 8:25 PM, Samuel Holland <samuel at sholland.net> wrote:

> Hello, everyone.
>
> Here is a basic implementation of fold[0]. It does not support multibyte
> characters, though that would probably just require more switch cases. This
> is my first contribution, so please comment your thoughts/what I can
> improve.
>
> I was planning to write an "unfold" utility that basically did the
> opposite. Although I don't think it's in any standard, would it still be of
> any interest?
>
> [0] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/fold.html
>
>
>
>
>
> Regards,
> Samuel Holland <samuel at sholland.net>
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20140402/02e2e34c/attachment-0003.htm>


More information about the Toybox mailing list