From 3908c985922d653fa47775dfbf5d2d29ff7c4fa0 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 18 Sep 2007 19:32:43 +0000 Subject: 2007-09-18 Jeff Johnston * libc/reent/renamer.c: New file. * libc/reent/Makefile.am: Add new file. * libc/reent/Makefile.in: Regenerated. * libc/stdio/rename.c: Break out _rename_r code into reent/renamer.c and add check for rename syscall. --- newlib/libc/stdio/rename.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) (limited to 'newlib/libc/stdio/rename.c') diff --git a/newlib/libc/stdio/rename.c b/newlib/libc/stdio/rename.c index 4fa8e39..6eb1f7d 100644 --- a/newlib/libc/stdio/rename.c +++ b/newlib/libc/stdio/rename.c @@ -21,27 +21,17 @@ FUNCTION INDEX rename -INDEX - _rename_r ANSI_SYNOPSIS #include int rename(const char *<[old]>, const char *<[new]>); - int _rename_r(struct _reent *<[reent]>, - const char *<[old]>, const char *<[new]>); - TRAD_SYNOPSIS #include int rename(<[old]>, <[new]>) char *<[old]>; char *<[new]>; - int _rename_r(<[reent]>, <[old]>, <[new]>) - struct _reent *<[reent]>; - char *<[old]>; - char *<[new]>; - DESCRIPTION Use <> to establish a new name (the string at <[new]>) for a file now known by the string at <[old]>. After a successful @@ -50,9 +40,6 @@ file now known by the string at <[old]>. After a successful If <> fails, the file named <<*<[old]>>> is unaffected. The conditions for failure depend on the host operating system. -The alternate function <<_rename_r>> is a reentrant version. The -extra argument <[reent]> is a pointer to a reentrancy structure. - RETURNS The result is either <<0>> (when successful) or <<-1>> (when the file could not be renamed). @@ -70,27 +57,6 @@ Supporting OS subroutines required: <>, <>, or <>. #include #include -int -_DEFUN(_rename_r, (ptr, old, new), - struct _reent *ptr _AND - _CONST char *old _AND - _CONST char *new) -{ -#ifdef HAVE_RENAME - return _rename (old,new); -#else - if (_link_r (ptr, old, new) == -1) - return -1; - - if (_unlink_r (ptr, old) == -1) - { - /* ??? Should we unlink new? (rhetorical question) */ - return -1; - } -#endif - return 0; -} - #ifndef _REENT_ONLY int -- cgit v1.1