diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2024-01-16 15:23:06 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2024-01-31 20:11:57 +0100 |
commit | 069f56db7a8d6d6c65913631902852f2366c1e32 (patch) | |
tree | 29166ed2391a8c0698343fc239b4716c90e781c4 /winsup/cygwin | |
parent | a4fead7bdd88668fd035413e2efa678f9212adab (diff) | |
download | newlib-069f56db7a8d6d6c65913631902852f2366c1e32.zip newlib-069f56db7a8d6d6c65913631902852f2366c1e32.tar.gz newlib-069f56db7a8d6d6c65913631902852f2366c1e32.tar.bz2 |
Cygwin: files: slightly simplify suffix handling
- drop appending .exe.lnk to files
- drop exe_suffixes, it's the same as stat_suffixes for a long time
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/local_includes/path.h | 3 | ||||
-rw-r--r-- | winsup/cygwin/path.cc | 36 | ||||
-rw-r--r-- | winsup/cygwin/spawn.cc | 10 |
3 files changed, 17 insertions, 32 deletions
diff --git a/winsup/cygwin/local_includes/path.h b/winsup/cygwin/local_includes/path.h index d19721e..4e62287 100644 --- a/winsup/cygwin/local_includes/path.h +++ b/winsup/cygwin/local_includes/path.h @@ -34,8 +34,7 @@ enum executable_states struct suffix_info { const char *name; - int addon; - suffix_info (const char *s, int addit = 0): name (s), addon (addit) {} + suffix_info (const char *s): name (s) {} }; extern suffix_info stat_suffixes[]; diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index b8e5746..4e0c008 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -70,8 +70,8 @@ suffix_info stat_suffixes[] = { - suffix_info ("", 1), - suffix_info (".exe", 1), + suffix_info (""), + suffix_info (".exe"), suffix_info (NULL) }; @@ -2836,7 +2836,6 @@ enum SCAN_JUSTCHECK, SCAN_JUSTCHECKTHIS, /* Never try to append a suffix. */ SCAN_APPENDLNK, - SCAN_EXTRALNK, SCAN_DONE, }; @@ -2923,16 +2922,12 @@ suffix_scan::next () nextstate = SCAN_LNK; return 1; } - nextstate = SCAN_EXTRALNK; - /* fall through to suffix checking below */ - break; - case SCAN_HASLNK: - nextstate = SCAN_APPENDLNK; /* Skip SCAN_BEG */ - return 1; - case SCAN_EXTRALNK: nextstate = SCAN_DONE; *eopath = '\0'; return 0; + case SCAN_HASLNK: + nextstate = SCAN_APPENDLNK; /* Skip SCAN_BEG */ + return 1; case SCAN_JUSTCHECK: nextstate = SCAN_LNK; return 1; @@ -2954,19 +2949,18 @@ suffix_scan::next () return 0; } - while (suffixes && suffixes->name) - if (nextstate == SCAN_EXTRALNK - && (!suffixes->addon || namelen > NAME_MAX - 8)) + if (suffixes && suffixes->name) + { + strcpy (eopath, suffixes->name); suffixes++; - else - { - strcpy (eopath, suffixes->name); - if (nextstate == SCAN_EXTRALNK) - strcat (eopath, ".lnk"); - suffixes++; - return 1; - } + return 1; + } suffixes = NULL; + if (nextstate == SCAN_BEG) + { + nextstate = SCAN_LNK; + *eopath = '\0'; + } } } diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index dc1c4ac..8a2db5c 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -30,13 +30,6 @@ details. */ #include "ntdll.h" #include "shared_info.h" -static const suffix_info exe_suffixes[] = -{ - suffix_info ("", 1), - suffix_info (".exe", 1), - suffix_info (NULL) -}; - /* Add .exe to PROG if not already present and see if that exists. If not, return PROG (converted from posix to win32 rules if necessary). The result is always BUF. @@ -50,8 +43,7 @@ perhaps_suffix (const char *prog, path_conv& buf, int& err, unsigned opt) err = 0; debug_printf ("prog '%s'", prog); - buf.check (prog, PC_SYM_FOLLOW | PC_NULLEMPTY | PC_POSIX, - (opt & FE_DLL) ? stat_suffixes : exe_suffixes); + buf.check (prog, PC_SYM_FOLLOW | PC_NULLEMPTY | PC_POSIX, stat_suffixes); if (buf.isdir ()) { |