Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!motcsd!xdos!doug From: doug@xdos.UUCP (Doug Merritt) Newsgroups: comp.sys.amiga.tech Subject: Re: What is my name? Message-ID: <430@xdos.UUCP> Date: 19 Jul 89 15:41:29 GMT References: <26385@agate.BERKELEY.EDU> <7330@ardent.UUCP> <26406@agate.BERKELEY.EDU> Reply-To: doug@xdos.UUCP (Doug Merritt) Organization: Hunter Systems, Mountain View CA (Silicon Valley) Lines: 24 > mwm@mica.berkeley.edu (Mike (I'll think of something yet) Meyer) writes: ><>Before I sit down & write it myself, does anyone have a piece of code ><>that will give me a full name for the binary it's running in? Not just Rob Peck said: > mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) writes: > The code in listing 2.9 prints the name of the current >directory. This is may not be the name of the directory that the >running file is from. Consider the following script, with "myname.c" Well, for a workbench program that's easy...WBenchMsg->sm_ArgList[0].wa_Lock is a lock on the file the executable came from, and the usual Examine()/ ParentDir() loop will turn that into a full path quite easily (SMOP). I couldn't find anything comparable for CLI-launched programs, although I wondered about (struct CommandLineInterface)->cli_CommandDir. If that doesn't do it than I guess the only solution is the previously posted answer of "which". Doug -- Doug Merritt {pyramid,apple}!xdos!doug Member, Crusaders for a Better Tomorrow Professional Wildeyed Visionary