opendir,readdir,closedir functions - gcl.git - GNU Common Lisp

index : gcl.git
GNU Common Lisp
summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamm Maguire <camm@debian.org>2013年11月08日 16:35:55 +0000
committerCamm Maguire <camm@debian.org>2013年11月08日 17:01:58 +0000
commitfda8341283acbc0cca36eab4fe6c82f64f5e261e (patch)
tree1446b1084b6e54a254773677211ede52adf9c4c8
parent18628ebae2f8f55e09ea839bf784c82271bc4634 (diff)
downloadgcl-fda8341283acbc0cca36eab4fe6c82f64f5e261e.tar.gz
opendir,readdir,closedir functions
Diffstat
-rwxr-xr-xgcl/o/unixfsys.c 25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcl/o/unixfsys.c b/gcl/o/unixfsys.c
index d324be2b3..c7260ed3d 100755
--- a/gcl/o/unixfsys.c
+++ b/gcl/o/unixfsys.c
@@ -851,6 +851,31 @@ LFD(Ldirectory)()
}
#endif
+#include <sys/types.h>
+#include <dirent.h>
+
+DEFUN("OPENDIR",fixnum,fSopendir,SI,1,1,NONE,IO,OO,OO,OO,(object x),"") {
+ DIR *d;
+ char filename[MAXPATHLEN];
+ check_type_string(&x);
+ memcpy(filename,x->st.st_self,x->st.st_fillp);
+ filename[x->st.st_fillp]=0;
+ d=opendir(filename);
+ return (fixnum)d;
+}
+
+DEFUN("READDIR",object,fSreaddir,SI,1,1,NONE,OI,OO,OO,OO,(fixnum x),"") {
+ struct dirent *e;
+ if (!x) RETURN1(Cnil);
+ e=readdir((DIR *)x);
+ RETURN1(e ? make_simple_string(e->d_name) : Cnil);
+}
+
+DEFUN("CLOSEDIR",object,fSclosedir,SI,1,1,NONE,OI,OO,OO,OO,(fixnum x),"") {
+ closedir((DIR *)x);
+ return Cnil;
+}
+
static void
FFN(siLchdir)(void)
{
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月02日 21:58:40 +0000

AltStyle によって変換されたページ (->オリジナル) /