{
if (machine_suffix)
{
- strcpy (temp, pl->prefix);
- strcat (temp, machine_suffix);
- strcat (temp, name);
- if (access (temp, mode) == 0)
- {
- if (pl->used_flag_ptr != 0)
- *pl->used_flag_ptr = 1;
- return temp;
- }
/* Some systems have a suffix for executable files.
- So try appending that. */
+ So try appending that first. */
if (file_suffix[0] != 0)
{
+ strcpy (temp, pl->prefix);
+ strcat (temp, machine_suffix);
+ strcat (temp, name);
strcat (temp, file_suffix);
if (access (temp, mode) == 0)
{
return temp;
}
}
- }
- /* Certain prefixes are tried with just the machine type,
- not the version. This is used for finding as, ld, etc. */
- if (just_machine_suffix && pl->require_machine_suffix == 2)
- {
+
+ /* Now try just the name. */
strcpy (temp, pl->prefix);
- strcat (temp, just_machine_suffix);
+ strcat (temp, machine_suffix);
strcat (temp, name);
if (access (temp, mode) == 0)
{
*pl->used_flag_ptr = 1;
return temp;
}
+ }
+
+ /* Certain prefixes are tried with just the machine type,
+ not the version. This is used for finding as, ld, etc. */
+ if (just_machine_suffix && pl->require_machine_suffix == 2)
+ {
/* Some systems have a suffix for executable files.
- So try appending that. */
+ So try appending that first. */
if (file_suffix[0] != 0)
{
+ strcpy (temp, pl->prefix);
+ strcat (temp, just_machine_suffix);
+ strcat (temp, name);
strcat (temp, file_suffix);
if (access (temp, mode) == 0)
{
return temp;
}
}
- }
- /* Certain prefixes can't be used without the machine suffix
- when the machine or version is explicitly specified. */
- if (!pl->require_machine_suffix)
- {
+
strcpy (temp, pl->prefix);
+ strcat (temp, just_machine_suffix);
strcat (temp, name);
if (access (temp, mode) == 0)
{
*pl->used_flag_ptr = 1;
return temp;
}
+ }
+
+ /* Certain prefixes can't be used without the machine suffix
+ when the machine or version is explicitly specified. */
+ if (!pl->require_machine_suffix)
+ {
/* Some systems have a suffix for executable files.
- So try appending that. */
+ So try appending that first. */
if (file_suffix[0] != 0)
{
+ strcpy (temp, pl->prefix);
+ strcat (temp, name);
strcat (temp, file_suffix);
if (access (temp, mode) == 0)
{
return temp;
}
}
+
+ strcpy (temp, pl->prefix);
+ strcat (temp, name);
+ if (access (temp, mode) == 0)
+ {
+ if (pl->used_flag_ptr != 0)
+ *pl->used_flag_ptr = 1;
+ return temp;
+ }
}
}