Hi,
I wonder if someone knows the solution to this:
In some software we are currently developing, we are facing the problem
of figuring out the complete path for the executable from within the
running process itself. That is, if someone says
Unix> app myfile.i
where app is the name of an executable, e.g. located in /usr/local/bin ,
the running process should be able by itself to figure out that it is
an instance of the executable /ust/local/bin/app. I have browsed all
kinds of man pages but have not seen any such utility. Moreover, we need
this mechanism to be portable across major Unix versions. Ironically,
Windows offer exactly this functionality as one system call, _pgmptr.
Hopefully, there is a similar Unix solution also. Otherwise, I guess the
alternative is to walk along the contents of the PATH variable and check
whether there is an executable matching the name of the currently
running program (as grabbed from the command line).
Any input is most welcome. Since I'm not a regular reader of this
newsgroup, I would appreciate that any answers to be copied to
Regards
Are Magnus Bruaset
--
----------------------------------------------------------------------
Technical Director Phone : +47 22 06 76 10
Numerical Objects AS Mobile: +47 92 61 00 63
P.O. Box 124 Blindern Fax : +47 22 06 73 50
N-0314 Oslo, Norway WWW : http://www.nobjects.com