From: Bruno Haible Date: Sun, 14 Sep 2008 11:50:55 +0000 (+0200) Subject: New module 'perror'. X-Git-Tag: v0.1~7049 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=3aa0d4da24ba7b52282b1d124b4118e4e8a46a2b;p=gnulib.git New module 'perror'. --- diff --git a/ChangeLog b/ChangeLog index bf3c9a546..addc68a49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2008-09-14 Bruno Haible + 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 + * modules/stdio (Makefile.am): Reorder to match the order in lib/stdio.in.h. * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Likewise. diff --git a/MODULES.html.sh b/MODULES.html.sh index 50077dc4a..26dd7d4a7 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -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 diff --git a/doc/posix-functions/perror.texi b/doc/posix-functions/perror.texi index d08f1d042..f5f34f088 100644 --- a/doc/posix-functions/perror.texi +++ b/doc/posix-functions/perror.texi @@ -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: diff --git a/lib/stdio.in.h b/lib/stdio.in.h index 1d3170a94..6a941a258 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -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 diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index 7eeb1d991..a043e63bc 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -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, diff --git a/modules/stdio b/modules/stdio index d660e429c..03649fbe1 100644 --- a/modules/stdio +++ b/modules/stdio @@ -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