guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: delete-file ??


From: Bruce Korb
Subject: Re: delete-file ??
Date: Mon, 15 Jul 2002 17:03:16 -0700

Rob Browning wrote:

> That sounds like a good idea to me, though we might need another
> function.  I'm not sure what the error/return semantics of delete-file...

Read the source, Luke :-(

> SCM_DEFINE (scm_delete_file, "delete-file", 1, 0, 0, 
>            (SCM str),
>   "Deletes (or \"unlinks\") the file specified by @var{path}.")
> #define FUNC_NAME s_scm_delete_file
> {
>   int ans;
>   SCM_VALIDATE_STRING (1, str);
>   SCM_SYSCALL (ans = unlink (SCM_STRING_CHARS (str)));
>   if (ans != 0)
>     SCM_SYSERROR;
>   return SCM_UNSPECIFIED;
> }
> #undef FUNC_NAME

You're right:

> SCM_DEFINE (scm_unlink, "unlink", 1, 0, 0, 
>            (SCM path),
>   "Unlinks (or \"deletes\") the file specified by @var{path}.")
> #define FUNC_NAME s_scm_unlink
> {
>   int ans;
>   SCM_VALIDATE_STRING (1, path);
>   SCM_SYSCALL (ans = unlink (SCM_STRING_CHARS (path)));
>   return gh_int2scm( ans );
> }
> #undef FUNC_NAME
>
> SCM_DEFINE (scm_delete_file, "delete-file", 1, 0, 0, 
>            (SCM path),
>   "Deletes (or \"unlinks\") the file specified by @var{path}.")
> #define FUNC_NAME s_scm_delete_file
> {
>   SCM res = scm_unlink( path );
>   return (gh_scm2int( res ) != 0) ? SCM_SYSERROR : SCM_UNSPECIFIED;
> }
> #undef FUNC_NAME

And, yes, I know "gh_*" is deprecated.  I'm sure you can fix it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]