Google Группы больше не поддерживают новые публикации и подписки в сети Usenet. Опубликованный ранее контент останется доступен.

Quoting style in C

0 просмотров
Перейти к первому непрочитанному сообщению

mathieu

не прочитано,
13 июл. 2007 г., 05:16:0313.07.2007
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

не прочитано,
13 июл. 2007 г., 05:48:5713.07.2007
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

не прочитано,
13 июл. 2007 г., 07:04:2713.07.2007
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 новых сообщений