repo.or.cz
/
binutils.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
1999-09-11 Donn Terry <donn@interix.com>
[binutils.git]
/
libiberty
/
rename.c
blob
ae26e2d004079e0e955369cb5f8982bf76ee9037
1
/* rename -- rename a file
2
This function is in the public domain. */
3
4
/* Rename a file. */
5
6
#include <errno.h>
7
8
int
9
rename
(
zfrom
,
zto
)
10
char
*
zfrom
;
11
char
*
zto
;
12
{
13
if
(
link
(
zfrom
,
zto
) <
0
)
14
{
15
if
(
errno
!=
EEXIST
)
16
return
-
1
;
17
if
(
unlink
(
zto
) <
0
18
||
link
(
zfrom
,
zto
) <
0
)
19
return
-
1
;
20
}
21
return
unlink
(
zfrom
);
22
}