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: <432@xdos.UUCP> Date: 19 Jul 89 15:53:57 GMT References: <26385@agate.BERKELEY.EDU> <20565@cup.portal.com> <1227@atanasoff.cs.iastate.edu> Reply-To: doug@xdos.UUCP (Doug Merritt) Organization: Hunter Systems, Mountain View CA (Silicon Valley) Lines: 26 In article <1227@atanasoff.cs.iastate.edu> jwright@atanasoff.cs.iastate.edu.UUCP (Jim Wright) writes: >In article <20565@cup.portal.com> thad@cup.portal.com (Thad P Floryan) writes: >| >| It would be trivial to adapt "which" to match the first occurrence >| of */argv[0] in the PATH searched by "which". > >Wouldn't this fail if, for example, I had a script file in S: which >then explicitly called the program and the program was not in a directory >on the PATH. But in this case the full path is in argv[0], making this the easiest of the solutions. if (!argc) look at WBenchMsg else if (any {':','/'} in argv[0]) use argv[0] else use PATH The only case I can see that would fail is when someone gets some code going using loadseg() explicitly, which (as far as I know, anyone want to correct me?) does not save the executable's name anywhere. Doug -- Doug Merritt {pyramid,apple}!xdos!doug Member, Crusaders for a Better Tomorrow Professional Wildeyed Visionary