1989-05-30 13:34:25 +00:00
|
|
|
/*
|
|
|
|
* rename.c - rename a file
|
|
|
|
*/
|
1994-06-24 14:02:31 +00:00
|
|
|
/* $Id$ */
|
1989-05-30 13:34:25 +00:00
|
|
|
|
2007-04-21 23:18:14 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
1989-05-30 13:34:25 +00:00
|
|
|
|
2016-08-08 21:55:47 +00:00
|
|
|
/* Disabled, dtrg: rename is a system call these days. */
|
|
|
|
#if 0
|
1990-01-22 11:13:26 +00:00
|
|
|
int _link(const char *name1, const char *name2);
|
1989-05-30 13:34:25 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
rename(const char *old, const char *new) {
|
1990-01-22 11:13:26 +00:00
|
|
|
if (!_link(old, new))
|
1989-05-30 13:34:25 +00:00
|
|
|
return remove(old);
|
|
|
|
else return -1;
|
|
|
|
}
|
1990-09-11 10:26:42 +00:00
|
|
|
#endif
|