summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/_rename_r.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-12-28 18:55:31 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-12-28 18:55:31 +0000
commit477996368827f818daf6a9dcf9de2d3e8d875fe4 (patch)
treeec4a98d647337ff2e084c9cd1e2ae0af5ad6303c /cpukit/libcsupport/src/_rename_r.c
parent2007-12-22 Chris Johns <chrisj@rtems.org> (diff)
downloadrtems-477996368827f818daf6a9dcf9de2d3e8d875fe4.tar.bz2
2007-12-28 Joel Sherrill <joel.sherrill@OARcorp.com>
* libcsupport/Makefile.am: _rename_r is required by newlib 1.16.0. Hopefully this implementation is OK. * libcsupport/src/_rename_r.c: New file.
Diffstat (limited to 'cpukit/libcsupport/src/_rename_r.c')
-rw-r--r--cpukit/libcsupport/src/_rename_r.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/_rename_r.c b/cpukit/libcsupport/src/_rename_r.c
new file mode 100644
index 0000000000..b0a636f468
--- /dev/null
+++ b/cpukit/libcsupport/src/_rename_r.c
@@ -0,0 +1,40 @@
+/*
+ * _rename_r() - POSIX 1003.1b - 5.3.4 - Rename a file
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <reent.h>
+
+#include <rtems.h>
+#include <rtems/libio.h>
+#include <errno.h>
+
+#include <rtems/libio_.h>
+#include <rtems/seterr.h>
+
+int _rename_r(
+ struct _reent *ptr,
+ const char *old,
+ const char *new
+)
+{
+ int s;
+
+ s = link( old, new );
+ if ( !s )
+ return s;
+ return unlink( old );
+}