OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [libiberty/] [rename.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* rename -- rename a file
2
   This function is in the public domain. */
3
 
4
/* Rename a file.  */
5
 
6
#ifdef HAVE_CONFIG_H
7
#include "config.h"
8
#endif
9
#include <errno.h>
10
#ifdef HAVE_UNISTD_H
11
#include <unistd.h>
12
#endif
13
 
14
int
15
rename (zfrom, zto)
16
     char *zfrom;
17
     char *zto;
18
{
19
  if (link (zfrom, zto) < 0)
20
    {
21
      if (errno != EEXIST)
22
        return -1;
23
      if (unlink (zto) < 0
24
          || link (zfrom, zto) < 0)
25
        return -1;
26
    }
27
  return unlink (zfrom);
28
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.