summaryrefslogtreecommitdiff
path: root/src/stdio/rename.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/rename.c')
-rw-r--r--src/stdio/rename.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/stdio/rename.c b/src/stdio/rename.c
new file mode 100644
index 00000000..068cd73d
--- /dev/null
+++ b/src/stdio/rename.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include "errno.h"
+#include "nonstd/syscall.h"
+
+/** rename a file **/
+int rename(const char *old, const char *new)
+{
+ SYSCALL_NUMBER(sc, "rename", -1);
+ int err = 0;
+
+ err = __syscall(sc, old, new);
+ if (err < 0) {
+ errno = -err;
+ return -1;
+ }
+
+ return 0;
+}
+
+/***
+renames a file from its original name ARGUMENT(old) to
+ARGUMENT(new).
+***/
+
+/*
+IMPLEMENTATION(Behavior if ARGUMENT(new) exists prior to THIS() being called)
+*/
+/*
+STDC(1)
+*/