delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
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 |
Message-ID: | <4153565F.F9777333@dessent.net> |
Date: | Thu, 23 Sep 2004 16:03:59 -0700 |
From: | Brian Dessent <brian AT dessent DOT net> |
Organization: | My own little world... |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Same code, same script, different results |
References: | <007501c4a172$a96aa9e0$b200a8c0 AT mindcooler> <Pine DOT GSO DOT 4 DOT 61 DOT 0409231148470 DOT 29444 AT slinky DOT cs DOT nyu DOT edu> <002201c4a189$1b126b80$b200a8c0 AT mindcooler> |
X-IsSubscribed: | yes |
Reply-To: | cygwin AT cygwin DOT com |
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id i8NN1CM2014035 |
Mikael Åsberg wrote: > Anyway, it's working as expected now. But to tell the truth I don't know > exactly what the problem was. I tinkered some with the script, did a make > clean ; make (again), and, voila, it works. I'm glad that it works, but it's > a bit annoying not understanding what the problem and the rememdy was. You had DOS line endings (\r\n) on your bash script. To bash the \r is just another character, not a line ending, and it was being included with the other arguments. Thus argv[2] was really "--non-recursive\r" which caused the nonzero strcmp() result. The difference between the two testcases results from the fact that argument parsing is done by the runtime of the compiler/library. In Windows there's really only one long command string for the process, it's the job of the CRT to parse it into words for argv[]. The MSVCRT treated the spurious \r as whitespace and did not include it in argv[2] whereas the Cygwin runtime made no such assumption. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |