Path: utzoo!mnetor!uunet!husc6!cmcl2!beta!unm-la!unmvax!turing.UNM.EDU!mike From: mike@turing.UNM.EDU (Michael I. Bushnell) Newsgroups: comp.unix.questions Subject: Re: How does a program get its path name? Message-ID: <872@unmvax.unm.edu> Date: 9 Mar 88 02:39:50 GMT References: <11923@brl-adm.ARPA> <4210002@hpcllf.HP.COM> <873@hsi.UUCP> <3845@cbterra.ATT.COM> Sender: news@unmvax.unm.edu Reply-To: mike@turing.UNM.EDU.UUCP (Michael I. Bushnell) Organization: University of New Mexico, Albuquerque Lines: 27 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@turing.unm.edu {ucbvax,gatech}!unmvax!turing!mike HASA -- "A" division