From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) by sourceware.org (Postfix) with ESMTPS id 6E7303851C37 for ; Wed, 21 Jul 2021 12:19:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6E7303851C37 Received: by mail-oo1-xc2d.google.com with SMTP id n187-20020a4a40c40000b029025e72bdf5d6so520822ooa.0 for ; Wed, 21 Jul 2021 05:19:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NF+NszRX/t0ld/F4cKvf7YQ2qQ8nJcfNm6FdltiRqSQ=; b=JacBsZSpvoeKcYlVPtq828wrSQiFB2qmvIaSONTHgp8mR+4SKCeJjVRUKmaVHN63qO uTYNXoXEuuIcZCg5oAV/RrAkQIjmS08m+ep7Arp91m48VW6pXoq2XBngm3d87RZDWzlC DqeNvBOLvnCVBKB8SZHZoOnVkvnc3RTTrxniXBm/RrZurXxNyNtum/uZyzmbZNjn9YHK 8r/2kw+yj6pbB40+gIitCd/85fEFWFydtktiHNa6AoENan30UfVQKqKTp1Mwg2UtksvM VPrSM85d1TbIlNSDCG21oACwyxjqGCiN7hTsFxnWM6QRzQDAhqyvtmerm9LqwKrWoHCE VMAg== X-Gm-Message-State: AOAM532OpO9yR9DkVTUpldOgzKabfCD1TRhfFdPI3zY4kdHuHuWZJqQ2 bPDhxnPlW3GmHnBeQQyRFv/dKWYa7UuA6i6+A2k= X-Google-Smtp-Source: ABdhPJx6hL1p+LN200+VN0vRAu1GsluM09Xu1W428boXbVFWOVbeQE4WIRsVlzdgf7P3oFo1pusAovRM7cplosiLI9w= X-Received: by 2002:a05:6820:1057:: with SMTP id x23mr24330456oot.56.1626869951763; Wed, 21 Jul 2021 05:19:11 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Russell VT Date: Wed, 21 Jul 2021 05:18:56 -0700 Message-ID: Subject: Re: Incorrect expansion of a program argument that is a special character? To: Ev Drikos Cc: cygwin X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jul 2021 12:19:14 -0000 Note that Powershell and BASH wildcard (globbing) may be notably different, which includes how items may be "escaped" to prevent such globbing operations. Moreover, in a UN*X shell, it is generally thought that it's the user's responsibility to declare how how file expansion should work, generally defaulting to the "one or more" presence (where true regular expressions use an asterisk as "zero or more"). In this way, shells and general regular expressions may differ. TLDR; In any environment, "arguments" are different between the command line, and the program itself. Basically, you need to understand how any given shell will pass arguments to your program, and that exercise is generally outside of general executable-type discussion (ie. it is almost a "religious war" as to how various shells may process arguments, regular expressions, or wildcards ... along with what options a user may specify to change the behaviour) Do you have an example of where the program functions as-expected, along with examples as to how the identical binary functions differently in other environments? Hope that lights a few lightbulbs for ya! Russell VT On Wed, Jul 21, 2021 at 4:44 AM Ev Drikos via Cygwin wrote: > Hello, > > When I run the program below from my home directory in a PowerShell > Console (Windows 8-1) I've to use an extra backslash character as > shown below or the star is expanded. Which happens only when the > program has been compiled in Cygwin. > > Is this a bug or a known feature? > > Ev. Drikos > > ---------------------------------------------- > PS C:\Users\suser> .\args.exe '\*' > > * > argc=1 > PS C:\Users\suser> > ---------------------------------------------- > > #include > int main(int argc, char *argv[]){ > int i; > for (i=1; i < argc; i++) { > printf("\n%s",argv[i]); > }//for > printf("\nargc=%d\n",argc-1); > return 0; > } > > -- > Problem reports: https://cygwin.com/problems.html > FAQ: https://cygwin.com/faq/ > Documentation: https://cygwin.com/docs.html > Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple > -- Russell M. Van Tassell