diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dired.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/src/dired.c b/src/dired.c index 203899e43a5..8ff38647946 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -47,19 +47,31 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 47 | #include <dirent.h> | 47 | #include <dirent.h> |
| 48 | #define DIRENTRY struct dirent | 48 | #define DIRENTRY struct dirent |
| 49 | 49 | ||
| 50 | #else | 50 | #else /* not SYSV_SYSTEM_DIR */ |
| 51 | 51 | ||
| 52 | #ifdef NONSYSTEM_DIR_LIBRARY | 52 | #ifdef NONSYSTEM_DIR_LIBRARY |
| 53 | #include "ndir.h" | 53 | #include "ndir.h" |
| 54 | #else /* not NONSYSTEM_DIR_LIBRARY */ | 54 | #else /* not NONSYSTEM_DIR_LIBRARY */ |
| 55 | #ifdef MSDOS | ||
| 56 | #include <dirent.h> | ||
| 57 | #else | ||
| 55 | #include <sys/dir.h> | 58 | #include <sys/dir.h> |
| 59 | #endif | ||
| 56 | #endif /* not NONSYSTEM_DIR_LIBRARY */ | 60 | #endif /* not NONSYSTEM_DIR_LIBRARY */ |
| 57 | 61 | ||
| 62 | #ifndef MSDOS | ||
| 58 | #define DIRENTRY struct direct | 63 | #define DIRENTRY struct direct |
| 59 | 64 | ||
| 60 | extern DIR *opendir (); | 65 | extern DIR *opendir (); |
| 61 | extern struct direct *readdir (); | 66 | extern struct direct *readdir (); |
| 62 | 67 | ||
| 68 | #endif /* not MSDOS */ | ||
| 69 | #endif /* not SYSV_SYSTEM_DIR */ | ||
| 70 | |||
| 71 | #ifdef MSDOS | ||
| 72 | #define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0) | ||
| 73 | #else | ||
| 74 | #define DIRENTRY_NONEMPTY(p) ((p)->d_ino) | ||
| 63 | #endif | 75 | #endif |
| 64 | 76 | ||
| 65 | #include "lisp.h" | 77 | #include "lisp.h" |
| @@ -173,7 +185,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.\n\ | |||
| 173 | 185 | ||
| 174 | if (!dp) break; | 186 | if (!dp) break; |
| 175 | len = NAMLEN (dp); | 187 | len = NAMLEN (dp); |
| 176 | if (dp->d_ino) | 188 | if (DIRENTRY_NONEMPTY (dp)) |
| 177 | { | 189 | { |
| 178 | if (NILP (match) | 190 | if (NILP (match) |
| 179 | || (0 <= re_search (&searchbuf, dp->d_name, len, 0, len, 0))) | 191 | || (0 <= re_search (&searchbuf, dp->d_name, len, 0, len, 0))) |
| @@ -290,6 +302,9 @@ file_name_completion (file, dirname, all_flag, ver_flag) | |||
| 290 | CHECK_STRING (file, 0); | 302 | CHECK_STRING (file, 0); |
| 291 | #endif /* not VMS */ | 303 | #endif /* not VMS */ |
| 292 | 304 | ||
| 305 | #ifdef FILE_SYSTEM_CASE | ||
| 306 | file = FILE_SYSTEM_CASE (file); | ||
| 307 | #endif | ||
| 293 | dirname = Fexpand_file_name (dirname, Qnil); | 308 | dirname = Fexpand_file_name (dirname, Qnil); |
| 294 | bestmatch = Qnil; | 309 | bestmatch = Qnil; |
| 295 | 310 | ||
| @@ -324,7 +339,7 @@ file_name_completion (file, dirname, all_flag, ver_flag) | |||
| 324 | 339 | ||
| 325 | if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) | 340 | if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) |
| 326 | goto quit; | 341 | goto quit; |
| 327 | if (!dp->d_ino | 342 | if (! DIRENTRY_NONEMPTY (dp) |
| 328 | || len < XSTRING (file)->size | 343 | || len < XSTRING (file)->size |
| 329 | || 0 <= scmp (dp->d_name, XSTRING (file)->data, | 344 | || 0 <= scmp (dp->d_name, XSTRING (file)->data, |
| 330 | XSTRING (file)->size)) | 345 | XSTRING (file)->size)) |
| @@ -563,6 +578,22 @@ If file does not exist, returns nil.") | |||
| 563 | if (lstat (XSTRING (filename)->data, &s) < 0) | 578 | if (lstat (XSTRING (filename)->data, &s) < 0) |
| 564 | return Qnil; | 579 | return Qnil; |
| 565 | 580 | ||
| 581 | #ifdef MSDOS | ||
| 582 | { | ||
| 583 | char *tmpnam = XSTRING (Ffile_name_nondirectory (filename))->data; | ||
| 584 | int l = strlen (tmpnam); | ||
| 585 | |||
| 586 | if (l >= 5 | ||
| 587 | && S_ISREG (s.st_mode) | ||
| 588 | && (stricmp (&tmpnam[l - 4], ".com") == 0 | ||
| 589 | || stricmp (&tmpnam[l - 4], ".exe") == 0 | ||
| 590 | || stricmp (&tmpnam[l - 4], ".bat") == 0)) | ||
| 591 | { | ||
| 592 | s.st_mode |= S_IEXEC; | ||
| 593 | } | ||
| 594 | } | ||
| 595 | #endif /* MSDOS */ | ||
| 596 | |||
| 566 | switch (s.st_mode & S_IFMT) | 597 | switch (s.st_mode & S_IFMT) |
| 567 | { | 598 | { |
| 568 | default: | 599 | default: |