This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: Argument parsing with gcc compiled program
- From: "Gluszczak, Glenn" <glenn dot gluszczak at emc dot com>
- To: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Fri, 27 Nov 2015 16:55:13 +0000
- Subject: RE: Argument parsing with gcc compiled program
- Authentication-results: sourceware.org; auth=none
- References: <CAO1jNwu2RXpCn2JuaZEhGaFA4_UTW9dxPxRcoasRuUBwgbRQgA at mail dot gmail dot com>
>On Fri, Nov 27, 2015 at 5:03 PM, Gluszczak, Glenn wrote:
> Please look at my example again. The same program compiled with Visual Studio does *not*
> strip out the backslash whether run in cmd.exe or bash.exe. Other utilities like Perl
> do not strip out the backslash either. It is only programs I compile with Cygwin gcc that do this.
>Windows Perl or Cygwin Perl ?
>
>Csaba
You're correct about Perl, my bad. My path in my CMD was pointing to Windows Perl.
Windows Perl does not strip out the backslash. Cygwin Perl is stripping out the backslash.
$ cat a.pl
$pcount = 0;
while ( $pcount <= ($#ARGV )) {
printf("%s\n",$ARGV[$pcount]);
$pcount ++;
}
$ perl a.pl -s "dsfgdsfgfsg d\:\\hello"
-s
dsfgdsfgfsg d\:\hello
K:\> c:\cygwin\bin\perl a.pl -s "dsfgdsfgfsg d\:\\hello"
-s
dsfgdsfgfsg d\:\hello
So if I compile with MS Visual Studio, binaries do not strip backslashes out of
arguments whether run in bash or cmd.
If I compile with Cygwin gcc, backslashes are stripped whether in bash or cmd.
This looks like a compiler issue to me unless someone knows of an option.