author | Camm Maguire <camm@debian.org> | 2013年11月08日 16:35:55 +0000 |
---|---|---|
committer | Camm Maguire <camm@debian.org> | 2013年11月08日 17:01:58 +0000 |
commit | fda8341283acbc0cca36eab4fe6c82f64f5e261e (patch) | |
tree | 1446b1084b6e54a254773677211ede52adf9c4c8 | |
parent | 18628ebae2f8f55e09ea839bf784c82271bc4634 (diff) | |
download | gcl-fda8341283acbc0cca36eab4fe6c82f64f5e261e.tar.gz |
-rwxr-xr-x | gcl/o/unixfsys.c | 25 |
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) { |