Re: EMX runtime and command line arguments

Ilya Zakharevich <nospam-abuse-qlYHBhoNh+/[email protected]> Tue, 13 Jan 2004 09:27:53 -0800
Newsgroups gmane.comp.ide.emx.devel
Message-ID <[email protected]>
On Sun, Jan 11, 2004 at 05:32:45PM +0100, Andreas Buening wrote:
> When an emx program is called, the command line arguments, i.e.,
> the argv argument of main() is modified before main() is entered.

No.

> Double quotes ('"') are removed and backslashes interpreted under
> certain circumstances (e.g., '\"' is replaced by '"').
> What exactly does the runtime do, and under which circumstances,
> and is it possible to access the original argv from within the
> program?

There is no "original argv".  The OS/2 model of IPC between the parent
and the child is not argc/argv, as on Unix, but a pair of strings:
"program name" and "the rest of the command line" (actually, there may
be more strings than 2 - this is a very weak spot in the OS/2 design).

What the startup code (in crt0.obj) does is conversion from the "OS/2
style" to argc/argv pair.  The original pair of strings *might* be
available through the PIB - but it may be that it is written over by
EMX (I doubt this, but I'm not completely sure - and do not rememeber).

Hope this helps,
Ilya