diff lib/stdio.in.h @ 11972:24ed6ac9fe07

rename: modernize replacement * modules/rename (Depends-on): Add stdio. (configure.ac): Declare witness. * m4/rename.m4 (gl_FUNC_RENAME): Ensure dependency order, and let stdio take care of replacement. * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Add new defaults. * modules/stdio (Makefile.am): Substitute them. * lib/stdio.in.h (rename): Declare replacement. * lib/rename.c (includes): Allow cross-compilation to non-windows machines. * doc/posix-functions/rename.texi (rename): Improve documentation. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Mon, 07 Sep 2009 11:27:05 -0600 (2009-09-07)
parents 229df0a197d3
children 73e9ab6e2c90
line wrap: on
line diff
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -416,6 +416,20 @@
 extern int puts (const char *string);
 #endif
 
+#if @GNULIB_RENAME@
+# if @REPLACE_RENAME@
+#  undef rename
+#  define rename rpl_rename
+extern int rename (const char *old, const char *new);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef rename
+# define rename(o,n)					   \
+   (GL_LINK_WARNING ("rename is buggy on some platforms - " \
+                     "use gnulib module rename for more portability"), \
+    rename (o, n))
+#endif
+
 #if @GNULIB_SNPRINTF@
 # if @REPLACE_SNPRINTF@
 #  define snprintf rpl_snprintf