]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix executable indicator in file name completion on Windows.
authorEli Zaretskii <eliz@gnu.org>
Tue, 30 Dec 2014 19:14:25 +0000 (21:14 +0200)
committerPatrick Palka <patrick@parcs.ath.cx>
Mon, 18 May 2015 13:51:39 +0000 (09:51 -0400)
readline/ChangeLog:

Reapply local change following readline 6.3 import.
* complete.c (stat_char) [_WIN32]: Don't use 'access' and X_OK on
Windows, they don't work.  Instead, look at the file-name
extension to determine whether the file is executable.

readline/ChangeLog.gdb
readline/complete.c

index e557cb12ddcd750694ef78f6e962d9dfd1ec1922..288626fdc47f16714f36d3f7dfc3ee76d12403c6 100644 (file)
@@ -1,3 +1,10 @@
+2014-05-16  Eli Zaretskii  <eliz@gnu.org>
+
+       Reapply local patch following readline 6.3 import.
+       * complete.c (stat_char) [_WIN32]: Don't use 'access' and X_OK on
+       Windows, they don't work.  Instead, look at the file-name
+       extension to determine whether the file is executable.
+
 2015-05-13  Patrick Palka  <patrick@parcs.ath.cx>
 
        Import readline 6.3 and upstream patches 1-8.
index cd9aebe8b7f8bc21026ad836053d6c69d252d477..0adcae6a06023885f1d3d4bfca16da892623ef42 100644 (file)
@@ -638,8 +638,21 @@ stat_char (filename)
 #endif
   else if (S_ISREG (finfo.st_mode))
     {
+#if defined (_WIN32) && !defined (__CYGWIN__)
+      /* Windows 'access' doesn't support X_OK and on latest Windows
+        versions even invokes an invalid parameter exception.  */
+      char *ext = strrchr (filename, '.');
+
+      if (ext
+         && (_rl_stricmp (ext, ".exe") == 0
+             || _rl_stricmp (ext, ".cmd") == 0
+             || _rl_stricmp (ext, ".bat") == 0
+             || _rl_stricmp (ext, ".com") == 0))
+       character = '*';
+#else
       if (access (filename, X_OK) == 0)
        character = '*';
+#endif
     }
 
   free (f);