moving file-exists? to (chibi filesystem)

This commit is contained in:
Alex Shinn 2009-12-27 00:45:28 +09:00
parent 23411056c2
commit 3c2615e2a7
5 changed files with 3 additions and 11 deletions

9
eval.c
View file

@ -2038,15 +2038,6 @@ static sexp sexp_close_port (sexp ctx, sexp port) {
return SEXP_VOID;
}
#ifndef PLAN9
static sexp sexp_file_exists_p (sexp ctx, sexp path) {
struct stat buf;
if (! sexp_stringp(path))
return sexp_type_exception(ctx, "not a string", path);
return (stat(sexp_string_data(path), &buf) ? SEXP_FALSE : SEXP_TRUE);
}
#endif
void sexp_warn_undefs (sexp ctx, sexp from, sexp to, sexp out) {
sexp x;
for (x=from; sexp_pairp(x) && x!=to; x=sexp_cdr(x))

View file

@ -14,7 +14,7 @@
file-access-time file-modification-time file-change-time
file-regular? file-directory? file-character?
file-block? file-fifo? file-link?
file-socket?
file-socket? file-exists?
get-file-descriptor-flags set-file-descriptor-flags!
get-file-descriptor-status set-file-descriptor-status!
open/read open/write open/read-write

View file

@ -37,3 +37,4 @@
(define (file-link? x) (S_ISLNK (file-mode x)))
(define (file-socket? x) (S_ISSOCK (file-mode x)))
(define (file-exists? x) (and (file-status file) #t))

View file

@ -142,7 +142,6 @@ _FN2OPTP(SEXP_PROCEDURE, SEXP_OPORT, "disasm", (sexp)"*current-error-port*", sex
#if PLAN9
#include "opt/plan9-opcodes.c"
#endif
_FN1(SEXP_STRING, "file-exists?", 0, sexp_file_exists_p),
#if SEXP_USE_MODULES
_FN1(SEXP_ENV, "env-exports", 0, sexp_env_exports),
_FN1(SEXP_STRING, "find-module-file", 0, sexp_find_module_file_op),

View file

@ -16,3 +16,4 @@ _FN1(SEXP_STRING, "change-directory", 0, sexp_chdir),
_FN0("wait", 0, sexp_wait),
_FN2(SEXP_FIXNUM, SEXP_STRING, "post-note", 0, sexp_postnote),
_FN4(SEXP_PAIR, SEXP_STRING, "%postmountsrv", 0, sexp_postmountsrv),
_FN1(SEXP_STRING, "file-exists?", 0, sexp_file_exists_p),