Mercurial > hg > xemacs-beta
comparison src/dired.c @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 8de8e3f6228a |
children | 576fb035e263 |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
21 /* Synched up with: FSF 19.30. */ | 21 /* Synched up with: FSF 19.30. */ |
22 | 22 |
23 #include <config.h> | 23 #include <config.h> |
24 #include "lisp.h" | 24 #include "lisp.h" |
25 | 25 |
26 #include "sysfile.h" | |
27 #include "sysdir.h" | |
28 #include "systime.h" | |
29 #include "sysdep.h" | |
30 #include "syspwd.h" | |
26 #include "buffer.h" | 31 #include "buffer.h" |
27 #include "commands.h" | 32 #include "commands.h" |
28 #include "elhash.h" | 33 #include "elhash.h" |
29 #include "regex.h" | 34 #include "regex.h" |
30 #include "opaque.h" | 35 #include "opaque.h" |
31 #include "sysfile.h" | |
32 #include "sysdir.h" | |
33 #include "systime.h" | |
34 #include "sysdep.h" | |
35 #include "syspwd.h" | |
36 | 36 |
37 Lisp_Object Vcompletion_ignored_extensions; | 37 Lisp_Object Vcompletion_ignored_extensions; |
38 Lisp_Object Qdirectory_files; | 38 Lisp_Object Qdirectory_files; |
39 Lisp_Object Qfile_name_completion; | 39 Lisp_Object Qfile_name_completion; |
40 Lisp_Object Qfile_name_all_completions; | 40 Lisp_Object Qfile_name_all_completions; |
144 int dir_p = 0; | 144 int dir_p = 0; |
145 | 145 |
146 memcpy (statbuf_tail, dp->d_name, len); | 146 memcpy (statbuf_tail, dp->d_name, len); |
147 statbuf_tail[len] = 0; | 147 statbuf_tail[len] = 0; |
148 | 148 |
149 if (stat (statbuf, &st) == 0 | 149 if (xemacs_stat (statbuf, &st) == 0 |
150 && (st.st_mode & S_IFMT) == S_IFDIR) | 150 && (st.st_mode & S_IFMT) == S_IFDIR) |
151 dir_p = 1; | 151 dir_p = 1; |
152 | 152 |
153 if (EQ (files_only, Qt) && dir_p) | 153 if (EQ (files_only, Qt) && dir_p) |
154 continue; | 154 continue; |
258 /* We want to return success if a link points to a nonexistent file, | 258 /* We want to return success if a link points to a nonexistent file, |
259 but we want to return the status for what the link points to, | 259 but we want to return the status for what the link points to, |
260 in case it is a directory. */ | 260 in case it is a directory. */ |
261 value = lstat (fullname, st_addr); | 261 value = lstat (fullname, st_addr); |
262 if (S_ISLNK (st_addr->st_mode)) | 262 if (S_ISLNK (st_addr->st_mode)) |
263 stat (fullname, st_addr); | 263 xemacs_stat (fullname, st_addr); |
264 #else | 264 #else |
265 value = stat (fullname, st_addr); | 265 value = xemacs_stat (fullname, st_addr); |
266 #endif | 266 #endif |
267 return value; | 267 return value; |
268 } | 268 } |
269 | 269 |
270 static Lisp_Object | 270 static Lisp_Object |
301 | 301 |
302 GCPRO3 (file, directory, bestmatch); | 302 GCPRO3 (file, directory, bestmatch); |
303 | 303 |
304 CHECK_STRING (file); | 304 CHECK_STRING (file); |
305 | 305 |
306 #ifdef WINDOWSNT | 306 #ifdef WIN32_NATIVE |
307 /* Filename completion on Windows ignores case, since Windows | 307 /* Filename completion on Windows ignores case, since Windows |
308 filesystems do. */ | 308 filesystems do. */ |
309 specbind (Qcompletion_ignore_case, Qt); | 309 specbind (Qcompletion_ignore_case, Qt); |
310 #endif /* WINDOWSNT */ | 310 #endif /* WIN32_NATIVE */ |
311 | 311 |
312 #ifdef FILE_SYSTEM_CASE | 312 #ifdef FILE_SYSTEM_CASE |
313 file = FILE_SYSTEM_CASE (file); | 313 file = FILE_SYSTEM_CASE (file); |
314 #endif | 314 #endif |
315 directory = Fexpand_file_name (directory, Qnil); | 315 directory = Fexpand_file_name (directory, Qnil); |
505 return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize)); | 505 return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize)); |
506 } | 506 } |
507 | 507 |
508 | 508 |
509 | 509 |
510 /* The *pwent() functions do not exist on NT */ | 510 /* The *pwent() functions do not exist on NT. #### The NT equivalent |
511 #ifndef WINDOWSNT | 511 is NetUserEnum(), and rewriting to use it is not hard.*/ |
512 #ifndef WIN32_NATIVE | |
512 | 513 |
513 static Lisp_Object user_name_completion (Lisp_Object user, | 514 static Lisp_Object user_name_completion (Lisp_Object user, |
514 int all_flag, | 515 int all_flag, |
515 int *uniq); | 516 int *uniq); |
516 | 517 |
705 return bestmatch; | 706 return bestmatch; |
706 if (matchcount == 1 && bestmatchsize == user_name_length) | 707 if (matchcount == 1 && bestmatchsize == user_name_length) |
707 return Qt; | 708 return Qt; |
708 return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize)); | 709 return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize)); |
709 } | 710 } |
710 #endif /* ! defined WINDOWSNT */ | 711 #endif /* ! defined WIN32_NATIVE */ |
711 | 712 |
712 | 713 |
713 Lisp_Object | 714 Lisp_Object |
714 make_directory_hash_table (CONST char *path) | 715 make_directory_hash_table (const char *path) |
715 { | 716 { |
716 DIR *d; | 717 DIR *d; |
717 if ((d = opendir (path))) | 718 if ((d = opendir (path))) |
718 { | 719 { |
719 DIRENTRY *dp; | 720 DIRENTRY *dp; |
794 | 795 |
795 #ifdef BSD4_2 | 796 #ifdef BSD4_2 |
796 directory = Ffile_name_directory (filename); | 797 directory = Ffile_name_directory (filename); |
797 #endif | 798 #endif |
798 | 799 |
799 #ifdef MSDOS | 800 #if 0 /* #### shouldn't this apply to WIN32_NATIVE and maybe CYGWIN? */ |
800 { | 801 { |
801 char *tmpnam = (char *) XSTRING_DATA (Ffile_name_nondirectory (filename)); | 802 char *tmpnam = (char *) XSTRING_DATA (Ffile_name_nondirectory (filename)); |
802 int l = strlen (tmpnam); | 803 int l = strlen (tmpnam); |
803 | 804 |
804 if (l >= 5 | 805 if (l >= 5 |
808 stricmp (&tmpnam[l - 4], ".bat") == 0)) | 809 stricmp (&tmpnam[l - 4], ".bat") == 0)) |
809 { | 810 { |
810 s.st_mode |= S_IEXEC; | 811 s.st_mode |= S_IEXEC; |
811 } | 812 } |
812 } | 813 } |
813 #endif /* MSDOS */ | 814 #endif |
814 | 815 |
815 switch (s.st_mode & S_IFMT) | 816 switch (s.st_mode & S_IFMT) |
816 { | 817 { |
817 default: | 818 default: |
818 values[0] = Qnil; | 819 values[0] = Qnil; |
841 values[8] = make_string ((Bufbyte *) modes, 10); | 842 values[8] = make_string ((Bufbyte *) modes, 10); |
842 #if defined (BSD4_2) || defined (BSD4_3) /* file gid will be dir gid */ | 843 #if defined (BSD4_2) || defined (BSD4_3) /* file gid will be dir gid */ |
843 { | 844 { |
844 struct stat sdir; | 845 struct stat sdir; |
845 | 846 |
846 if (!NILP (directory) && stat ((char *) XSTRING_DATA (directory), &sdir) == 0) | 847 if (!NILP (directory) && xemacs_stat ((char *) XSTRING_DATA (directory), &sdir) == 0) |
847 values[9] = (sdir.st_gid != s.st_gid) ? Qt : Qnil; | 848 values[9] = (sdir.st_gid != s.st_gid) ? Qt : Qnil; |
848 else /* if we can't tell, assume worst */ | 849 else /* if we can't tell, assume worst */ |
849 values[9] = Qt; | 850 values[9] = Qt; |
850 } | 851 } |
851 #else /* file gid will be egid */ | 852 #else /* file gid will be egid */ |
871 defsymbol (&Qfile_attributes, "file-attributes"); | 872 defsymbol (&Qfile_attributes, "file-attributes"); |
872 | 873 |
873 DEFSUBR (Fdirectory_files); | 874 DEFSUBR (Fdirectory_files); |
874 DEFSUBR (Ffile_name_completion); | 875 DEFSUBR (Ffile_name_completion); |
875 DEFSUBR (Ffile_name_all_completions); | 876 DEFSUBR (Ffile_name_all_completions); |
876 #ifndef WINDOWSNT | 877 #ifndef WIN32_NATIVE |
877 DEFSUBR (Fuser_name_completion); | 878 DEFSUBR (Fuser_name_completion); |
878 DEFSUBR (Fuser_name_completion_1); | 879 DEFSUBR (Fuser_name_completion_1); |
879 DEFSUBR (Fuser_name_all_completions); | 880 DEFSUBR (Fuser_name_all_completions); |
880 #endif | 881 #endif |
881 DEFSUBR (Ffile_attributes); | 882 DEFSUBR (Ffile_attributes); |