diff options
| author | Paul Eggert | 2011-02-21 17:55:20 -0800 |
|---|---|---|
| committer | Paul Eggert | 2011-02-21 17:55:20 -0800 |
| commit | f68c809d7e91fcde5ee2e4f7f15def3d7e48b720 (patch) | |
| tree | 9df8577ff5f281f066f778dee44bdb839eb13daf /src/dired.c | |
| parent | 5ecec6a7f4a1ce83abd53a14fba7f51b668c6336 (diff) | |
| download | emacs-f68c809d7e91fcde5ee2e4f7f15def3d7e48b720.tar.gz emacs-f68c809d7e91fcde5ee2e4f7f15def3d7e48b720.zip | |
[ChangeLog]
Assume S_ISLNK etc. work, since gnulib supports this.
* Makefile.in (GNULIB_MODULES): Add sys_stat.
* configure.in: Check for lstat and set HAVE_LSTAT=0 if not.
Pretend to be using the gnulib lstat module for benefit of sys/stat.h.
* configure, lib/Makefile.in, lib/gnulib.mk: Regenerate.
[lib-src/ChangeLog]
Assume S_ISLNK etc. work, since gnulib supports this.
* etags.c (S_ISREG): Remove.
[src/ChangeLog]
Assume S_ISLNK etc. work, since gnulib supports this.
* config.in: Regenerate.
* dired.c (lstat): Remove.
(file_name_completion): Assume S_ISDIR works.
(file_name_completion_stat): Assume S_ISLNK works.
Do not bother calling stat unless lstat says it's a symlink.
* fileio.c (S_ISLNK, S_ISFIFO, S_ISREG, lstat): Remove.
(Fcopy_file): Assume S_ISREG and S_ISLNK work.
(check_writable, Ffile_writable_p, Fset_file_times):
Assume S_ISDIR works.
(Ffile_readable_p): Use S_IFIFO, not S_ISFIFO, to guess whether
fifos exist.
(Ffile_regular_p, Finsert_file_contents): Assumes S_ISREG works.
* filelock.c (S_ISLNK): Remove.
* lread.c (openp): Assume S_ISDIR works.
* xrdb.c (S_ISDIR): Remove.
Diffstat (limited to 'src/dired.c')
| -rw-r--r-- | src/dired.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/dired.c b/src/dired.c index b01ce8d4d8f..92c12846558 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -84,13 +84,6 @@ extern struct re_pattern_buffer *compile_pattern (Lisp_Object, | |||
| 84 | struct re_registers *, | 84 | struct re_registers *, |
| 85 | Lisp_Object, int, int); | 85 | Lisp_Object, int, int); |
| 86 | 86 | ||
| 87 | /* if system does not have symbolic links, it does not have lstat. | ||
| 88 | In that case, use ordinary stat instead. */ | ||
| 89 | |||
| 90 | #ifndef S_IFLNK | ||
| 91 | #define lstat stat | ||
| 92 | #endif | ||
| 93 | |||
| 94 | Lisp_Object Qdirectory_files; | 87 | Lisp_Object Qdirectory_files; |
| 95 | Lisp_Object Qdirectory_files_and_attributes; | 88 | Lisp_Object Qdirectory_files_and_attributes; |
| 96 | Lisp_Object Qfile_name_completion; | 89 | Lisp_Object Qfile_name_completion; |
| @@ -539,7 +532,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 539 | if (file_name_completion_stat (encoded_dir, dp, &st) < 0) | 532 | if (file_name_completion_stat (encoded_dir, dp, &st) < 0) |
| 540 | continue; | 533 | continue; |
| 541 | 534 | ||
| 542 | directoryp = ((st.st_mode & S_IFMT) == S_IFDIR); | 535 | directoryp = S_ISDIR (st.st_mode); |
| 543 | tem = Qnil; | 536 | tem = Qnil; |
| 544 | /* If all_flag is set, always include all. | 537 | /* If all_flag is set, always include all. |
| 545 | It would not actually be helpful to the user to ignore any possible | 538 | It would not actually be helpful to the user to ignore any possible |
| @@ -843,20 +836,16 @@ file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_ad | |||
| 843 | memcpy (fullname + pos, dp->d_name, len); | 836 | memcpy (fullname + pos, dp->d_name, len); |
| 844 | fullname[pos + len] = 0; | 837 | fullname[pos + len] = 0; |
| 845 | 838 | ||
| 846 | #ifdef S_IFLNK | ||
| 847 | /* We want to return success if a link points to a nonexistent file, | 839 | /* We want to return success if a link points to a nonexistent file, |
| 848 | but we want to return the status for what the link points to, | 840 | but we want to return the status for what the link points to, |
| 849 | in case it is a directory. */ | 841 | in case it is a directory. */ |
| 850 | value = lstat (fullname, st_addr); | 842 | value = lstat (fullname, st_addr); |
| 851 | stat (fullname, st_addr); | 843 | if (value == 0 && S_ISLNK (st_addr->st_mode)) |
| 852 | return value; | 844 | stat (fullname, st_addr); |
| 853 | #else | ||
| 854 | value = stat (fullname, st_addr); | ||
| 855 | #ifdef MSDOS | 845 | #ifdef MSDOS |
| 856 | _djstat_flags = save_djstat_flags; | 846 | _djstat_flags = save_djstat_flags; |
| 857 | #endif /* MSDOS */ | 847 | #endif /* MSDOS */ |
| 858 | return value; | 848 | return value; |
| 859 | #endif /* S_IFLNK */ | ||
| 860 | } | 849 | } |
| 861 | 850 | ||
| 862 | Lisp_Object | 851 | Lisp_Object |