Re: [Toybox] [toybox] fold implementation
I apologize for anything gmail's reply function does to this message. It's... opinionated. On Wed, Apr 2, 2014 at 11:16 PM, Robert Thompson robertt.thomp...@gmail.com wrote: 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. I've looked at fmt and it is interesting, but it's not in posix or lsb so I'm not entirely sure what functionality to implement. (The gnu/dammit version's man page is a stub telling me to install the info command, which isn't happening.) 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=fmtsektion=1apropos=0manpath=FreeBSD+6.2-RELEASE http://www.gnu.org/software/coreutils/manual/html_node/fmt-invocation.html Ooh, good links. Thanks. Rob ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
[Toybox] [toybox] fold implementation
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 fold.patch Description: Binary data Regards, Samuel Holland sam...@sholland.net___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
Re: [Toybox] [toybox] fold implementation
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=fmtsektion=1apropos=0manpath=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 sam...@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 sam...@sholland.net ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net