#ifndef LINT
static char rcsid[] = "$Id: rename_unixstyle.c,v 8.1 1996/06/08 06:23:51 seawi Exp $";
#endif

/*
 * unix-style rename() routine for EMX/GCC OS/2; if target already exists,
 it will be overwritten. Tony Sanmarti <warper@ansaro.com>
 */

#ifdef __EMX__

#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

int rename_unixstyle(const char *old_name, const char *new_name)
{
  int result;

  if (access(new_name, F_OK) == 0) {
             chmod(new_name, S_IWRITE);
             result = remove(new_name);
             if (result) return (result);
             }
  if (access(old_name, F_OK) == 0) chmod(old_name, S_IWRITE);
  result = rename(old_name, new_name);

  return result;
};

int isc_movefile(const char *oldname, const char *newname)
{
 int result;

 result = rename_unixstyle(oldname,newname);
 return(result);
}
#endif


