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

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [gdb-5.0/] [libiberty/] [rename.c] - Diff between revs 579 and 1765

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);
}
}
 
 

powered by: WebSVN 2.1.0

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