+2006-11-08 Vladimir Prus <vladimir@codesourcery.com>
+
+ * pex-win32.c (no_suffixes): Remove.
+ (std_suffixes): Add "" as first element.
+ (find_executable): Remove detection of already-present
+ extension. Try all suffixes in std_suffixes.
+
2006-11-07 Julian Brown <julian@codesourcery.com>
* floatformat.c (get_field): Fix segfault with little-endian word
return cmdline;
}
+/* We'll try the passed filename with all the known standard
+ extensions, and then without extension. We try no extension
+ last so that we don't try to run some random extension-less
+ file that might be hanging around. We try both extension
+ and no extension so that we don't need any fancy logic
+ to determine if a file has extension. */
static const char *const
std_suffixes[] = {
".com",
".exe",
".bat",
".cmd",
- 0
-};
-static const char *const
-no_suffixes[] = {
"",
0
};
const char *const *ext;
const char *p, *q;
size_t proglen = strlen (program);
- int has_extension = !!strchr (program, '.');
int has_slash = (strchr (program, '/') || strchr (program, '\\'));
HANDLE h;
if (*q == ';')
q++;
}
- fe_len = fe_len + 1 + proglen + (has_extension ? 1 : 5);
+ fe_len = fe_len + 1 + proglen + 5 /* space for extension */;
full_executable = XNEWVEC (char, fe_len);
p = path;
/* At this point, e points to the terminating NUL character for
full_executable. */
- for (ext = has_extension ? no_suffixes : std_suffixes; *ext; ext++)
+ for (ext = std_suffixes; *ext; ext++)
{
/* Remove any current extension. */
*e = '\0';