chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] windows shell problem


From: Thomas Chust
Subject: Re: [Chicken-users] windows shell problem
Date: Mon, 05 Jan 2009 01:27:16 +0100
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.8.1.19) Gecko/20081227 SeaMonkey/1.1.14

Ivan Raikov wrote:
> [...]
>    I think the problem is that \ in strings needs to be escaped,
> [...]

Hello,

I don't think so, unless the escaping problem occurs on the Scheme or C
side of things.

As far as I know, the Windows shell only understands two escape
characters: The double quote ("), to group things that contain spaces
together and the caret (^) to escape a single following special character.

You can usually enclose things in more than one pair of double quotes
for multiple levels of quoting, however there is no reliable way that I
know of to include double quotes somewhere in the middle of a quoted
string, since at least by the shell no other escape character is
recognized inside double quotes. The caret on the other hand can only be
used to quote certain other characters, like '<', '>', '(', ')', but, if
I recall correctly, it cannot be used to quote spaces or double quotes.

One also has to keep in mind that, unlike under *NIX, the shell is not
responsible for tokenizing command lines into a list of arguments under
Windows. It passes everything after the program name that it doesn't
process itself to the program as a single string and it does not remove
any meta characters from that string. Since the ANSI C standard
prescribes that the main entry point of a program gets a tokenized array
of command line arguments as a parameter, the C library linked into most
programs splits the command line passed by the shell into separate
arguments somehow. However, programs compiled with different tool chains
or linked against different versions of a Windows C runtime library
occasionally have different ideas about how this tokenization should
work. If you have to deal with several such programs, it may be entirely
impossible to quote the command lines correctly.

At least the fact that the shell does not split the command lines but
the application programs do implies that it is impossible to devise a
generally safe and meaningful quoting scheme for Windows shell commands.

cu,
Thomas




reply via email to

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