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

Subversion Repositories or1k

[/] [or1k/] [branches/] [oc/] [gdb-5.0/] [libiberty/] [rename.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/* 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
}

powered by: WebSVN 2.1.0

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