[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Locating a program in a portable way
From: |
Thomas Dickey |
Subject: |
Re: Locating a program in a portable way |
Date: |
Sun, 7 Sep 2003 20:44:53 -0400 (EDT) |
On Sun, 7 Sep 2003, Paul Eggert wrote:
> address@hidden writes:
>
> > 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.
>
> Yes, it's a bit tricky, but gnulib's findprog module does that.
quoting:
{
#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined
__DJGPP__
/* Win32, OS/2, DOS */
/* The searching rules with .COM, .EXE, .BAT, .CMD etc. suffixes are
too complicated. Leave it to the OS. */
return progname;
#else
either you're joking (with a poor sense of humor), or the usual
applies...
>
> See <http://savannah.gnu.org/projects/gnulib>, and grab the following files:
>
> modules/findprog
> lib/findprog.h
> lib/findprog.c
> m4/findprog.m4
> m4/eaccess.m4
>
>
>
--
T.E.Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net