Commit 4b9cce4b3db02ef0128e0efa13ef5aabbe83a0e4

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

Add missing functions and export missing symbols.

diff --git a/cffi-dirent.lisp b/cffi-dirent.lisp
index 419833e..33404c0 100644
--- a/cffi-dirent.lisp
+++ b/cffi-dirent.lisp
@@ -64,6 +64,37 @@
 	    (error-errno "readdir"))
 	dirent)))
 
+(defcfun ("rewinddir" c-rewinddir) :void
+  (dirp :pointer))
+
+(defun rewinddir (dir)
+  (c-rewinddir dir))
+
+(defcfun ("seekdir" c-seekdir) :void
+  (dirp :pointer)
+  (pos :long))
+
+(defun seekdir (dirp pos)
+  (c-seekdir dirp pos))
+
+(defcfun ("telldir" c-telldir) :long
+  (dirp :pointer))
+
+(defun telldir (dir)
+  (let ((pos (c-telldir dir)))
+    (if (= -1 pos)
+        (error-errno "telldir")
+        pos)))
+
+(defcfun ("dirfd" c-dirfd) :int
+  (dirp :pointer))
+
+(defun dirfd (dir)
+  (let ((fd (c-dirfd dir)))
+    (if (< fd 0)
+        (error-errno "dirfd")
+        fd)))
+
 (defun dirent-ino (dirent)
   (foreign-slot-value dirent '(:struct dirent) 'd-ino))
 
diff --git a/package.lisp b/package.lisp
index 65cc48a..5f15281 100644
--- a/package.lisp
+++ b/package.lisp
@@ -40,9 +40,24 @@
    #:closedir
    #:with-dir
    #:readdir
+   #:dirent-ino
+   #:dirent-off
+   #:dirent-reclen
+   #:dirent-type
    #:dirent-name
    #:do-dir
+   #:dir
    #:readdir-r
    #:rewinddir
    #:seekdir
-   #:telldir))
+   #:telldir
+   #:dirfd
+   #:+dt-unknown+
+   #:+dt-fifo+
+   #:+dt-chr+
+   #:+dt-dir+
+   #:+dt-blk+
+   #:+dt-reg+
+   #:+dt-lnk+
+   #:+dt-sock+
+   #:+dt-wht+))