Mercurial > hg > xemacs-beta
comparison src/dired.c @ 120:cca96a509cfe r20-1b12
Import from CVS: tag r20-1b12
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:25:29 +0200 |
parents | 7d55a9ba150c |
children | 8eaf7971accc |
comparison
equal
deleted
inserted
replaced
119:d101af7320b8 | 120:cca96a509cfe |
---|---|
51 if FILES-ONLY is nil (the default) then both files and subdirectories will | 51 if FILES-ONLY is nil (the default) then both files and subdirectories will |
52 be returned. | 52 be returned. |
53 */ | 53 */ |
54 (dirname, full, match, nosort, files_only)) | 54 (dirname, full, match, nosort, files_only)) |
55 { | 55 { |
56 /* This function can GC */ | 56 /* This function can GC. GC checked 1997.04.06. */ |
57 DIR *d; | 57 DIR *d; |
58 Bytecount dirname_length; | 58 Bytecount dirname_length; |
59 Lisp_Object list, name, dirfilename = Qnil; | 59 Lisp_Object list, name, dirfilename = Qnil; |
60 Lisp_Object handler; | 60 Lisp_Object handler; |
61 struct re_pattern_buffer *bufp; | 61 struct re_pattern_buffer *bufp; |
64 char *statbuf_tail; | 64 char *statbuf_tail; |
65 Lisp_Object tail_cons = Qnil; | 65 Lisp_Object tail_cons = Qnil; |
66 char slashfilename[MAXNAMLEN+2]; | 66 char slashfilename[MAXNAMLEN+2]; |
67 char *filename = slashfilename; | 67 char *filename = slashfilename; |
68 | 68 |
69 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 69 struct gcpro gcpro1, gcpro2, gcpro3; |
70 | 70 GCPRO3 (dirname, dirfilename, tail_cons); |
71 /* #### Needs more gcpro's */ | |
72 GCPRO5 (dirname, match, files_only, tail_cons, dirfilename); | |
73 | 71 |
74 /* If the file name has special constructs in it, | 72 /* If the file name has special constructs in it, |
75 call the corresponding file handler. */ | 73 call the corresponding file handler. */ |
76 handler = Ffind_file_name_handler (dirname, Qdirectory_files); | 74 handler = Ffind_file_name_handler (dirname, Qdirectory_files); |
77 if (!NILP (handler)) | 75 if (!NILP (handler)) |
83 else | 81 else |
84 return call5 (handler, Qdirectory_files, dirname, full, match, | 82 return call5 (handler, Qdirectory_files, dirname, full, match, |
85 nosort); | 83 nosort); |
86 } | 84 } |
87 | 85 |
86 /* #### why do we do Fexpand_file_name after file handlers here, | |
87 but earlier everywhere else? */ | |
88 dirname = Fexpand_file_name (dirname, Qnil); | 88 dirname = Fexpand_file_name (dirname, Qnil); |
89 dirfilename = Fdirectory_file_name (dirname); | 89 dirfilename = Fdirectory_file_name (dirname); |
90 | 90 |
91 { | 91 { |
92 /* XEmacs: this should come before the opendir() because it might error. */ | 92 /* XEmacs: this should come before the opendir() because it might error. */ |
223 other possible completion. `completion-ignored-extensions' is not applied | 223 other possible completion. `completion-ignored-extensions' is not applied |
224 to the names of directories. | 224 to the names of directories. |
225 */ | 225 */ |
226 (file, dirname)) | 226 (file, dirname)) |
227 { | 227 { |
228 /* This function can GC */ | 228 /* This function can GC. GC checked 1996.04.06. */ |
229 Lisp_Object handler; | 229 Lisp_Object handler; |
230 | 230 |
231 /* If the directory name has special constructs in it, | 231 /* If the directory name has special constructs in it, |
232 call the corresponding file handler. */ | 232 call the corresponding file handler. */ |
233 handler = Ffind_file_name_handler (dirname, Qfile_name_completion); | 233 handler = Ffind_file_name_handler (dirname, Qfile_name_completion); |
252 other possible completion. `completion-ignored-extensions' is not applied | 252 other possible completion. `completion-ignored-extensions' is not applied |
253 to the names of directories. | 253 to the names of directories. |
254 */ | 254 */ |
255 (file, dirname)) | 255 (file, dirname)) |
256 { | 256 { |
257 /* This function can GC */ | 257 /* This function can GC. GC checked 1997.06.04. */ |
258 Lisp_Object handler; | 258 Lisp_Object handler; |
259 struct gcpro gcpro1; | 259 struct gcpro gcpro1; |
260 | 260 |
261 GCPRO1 (dirname); | 261 GCPRO1 (dirname); |
262 dirname = Fexpand_file_name (dirname, Qnil); | 262 dirname = Fexpand_file_name (dirname, Qnil); |
617 | 617 |
618 If file does not exist, returns nil. | 618 If file does not exist, returns nil. |
619 */ | 619 */ |
620 (filename)) | 620 (filename)) |
621 { | 621 { |
622 /* This function can call lisp */ | 622 /* This function can GC. GC checked 1997.06.04. */ |
623 Lisp_Object values[12]; | 623 Lisp_Object values[12]; |
624 Lisp_Object dirname = Qnil; | 624 Lisp_Object dirname = Qnil; |
625 struct stat s; | 625 struct stat s; |
626 char modes[10]; | 626 char modes[10]; |
627 Lisp_Object handler; | 627 Lisp_Object handler; |
628 struct gcpro gcpro1, gcpro2; | 628 struct gcpro gcpro1, gcpro2; |
629 | 629 |
630 GCPRO1 (filename); | 630 GCPRO2 (filename, dirname); |
631 filename = Fexpand_file_name (filename, Qnil); | 631 filename = Fexpand_file_name (filename, Qnil); |
632 | 632 |
633 /* If the file name has special constructs in it, | 633 /* If the file name has special constructs in it, |
634 call the corresponding file handler. */ | 634 call the corresponding file handler. */ |
635 handler = Ffind_file_name_handler (filename, Qfile_attributes); | 635 handler = Ffind_file_name_handler (filename, Qfile_attributes); |
636 UNGCPRO; | |
637 if (!NILP (handler)) | 636 if (!NILP (handler)) |
638 return call2 (handler, Qfile_attributes, filename); | 637 { |
638 UNGCPRO; | |
639 return call2 (handler, Qfile_attributes, filename); | |
640 } | |
639 | 641 |
640 if (lstat ((char *) XSTRING_DATA (filename), &s) < 0) | 642 if (lstat ((char *) XSTRING_DATA (filename), &s) < 0) |
641 return Qnil; | 643 { |
642 | 644 UNGCPRO; |
643 GCPRO2 (filename, dirname); | 645 return Qnil; |
646 } | |
644 | 647 |
645 #ifdef BSD4_2 | 648 #ifdef BSD4_2 |
646 dirname = Ffile_name_directory (filename); | 649 dirname = Ffile_name_directory (filename); |
647 #endif | 650 #endif |
648 | 651 |