delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/11/26/15:20:22

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=pRik4S/jxyWQ6JWG
GabwSDCTXAhw1KbVY1sqtlmy/Wj1uBiDrhfBMEvSyIv86yiW7lLsxzCsJmqlbjzs
dpQb7nT92M9rBB509suvZIEeUE4ixQfL/8h7c5daty+WskgiRV53+fKRBCPqZQQc
egWi288ReOqYIqMI6I1w5XJ88Rg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=tz2QR/QNQMxD5OFWQQVMJf
5NHhM=; b=HpeVY33GpHeHdYiYskiSGhXlptGQO1XY3nB/KHV7KvDS5omMSq4VQS
2Sr6bPkyZoBwM/KmOOsBXKThZkomA3/IKsyAIGegTytfl3ljRfpBxoHp9ln/dZy1
TXeiMT7RBw5HOmUrB9xn6DdrH/sF4QpUSdBRhLt3bK5ZgEosCcgh0=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-wm0-f49.google.com
X-Received: by 10.28.210.137 with SMTP id j131mr6229891wmg.93.1448569205369; Thu, 26 Nov 2015 12:20:05 -0800 (PST)
Subject: Re: Argument parsing with gcc compiled program
To: cygwin AT cygwin DOT com
References: <91DCAC3CB99C724EB365BB64677FBE7B01DD4B AT MX204CL04 DOT corp DOT emc DOT com>
From: Marco Atzeri <marco DOT atzeri AT gmail DOT com>
Message-ID: <56576970.3030501@gmail.com>
Date: Thu, 26 Nov 2015 21:20:00 +0100
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
MIME-Version: 1.0
In-Reply-To: <91DCAC3CB99C724EB365BB64677FBE7B01DD4B@MX204CL04.corp.emc.com>
X-IsSubscribed: yes


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019