URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 579 |
Rev 1765 |
/* rename -- rename a file
|
/* rename -- rename a file
|
This function is in the public domain. */
|
This function is in the public domain. */
|
|
|
/* Rename a file. */
|
/* Rename a file. */
|
|
|
#include <errno.h>
|
#include <errno.h>
|
|
|
int
|
int
|
rename (zfrom, zto)
|
rename (zfrom, zto)
|
char *zfrom;
|
char *zfrom;
|
char *zto;
|
char *zto;
|
{
|
{
|
if (link (zfrom, zto) < 0)
|
if (link (zfrom, zto) < 0)
|
{
|
{
|
if (errno != EEXIST)
|
if (errno != EEXIST)
|
return -1;
|
return -1;
|
if (unlink (zto) < 0
|
if (unlink (zto) < 0
|
|| link (zfrom, zto) < 0)
|
|| link (zfrom, zto) < 0)
|
return -1;
|
return -1;
|
}
|
}
|
return unlink (zfrom);
|
return unlink (zfrom);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.