Finding where an executable was run

gordon at sneaky.UUCP gordon at sneaky.UUCP
Wed May 18 04:18:00 AEST 1988


> The convention used by ksh-i is to put the full pathname used to exec a file
> in the environment variable "_". This makes a lot of sense to me, and seems
> as good an example of prior art as anything else out there. It is also cleaner
> than most of the suggestions we've seen so far in this discussion, not
> requiring any change to the kernel or the C calling conventions.

Great.  Now all the programs that use one of the forms of "exec" have to
fiddle with the environment (remove the old value of $_, if present, and
add a new one).  Either that, or you change the exec*() family of library
interface routines (you don't really want this in the kernel, do you?) to do
it for you, and relink *EVERYTHING*.  (Does anyone REALLY want exec*()
to call malloc()?  Anyone got a good alternative?)

If you just put the code in the shells (remember, uucico is a commonly
used shell), then I would expect mass confusion when /bin/cc is invoked and 
$_ comes out as "/bin/make".  Or maybe it ends up undefined.  There are 
lots of programs out there that don't use a shell if the command is simple 
enough to parse and exec by itself.

					Gordon L. Burditt
					...!ihnp4!sys1!sneaky!gordon



More information about the Comp.unix.wizards mailing list