New module 'perror'.
authorBruno Haible <bruno@clisp.org>
Sun, 14 Sep 2008 11:50:55 +0000 (13:50 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 14 Sep 2008 11:50:55 +0000 (13:50 +0200)
ChangeLog
MODULES.html.sh
doc/posix-functions/perror.texi
lib/stdio.in.h
m4/stdio_h.m4
modules/stdio

index bf3c9a5..addc68a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2008-09-14  Bruno Haible  <bruno@clisp.org>
 
+       New module 'perror'.
+       * lib/stdio.in.h (perror): New declaration.
+       * lib/perror.c: New file.
+       * m4/perror.m4: New file.
+       * modules/perror: New file.
+       * MODULES.html.sh (Support for systems lacking POSIX:2001): Add perror.
+       * doc/posix-functions/perror.texi: Mention the perror module.
+       * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Initialize GNULIB_PERROR,
+       REPLACE_PERROR.
+       * modules/stdio (Makefile.am): Substitute GNULIB_PERROR,
+       REPLACE_PERROR.
+
+2008-09-14  Bruno Haible  <bruno@clisp.org>
+
        * modules/stdio (Makefile.am): Reorder to match the order in
        lib/stdio.in.h.
        * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Likewise.
index 50077dc..26dd7d4 100755 (executable)
@@ -2112,6 +2112,7 @@ func_all_modules ()
   func_module mkstemp
   func_module netinet_in
   func_module open
+  func_module perror
   func_module poll
   func_module printf-posix
   func_module readlink
index d08f1d0..f5f34f0 100644 (file)
@@ -4,10 +4,14 @@
 
 POSIX specification: @url{http://www.opengroup.org/susv3xsh/perror.html}
 
-Gnulib module: ---
+Gnulib module: perror
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function does not support the error values that are specified by POSIX
+but not defined by the system, on some platforms:
+OpenBSD 4.0, OSF/1 5.1, mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 1d3170a..6a941a2 100644 (file)
@@ -395,6 +395,22 @@ extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
    getline (l, s, f))
 #endif
 
+#if @GNULIB_PERROR@
+# if @REPLACE_PERROR@
+#  define perror rpl_perror
+/* Print a message to standard error, describing the value of ERRNO,
+   (if STRING is not NULL and not empty) prefixed with STRING and ": ",
+   and terminated with a newline.  */
+extern void perror (const char *string);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef perror
+# define perror(s) \
+    (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
+                      "use gnulib module perror for portability"), \
+     perror (s))
+#endif
+
 #ifdef __cplusplus
 }
 #endif
index 7eeb1d9..a043e63 100644 (file)
@@ -39,6 +39,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   GNULIB_FFLUSH=0;               AC_SUBST([GNULIB_FFLUSH])
   GNULIB_GETDELIM=0;             AC_SUBST([GNULIB_GETDELIM])
   GNULIB_GETLINE=0;              AC_SUBST([GNULIB_GETLINE])
+  GNULIB_PERROR=0;               AC_SUBST([GNULIB_PERROR])
   dnl Assume proper GNU behavior unless another module says otherwise.
   REPLACE_FPRINTF=0;             AC_SUBST([REPLACE_FPRINTF])
   REPLACE_VFPRINTF=0;            AC_SUBST([REPLACE_VFPRINTF])
@@ -66,6 +67,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   HAVE_DECL_GETDELIM=1;          AC_SUBST([HAVE_DECL_GETDELIM])
   HAVE_DECL_GETLINE=1;           AC_SUBST([HAVE_DECL_GETLINE])
   REPLACE_GETLINE=0;             AC_SUBST([REPLACE_GETLINE])
+  REPLACE_PERROR=0;              AC_SUBST([REPLACE_PERROR])
 ])
 
 dnl Code shared by fseeko and ftello.  Determine if large files are supported,
index d660e42..03649fb 100644 (file)
@@ -43,6 +43,7 @@ stdio.h: stdio.in.h
              -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
              -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \
              -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \
+             -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \
              -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
              -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
              -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
@@ -67,6 +68,7 @@ stdio.h: stdio.in.h
              -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
              -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
              -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
+             -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              < $(srcdir)/stdio.in.h; \
        } > $@-t