summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fileio.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 371d44050e9..4f37b392f8d 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2352,6 +2352,19 @@ DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0,
if (stat (XSTRING (abspath)->data, &st) < 0)
return Qnil;
+#ifdef MSDOS
+ {
+ int len;
+ char *suffix;
+ if (S_ISREG (st.st_mode)
+ && (len = XSTRING (abspath)->size) >= 5
+ && (stricmp ((suffix = XSTRING (abspath)->data + len-4), ".com") == 0
+ || stricmp (suffix, ".exe") == 0
+ || stricmp (suffix, ".bat") == 0))
+ st.st_mode |= S_IEXEC;
+ }
+#endif /* MSDOS */
+
return make_number (st.st_mode & 07777);
}