Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Quoting style in C

2 views
Skip to first unread message

mathieu

unread,
Jul 13, 2007, 5:16:03 AM7/13/07
to
Hi

I was struggling with a weird path. So I decided to use a fancy
option in ls to help me out. But I think the output is incorrect.

Steps:
mkdir /tmp/bla
touch "/tmp/bla/filename with | pipe"
ls --quoting-style=c /tmp/bla

returns:

"filename with \| pipe"

I do not think escaping | is correct in C.

Comments ?
-Mathieu

Richard Bos

unread,
Jul 13, 2007, 5:48:57 AM7/13/07
to
mathieu <mathieu....@gmail.com> wrote:

You are right. '\|' is not a defined escape character in C; its value is
implementation-defined.
(Of course, one might nit-pick and say that the _style_ of escaping is
that used by C, even if this particular escape _character_ is not in the
C Standard.)

Richard

Ralf Damaschke

unread,
Jul 13, 2007, 7:04:27 AM7/13/07
to
Richard Bos wrote:

> mathieu <mathieu....@gmail.com> wrote:
>> I do not think escaping | is correct in C.
>
> You are right. '\|' is not a defined escape character in C;
> its value is implementation-defined.

No, it is not defined (by the grammar rule for escape-sequence)
and requires a diagnostic; there is even a footnote on 6.4.4.4
which explicitly states this.
6.11.4 allows it in extensions though.

Ralf

0 new messages