The which command uses the PATH, after checking for builtins, and aliases. -----Original Message----- From: Ferguson, Neale [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 4:35 PM To: [EMAIL PROTECTED] Subject: Re: API to get fullpath name
How does the command 'which' work? The symbolic link /proc/self/exe will point to the absolute path. -----Original Message----- In general, you have to know the name of the program (argv[0] may be incorrect) and then have to look at the users PATH environment to find it... That is - you have to look at argv[0] to see if it's a direct path specification (begins with '/' or '.'). If it's not, then you look along the PATH environment variable to find argv[0]. This approach does not work if the program is being exec'd and the exec() call sets argv[0] to something strange.
