delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/02/19/07:53:00

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <98f79fac1002190437g5fec3138mb2c7e24d8f03212a@mail.gmail.com>
References: <98f79fac1002180955m1ddea014id0b27cc3b909a17a AT mail DOT gmail DOT com> <4B7D80B3 DOT 4000300 AT cygwin DOT com> <98f79fac1002181224g7987690dn6822d025d1a59405 AT mail DOT gmail DOT com> <4B7DA704 DOT 1080709 AT cygwin DOT com> <98f79fac1002190437g5fec3138mb2c7e24d8f03212a AT mail DOT gmail DOT com>
Date: Fri, 19 Feb 2010 13:52:48 +0100
Message-ID: <98f79fac1002190452h2d99cf0aqf5ca72d952521da0@mail.gmail.com>
Subject: Re: CreateProcess() - executed program gets different argument depending if it's compiled with gcc (cygwin) or cl (VS)?
From: Piotr Krukowiecki <piotr DOT krukowiecki DOT news AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Fri, Feb 19, 2010 at 1:37 PM, Piotr Krukowiecki wrote:
> On Thu, Feb 18, 2010 at 9:45 PM, Larry Hall (Cygwin) wrote:
>> On 02/18/2010 03:24 PM, Piotr Krukowiecki wrote:
>>> On Thu, Feb 18, 2010 at 7:02 PM, Larry Hall (Cygwin)
>>>> On 02/18/2010 12:55 PM, Piotr Krukowiecki wrote:
>>>>> - if the executed program is compiled with cygwin's gcc the program
>>>>> receives \127.0.0.127\foo.cxx (just one backslash at the begining).
>>>>> - if it's compiled with cl it gets \\127.0.0.127\foo.cxx (double
>>>>> backslash - what I expected)
>>>>
>>>> '\' is an escape character in C, Unix, and Linux. =A0In Windows, it's a
>>>> path separator. =A0Use '/' instead when working with Cygwin and you'll
>>>> avoid allot of problems. =A0Better yet, use POSIX paths exclusively.
[...]
> I don't know which program (cygwin/windows) is going to be executed.
> Do I have to check before execution if the program is compiled under
> cygwin and implement different logic in that case? From what I
> understood so far this is the only way?

There's another confusing behaviour: backslashes seem to be treated as
escape characters only if inside quotes:

Command: F:\t\dumpargs_gcc.exe  "\\foo" \\bar
/cygdrive/f/t/dumpargs_gcc
\foo
\\bar

Command: F:\t\dumpargs_cl.exe  "\\foo" \\bar
F:\t\dumpargs_cl.exe
\\foo
\\bar

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