summaryrefslogtreecommitdiff
path: root/src/stdio/rename.c
blob: 068cd73d2b1a028d187f8a6f190483a6adcba594 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)
*/