public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Earnie Boyd <earnie_boyd@yahoo.com>
To: Andrew Dalgleish <andrewd@axonet.com.au>
Cc: gw32 <gnu-win32@cygnus.com>
Subject: RE: Asterisk expansion...
Date: Fri, 31 Jul 1998 12:10:00 -0000	[thread overview]
Message-ID: <19980731115227.10857.rocketmail@send1a.yahoomail.com> (raw)

---Andrew Dalgleish <andrewd@axonet.com.au> wrote:
>
> 
> 
> > -----Original Message-----
> > From:	Earnie Boyd [SMTP:earnie_boyd@yahoo.com]
> > Sent:	1998 July 30, Thursday 21:37
> > To:	gnu-win32@cygnus.com; Andrew Dalgleish
> > Subject:	RE: Asterisk expansion...
> > 
> > ---Andrew Dalgleish <andrewd@axonet.com.au> wrote:
> > >
> > > 
> > > 
> > <snip>
> > > 
> > > When linked with SETARGV.OBJ, the arguments are globbed.
> > > When linked without SETARGV.OBJ, the arguments are NOT globbed.
> > > 
> > > Hence cmd/command do NOT do globbing for external commands
> > > 
> > > (Actually it is possible that globbing is done by the shell.
> > > E.g. the shell could peek into the .EXE to detect which version of
> > > SETARGV.OBJ was included.
> > > I don't think this is very likely, but then it is Microsoft... :-)
> > > 
> > 
> > It is also possible that cmd.exe/command.com does do the globbing
and
> > that the default _setargv reads the command line and resets the argv
> > array.  I would do this if I had the MS compiler; but, try with this
> > sample code creating your own _setargv which simply does nothing
> > (maybe output a message so that you know that your _setargv was
> > called).
> [Andrew Dalgleish]  
> I've waded through Microsoft's run-time source.
> 
> SETARGV.OBJ contains a single function "_setargv".
> The default version does nothing.
> The globbing version sets a flag "_dowildcard" to one.
> 
> Later in the startup "__getmainargs" calls "__setargv".
> (It took me a while to realize this one has two leading underscores
:-)
> 
> If the flag is set "__setargv" then calls "_cwild".
> "_cwild" does some simple checks for quoted arguments (which are not
> expanded), and passes args which may be wildcards on to "tmatch".
> "tmatch" looks for the wildcard characters, then uses
> FindFirstFile/FindNextFile to build the list of files.
> 
> Most of these functions have two versions, one for char and one for
> wchar_t
> They use a single source with lots of #if's sprinkled around.
> For example "tmatch" is #defined to either "match" or "wmatch"
> 
> The bottom line - cmd/command do not glob.
> 
> 
> 

I found the following code from the init.c code for mingw32.  Note
that it has nothing to do with _setargv but it does confirm that
cmd/command _DO_NOT_GLOB_.

/* NOTE: Thanks to Pedro A. Aranda Gutiirrez <paag@tid.es> for pointing
 * this out to me. GetMainArgs (used below) takes a fourth argument
 * which is an int that controls the globbing of the command line. If
 * _CRT_glob is non-zero the command line will be globbed (e.g. *.*
 * expanded to be all files in the startup directory). In the mingw32
 * library a _CRT_glob variable is defined as being -1, enabling
 * this command line globbing by default. To turn it off and do all
 * command line processing yourself (and possibly escape bogons in
 * MS's globbing code) include a line in one of your source modules
 * defining _CRT_glob and setting it to zero, like this:
 *  int _CRT_glob = 0;
 */
extern int  _CRT_glob;

/*
 * Initialize the __argc, __argv and _environ variables.
 */
static void
_mingw32_init_mainargs ()
{
    /*
     * CRTDLL provides a nice little function for doing just that.
     * Convenient isn't it?
     * NOTE: The last
     */
    (void) __GetMainArgs(&__argc, &__argv, &_environ, _CRT_glob);
}

==
-        \\||//
---o0O0--Earnie--0O0o----
--earnie_boyd@yahoo.com--
------ooo0O--O0ooo-------



_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

             reply	other threads:[~1998-07-31 12:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-07-31 12:10 Earnie Boyd [this message]
  -- strict thread matches above, loose matches on Subject: below --
1998-07-31  3:03 Earnie Boyd
1998-07-29 17:43 Andrew Dalgleish
1998-07-28  5:54 Andrew Dalgleish
1998-07-28  0:57 Robertson, Jason V
1998-07-27 15:12 ` Michael Weiser
1998-07-27 14:23 Earnie Boyd
1998-07-27 14:23 ` Fergus Henderson
1998-07-27  9:00 Earnie Boyd
1998-07-27  9:00 ` Fergus Henderson
     [not found] <35B93BE2.2642EDA3@home.com>
1998-07-25 18:10 ` Jason V Robertson
1998-07-27 14:23   ` Michael Weiser
1998-07-24 12:58 Earnie Boyd
1998-07-25  1:22 ` Fergus Henderson
1998-07-25 10:30   ` Leo Mauro
1998-07-23 15:30 Robertson, Jason V
1998-07-24 11:17 ` Matthias Morche
1998-07-24 12:58 ` Mike Bandy
1998-07-25  0:08 ` Michael Hirmke
1998-07-25  4:14   ` Fergus Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19980731115227.10857.rocketmail@send1a.yahoomail.com \
    --to=earnie_boyd@yahoo.com \
    --cc=andrewd@axonet.com.au \
    --cc=gnu-win32@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).