Partially sync files.el from XEmacs 21.5 for wildcard support.
[sxemacs] / src / dired.c
index e957a22..8cec22b 100644 (file)
@@ -128,7 +128,7 @@ static int pathname_matches_p(Lisp_Object, Lisp_Object,
 static char *
 dired_realpath(const char *file)
 {
-       char *result = xmalloc_atomic(4096);    
+       char *result = xmalloc_atomic(4096);
 
        if ( realpath(file, result) == NULL ) {
                xfree(result);
@@ -285,7 +285,7 @@ dfr_inner(dirent_t *res,
                 * check against the bloom filter.
                 */
                canon_name = CANONICALISE_FILENAME(statnam);
-               
+
                if (canon_name) {
                        /* now, recycle full name */
                        fullname = make_ext_string(
@@ -328,7 +328,7 @@ dfr_inner(dirent_t *res,
           - With the former variant it is NOT possible to have
           the trivial filenames on the result list, since a
           match against "^[.]$" would exclude everything, while
-          actually it was likely meant to _solely_ exclude "." 
+          actually it was likely meant to _solely_ exclude "."
           from the result list
           - Furthermore, we _MUST_ traverse in preorder,
           otherwise there is the possibility that pathnames are
@@ -581,7 +581,7 @@ directory_files_resultify(Lisp_Object result, Lisp_Object result_type)
        } else if (EQ(result_type, Qdesc_sorted_list)) {
                final_result = Fdllist_to_list(result);
                final_result = Fsort(final_result, Qstring_greaterp);
-       } else if (EQ(result_type, Qt) || EQ(result_type, Qlist)) {
+       } else if (!NILP(result_type) || EQ(result_type, Qlist)) {
                final_result = Fdllist_to_list(result);
        }
 
@@ -634,6 +634,10 @@ Optional argument RESULT-TYPE can be one of:
 The two latter types can be useful if you plan to sort the result
 yourself, or want to feed the result to further processing.
 
+For compatibility with XEmacs' NOSORT argument to this function,
+RESULT-TYPE can also be any non-nil value.  In that case it will
+return an unsorted list. (http://issues.sxemacs.org/show_bug.cgi?id=163)
+
 Optional argument FILES-ONLY can be one of:
 - t  to return only files and symlinks in DIRECTORY
 - nil (default)  to return all entries (files, symlinks, and
@@ -707,7 +711,7 @@ Optional argument MAXDEPTH \(a positive integer\) specifies the
 maximal recursion depth, use 0 to emulate old `directory-files'.
 
 Optional argument SYMLINK-IS-FILE specifies whether symlinks
-should be resolved \(which is the default behaviour\) or whether 
+should be resolved \(which is the default behaviour\) or whether
 they are treated as ordinary files \(non-nil\), in the latter
 case symlinks to directories are not recurred.
 
@@ -1055,8 +1059,8 @@ file_name_completion(Lisp_Object file, Lisp_Object directory, int all_flag,
                                               ==
                                               XSTRING_CHAR_LENGTH(bestmatch)))
                                             /* If there is more than one exact match aside from
-                                               case, and one of them is exact including case,
-                                               prefer that one.  */
+                                               case, and one of them is exact including case,
+                                               prefer that one.  */
                                             && 0 > scmp_1(p2,
                                                           XSTRING_DATA(file),
                                                           file_name_length, 0)