X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 30AC53950CA5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1626869984; bh=DWWPzHEQZ3tiavCTrNqzT7yvCy6mnPeuyyiYeqvBaw4=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=qzaifWtoT/5s1EreUknf96N5hnPDXfG6dRqhJUuEuBv944Un8k5zqixFnFjdIXjvl riN89cqAIWV8F/odJ/eHAtW4u6cbT0vO9G4CQI+xNWq6Hk/KBJoKcHY79s9t7NB+5u tcZE+5PNv/gY5hR5dmQ493j6QBkN1EInSUDPYnuA= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6E7303851C37 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: 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 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 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Russell VT via Cygwin Reply-To: Russell VT Cc: cygwin Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Cygwin" 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 -- 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