tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: fold(1) and "blank" and add lazy option

On 09/22/09 13:43, Jeremy C. Reed wrote:
fold(1) says:

  -s      Fold line after the last blank character within the first width
          column positions (or bytes).

I plan to add to that -s description: "If a blank character does not
exist within the width, then a longer line will still be split at
the width."

It specifically says "blank". But code has:

           if (buf[i] == ' ')
                   last_space = i;

It doesn't use isblank. I may change the manual page to say "space"
instead (since \t has a different purpose in fold). Anyways "-s" for
*s*pace makes sense.

Check POSIX 2008 if you are unsure, if it doesnt say anything about it, then its ok, I think.

The -[0-9] arguments aren't documented in manual page nor in usage. Why?
Historical, but planned to be removed to just use -w instead?

I guess its a remnant from ancient times, its not documented because it
shouldn't be relied on, I suppose.

I was thinking of adding a lazy option so when using -s it won't still
split at width if there is no space up to the width. So some
output lines may be longer than width when using the option.

I think I had a version which did this. It makes sense actually, but later I have decided to keep the historical behaviour.

   Jeremy C. Reed

p.s. I am looking for a LaTeX formatter, that can fold and possibly
justify lines. It must know LaTeX, for example, if it folds a % comment,
then it should add a % to continue the comment.

Home | Main Index | Thread Index | Old Index