Mail Archives: cygwin/2005/08/28/05:37:47
Hello,
when i compile an application with `gcc -mno-cygwin` and execute it from
cmd.exe, argv parsing is broken for argv[0] when quotes are embedded in
the command used to launch the application.
For example, executing ` "."\argv0_bug "a"\b ` from cmd.exe gives
arg0: .
arg1: \argv_bug
arg2: a\b
instead of
arg0: .\argv_bug
arg1: a\b
Note that this is only a problem with argv[0].
MinGW.org's binaries seem to behave as expected. I'm using gcc version
3.4.4 (cygming special) (gdc 0.12, using dmd 0.125).
Below is a shell script that demonstrates the problem.
Regards,
Mudi Obada
#--------------------------
#!/bin/sh
f=argv0_bug
cat <<__EOF__ > $f.c
int main(int argc, char * * argv)
{
int i;
for (i = 0; i < argc; i++) {
printf("arg%d: %s\n", i, argv[i]);
}
return 0;
}
__EOF__
gcc -mno-cygwin $f.c -o $f
echo \".\"\\$f \"a\"\\b > ${f}-test.bat
cmd /c ${f}-test.bat
#--------------------------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -