Karl Fogel <kfogel@red-bean.com> wrote:
>> A comma works fine if the whole list is double-quoted, and we should
>> probably be quoting all parameters anyway to handle spaces in paths,
>> etc. if APR isn't already.
>
> Hmmm. But this isn't going through a shell. If we put double quotes
> around something, then the double quotes will actually be there in the
> argument, right? That is, if you write your hook program in C, then
> argv[3][0] == '"', no?
No
It doesn't matter on windows: the double quotes are handled by the
application not the shell. Windows respects the quote marks when it is
looking for things like command separators, but the entire string is
passed through unaltered to the application, and the application then
has to parse the string. If it is a C runtime then argv is generated by
the runtime, not by the shell.
e.g.
#include <stdio.h>
int main(int argc, char **argv) {
int i;
for (i = 0; i < argc; i++) {
printf("arg %d: %s\n", i, argv[i]);
};
return 0;
}
... compiled to a.exe using MinGW or Microsoft C/C++, it doesn't matter
...
C:\Temp>\python25\python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.spawnl(os.P_WAIT, 'a.exe', 'a.exe', '1', '2', '3,4,5')
arg 0: a.exe
arg 1: 1
arg 2: 2
arg 3: 3,4,5
0
>>> os.spawnl(os.P_WAIT, 'a.exe', 'a.exe', '1', '2', '"3,4,5"')
arg 0: a.exe
arg 1: 1
arg 2: 2
arg 3: 3,4,5
0
>>> os.spawnl(os.P_WAIT, 'a.exe', 'a.exe', '1 2 "3,4,5"')
arg 0: a.exe
arg 1: 1
arg 2: 2
arg 3: 3,4,5
0
>>>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Nov 8 10:41:26 2007