[Catalyst] (OT) It’s not CMD.EXE’s fault (was: Easier catalyst installation)

A. Pagaltzis pagaltzis at gmx.de
Wed Apr 5 06:51:59 CEST 2006


* Nilson Santos Figueiredo Junior <acid06 at gmail.com> [2006-04-04 23:50]:
> On 4/4/06, A. Pagaltzis <pagaltzis at gmx.de> wrote:
> > The matter is more insidious than that. DOS and Win32 don't
> > have a notion of argv; the command line is just a string, as
> > opposed to a list of strings like it is on *nix.
> 
> Well. Are you sure about this?

Yes.

> Then, when compiling some C code, the compiler needs to
> generates hidden code to pass into my main() the splitted
> parameters?

Yes. It has always generated quite a lot of hidden code,
actually, stuff like setting up malloc()’s data structures and
more that I forget about.

> But when looking at the CreateProcess() API entry, there really
> is one only string parameter which represents the command line.
> However, inside this same description, it also states that the
> parameters will be available through argc/argv[], as expected.
> So, clearly, the OS seems to do some magic.

No, it’s libc that does the magic for you. Most binaries for
Windows are compiled against some version of the typical runtime
libs, usually Microsoft’s (but others follow the same rules now),
and they all parse the string following very similar rules, so
most of the time all appears to work as it should. That’s what I
meant by “de facto standard for quoting.”

This wasn’t always the case; I grew up on MSFT systems in the
days before VFAT/FAT32, when filenames were only 8+3 chars long
and could not contain spaces. Since quoting was not an issue,
noone bothered to do much magic, you just split the command line
string on whitespace.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list