GNU Binutils with patches for OS216
Revision | 29d8ba014e5374bb2a0f1106da18fde651a4b8d1 (tree) |
---|---|
Time | 2006-11-09 02:45:23 |
Author | Vladimir Prus <vladimir@code...> |
Commiter | Vladimir Prus |
2006-11-08 Vladimir Prus <vladimir@codesourcery.com>
@@ -1,3 +1,10 @@ | ||
1 | +2006-11-08 Vladimir Prus <vladimir@codesourcery.com> | |
2 | + | |
3 | + * pex-win32.c (no_suffixes): Remove. | |
4 | + (std_suffixes): Add "" as first element. | |
5 | + (find_executable): Remove detection of already-present | |
6 | + extension. Try all suffixes in std_suffixes. | |
7 | + | |
1 | 8 | 2006-11-07 Vladimir Prus <vladimir@codesourcery.com> |
2 | 9 | |
3 | 10 | * testsuite/ld-elf/symbol2w.s: Use "%" instead |
@@ -382,16 +382,18 @@ argv_to_cmdline (char *const *argv) | ||
382 | 382 | return cmdline; |
383 | 383 | } |
384 | 384 | |
385 | +/* We'll try the passed filename with all the known standard | |
386 | + extensions, and then without extension. We try no extension | |
387 | + last so that we don't try to run some random extension-less | |
388 | + file that might be hanging around. We try both extension | |
389 | + and no extension so that we don't need any fancy logic | |
390 | + to determine if a file has extension. */ | |
385 | 391 | static const char *const |
386 | 392 | std_suffixes[] = { |
387 | 393 | ".com", |
388 | 394 | ".exe", |
389 | 395 | ".bat", |
390 | 396 | ".cmd", |
391 | - 0 | |
392 | -}; | |
393 | -static const char *const | |
394 | -no_suffixes[] = { | |
395 | 397 | "", |
396 | 398 | 0 |
397 | 399 | }; |
@@ -409,7 +411,6 @@ find_executable (const char *program, BOOL search) | ||
409 | 411 | const char *const *ext; |
410 | 412 | const char *p, *q; |
411 | 413 | size_t proglen = strlen (program); |
412 | - int has_extension = !!strchr (program, '.'); | |
413 | 414 | int has_slash = (strchr (program, '/') || strchr (program, '\\')); |
414 | 415 | HANDLE h; |
415 | 416 |
@@ -432,7 +433,7 @@ find_executable (const char *program, BOOL search) | ||
432 | 433 | if (*q == ';') |
433 | 434 | q++; |
434 | 435 | } |
435 | - fe_len = fe_len + 1 + proglen + (has_extension ? 1 : 5); | |
436 | + fe_len = fe_len + 1 + proglen + 5 /* space for extension */; | |
436 | 437 | full_executable = xmalloc (fe_len); |
437 | 438 | |
438 | 439 | p = path; |
@@ -458,7 +459,7 @@ find_executable (const char *program, BOOL search) | ||
458 | 459 | |
459 | 460 | /* At this point, e points to the terminating NUL character for |
460 | 461 | full_executable. */ |
461 | - for (ext = has_extension ? no_suffixes : std_suffixes; *ext; ext++) | |
462 | + for (ext = std_suffixes; *ext; ext++) | |
462 | 463 | { |
463 | 464 | /* Remove any current extension. */ |
464 | 465 | *e = '\0'; |