Subject: Re: CVS commit: src/bin/ls
To: None <source-changes@NetBSD.org>
From: Perry E. Metzger <perry@piermont.com>
List: source-changes
Date: 04/08/2006 17:53:51
Jan Schaumann <jschauma@netmeister.org> writes:
> "Perry E. Metzger" <perry@piermont.com> wrote:
>> 
>> Jan Schaumann <jschauma@netmeister.org> writes:
>
>> > Running 'ls -b "foo bar"' yields:
>> >
>> > On Lunix:   foo\ bar
>> > On IRIX:    foo\0x4bar
>> > On Solaris: foo bar
>> > On NetBSD:  foo bar
>> 
>> I think shockingly, the Linux behavior seems most in accord with what
>> one would expect -b to do (and with what is most useful to the user.)
>
> Actually, if the manual page that '-b' "prints octal escapes for
> nongraphic characters", then using "\ " for a space doesn't seem
> quite correct.

That's not what the manual says for -b -- it is what it says for -B.

     -B      Force printing of non-printable characters in file names as \xxx,
             where xxx is the numeric value of the character in octal.

     -b      As -B, but use C escape codes whenever possible.

So -b uses "escape codes" and not "octal escapes".

POSIX/SuS does not define the behavior of -B and -b, so I think we can
go for what is "most reasonable".

Perry