Added current-directory parameter that gets/sets cwd.

This commit is contained in:
Abdulaziz Ghuloum
2008-05-03 02:39:49 -04:00
parent 7e5d053fb2
commit 5f92e4b96d
4 changed files with 44 additions and 3 deletions
+22
View File
@@ -32,6 +32,7 @@
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <sys/param.h>
#ifdef __CYGWIN__
#include "ikarus-winmmap.h"
#endif
@@ -991,6 +992,27 @@ ikrt_nanosleep(ikptr secs, ikptr nsecs, ikpcb* pcb){
return fix(nanosleep(&t, NULL));
}
ikptr
ikrt_chdir(ikptr pathbv, ikpcb* pcb){
int err = chdir(off_bytevector_data+(char*)pathbv);
return fix(err); /* FIXME: provide more meaninful result */
}
ikptr
ikrt_getcwd(ikpcb* pcb){
char buff[MAXPATHLEN+1];
char* path = getcwd(buff, MAXPATHLEN);
if(! path){
return fix(-1); /* FIXME: provide more meaninful result */
}
int len = strlen(path);
ikptr bv = ik_safe_alloc(pcb, align(disp_bytevector_data+len+1));
ref(bv,0) = fix(len);
strncpy(disp_bytevector_data+(char*)(bv), path, len);
return bv+bytevector_tag;
}
ikptr
ikrt_debug(ikptr x){