1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-25 20:50:31 +02:00

Define a Scheme binding to ‘renameat’ when it exists.

* configure.ac: Detect if ‘renameat’ is defined.
* libguile/filesys.c (scm_renameat): Define a Scheme binding
  to the ‘renameat’ system call.
* doc/ref/posix.texi (File System): Document it.
* libguile/filesys.h (scm_renameat): Make it part of the C API.
* test-suite/tests/filesys.test ("rename-file-at"): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Maxime Devos 2021-11-16 11:06:31 +00:00 committed by Ludovic Courtès
parent 24028e75ca
commit 3a0554c60f
5 changed files with 149 additions and 1 deletions

View file

@ -895,6 +895,15 @@ Renames the file specified by @var{oldname} to @var{newname}.
The return value is unspecified.
@end deffn
@findex renameat
@deffn {Scheme Procedure} rename-file-at olddir oldname newdir newname
@deffnx {C Function} scm_renameat (olddir, oldname, newdir, newname)
Like @code{rename-file}, but when @var{olddir} or @var{newdir} is true,
resolve @var{oldname} or @var{newname} relative to the directory
specified by the file port @var{olddir} or @var{newdir} instead of the
current working directory.
@end deffn
@deffn {Scheme Procedure} link oldpath newpath
@deffnx {C Function} scm_link (oldpath, newpath)
Creates a new name @var{newpath} in the file system for the