scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 6bebff844a6aa4f95675dc7beae9ff24d06464b0
parent 7fd2f3863ae891c34bb5e87679b256c48843c543
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Thu, 19 May 2022 18:46:41 +0200

libc: stdio: add rename()

Diffstat:
Msrc/libc/arch/amd64/openbsd/.gitignore | 1+
Msrc/libc/arch/amd64/openbsd/Makefile | 1+
Msrc/libc/arch/amd64/openbsd/syscall.lst | 1+
Msrc/libc/objs/amd64-openbsd.mk | 1+
Msrc/libc/objs/common-objs.mk | 1+
Msrc/libc/stdio/Makefile | 1+
Asrc/libc/stdio/rename.c | 11+++++++++++
Msrc/libc/syscall.h | 1+
8 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/libc/arch/amd64/openbsd/.gitignore b/src/libc/arch/amd64/openbsd/.gitignore @@ -11,6 +11,7 @@ _kill.s _lseek.s _open.s _read.s +_rename.s _sigaction.s _sys_errlist.c _unlink.s diff --git a/src/libc/arch/amd64/openbsd/Makefile b/src/libc/arch/amd64/openbsd/Makefile @@ -18,6 +18,7 @@ GENOBJS =\ _lseek.$O\ _open.$O\ _read.$O\ + _rename.$O\ _sigaction.$O\ _unlink.$O\ _write.$O\ diff --git a/src/libc/arch/amd64/openbsd/syscall.lst b/src/libc/arch/amd64/openbsd/syscall.lst @@ -16,4 +16,5 @@ 59 _execve 3 67 _gettimeofday 2 122 _kill 2 +128 _rename 2 198 _lseek 3 diff --git a/src/libc/objs/amd64-openbsd.mk b/src/libc/objs/amd64-openbsd.mk @@ -15,6 +15,7 @@ OBJS =\ arch/amd64/openbsd/_lseek.$O\ arch/amd64/openbsd/_open.$O\ arch/amd64/openbsd/_read.$O\ + arch/amd64/openbsd/_rename.$O\ arch/amd64/openbsd/_sigaction.$O\ arch/amd64/openbsd/_unlink.$O\ arch/amd64/openbsd/_wait4.$O\ diff --git a/src/libc/objs/common-objs.mk b/src/libc/objs/common-objs.mk @@ -51,6 +51,7 @@ COMMON_OBJS =\ stdio/putchar.$O\ stdio/puts.$O\ stdio/remove.$O\ + stdio/rename.$O\ stdio/rewind.$O\ stdio/setbuf.$O\ stdio/setvbuf.$O\ diff --git a/src/libc/stdio/Makefile b/src/libc/stdio/Makefile @@ -33,6 +33,7 @@ OBJS =\ putchar.$O\ puts.$O\ remove.$O\ + rename.$O\ rewind.$O\ setbuf.$O\ setvbuf.$O\ diff --git a/src/libc/stdio/rename.c b/src/libc/stdio/rename.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +#include "../syscall.h" + +#undef rename + +int +rename(const char *old, const char *new) +{ + return _rename(old, new); +} diff --git a/src/libc/syscall.h b/src/libc/syscall.h @@ -7,3 +7,4 @@ extern int _unlink(const char *); extern int _write(int, void *, size_t); extern int _access(const char *, int); extern long _lseek(int, long, int); +extern int _rename(const char *, const char *);