File:  [MW Coherent from dump] / coherent / g / usr / lib / uucp / tay104 / unix / rename.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:35 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/* rename.c
   Rename a file to a new name (Unix specific implementation).  */

#include "uucp.h"

#include "sysdep.h"

#include <errno.h>

/* This implementation will not work on directories, but fortunately
   we never want to rename directories.  */

int
rename (zfrom, zto)
     const char *zfrom;
     const char *zto;
{
  if (link (zfrom, zto) < 0)
    {
      if (errno != EEXIST)
	return -1;
      if (unlink (zto) < 0
	  || link (zfrom, zto) < 0)
	return -1;
    }
  return unlink (zfrom);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.