summaryrefslogtreecommitdiff
path: root/src/stdio/rename.c
blob: 43500cf31c23cb5b9f12add4119b4c41e013fdf2 (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 "../_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)
*/