Path: utzoo!attcan!uunet!samsung!brutus.cs.uiuc.edu!apple!oliveb!orc!mipos3!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.unix.questions Subject: Re: How to get the pathname of the current executable? Message-ID: <1990Feb7.211538.3894@iwarp.intel.com> Date: 7 Feb 90 21:15:38 GMT References: <1610.25d028a3@wums.wustl.edu> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 17 In-Reply-To: bethge@wums.wustl.edu In article <1610.25d028a3@wums.wustl.edu>, bethge@wums writes: [wants to know how to find the name of the current executable] | Is there a better (more transparent) way? No. This was hashed out about a year ago in either c.u.q or c.u.w. Basically, it boils down to the fact that you have no idea where you came from, and the closest you could come is to count on the shells to *mostly* give you the right answer *most* of the time in argv[0]. However, programs that do execv() are free to provide *whatever* they want. So, you're out of luck, and subject to spoofing. Just another UNIX hacker, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/