Commit 3ace87e3 authored by Karl Heuer's avatar Karl Heuer
Browse files

(Ffile_modes) [MSDOS]: set exec-bit based on file suffix.

parent a7d40caa
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment