Mail Archives: djgpp-workers/2001/07/07/14:13:45
> I think you should call it in the fragment below with second argument
> `rd', not `rp'.
> > if (_use_lfn(path) || !rd)
> > {
> > i = find_extension(rpath, rp);
I think it's correct as-is. For one, it's what the current version in
dosexec.c does:
if (_use_lfn(rpath) || !rd)
{
for (i=0; interpreters[i].extension; i++)
{
if ((interpreters[i].flags & INTERP_FLAG_SKIP_SEARCH) == 0)
{
strcpy(rp, interpreters[i].extension);
if (access(rpath, F_OK) == 0 && !(is_dir = (access(rpath, D_OK) ==
0)))
{
found = 1;
break;
But that by itself isn't a good reason. My understanding of what's happening
here: The code inside the if block is searching for an extension to append to
the filename. The two ways to get inside this block are if lfn is supported
or if the path in rpath doesn't already contain an extension. lfn support is
an automatic pass because lfn paths may have more than one dot. 'rp' points
to the end of the path, so this is where an extension must be appended. 'rd'
points to the extension in rpath (if any). So using it instead of 'rp' means
that the extension in rpath would be replaced by one ahead of it in the
search order if that a file with that extension exists.
Plus it's also what the current version in dosexec.c does:
if (_use_lfn(rpath) || !rd)
{
for (i=0; interpreters[i].extension; i++)
{
if ((interpreters[i].flags & INTERP_FLAG_SKIP_SEARCH) == 0)
{
strcpy(rp, interpreters[i].extension);
if (access(rpath, F_OK) == 0 && !(is_dir = (access(rpath, D_OK) ==
0)))
{
found = 1;
break;
}
}
}
}
- Raw text -