tech-userlevel archive

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

Re: [PATCH] Allow qualified filename (bar/foo) PATH searching.



On Mon, Sep 30, 2024 at 10:46:12PM +0000, RVP wrote:
> On Sun, 29 Sep 2024, tlaronde%kergis.com@localhost wrote:
> 
> > POSIX requires that PATH searching be done only if the identifier
> > (aka "file") has no '/' (if it has, it is a "path").
> > 
> > Allow searching qualified filenames, i.e. Resource Identifier,
> > like dk/ctl, vect/in/dxf by setting an environment variable
> > PATH_SEARCH_OPT with the setting 'Q' in the definition.
> > 
> 
> I like this proposal in general: it makes things like using multiple
> compilers very convenient (w/o any PATH-fiddling).
> 
> Assuming the binaries/links are in /opt/compilers/bin (and that is in $PATH),
> then:
> 
> $ gcc13/gcc ...
> $ clang-18/cc ...
> 
> etc,... but, what should be done for: {base,dir}name(), {get,set}progname(),
> and err*()/warn*()? And, of course, realpath() (add a `-m' to the binary?).
> 

Good question.

For {get,set}progname and err*()/warn*(), it would need an option to
not truncate to last component.

For {base,dir}name(), it would need an option telling to search the
first prefix in PATH matching and to return the prefix as dir and the
rest as identifier.

For realpath(), for me, nothing has to be done: it returns a path. And
a path is not an identifier. If one wants something else, first call realpath,
and then call {base,dir}name() with option.

-- 
        Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index