How does a program get its path name?
Michael I. Bushnell
mike at turing.UNM.EDU
Wed Mar 9 12:39:50 AEST 1988
Now, I can see a better, more complete solution that all the previous ones.
Just
1: Take a look in the core map and find out the inode of
the file you are executing.
2: Search the hierarchy looking for that inode.
Of course, (2) can be made much shorter by first checking out
a bunch of likely locations, and then resorting to searching
the whole thing.
Further, you could look at files with the same name as argv[0] only,
but I don't think that would give you any improvement over just
stat-ing them all.
Just remember
"If you have a hard UNIX problem, a kernel dive is the answer."
but I don't thing
but t
Michael I. Bushnell
mike at turing.unm.edu
{ucbvax,gatech}!unmvax!turing!mike
HASA -- "A" division
More information about the Comp.unix.questions
mailing list