Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!usc!samsung!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.unix.wizards Subject: Re: Why isn't argv[argc]==(char *)0 ? Message-ID: <11606@smoke.BRL.MIL> Date: 15 Nov 89 22:58:50 GMT References: <547.nlhp3@oracle.nl> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 32 In article <547.nlhp3@oracle.nl> bengsig@oracle.nl (Bjorn Engsig) writes: >The execv family of system calls all have char *argv[] as their second >parameter, and you are required to put an endmarker as (char *)0 in it. >On the other hand, main has int argc and char *argv[] but here, the >endmarker has disappeared. Has it ever been considered to change the defi- >nition of main such that it will always be true that argv[argc] == (char *)0 >or to change the execv's to use argc and not an endmarker. What makes you think that argv[argc]!=(char*)0 ? argv[argc]==(char*)0 is existing practice and is also required by the C Standard (for hosted implementations, which are the only ones for which argv is an issue). There would be no point in changing execv(), especially since it would break all existing code that used execv(). >Is it due to the fact that main() is a C-thing whereas exec() is a Unix thing, >and they therefore are incompatible? If this is the case, why isn't there a >system() counterpart in the scope of C with the same parameters as main()? execv() definitely is UNIX- (or POSIX-) specific, but the main() and execv() interfaces are compatible in this regard since both originated within the same software development culture. The C Standard does specify the system() standard library function, but it just takes a single command string argument, because there is too wide a variety of execution environments to be more specific. >It is probably much too late to change anything, but I would just like to >know if this has ever been considered. I don't see the problem.