Subject: Re: Getting a path in argv[0] To: olly AT mantis DOT co DOT uk (Olly Betts) Date: Thu, 1 Dec 1994 18:56:44 -0600 (CST) Cc: djgpp AT sun DOT soe DOT clarkson DOT edu From: mcastle AT umr DOT edu (Mike Castle) Amazingly enough Olly Betts said: > > DJGPP seems to just give the leaf-name of the executable in argv[0], > rather than the executable path as DOS compilers seem to. I suppose > this follows the UNIX style, but I have a program which uses the path > on argv[0] to find support files. Acutally, how this is done depends on the shell one is using in unix. If familiar with the exec(2), command, you know that the first parm is the path to the executable, and that you can fill in argv[0] with anything you want. I believe bourne shell, et al fill in with just the name of the executable, while csh, and family, use the complete path. Actually, I've been meaning to check with a few other dos compilers how this works as well... At anyrate, the portable solution is to manully check the path(). I remember when I played around with the DLD package, it had a routine for checking the path to do just this. I just had to modify it slightly to use ; as path separators rather than ;. Check out prep.ai.mit.edu in pub/gnu/dld323.tar.gz (or some similar name). May seem a bit over kill to get the package just for that one function, but it may be easier than writing your own. mrc -- Mike Castle .-=NEXUS=-. Life is like a clock: You can work constantly mcastle AT cs DOT umr DOT edu and be right all the time, or not work at all mcastle AT umr DOT edu and be right at least twice a day. -- mrc We are all of us living in the shadow of Manhattan. -- Watchmen