Colin McKinnon <[EMAIL PROTECTED]> writes:
> ... the Atari ST in great detail. There the command line is
> simply passed to the application as a single string (after shell
> substitutions, including quotes) and _main() chops it up into
> argc/argv - presumably this is not the case in Unix since there is
> discrimation between an embedded space and a field seperator. Does the
> shell split the command line or does it pass the quote marks to the
> program?
All the stuff you are seeing is *shell* stuff. A shell is
given a null-terminated string, and it does its little old
lexing/parsing/whatnot thing, and ends up making
fork-and-exec system calls to fire its subprograms
(including yours, whatever that is). To each of those, it
supplies arguments in the form of an array of strings
(commonly called argv, @ARGV in Perl), as well as an environ
(array of name-value pairs). That's why C programs begin
with: main(argc,argv,envp) ...
Spaces and double-quotes (and single-quotes) "mean
something" to the shell, and that's where all the action
is.
The program "receiving" an argv/envp bunch of stuff can make
whatever its wants of it. As far as Unix goes, it simply
gave you a bunch of null-terminated strings. About all you
know is that they don't have '\0' in them.
Will
--------------------------------------------------------------------
http://www.lug.org.uk http://www.linuxportal.co.uk
http://www.linuxjob.co.uk http://www.linuxshop.co.uk
--------------------------------------------------------------------