delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/05/13/12:46:15

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:references:to:from:reply-to:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=KmBfAoRaauFXZIvq
SfI6iCLIeXERkz92zUYsq0Z/lzQde6RFBLc7CXMGW/Ez3lMucrBV7/0D+9XIweAf
y+xtoRy1uWkdxgxpyJ3uh1Xko7hbop6UEt3Wan7XE1CmFv8xN8rvNXCJX4NIKDO1
q0MEgWEb+feX6R+lqohqJmEmkdc=
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:references:to:from:reply-to:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=/9vKECsv5mCmRHq+CgH0wM
vSAew=; b=V7RGGbVStyA7J8r746ZIRzSLnmxmeCFjDC8FMkz0vcU28iA4NLsfcx
yiVK5eACH4ev9kSJKsJcyOaUlOctwLej5HtvhSFFmk9lMeiEqgYn/veEgjb3QLMq
fggbC/XPFk7YvAEWOzNRPfjx/99KzKH3UV5VNYm1sOLjynAhqIZ68=
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=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=H*r:ip*192.168.1.100, cruft, H*RU:!192.168.1.100!, Hx-spam-relays-external:!192.168.1.100!
X-HELO: smtp-out-no.shaw.ca
X-Authority-Analysis: v=2.2 cv=a+JAzQaF c=1 sm=1 tr=0 a=WqCeCkldcEjBO3QZneQsCg==:117 a=WqCeCkldcEjBO3QZneQsCg==:17 a=IkcTkHD0fZMA:10 a=SC9bsmlT6wrbtb-3c-UA:9 a=QEXdDO2ut3YA:10
Subject: Re: BUG: winmain GetCommandLine only returning program name and path with no arguments
References: <CAF_6hF4+jNWuqA-7jSn2=Jqb2X--MDmY0qhbNwtLxBcHwkrxbA AT mail DOT gmail DOT com>
To: cygwin AT cygwin DOT com
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
Message-ID: <70d719e8-c669-586c-7244-9dc80d3c9e73@SystematicSw.ab.ca>
Date: Sat, 13 May 2017 10:45:53 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <CAF_6hF4+jNWuqA-7jSn2=Jqb2X--MDmY0qhbNwtLxBcHwkrxbA@mail.gmail.com>
X-CMAE-Envelope: MS4wfJelb+juWEtOqRbt9/6v7Fp/4yjecFhv3yGnWb521kAgQXAdS3jX/O8VwNeLheOTV5p3e8aXEPvkhq/A9D6o6g+lcCxLKRF1vavbdIEj9e2Adws9bapd lXA28CSYoQsJJgttOs4CXyS9D8Acw/dTbMHc0TaB5XS4YnQ9SMAMxvmU/MTDyji/9gbPY+/dbEGYOg==
X-IsSubscribed: yes

On 2017-05-13 08:30, Mike Barry wrote:
> Below is a sample program that demonstrates that the GetCommandLine 
> function is not returning the command line arguments. I attached 
> cygcheck.out.
> 
> #include <windows.h>
> #include <stdio.h>
> 
> int WINAPI
> WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) {
>         char* text = GetCommandLine();
>         printf("getcmdline: %s\n", text);
>         return 0;
> }
> 
> gcc test_wmain.c -o test
> 
> $ ./test hello world
> getcmdline: "C:\cygwin64\home\mbarry\game-repos\greenbeam\src\test.exe"

Cygwin program startup may have already taken care of the command line.

If you're using Cygwin, lose the MS cruft, and define a standard non-MS: 

int 
main( int argc, char **argv) {
...
}

and process the args with getopt as usual.
You could try Mingw or VS, but even there I believe you can use standard 
main(). 

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

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