Re: Source code for gtk-demo
- From: "Freddie Unpenstein" <fredderic excite com>
- To: devilsclaw devilsclaws net, gtk-app-devel-list gnome org
- Subject: Re: Source code for gtk-demo
- Date: Sun, 10 Dec 2006 04:04:05 -0500 (EST)
I guess since my shell defaults to \ with directories or file names
that have spaces and windows requires "" around parameters passed
the the executable i was wrong about linux also being able to use\
"" for parameters passed to the executable..
Linux's argv[] array is, in fact, passed as an array. Much in the same way as the environment, I believe.
Each argument in argv[] is in fact a discrete string.
In Winblows, I believe it receives one solid string which the real C entry point parses into an array before
it calls main(), passing it through as an array.
So what's actually happening on Winblows is that the command-line parser within the application is sensitive
to double-quotes (but possibly not to \-quoting) and is using that to figure out what you wanted the
arguments to be. Generally, I believe the original command-line is preserved within the programs
environment, and a copy is created containing the discrete arguments as they're parsed out. (I used to
program DOS Assembler, where we didn't have a built-in argument parses.)
In Linux, the shell is what parses the command-line, stripping off the quoting as it goes, and passes the
actual filename(s) as discrete arguments, the way they should be. In Bash and similar Unix shells, you can
even mix quoting styles as needed. (Bash offers double-quotes, single-quotes, and back-quoting, as standard.)
As an interesting example, the Windows "echo" command will preserve multiple spaces and what-not, and
generally print out exactly what you give it (including any quoting). The Unix "echo" command doesn't, and
will reduce any white-space separating individual arguments to a single space, unless quoted. This is, as I
said, a function of the shell. If you use the exec() system call from Unix, and pass it an argument with
quotes, those quotes will indeed be printed as expected.
Fredderic
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]