Michael Jennings wrote:
On Wednesday, 21 December 2005, at 12:02:18 (-0800),
dkegel wrote:
The idiom
dn0=`dirname $0`
SOURCEDIR=`cd $dn0; pwd`
seems to reliably do it for shell scripts.
First off, we're talking about binaries, not shell scripts. That
means C.
Second, if you read what I wrote, you should observe that getting the
directory name from argv[0] (for which the shell equivalent is
`dirname $0`) is not an option. But thanks for playing. :-)
One reason why parsing argv[0] is not sufficient is that it doesn't work
for shared objects loaded up via dlopen. Are there others? I'm actually
quite successful with doing the argv[0] trick for most normal
executables, and even perl can work that way as long as you don't try to
embed it.
Solaris, of all systems, has the right construct: you can compile in
"ORIGIN" into the library search path.
--
cg - resigned to installtime binary hacking of embedded paths -sigh-
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list