From 3ace87e34c93a6b000932510d3bd3b81d4056d20 Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Wed, 16 Mar 1994 22:14:23 +0000 Subject: [PATCH] (Ffile_modes) [MSDOS]: set exec-bit based on file suffix. --- src/fileio.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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); } -- 2.39.5