[Top][All Lists]

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

Re: textutils 2.[01]: "fmt --prefix=TAB" doesn't work

From: Jim Meyering
Subject: Re: textutils 2.[01]: "fmt --prefix=TAB" doesn't work
Date: Sun, 30 Mar 2003 10:53:26 +0200

Haakon Riiser <address@hidden> wrote:
> given. :-) Here's a sure way to reproduce to the bug:
>   $ printf '\tfoo\n\tbar\n' | fmt --prefix="`printf '\t'`"
>   foo
>   bar

Thank you for the report.
I'd say that the specification has to be changed to account
for a prefix specified with a leading TAB character.

Currently, the code lets you specify e.g., '>' or ' >' as the prefix
and does what some might expect, even when the text to be formatted has
many leading spaces or only TABs before the '>'.

Both of these

  printf '\t>a\n\t>b\n'|fmt -p '>'
  printf '\t>a\n\t>b\n'|fmt -p ' >'

preserve the leading TAB and honor the specified prefix:

        >a b

FWIW, I don't see the value in ignoring leading space,
as in the second example above.

But this

  printf '\t>a\n\t>b\n'|fmt -p "$(printf '\t')>"

prints this (not honoring the specified prefix):


Currently, the code removes leading white space from the specified
prefix string.  I think it'd be worthwhile to change it not to do that.
And of course to document the new behavior.

I also noticed that fmt doesn't take TABs in a prefix string
into consideration when counting output columns.

  $ printf '[\t\t]a\n[\t\t]b\n' |fmt -p "$(printf '[\t\t]')" -w 8|cat -A
  [^I^I]a b$

Are you interested in working on fmt.c?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]