Improve directory-files{,-recur} options
Add the following FILES-ONLY options:
- dirs to return only directories and symlinks to directories
- files to return only files -- but *NOT* symlinks to files
- symlinks to return only symlinks -- but *NOT* real files
or directories.
Change the following FILES-ONLY options:
- t to return only files and symlinks to files
- subdir to return only subdirectories -- but *NOT* symlinks to
directories, nor the current or parent directories
This means the behaviour with the following tree:
tmp/
tmp/bar -> foo
tmp/baz/
tmp/baz/baz/
tmp/baz/baz/foo/
tmp/baz/baz/boz -> boz
tmp/baz/fool -> ../baz/
tmp/baz/biz
tmp/baz/booze -> baz/
tmp/baz/boz -> biz
tmp/foz -> baz/
tmp/foo
The following will yield:
(directory-files "tmp" nil nil nil t)
=> ("bar" "foo" "foz")
(directory-files "tmp" nil nil nil nil)
=> ("." ".." "bar" "baz" "foo" "foz")
(directory-files "tmp" nil nil nil 'files)
=> ("foo")
(directory-files "tmp" nil nil nil 'dirs)
("." ".." "baz")
(directory-files "tmp" nil nil nil 'symlinks)
=> ("bar" "foz")
(directory-files "tmp" nil nil nil 'subdir)
=> ("baz")
(directory-files-recur "~/tmp" nil nil nil t 10 nil)
=> ("bar" "baz/baz/boz" "baz/biz" "baz/boz" "baz/fool" "foo")
(directory-files-recur "~/tmp" nil nil nil t 10 t)
=> ("bar" "baz/baz/boz" "baz/biz" "baz/booze" "baz/boz"
"baz/fool" "foo" "foz")
(directory-files-recur "~/tmp" nil nil nil nil 10 nil)
=> ("bar" "baz" "baz/baz" "baz/baz/boz" "baz/baz/foo" "baz/biz"
"baz/booze" "baz/boz" "baz/fool" "foo" "foz")
(directory-files-recur "~/tmp" nil nil nil nil 10 t)
=> ("bar" "baz" "baz/baz" "baz/baz/boz" "baz/baz/foo" "baz/biz"
"baz/booze" "baz/boz" "baz/fool" "foo" "foz")
(directory-files-recur "~/tmp" nil nil nil 'files 10 nil)
=> ("baz/biz" "foo")
(directory-files-recur "~/tmp" nil nil nil 'dirs 10 t)
=> ("baz" "baz/baz" "baz/baz/foo")
(directory-files-recur "~/tmp" nil nil nil 'symlinks 10 nil)
=> ("bar" "baz/baz/boz" "baz/booze" "baz/boz" "baz/fool" "foz")
(directory-files-recur "~/tmp" nil nil nil 'subdir 10 t)
=> ("baz" "baz/baz" "baz/baz/foo")
* dired.c (TRIVIAL_DIRECTORY_ENTRY): Reorder the strcmp arguments.
* dired.c: Remove Qsymlink, Qalive_symlink, Qdead_symlink unused
symbols. Add new symbols Qsubdir, Qsymlinks, Qfiles, Qdirs to be
used in directory-files.
* dired.c (dfr_inner): Determine separately whether a file is a
symlink or a directory. If it is a symlink further determine if
the linked file is a directory. Include the result according to the
new options and changed meanings under FILES-ONLY symbol. Determine
recursion separately of whether file is directory. Always avoid
recursion of the current and parent directories.
* dired.c (Fdirectory_files): Update DOCSTRING
* dired.c (Fdirectory_files_recur): Update DOCSTRING
* dired.c (syms_of_dired): Add new symbols Qsubdir, Qsymlinks,
Qfiles, Qdirs
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>