public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Marco Atzeri <marco.atzeri@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Argument parsing with gcc compiled program
Date: Thu, 26 Nov 2015 20:30:00 -0000	[thread overview]
Message-ID: <56576970.3030501@gmail.com> (raw)
In-Reply-To: <91DCAC3CB99C724EB365BB64677FBE7B01DD4B@MX204CL04.corp.emc.com>



On 26/11/2015 21:08, Gluszczak, Glenn wrote:
> For some reason when I compile a C program in gcc, double backslashes within quotes are stripped.
> But if I compile with Visual Studio this does not happen.  I used a small
> test program to demonstrate.
>
> VS
> c:\msvc2010_SP1\VC>a.exe -s something "something d\:\\hello"
>
> Command-line arguments:
>    argv[0]   a.exe
>    argv[1]   -s
>    argv[2]   something
>    argv[3]   something d\:\\hello
> CL: a.exe  -s something "something d\:\\hello"
>
>
> GCC
> $ ./a.exe -s something "something d\:\\hello"
>
> Command-line arguments:
>    argv[0]   ./a
>    argv[1]   -s
>    argv[2]   something
>    argv[3]   something d\:\hello
> CL: K:\sat-misc\src\sat-main\sat\src\wiz\a -s something "something d\:\hello"
>
> Is there some compiler option or setting I'm unaware of?
> Thanks,
> Glenn
>

bash is stripping the double backslashes
when using " , try '

$ ./a.exe -s something 'something d\:\\hello'

Command-line arguments:
   argv[0]   ./a
   argv[1]   -s
   argv[2]   something
   argv[3]   something d\:\\hello
CL: "E:\cygwin64\tmp\a.exe"




--
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

  reply	other threads:[~2015-11-26 20:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26 20:15 Gluszczak, Glenn
2015-11-26 20:30 ` Marco Atzeri [this message]
2015-11-26 21:20 Gluszczak, Glenn
2015-11-27 10:10 ` Jan Nijtmans
2015-11-27 16:34   ` Gluszczak, Glenn
2015-11-27 16:55     ` Csaba Raduly
2015-11-27 17:08   ` Gluszczak, Glenn
2015-11-27 17:34     ` Marco Atzeri
2015-11-27 19:02 Gluszczak, Glenn
2015-11-28 10:06 ` Achim Gratz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56576970.3030501@gmail.com \
    --to=marco.atzeri@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).