From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Dalgleish To: earnie_boyd@yahoo.com, gnu-win32@cygnus.com Subject: RE: Asterisk expansion... Date: Wed, 29 Jul 1998 17:43:00 -0000 Message-id: <91A8FD196436D1118EC2006008186C960B67B9@server1.axonet.com.au> X-SW-Source: 1998-07/msg00648.html > -----Original Message----- > From: Earnie Boyd [SMTP:earnie_boyd@yahoo.com] > Sent: 1998 July 30, Thursday 00:29 > To: Andrew Dalgleish > Subject: RE: Asterisk expansion... > > > Thanks for this information. I hate giving misinformation. I have > yet to find a definition of the function _setargv though. I've built > simple tests with both mingw32 gcc and with Jacob Navia's LCC and they > both do the same globbing on NT 3.51. I've searched the executables > with `nm test.exe | less' and can only find argv as data which comes > from the parameter definitions from main. I've searched crtdll.dll > with the strings command and did not find the _setargv function. > > From the definition you've given below I can conclude the cmd.exe does > infact do globbing. The statement > > > The wildcards are expanded in the same manner as operating system > > commands. (See your operating system user's guide if you are > unfamiliar > > implies to me that the * is expanded to a list of files by cmd.exe > albeit only from the working directory. [Andrew Dalgleish] cmd/command only do globbing for INTERNAL commands. (For internal commands, it is a moot point as to whether the shell or the command does the globbing.) Microsoft use a function _setargv in their startup code. The default version does NOT do any globbing. They also offer a "more powerful version" which does do globbing, but you need to specify the SETARGV.OBJ file in the link command. I am not suprised you could not find any references to _setargv. This function is Microsoft-specific, and if anyone else uses a function with the same name it is just co-incidence. Here is definitive proof that cmd does NOT do globbing for external commands unless you link with the alternative _setargv. C:\>type ShowArgs.c #include #include int main(int argc, char *argv[]) { int ArgIndex; for (ArgIndex = 0; ArgIndex < argc; ++ArgIndex) printf("%d %s\n", ArgIndex, argv[ArgIndex]); return EXIT_SUCCESS; } C:\>cl ShowArgs.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 11.00.7022 for 80x86 Copyright (C) Microsoft Corp 1984-1997. All rights reserved. ShowArgs.c Microsoft (R) 32-Bit Incremental Linker Version 5.10.7303 Copyright (C) Microsoft Corp 1992-1997. All rights reserved. /out:ShowArgs.exe ShowArgs.obj C:\>ShowArgs *.c 0 ShowArgs 1 *.c C:\>cl ShowArgs.c setargv.obj Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 11.00.7022 for 80x86 Copyright (C) Microsoft Corp 1984-1997. All rights reserved. ShowArgs.c Microsoft (R) 32-Bit Incremental Linker Version 5.10.7303 Copyright (C) Microsoft Corp 1992-1997. All rights reserved. /out:ShowArgs.exe ShowArgs.obj setargv.obj C:\>ShowArgs *.c 0 ShowArgs 1 SHOWARGS.C C:\> 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... :-) Regards, Andrew Dalgleish - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request@cygnus.com" with one line of text: "help".