autoconf
[Top][All Lists]
Advanced

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

Re: finding datadir from executable


From: Andreas Schwab
Subject: Re: finding datadir from executable
Date: Sun, 12 Sep 2004 11:08:57 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Ralph Corderoy <address@hidden> 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, address@hidden
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."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]