From: Casper H.S. Dik (Casper.Dik_at_Sun.COM)
Date: 01 Nov 2004 09:40:25 GMT
>What should the first argument - argv - be when executing an
>>From the execv manpage:
> The first argument, by convention, should point to the file name
>associated with the file being executed.
"By convention .... should ...."
Roughly translates to "may or may not"
>Does this mean the path which was executed or just the last component?
>or does it matter? Is more information available elsewhere?
It could be anything what the shell or whichever program puts there.
- by convention, login(1) invokes the shell with argv
equal to -sh (or -ksh or whatever)
- by convention, shells put the command as typed in argv
(after alias/variable expansion); so they use "cat" and not
"/bin/cat" and you need to search $PATH
- by convention, only programs invoked using the full pathname will
have the full pathname there.
-- Expressed in this posting are my opinions. They are in no way related to opinions held by my employer, Sun Microsystems. Statements on Sun products included here are not gospel and may be fiction rather than truth.