Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!zog.cs.cmu.edu!tgl From: tgl@zog.cs.cmu.edu (Tom Lane) Newsgroups: comp.unix.wizards Subject: Getting path to executed program file Message-ID: <9995@pt.cs.cmu.edu> Date: 24 Jul 90 22:11:51 GMT Organization: Carnegie-Mellon University, CS/RI Lines: 18 Is there any way for a program to discover the path name of the file from which it was executed? I would like to be able to access auxiliary files stored in the same directory as the main executable file. However, after reading the man page for exec(2), it doesn't seem like the program gets enough information to reliably determine what file/directory it was loaded from. (For one thing, you don't know whether PATH was used, and for another, you don't know whether argv[0] is the same as the supplied path or is just the last component.) If the info is in fact squirrelled away somewhere, please tell me where! -- tom lane Internet: tgl@cs.cmu.edu UUCP: !cs.cmu.edu!tgl BITNET: tgl%cs.cmu.edu@cmuccvma CompuServe: >internet:tgl@cs.cmu.edu