bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] findprog: Support searching in a specified path string


From: Bruno Haible
Subject: Re: [PATCH] findprog: Support searching in a specified path string
Date: Sat, 07 Sep 2019 12:42:35 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-159-generic; KDE/5.18.0; x86_64; ; )

Hi Paul,

> find_prog_in_path() always uses the PATH value in the current
> environment.  It can be very useful to search for programs on
> a path without having to modify the environment first.
> 
> Provide find_in_path_str() which takes a path string to search.
> If the path passed in is NULL, fall back to searching in the
> environment's PATH value.

I have nothing against extending the 'findprog' module in principle.

But the interface that you propose looks odd to me:

  * Why one function that always uses $PATH and one function that
    uses a given set of directories _or_ $PATH?
    Why not simpler: one function that always uses $PATH and one
    function that uses a given set of directories?

  * For the function that uses a given set of directories, isn't
    it easier for the caller to provide a NULL-terminated array
    of directories, rather than to glue them together with a
    platform-dependent separator (':' or ';')?

Because of this oddity, I have to ask: What is the use-case that
you have in mind? The use-case of the existing find_in_path function
is when a program wants to optimize multiple invocations (spawn/exec)
of one given program. What's yours?

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]