Mercurial > hg > xemacs-beta
comparison src/dired.c @ 48:56c54cf7c5b6 r19-16b90
Import from CVS: tag r19-16b90
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:56:04 +0200 |
parents | 8d2a9b52c682 |
children | 2e6f5e180fb8 |
comparison
equal
deleted
inserted
replaced
47:11c6df210d7f | 48:56c54cf7c5b6 |
---|---|
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 | 259 struct gcpro gcpro1; |
260 | |
261 GCPRO1 (dirname); | |
262 dirname = Fexpand_file_name (dirname, Qnil); | |
260 /* If the file name has special constructs in it, | 263 /* If the file name has special constructs in it, |
261 call the corresponding file handler. */ | 264 call the corresponding file handler. */ |
262 handler = Ffind_file_name_handler (dirname, Qfile_name_all_completions); | 265 handler = Ffind_file_name_handler (dirname, Qfile_name_all_completions); |
266 UNGCPRO; | |
263 if (!NILP (handler)) | 267 if (!NILP (handler)) |
264 return call3 (handler, Qfile_name_all_completions, file, | 268 return call3 (handler, Qfile_name_all_completions, file, |
265 dirname); | 269 dirname); |
266 | 270 |
267 return file_name_completion (file, dirname, 1, 0); | 271 return file_name_completion (file, dirname, 1, 0); |
613 | 617 |
614 If file does not exist, returns nil. | 618 If file does not exist, returns nil. |
615 */ | 619 */ |
616 (filename)) | 620 (filename)) |
617 { | 621 { |
618 /* This function can call lisp */ | 622 /* This function can GC. GC checked 1997.06.04. */ |
619 Lisp_Object values[12]; | 623 Lisp_Object values[12]; |
620 Lisp_Object dirname = Qnil; | 624 Lisp_Object dirname = Qnil; |
621 struct stat s; | 625 struct stat s; |
622 char modes[10]; | 626 char modes[10]; |
623 Lisp_Object handler; | 627 Lisp_Object handler; |
624 struct gcpro gcpro1, gcpro2; | 628 struct gcpro gcpro1, gcpro2; |
625 | 629 |
626 GCPRO1 (filename); | 630 GCPRO2 (filename, dirname); |
627 filename = Fexpand_file_name (filename, Qnil); | 631 filename = Fexpand_file_name (filename, Qnil); |
628 | 632 |
629 /* If the file name has special constructs in it, | 633 /* If the file name has special constructs in it, |
630 call the corresponding file handler. */ | 634 call the corresponding file handler. */ |
631 handler = Ffind_file_name_handler (filename, Qfile_attributes); | 635 handler = Ffind_file_name_handler (filename, Qfile_attributes); |
632 UNGCPRO; | |
633 if (!NILP (handler)) | 636 if (!NILP (handler)) |
634 return call2 (handler, Qfile_attributes, filename); | 637 { |
638 UNGCPRO; | |
639 return call2 (handler, Qfile_attributes, filename); | |
640 } | |
635 | 641 |
636 if (lstat ((char *) XSTRING_DATA (filename), &s) < 0) | 642 if (lstat ((char *) XSTRING_DATA (filename), &s) < 0) |
637 return Qnil; | 643 { |
638 | 644 UNGCPRO; |
639 GCPRO2 (filename, dirname); | 645 return Qnil; |
646 } | |
640 | 647 |
641 #ifdef BSD4_2 | 648 #ifdef BSD4_2 |
642 dirname = Ffile_name_directory (filename); | 649 dirname = Ffile_name_directory (filename); |
643 #endif | 650 #endif |
644 | 651 |