diff options
author | Maxime Devos <maximedevos@telenet.be> | 2021-11-16 11:06:33 +0000 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-10-21 17:40:37 +0200 |
commit | 3b45185d8f40b5c41abfe15571550ce1a7fd4011 (patch) | |
tree | 069837a18afb4a44b90e0dcb6da5f32df436e3b5 /doc/ref/posix.texi | |
parent | 19b48b1c4a0335851a51d1ac69a24b154d401fdd (diff) | |
download | guile-3b45185d8f40b5c41abfe15571550ce1a7fd4011.tar.gz |
Define a Scheme binding to ‘unlinkat’ when it exists.
‘unlinkat’ is used for both unlinking regular files
and removing empty directories.
* configure.ac: Detect if ‘unlinkat’ exists.
* doc/ref/posix.texi (File System): Document why there is no
‘rmdirat’ procedure, and document the ‘delete-file-at’ procedure.
* libguile/filesys.c
(scm_rmdir): Adjust the docstring here as well.
(scm_delete_file_at): Define a Scheme binding to ‘unlinkat’.
* libguile/filesys.h (scm_delete_file_at): Make ‘scm_delete_file_at’
part of the C API.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'doc/ref/posix.texi')
-rw-r--r-- | doc/ref/posix.texi | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/ref/posix.texi b/doc/ref/posix.texi index 85da56ca8..7524ba5df 100644 --- a/doc/ref/posix.texi +++ b/doc/ref/posix.texi @@ -852,6 +852,18 @@ Deletes (or ``unlinks'') the file whose path is specified by @var{str}. @end deffn +@findex unlinkat +@deffn {Scheme Procedure} delete-file-at dir str [flags] +@deffnx {C Function} scm_delete_file_at (dir, str, flags) +Like @code{unlink}, but resolve @var{str} relative to the +directory referred to by the file port @var{dir} instead. + +The optional @var{flags} argument can be @code{AT_REMOVEDIR}, +in which case @code{delete-file-at} will act like @code{rmdir} instead +of @code{delete-file}. Why doesn't POSIX have a @code{rmdirat} function +for this instead? No idea! +@end deffn + @deffn {Scheme Procedure} copy-file oldfile newfile @deffnx {C Function} scm_copy_file (oldfile, newfile) Copy the file specified by @var{oldfile} to @var{newfile}. |