Mercurial > emacs
comparison src/fileio.c @ 15625:537b4cdf9eff
(Fcopy_file): Use st_ino under DJGPP v2 and later to
prevent copying file into itself.
(check_executable): DJGPP v2 `stat' doesn't need to be augmented
in case of executable files.
(Ffile_modes): Use `stat' results as is in DJGPP v2 and later.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Sun, 07 Jul 1996 22:36:38 +0000 |
parents | 69c516d109e7 |
children | 4ccf88623c95 |
comparison
equal
deleted
inserted
replaced
15624:2cf06d9df144 | 15625:537b4cdf9eff |
---|---|
2076 | 2076 |
2077 /* We can only copy regular files and symbolic links. Other files are not | 2077 /* We can only copy regular files and symbolic links. Other files are not |
2078 copyable by us. */ | 2078 copyable by us. */ |
2079 input_file_statable_p = (fstat (ifd, &st) >= 0); | 2079 input_file_statable_p = (fstat (ifd, &st) >= 0); |
2080 | 2080 |
2081 #ifndef MSDOS | 2081 #if !defined (MSDOS) || __DJGPP__ > 1 |
2082 if (out_st.st_mode != 0 | 2082 if (out_st.st_mode != 0 |
2083 && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino) | 2083 && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino) |
2084 { | 2084 { |
2085 errno = 0; | 2085 errno = 0; |
2086 report_file_error ("Input and output files are the same", | 2086 report_file_error ("Input and output files are the same", |
2532 int len = strlen (filename); | 2532 int len = strlen (filename); |
2533 char *suffix; | 2533 char *suffix; |
2534 struct stat st; | 2534 struct stat st; |
2535 if (stat (filename, &st) < 0) | 2535 if (stat (filename, &st) < 0) |
2536 return 0; | 2536 return 0; |
2537 #ifdef WINDOWSNT | 2537 #if defined (WINDOWSNT) || (defined (MSDOS) && __DJGPP__ > 1) |
2538 return ((st.st_mode & S_IEXEC) != 0); | 2538 return ((st.st_mode & S_IEXEC) != 0); |
2539 #else | 2539 #else |
2540 return (S_ISREG (st.st_mode) | 2540 return (S_ISREG (st.st_mode) |
2541 && len >= 5 | 2541 && len >= 5 |
2542 && (stricmp ((suffix = filename + len-4), ".com") == 0 | 2542 && (stricmp ((suffix = filename + len-4), ".com") == 0 |
2838 if (!NILP (handler)) | 2838 if (!NILP (handler)) |
2839 return call2 (handler, Qfile_modes, absname); | 2839 return call2 (handler, Qfile_modes, absname); |
2840 | 2840 |
2841 if (stat (XSTRING (absname)->data, &st) < 0) | 2841 if (stat (XSTRING (absname)->data, &st) < 0) |
2842 return Qnil; | 2842 return Qnil; |
2843 #ifdef MSDOS | 2843 #if defined (MSDOS) && __DJGPP__ < 2 |
2844 if (check_executable (XSTRING (absname)->data)) | 2844 if (check_executable (XSTRING (absname)->data)) |
2845 st.st_mode |= S_IEXEC; | 2845 st.st_mode |= S_IEXEC; |
2846 #endif /* MSDOS */ | 2846 #endif /* MSDOS && __DJGPP__ < 2 */ |
2847 | 2847 |
2848 return make_number (st.st_mode & 07777); | 2848 return make_number (st.st_mode & 07777); |
2849 } | 2849 } |
2850 | 2850 |
2851 DEFUN ("set-file-modes", Fset_file_modes, Sset_file_modes, 2, 2, 0, | 2851 DEFUN ("set-file-modes", Fset_file_modes, Sset_file_modes, 2, 2, 0, |