Commit 45b40e69e4970bdd2b06c2213809f23ec7f665af

Thomas de Grivel 2018-02-02T02:34:33

Change DIR.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/cffi-dirent.lisp b/cffi-dirent.lisp
index 33404c0..d725b93 100644
--- a/cffi-dirent.lisp
+++ b/cffi-dirent.lisp
@@ -122,6 +122,13 @@
 	    (let ((,var ,dirent))
 	      ,@body))))))
 
+(defun dir (name &key (test #'string<)
+                   (key #'dirent-name))
+  (let (dir)
+    (do-dir (d name)
+      (push d dir))
+    (sort dir test :key key)))
+
 #+test
 (do-dir (df "/")
   (format t "~&~S ~S ~S ~S ~S~%"