Re: finding datadir from executable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ralph Corderoy <ralph@xxxxxxxxxxxxxxx> writes:

> I wasn't clear.  I realise it isn't always an absolute path, and is
> normally whatever's passed to execve(2).  I was just trying to point out
> that some old Unixes, Xenix? -- I can't remember, effectively strip any
> path, absolute or relative, from execve's argument before it turns up in
> argv[0], i.e. execve("./ls", ...) and execve("/bin/ls", ...) both

The first argument of execve is irrelevant for argv[0].  The argv array
(including argv[0]) is completely passed in by the caller, which can set
it any way it likes.  What you have seen might be the effect of a
misbehaving shell.  Usually argv[0] is the command name before looking it
up in $PATH.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@xxxxxxx
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux