From b2f3ab8c42ddb13cc57a15ac756527c3a2849bec Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 21 Feb 2007 02:18:10 +0000 Subject: [PATCH] New module 'stdio'. --- ChangeLog | 10 ++++++++ MODULES.html.sh | 1 + lib/stdio_.h | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ m4/stdio_h.m4 | 29 +++++++++++++++++++++++ modules/stdio | 41 ++++++++++++++++++++++++++++++++ 5 files changed, 153 insertions(+) create mode 100644 lib/stdio_.h create mode 100644 m4/stdio_h.m4 create mode 100644 modules/stdio diff --git a/ChangeLog b/ChangeLog index 523e2dbfd..cb8c67496 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-02-20 Bruno Haible + + * modules/stdio: New file. + * lib/stdio_.h: New file, incorporating snprintf.h and vsnprintf.h. + * lib/snprintf.h: Remove file. + * lib/vsnprintf.h: Remove file. + * lib/.cppi-disable: Remove snprintf.h. + * m4/stdio_h.m4: New file. + * MODULES.html.sh (Support for systems lacking ISO C 99): Add stdio. + 2007-02-20 Jim Meyering * lib/ftruncate.c [HAVE_CHSIZE]: Document that this code is diff --git a/MODULES.html.sh b/MODULES.html.sh index c0b7b97b5..de9aa98b8 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -1840,6 +1840,7 @@ func_all_modules () func_echo "$element" func_begin_table + func_module stdio func_module snprintf func_module vsnprintf func_end_table diff --git a/lib/stdio_.h b/lib/stdio_.h new file mode 100644 index 000000000..025b4b9af --- /dev/null +++ b/lib/stdio_.h @@ -0,0 +1,72 @@ +/* A GNU-like . + + Copyright (C) 2004, 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if defined __need_FILE +/* Special invocation convention inside glibc header files. */ + +#include @ABSOLUTE_STDIO_H@ + +#else +/* Normal invocation convention. */ +#ifndef _GL_STDIO_H +#define _GL_STDIO_H + +#include @ABSOLUTE_STDIO_H@ + +#include + + +/* The definition of GL_LINK_WARNING is copied here. */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +#if @GNULIB_SNPRINTF@ +# if !@HAVE_DECL_SNPRINTF@ +extern int snprintf (char *str, size_t size, const char *format, ...); +# endif +#elif defined GNULIB_POSIXCHECK +# undef snprintf +# define snprintf \ + (GL_LINK_WARNING ("snprintf is unportable - " \ + "use gnulib module snprintf for portability"), \ + snprintf) +#endif + +#if @GNULIB_VSNPRINTF@ +# if !@HAVE_DECL_VSNPRINTF@ +extern int vsnprintf (char *str, size_t size, const char *format, va_list args); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vsnprintf +# define vsnprintf(b,s,f,a) \ + (GL_LINK_WARNING ("vsnprintf is unportable - " \ + "use gnulib module vsnprintf for portability"), \ + vsnprintf (b, s, f, a)) +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_STDIO_H */ +#endif diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 new file mode 100644 index 000000000..3ece71a46 --- /dev/null +++ b/m4/stdio_h.m4 @@ -0,0 +1,29 @@ +# stdio_h.m4 serial 1 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_STDIO_H], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + gl_ABSOLUTE_HEADER([stdio.h]) + ABSOLUTE_STDIO_H=\"$gl_cv_absolute_stdio_h\" + AC_SUBST([ABSOLUTE_STDIO_H]) +]) + +AC_DEFUN([gl_STDIO_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_STDIO_H_DEFAULTS], +[ + GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) + GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) + HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) +]) diff --git a/modules/stdio b/modules/stdio new file mode 100644 index 000000000..a45da83d4 --- /dev/null +++ b/modules/stdio @@ -0,0 +1,41 @@ +Description: +A GNU-like . + +Files: +lib/stdio_.h +m4/stdio_h.m4 + +Depends-on: +absolute-header +link-warning + +configure.ac: +gl_STDIO_H + +Makefile.am: +BUILT_SOURCES += stdio.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdio.h: stdio_.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''ABSOLUTE_STDIO_H''@|$(ABSOLUTE_STDIO_H)|g' \ + -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ + -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ + -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ + -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/stdio_.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += stdio.h stdio.h-t + +Include: +#include + +License: +LGPL + +Maintainer: +all -- 2.11.0