Re: [Toybox] [toybox] fold implementation

2014-04-03 Thread Rob Landley
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


Re: [Toybox] fold implementation

2014-04-03 Thread Samuel Holland
On Apr 3, 2014, at 5:56 PM, Rob Landley r...@landley.net wrote:
 The -u option to fold isn't currently being used...
 
 Could you describe a little more how unfold would work?

Generally, I write papers and such in a text editor with hard wrapping, like 
nano, and then transfer them to LibreOffice for formatting. So I go from 
newline after X columns and a blank line between paragraphs to long lines with 
a single newline between paragraphs. The simplest algorithm would be to remove 
all newlines except double newlines (and convert those to single). If -s was 
specified, we would only remove newlines after spaces and tabs (or unless there 
was no space in that line). Finally, if -w was specified, we would re-wrap at 
that width.

 Rob

Regards,
Samuel Holland sam...@sholland.net

___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net