This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: cygwin passes argv with preserved (") quote. and it is undesired result.
- From: Csaba Raduly <rcsaba at gmail dot com>
- To: cygwin at cygwin dot com, jojelino at gmail dot com
- Date: Thu, 31 Dec 2009 15:42:37 +0200
- Subject: Re: cygwin passes argv with preserved (") quote. and it is undesired result.
- References: <hhhlmo$68u$1@ger.gmane.org>
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