cygwin passes argv with preserved (") quote. and it is undesired result.

Csaba Raduly rcsaba@gmail.com
Thu Dec 31 13:42:00 GMT 2009


On Thu, Dec 31, 2009 at 10:00 AM, jojelino  wrote:
> hi
> here is testcase to reproduce the problem
>
> #include <stdio.h>
> #include <assert.h>
> int main(int argc, char**argv)
> {
> printf("argv %s",argv[1]);
> open(argv[1],"r");
> assert(fp);
> return 0;
> }
> build
> make け.txt in directory.
> and run in cmd.exe
> type,
> a "け.txt"
>
> and it complains file can't be opened.
> and you can see argv[1]  is passed with preserved quote (") although it is
> invoked in winshell
> it must be eliminted when it is transduced to cygwin environment.
>
> but when parent process is cygwin, it gives no complaint
>>strace a "け.txt"
> in result, is it designed to do so?

Yes. "parent process is cygwin" probably means that a.exe was started
from bash. The quote character is special for bash; see for example
http://linux.about.com/od/bgb_guide/a/gdebgb30t03.htm

This means that when started from bash, a.exe gets what's inside the
quotes, without the quotes themselves. cmd.exe may behave differently.


Hope this helps,
Csaba
-- 
Life is complex, with real and imaginary parts

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list