diff options
author | Jari Aalto <jari.aalto@cante.net> | 1999-02-19 17:11:39 +0000 |
---|---|---|
committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:52 +0000 |
commit | b72432fdcc59300c6fe7c9d6c8a31ad3447933f5 (patch) | |
tree | b9899162338c2ff3fd83a8aef8831cb119e85cd7 /lib/sh/rename.c | |
parent | bc4cd23ce958feda898c618215f94d8a4e8f4ffa (diff) | |
download | bash-b72432fdcc59300c6fe7c9d6c8a31ad3447933f5.tar.gz |
Imported from ../bash-2.03.tar.gz.
Diffstat (limited to 'lib/sh/rename.c')
-rw-r--r-- | lib/sh/rename.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/sh/rename.c b/lib/sh/rename.c new file mode 100644 index 00000000..799cb697 --- /dev/null +++ b/lib/sh/rename.c @@ -0,0 +1,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 */ |