aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sh/rename.c
blob: 799cb69767acfb416e13746ff4047641aba34a49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * rename - rename a file
 */

#include <config.h>

#if !defined (HAVE_RENAME)

#include <bashtypes.h>

#if defined (HAVE_UNISTD_H)
#  include <unistd.h>
#endif

#include <stdc.h>

int
rename (from, to)
     const char *from, *to;
{
  unlink (to);
  if (link (from, to) < 0)
    return (-1);
  unlink (from);
  return (0);
}
#endif /* !HAVE_RENAME */