[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Locating a program in a portable way
From: |
moseley |
Subject: |
Locating a program in a portable way |
Date: |
Sun, 7 Sep 2003 07:10:37 -0700 |
User-agent: |
Mutt/1.5.4i |
This is more of a programming question, so please let me know if there's
a better place to ask.
Our project (Swish-e) runs external programs via popen() and system().
Some of the external programs are placed in our $libexecdir which is
not normally in the $PATH.
We initially used setenv() to add our $libexecdir to $PATH, but setenv()
doesn't seem to be portable (not sure it exists on Windows, for
example).
So the current plan is to read $PATH, prepend (or append) our
$libexecdir to the path, and then walk the path looking for the program.
The problem is how to do it in a portable way. I'll probably use the
GNU Which(1) source as a base, but I'm wondering if anyone here has or
knows of code to do this in a portable way. I expect VMS and Windows
will give us the most trouble.
Any pointers?
Thanks,
--
Bill Moseley
address@hidden
- Locating a program in a portable way,
moseley <=