1 /* Lisp functions for making directory listings.
2 Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc.
4 This file is part of XEmacs.
6 XEmacs is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with XEmacs; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* Synched up with: FSF 19.30. */
36 Lisp_Object Vcompletion_ignored_extensions;
37 Lisp_Object Qdirectory_files;
38 Lisp_Object Qfile_name_completion;
39 Lisp_Object Qfile_name_all_completions;
40 Lisp_Object Qfile_attributes;
43 close_directory_unwind (Lisp_Object unwind_obj)
45 DIR *d = (DIR *)get_opaque_ptr (unwind_obj);
47 free_opaque_ptr (unwind_obj);
51 DEFUN ("directory-files", Fdirectory_files, 1, 5, 0, /*
52 Return a list of names of files in DIRECTORY.
53 There are four optional arguments:
54 If FULL is non-nil, absolute pathnames of the files are returned.
55 If MATCH is non-nil, only pathnames containing that regexp are returned.
56 If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
57 NOSORT is useful if you plan to sort the result yourself.
58 If FILES-ONLY is the symbol t, then only the "files" in the directory
59 will be returned; subdirectories will be excluded. If FILES-ONLY is not
60 nil and not t, then only the subdirectories will be returned. Otherwise,
61 if FILES-ONLY is nil (the default) then both files and subdirectories will
64 (dirname, full, match, nosort, files_only))
66 /* This function can GC */
68 Lisp_Object list = Qnil;
71 struct re_pattern_buffer *bufp = NULL;
72 int speccount = specpdl_depth ();
73 char *statbuf, *statbuf_tail;
75 struct gcpro gcpro1, gcpro2;
76 GCPRO2 (dirname, list);
78 /* If the file name has special constructs in it,
79 call the corresponding file handler. */
80 handler = Ffind_file_name_handler (dirname, Qdirectory_files);
84 if (!NILP (files_only))
85 return call6 (handler, Qdirectory_files, dirname, full, match, nosort,
88 return call5 (handler, Qdirectory_files, dirname, full, match,
92 /* #### why do we do Fexpand_file_name after file handlers here,
93 but earlier everywhere else? */
94 dirname = Fexpand_file_name (dirname, Qnil);
95 dirname = Ffile_name_as_directory (dirname);
96 dirnamelen = XSTRING_LENGTH (dirname);
98 statbuf = (char *)alloca (dirnamelen + MAXNAMLEN + 1);
99 memcpy (statbuf, XSTRING_DATA (dirname), dirnamelen);
100 statbuf_tail = statbuf + dirnamelen;
102 /* XEmacs: this should come after Ffile_name_as_directory() to avoid
103 potential regexp cache smashage. It comes before the opendir()
104 because it might signal an error. */
107 CHECK_STRING (match);
109 /* MATCH might be a flawed regular expression. Rather than
110 catching and signalling our own errors, we just call
111 compile_pattern to do the work for us. */
112 bufp = compile_pattern (match, 0, 0, 0, ERROR_ME);
115 /* Now *bufp is the compiled form of MATCH; don't call anything
116 which might compile a new regexp until we're done with the loop! */
118 /* Do this opendir after anything which might signal an error.
119 NOTE: the above comment is old; previously, there was no
120 unwind-protection in case of error, but now there is. */
121 d = opendir ((char *) XSTRING_DATA (dirname));
123 report_file_error ("Opening directory", list1 (dirname));
125 record_unwind_protect (close_directory_unwind, make_opaque_ptr ((void *)d));
127 /* Loop reading blocks */
130 DIRENTRY *dp = readdir (d);
136 if (DIRENTRY_NONEMPTY (dp)
138 || (0 <= re_search (bufp, dp->d_name, len, 0, len, 0))))
140 if (!NILP (files_only))
144 char *cur_statbuf = statbuf;
145 char *cur_statbuf_tail = statbuf_tail;
147 /* #### I don't think the code under `if' is necessary
148 anymore. The crashes in this function were reported
149 because MAXNAMLEN was used to remember the *whole*
150 statbuf, instead of using MAXPATHLEN. This should be
151 tested after 21.0 is released. */
153 /* We normally use the buffer created by alloca.
154 However, if the file name we get too big, we'll use a
155 malloced buffer, and free it. It is undefined how
156 stat() will react to this, but we avoid a buffer
160 cur_statbuf = (char *)xmalloc (dirnamelen + len + 1);
161 memcpy (cur_statbuf, statbuf, dirnamelen);
162 cur_statbuf_tail = cur_statbuf + dirnamelen;
164 memcpy (cur_statbuf_tail, dp->d_name, len);
165 cur_statbuf_tail[len] = 0;
167 if (stat (cur_statbuf, &st) < 0)
170 dir_p = ((st.st_mode & S_IFMT) == S_IFDIR);
172 if (cur_statbuf != statbuf)
175 if (EQ (files_only, Qt) && dir_p)
177 else if (!EQ (files_only, Qt) && !dir_p)
183 make_string ((Bufbyte *)dp->d_name, len);
185 name = concat2 (dirname, name);
187 list = Fcons (name, list);
191 unbind_to (speccount, Qnil); /* This will close the dir */
194 list = Fsort (Fnreverse (list), Qstring_lessp);
196 RETURN_UNGCPRO (list);
199 static Lisp_Object file_name_completion (Lisp_Object file,
201 int all_flag, int ver_flag);
203 DEFUN ("file-name-completion", Ffile_name_completion, 2, 2, 0, /*
204 Complete file name FILE in directory DIR.
205 Returns the longest string common to all filenames in DIR
206 that start with FILE.
207 If there is only one and FILE matches it exactly, returns t.
208 Returns nil if DIR contains no name starting with FILE.
210 Filenames which end with any member of `completion-ignored-extensions'
211 are not considered as possible completions for FILE unless there is no
212 other possible completion. `completion-ignored-extensions' is not applied
213 to the names of directories.
217 /* This function can GC. GC checked 1996.04.06. */
220 /* If the directory name has special constructs in it,
221 call the corresponding file handler. */
222 handler = Ffind_file_name_handler (dirname, Qfile_name_completion);
224 return call3 (handler, Qfile_name_completion, file, dirname);
226 /* If the file name has special constructs in it,
227 call the corresponding file handler. */
228 handler = Ffind_file_name_handler (file, Qfile_name_completion);
230 return call3 (handler, Qfile_name_completion, file, dirname);
232 return file_name_completion (file, dirname, 0, 0);
235 DEFUN ("file-name-all-completions", Ffile_name_all_completions, 2, 2, 0, /*
236 Return a list of all completions of file name FILE in directory DIR.
237 These are all file names in directory DIR which begin with FILE.
239 Filenames which end with any member of `completion-ignored-extensions'
240 are not considered as possible completions for FILE unless there is no
241 other possible completion. `completion-ignored-extensions' is not applied
242 to the names of directories.
246 /* This function can GC. GC checked 1997.06.04. */
251 dirname = Fexpand_file_name (dirname, Qnil);
252 /* If the file name has special constructs in it,
253 call the corresponding file handler. */
254 handler = Ffind_file_name_handler (dirname, Qfile_name_all_completions);
257 return call3 (handler, Qfile_name_all_completions, file,
260 return file_name_completion (file, dirname, 1, 0);
264 file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp,
265 struct stat *st_addr)
267 Bytecount len = NAMLEN (dp);
268 Bytecount pos = XSTRING_LENGTH (dirname);
270 char *fullname = (char *) alloca (len + pos + 2);
272 memcpy (fullname, XSTRING_DATA (dirname), pos);
273 if (!IS_DIRECTORY_SEP (fullname[pos - 1]))
274 fullname[pos++] = DIRECTORY_SEP;
276 memcpy (fullname + pos, dp->d_name, len);
277 fullname[pos + len] = 0;
280 /* We want to return success if a link points to a nonexistent file,
281 but we want to return the status for what the link points to,
282 in case it is a directory. */
283 value = lstat (fullname, st_addr);
284 if (S_ISLNK (st_addr->st_mode))
285 stat (fullname, st_addr);
287 value = stat (fullname, st_addr);
293 file_name_completion_unwind (Lisp_Object locative)
296 Lisp_Object obj = XCAR (locative);
300 d = (DIR *)get_opaque_ptr (obj);
302 free_opaque_ptr (obj);
304 free_cons (XCONS (locative));
309 file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag,
312 /* This function can GC */
315 Lisp_Object bestmatch = Qnil;
316 Charcount bestmatchsize = 0;
319 int speccount = specpdl_depth ();
320 Charcount file_name_length;
321 Lisp_Object locative;
322 struct gcpro gcpro1, gcpro2, gcpro3;
324 GCPRO3 (file, dirname, bestmatch);
329 /* Filename completion on Windows ignores case, since Windows
331 specbind (Qcompletion_ignore_case, Qt);
332 #endif /* WINDOWSNT */
334 #ifdef FILE_SYSTEM_CASE
335 file = FILE_SYSTEM_CASE (file);
337 dirname = Fexpand_file_name (dirname, Qnil);
338 file_name_length = XSTRING_CHAR_LENGTH (file);
340 /* With passcount = 0, ignore files that end in an ignored extension.
341 If nothing found then try again with passcount = 1, don't ignore them.
342 If looking for all completions, start with passcount = 1,
343 so always take even the ignored ones.
345 ** It would not actually be helpful to the user to ignore any possible
346 completions when making a list of them.** */
348 /* We cannot use close_directory_unwind() because we change the
349 directory. The old code used to just avoid signaling errors, and
350 call closedir, but it was wrong, because it made sane handling of
351 QUIT impossible and, besides, various utility functions like
352 regexp_ignore_completion_p can signal errors. */
353 locative = noseeum_cons (Qnil, Qnil);
354 record_unwind_protect (file_name_completion_unwind, locative);
356 for (passcount = !!all_flag; NILP (bestmatch) && passcount < 2; passcount++)
358 d = opendir ((char *) XSTRING_DATA (Fdirectory_file_name (dirname)));
360 report_file_error ("Opening directory", list1 (dirname));
361 XCAR (locative) = make_opaque_ptr ((void *)d);
363 /* Loop reading blocks */
368 /* scmp() works in characters, not bytes, so we have to compute
372 int ignored_extension_p = 0;
378 /* Cast to Bufbyte* is OK, as readdir() Mule-encapsulates. */
379 d_name = (Bufbyte *) dp->d_name;
381 cclen = bytecount_to_charcount (d_name, len);
385 if (! DIRENTRY_NONEMPTY (dp)
386 || cclen < file_name_length
387 || 0 <= scmp (d_name, XSTRING_DATA (file), file_name_length))
390 if (file_name_completion_stat (dirname, dp, &st) < 0)
393 directoryp = ((st.st_mode & S_IFMT) == S_IFDIR);
396 #ifndef TRIVIAL_DIRECTORY_ENTRY
397 #define TRIVIAL_DIRECTORY_ENTRY(n) (!strcmp (n, ".") || !strcmp (n, ".."))
399 /* "." and ".." are never interesting as completions, but are
400 actually in the way in a directory containing only one file. */
401 if (!passcount && TRIVIAL_DIRECTORY_ENTRY (dp->d_name))
406 /* Compare extensions-to-be-ignored against end of this file name */
407 /* if name is not an exact match against specified string. */
408 if (!passcount && cclen > file_name_length)
411 /* and exit this for loop if a match is found */
412 EXTERNAL_LIST_LOOP (tem, Vcompletion_ignored_extensions)
414 Lisp_Object elt = XCAR (tem);
419 skip = cclen - XSTRING_CHAR_LENGTH (elt);
420 if (skip < 0) continue;
422 if (0 > scmp (charptr_n_addr (d_name, skip),
424 XSTRING_CHAR_LENGTH (elt)))
426 ignored_extension_p = 1;
433 /* If an ignored-extensions match was found,
434 don't process this name as a completion. */
435 if (!passcount && ignored_extension_p)
438 if (!passcount && regexp_ignore_completion_p (d_name, Qnil, 0, cclen))
441 /* Update computation of how much all possible completions match */
444 if (all_flag || NILP (bestmatch))
446 Lisp_Object name = Qnil;
447 struct gcpro ngcpro1;
449 /* This is a possible completion */
450 name = make_string (d_name, len);
451 if (directoryp) /* Completion is a directory; end it with '/' */
452 name = Ffile_name_as_directory (name);
455 bestmatch = Fcons (name, bestmatch);
460 bestmatchsize = XSTRING_CHAR_LENGTH (name);
466 Charcount compare = min (bestmatchsize, cclen);
467 Bufbyte *p1 = XSTRING_DATA (bestmatch);
468 Bufbyte *p2 = d_name;
469 Charcount matchsize = scmp (p1, p2, compare);
473 if (completion_ignore_case)
475 /* If this is an exact match except for case,
476 use it as the best match rather than one that is not
477 an exact match. This way, we get the case pattern
478 of the actual match. */
479 if ((matchsize == cclen
480 && matchsize + !!directoryp
481 < XSTRING_CHAR_LENGTH (bestmatch))
483 /* If there is no exact match ignoring case,
484 prefer a match that does not change the case
486 (((matchsize == cclen)
488 (matchsize + !!directoryp
489 == XSTRING_CHAR_LENGTH (bestmatch)))
490 /* If there is more than one exact match aside from
491 case, and one of them is exact including case,
493 && 0 > scmp_1 (p2, XSTRING_DATA (file),
495 && 0 <= scmp_1 (p1, XSTRING_DATA (file),
496 file_name_length, 0)))
498 bestmatch = make_string (d_name, len);
500 bestmatch = Ffile_name_as_directory (bestmatch);
504 /* If this dirname all matches,
505 see if implicit following slash does too. */
507 && compare == matchsize
508 && bestmatchsize > matchsize
509 && IS_ANY_SEP (charptr_emchar_n (p1, matchsize)))
511 bestmatchsize = matchsize;
515 free_opaque_ptr (XCAR (locative));
516 XCAR (locative) = Qnil;
519 unbind_to (speccount, Qnil);
523 if (all_flag || NILP (bestmatch))
525 if (matchcount == 1 && bestmatchsize == file_name_length)
527 return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize));
532 /* The *pwent() functions do not exist on NT */
535 static Lisp_Object user_name_completion (Lisp_Object user,
539 DEFUN ("user-name-completion", Fuser_name_completion, 1, 1, 0, /*
540 Complete user name USER.
542 Returns the longest string common to all user names that start
543 with USER. If there is only one and USER matches it exactly,
544 returns t. Returns nil if there is no user name starting with USER.
548 return user_name_completion (user, 0, NULL);
551 DEFUN ("user-name-completion-1", Fuser_name_completion_1, 1, 1, 0, /*
552 Complete user name USER.
554 This function is identical to `user-name-completion', except that
555 the cons of the completion and an indication of whether the
556 completion was unique is returned.
558 The car of the returned value is the longest string common to all
559 user names that start with USER. If there is only one and USER
560 matches it exactly, the car is t. The car is nil if there is no
561 user name starting with USER. The cdr of the result is non-nil
562 if and only if the completion returned in the car was unique.
567 Lisp_Object completed;
569 completed = user_name_completion (user, 0, &uniq);
570 return Fcons (completed, uniq ? Qt : Qnil);
573 DEFUN ("user-name-all-completions", Fuser_name_all_completions, 1, 1, 0, /*
574 Return a list of all completions of user name USER.
575 These are all user names which begin with USER.
579 return user_name_completion (user, 1, NULL);
583 user_name_completion_unwind (Lisp_Object locative)
585 Lisp_Object obj1 = XCAR (locative);
586 Lisp_Object obj2 = XCDR (locative);
591 if (!NILP (obj1) && !NILP (obj2))
593 /* clean up if interrupted building cache */
594 cache = *(char ***)get_opaque_ptr (obj1);
595 clen = *(int *)get_opaque_ptr (obj2);
596 free_opaque_ptr (obj1);
597 free_opaque_ptr (obj2);
598 for (i = 0; i < clen; i++)
603 free_cons (XCONS (locative));
609 static char **user_cache;
610 static int user_cache_len;
611 static int user_cache_max;
612 static long user_cache_time;
614 #define USER_CACHE_REBUILD (24*60*60) /* 1 day, in seconds */
617 user_name_completion (Lisp_Object user, int all_flag, int *uniq)
619 /* This function can GC */
622 Lisp_Object bestmatch = Qnil;
623 Charcount bestmatchsize = 0;
624 int speccount = specpdl_depth ();
627 Charcount user_name_length;
628 Lisp_Object locative;
630 struct gcpro gcpro1, gcpro2;
632 GCPRO2 (user, bestmatch);
636 user_name_length = XSTRING_CHAR_LENGTH (user);
638 /* Cache user name lookups because it tends to be quite slow.
639 * Rebuild the cache occasionally to catch changes */
642 EMACS_SECS (t) - user_cache_time > USER_CACHE_REBUILD)
644 for (i = 0; i < user_cache_len; i++)
645 free (user_cache[i]);
652 if (user_cache == NULL || user_cache_max <= 0)
656 cache = (char **) malloc (cmax*sizeof (char *));
659 locative = noseeum_cons (Qnil, Qnil);
660 XCAR (locative) = make_opaque_ptr ((void *) &cache);
661 XCDR (locative) = make_opaque_ptr ((void *) &clen);
662 record_unwind_protect (user_name_completion_unwind, locative);
663 /* #### may need to slow down interrupts around call to getpwent
664 * below. at least the call to getpwnam in Fuser_full_name
665 * is documented as needing it on irix. */
666 while ((pw = getpwent ()))
671 cache = (char **) realloc (cache, cmax*sizeof (char *));
676 cache[clen++] = strdup (pw->pw_name);
678 free_opaque_ptr (XCAR (locative));
679 free_opaque_ptr (XCDR (locative));
680 XCAR (locative) = Qnil;
681 XCDR (locative) = Qnil;
683 unbind_to (speccount, Qnil); /* free locative cons, endpwent() */
685 user_cache_max = cmax;
686 user_cache_len = clen;
688 user_cache_time = EMACS_SECS (t);
691 for (i = 0; i < user_cache_len; i++)
693 Bufbyte *d_name = (Bufbyte *) user_cache[i];
694 Bytecount len = strlen ((char *) d_name);
695 /* scmp() works in chars, not bytes, so we have to compute this: */
696 Charcount cclen = bytecount_to_charcount (d_name, len);
700 if (cclen < user_name_length ||
701 0 <= scmp (d_name, XSTRING_DATA (user), user_name_length))
704 matchcount++; /* count matching completions */
706 if (all_flag || NILP (bestmatch))
708 Lisp_Object name = Qnil;
709 struct gcpro ngcpro1;
711 /* This is a possible completion */
712 name = make_string (d_name, len);
715 bestmatch = Fcons (name, bestmatch);
720 bestmatchsize = XSTRING_CHAR_LENGTH (name);
726 Charcount compare = min (bestmatchsize, cclen);
727 Bufbyte *p1 = XSTRING_DATA (bestmatch);
728 Bufbyte *p2 = d_name;
729 Charcount matchsize = scmp (p1, p2, compare);
733 if (completion_ignore_case)
735 /* If this is an exact match except for case,
736 use it as the best match rather than one that is not
737 an exact match. This way, we get the case pattern
738 of the actual match. */
739 if ((matchsize == cclen
740 && matchsize < XSTRING_CHAR_LENGTH (bestmatch))
742 /* If there is no exact match ignoring case,
743 prefer a match that does not change the case
745 (((matchsize == cclen)
747 (matchsize == XSTRING_CHAR_LENGTH (bestmatch)))
748 /* If there is more than one exact match aside from
749 case, and one of them is exact including case,
751 && 0 > scmp_1 (p2, XSTRING_DATA (user),
753 && 0 <= scmp_1 (p1, XSTRING_DATA (user),
754 user_name_length, 0)))
756 bestmatch = make_string (d_name, len);
760 bestmatchsize = matchsize;
767 *uniq = (matchcount == 1);
769 if (all_flag || NILP (bestmatch))
771 if (matchcount == 1 && bestmatchsize == user_name_length)
773 return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize));
775 #endif /* ! defined WINDOWSNT */
779 make_directory_hash_table (CONST char *path)
783 make_lisp_hash_table (100, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL);
784 if ((d = opendir (path)))
788 while ((dp = readdir (d)))
790 Bytecount len = NAMLEN (dp);
791 if (DIRENTRY_NONEMPTY (dp))
792 /* Cast to Bufbyte* is OK, as readdir() Mule-encapsulates. */
793 Fputhash (make_string ((Bufbyte *) dp->d_name, len), Qt, hash);
801 wasteful_word_to_lisp (unsigned int item)
803 /* Compatibility: in other versions, file-attributes returns a LIST
804 of two 16 bit integers... */
805 Lisp_Object cons = word_to_lisp (item);
806 XCDR (cons) = Fcons (XCDR (cons), Qnil);
810 DEFUN ("file-attributes", Ffile_attributes, 1, 1, 0, /*
811 Return a list of attributes of file FILENAME.
812 Value is nil if specified file cannot be opened.
813 Otherwise, list elements are:
814 0. t for directory, string (name linked to) for symbolic link, or nil.
815 1. Number of links to file.
818 4. Last access time, as a list of two integers.
819 First integer has high-order 16 bits of time, second has low 16 bits.
820 5. Last modification time, likewise.
821 6. Last status change time, likewise.
822 7. Size in bytes. (-1, if number is out of range).
823 8. File modes, as a string of ten letters or dashes as in ls -l.
824 9. t iff file's gid would change if file were deleted and recreated.
828 If file does not exist, returns nil.
832 /* This function can GC. GC checked 1997.06.04. */
833 Lisp_Object values[12];
834 Lisp_Object dirname = Qnil;
838 struct gcpro gcpro1, gcpro2;
840 GCPRO2 (filename, dirname);
841 filename = Fexpand_file_name (filename, Qnil);
843 /* If the file name has special constructs in it,
844 call the corresponding file handler. */
845 handler = Ffind_file_name_handler (filename, Qfile_attributes);
849 return call2 (handler, Qfile_attributes, filename);
852 if (lstat ((char *) XSTRING_DATA (filename), &s) < 0)
859 dirname = Ffile_name_directory (filename);
864 char *tmpnam = (char *) XSTRING_DATA (Ffile_name_nondirectory (filename));
865 int l = strlen (tmpnam);
868 && S_ISREG (s.st_mode)
869 && (stricmp (&tmpnam[l - 4], ".com") == 0 ||
870 stricmp (&tmpnam[l - 4], ".exe") == 0 ||
871 stricmp (&tmpnam[l - 4], ".bat") == 0))
873 s.st_mode |= S_IEXEC;
878 switch (s.st_mode & S_IFMT)
888 values[0] = Ffile_symlink_p (filename);
892 values[1] = make_int (s.st_nlink);
893 values[2] = make_int (s.st_uid);
894 values[3] = make_int (s.st_gid);
895 values[4] = wasteful_word_to_lisp (s.st_atime);
896 values[5] = wasteful_word_to_lisp (s.st_mtime);
897 values[6] = wasteful_word_to_lisp (s.st_ctime);
898 values[7] = make_int ((EMACS_INT) s.st_size);
899 /* If the size is out of range, give back -1. */
900 /* #### Fix when Emacs gets bignums! */
901 if (XINT (values[7]) != s.st_size)
902 values[7] = make_int (-1);
903 filemodestring (&s, modes);
904 values[8] = make_string ((Bufbyte *) modes, 10);
905 #if defined (BSD4_2) || defined (BSD4_3) /* file gid will be dir gid */
909 if (!NILP (dirname) && stat ((char *) XSTRING_DATA (dirname), &sdir) == 0)
910 values[9] = (sdir.st_gid != s.st_gid) ? Qt : Qnil;
911 else /* if we can't tell, assume worst */
914 #else /* file gid will be egid */
915 values[9] = (s.st_gid != getegid ()) ? Qt : Qnil;
916 #endif /* BSD4_2 or BSD4_3 */
917 values[10] = make_int (s.st_ino);
918 values[11] = make_int (s.st_dev);
920 return Flist (countof (values), values);
924 /************************************************************************/
926 /************************************************************************/
931 defsymbol (&Qdirectory_files, "directory-files");
932 defsymbol (&Qfile_name_completion, "file-name-completion");
933 defsymbol (&Qfile_name_all_completions, "file-name-all-completions");
934 defsymbol (&Qfile_attributes, "file-attributes");
936 DEFSUBR (Fdirectory_files);
937 DEFSUBR (Ffile_name_completion);
938 DEFSUBR (Ffile_name_all_completions);
940 DEFSUBR (Fuser_name_completion);
941 DEFSUBR (Fuser_name_completion_1);
942 DEFSUBR (Fuser_name_all_completions);
944 DEFSUBR (Ffile_attributes);
950 DEFVAR_LISP ("completion-ignored-extensions", &Vcompletion_ignored_extensions /*
951 *Completion ignores filenames ending in any string in this list.
952 This variable does not affect lists of possible completions,
953 but does affect the commands that actually do completions.
954 It is used by the functions `file-name-completion' and
955 `file-name-all-completions'.
957 Vcompletion_ignored_extensions = Qnil;