[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
new module stdio
From: |
Bruno Haible |
Subject: |
new module stdio |
Date: |
Wed, 21 Feb 2007 03:25:19 +0100 |
User-agent: |
KMail/1.5.4 |
This is the semi-"complete" <stdio.h>. It replaces the snprintf.h and
vsnprintf.h headers. So, it paves the way for new POSIX-compatible printf,
fprintf etc. replacements that Daniel Jacobowitz and/or Ben Pfaff want to
contribute.
2007-02-20 Bruno Haible <address@hidden>
* modules/vsnprintf (Files): Remove lib/vsnprintf.h.
(Depends-on): Add stdio.
(configure.ac): Invoke gl_STDIO_MODULE_INDICATOR.
(Include): Use <stdio.h> instead of vsnprintf.h.
* m4/vsnprintf.m4 (gl_FUNC_VSNPRINTF): Require gl_STDIO_H_DEFAULTS. Set
HAVE_DECL_VSNPRINTF.
* lib/vsnprintf.c: Include <stdio.h> instead of vsnprintf.h.
* modules/snprintf (Files): Remove lib/snprintf.h.
(Depends-on): Add stdio.
(configure.ac): Invoke gl_STDIO_MODULE_INDICATOR.
(Include): Use <stdio.h> instead of snprintf.h.
* m4/snprintf.m4 (gl_FUNC_SNPRINTF): Require gl_STDIO_H_DEFAULTS. Set
HAVE_DECL_SNPRINTF.
* lib/snprintf.c: Include <stdio.h> instead of snprintf.h.
* lib/getaddrinfo.c: Likewise.
* 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.
============================== modules/stdio ===============================
Description:
A GNU-like <stdio.h>.
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 <stdio.h> when the system
# doesn't have one that works with the given compiler.
stdio.h: stdio_.h
rm -f address@hidden $@
{ 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; \
} > address@hidden
mv address@hidden $@
MOSTLYCLEANFILES += stdio.h stdio.h-t
Include:
#include <stdio.h>
License:
LGPL
Maintainer:
all
============================== lib/stdio_.h ================================
/* A GNU-like <stdio.h>.
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 <stdarg.h>
/* The definition of GL_LINK_WARNING is copied here. */
#ifdef __cplusplus
extern "C" {
#endif
#if @GNULIB_SNPRINTF@
# if address@hidden@
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 address@hidden@
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
============================== m4/stdio_h.m4 ===============================
# 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])
])
============================================================================
*** MODULES.html.sh 18 Feb 2007 15:41:59 -0000 1.198
--- MODULES.html.sh 21 Feb 2007 02:07:13 -0000
***************
*** 1840,1845 ****
--- 1840,1846 ----
func_echo "$element"
func_begin_table
+ func_module stdio
func_module snprintf
func_module vsnprintf
func_end_table
*** lib/.cppi-disable 26 Jan 2007 22:16:55 -0000 1.26
--- lib/.cppi-disable 21 Feb 2007 02:07:14 -0000
***************
*** 29,35 ****
regex.h
regex_internal.c
regex_internal.h
- snprintf.h
socket_.h
stat-time.h
stdbool_.h
--- 29,34 ----
*** lib/getaddrinfo.c 26 Jan 2007 22:16:55 -0000 1.21
--- lib/getaddrinfo.c 21 Feb 2007 02:07:14 -0000
***************
*** 31,36 ****
--- 31,39 ----
/* Get memcpy, strdup. */
#include <string.h>
+ /* Get snprintf. */
+ #include <stdio.h>
+
#include <stdbool.h>
#include "gettext.h"
***************
*** 38,44 ****
#define N_(String) String
#include "inet_ntop.h"
- #include "snprintf.h"
/* BeOS has AF_INET, but not PF_INET. */
#ifndef PF_INET
--- 41,46 ----
*** lib/snprintf.c 13 Sep 2006 22:38:14 -0000 1.11
--- lib/snprintf.c 21 Feb 2007 02:07:14 -0000
***************
*** 1,5 ****
/* Formatted output to strings.
! Copyright (C) 2004, 2006 Free Software Foundation, Inc.
Written by Simon Josefsson and Paul Eggert.
This program is free software; you can redistribute it and/or modify
--- 1,5 ----
/* Formatted output to strings.
! Copyright (C) 2004, 2006-2007 Free Software Foundation, Inc.
Written by Simon Josefsson and Paul Eggert.
This program is free software; you can redistribute it and/or modify
***************
*** 18,24 ****
#include <config.h>
! #include "snprintf.h"
#include <errno.h>
#include <limits.h>
--- 18,25 ----
#include <config.h>
! /* Specification. */
! #include <stdio.h>
#include <errno.h>
#include <limits.h>
*** lib/vsnprintf.c 28 Aug 2006 16:04:14 -0000 1.3
--- lib/vsnprintf.c 21 Feb 2007 02:07:14 -0000
***************
*** 1,5 ****
/* Formatted output to strings.
! Copyright (C) 2004, 2006 Free Software Foundation, Inc.
Written by Simon Josefsson and Yoann Vandoorselaere <address@hidden>.
This program is free software; you can redistribute it and/or modify
--- 1,5 ----
/* Formatted output to strings.
! Copyright (C) 2004, 2006-2007 Free Software Foundation, Inc.
Written by Simon Josefsson and Yoann Vandoorselaere <address@hidden>.
This program is free software; you can redistribute it and/or modify
***************
*** 21,32 ****
#endif
/* Specification. */
! #include "vsnprintf.h"
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
- #include <stdio.h>
#include <stdlib.h>
#include <string.h>
--- 21,31 ----
#endif
/* Specification. */
! #include <stdio.h>
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
*** m4/snprintf.m4 23 Jan 2005 08:06:57 -0000 1.3
--- m4/snprintf.m4 21 Feb 2007 02:07:14 -0000
***************
*** 1,13 ****
! # snprintf.m4 serial 2
! dnl Copyright (C) 2002, 2003, 2004 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_FUNC_SNPRINTF],
[
AC_REPLACE_FUNCS(snprintf)
AC_CHECK_DECLS_ONCE(snprintf)
gl_PREREQ_SNPRINTF
])
--- 1,17 ----
! # snprintf.m4 serial 3
! dnl Copyright (C) 2002, 2003, 2004, 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_FUNC_SNPRINTF],
[
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AC_REPLACE_FUNCS(snprintf)
AC_CHECK_DECLS_ONCE(snprintf)
+ if test $ac_cv_have_decl_snprintf = no; then
+ HAVE_DECL_SNPRINTF=0
+ fi
gl_PREREQ_SNPRINTF
])
*** m4/vsnprintf.m4 23 Jan 2005 08:06:57 -0000 1.2
--- m4/vsnprintf.m4 21 Feb 2007 02:07:14 -0000
***************
*** 1,13 ****
! # vsnprintf.m4 serial 2
! dnl Copyright (C) 2002, 2003, 2004 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_FUNC_VSNPRINTF],
[
AC_REPLACE_FUNCS(vsnprintf)
AC_CHECK_DECLS_ONCE(vsnprintf)
gl_PREREQ_VSNPRINTF
])
--- 1,17 ----
! # vsnprintf.m4 serial 3
! dnl Copyright (C) 2002, 2003, 2004, 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_FUNC_VSNPRINTF],
[
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AC_REPLACE_FUNCS(vsnprintf)
AC_CHECK_DECLS_ONCE(vsnprintf)
+ if test $ac_cv_have_decl_vsnprintf = no; then
+ HAVE_DECL_VSNPRINTF=0
+ fi
gl_PREREQ_VSNPRINTF
])
*** modules/snprintf 13 Oct 2006 12:40:23 -0000 1.6
--- modules/snprintf 21 Feb 2007 02:07:14 -0000
***************
*** 2,21 ****
snprintf() function: print formatted output to a fixed length string
Files:
- lib/snprintf.h
lib/snprintf.c
m4/snprintf.m4
Depends-on:
vasnprintf
configure.ac:
gl_FUNC_SNPRINTF
Makefile.am:
Include:
! "snprintf.h"
License:
LGPL
--- 2,22 ----
snprintf() function: print formatted output to a fixed length string
Files:
lib/snprintf.c
m4/snprintf.m4
Depends-on:
+ stdio
vasnprintf
configure.ac:
gl_FUNC_SNPRINTF
+ gl_STDIO_MODULE_INDICATOR([snprintf])
Makefile.am:
Include:
! <stdio.h>
License:
LGPL
*** modules/vsnprintf 13 Oct 2006 12:40:23 -0000 1.3
--- modules/vsnprintf 21 Feb 2007 02:07:14 -0000
***************
*** 3,23 ****
to a fixed length string
Files:
- lib/vsnprintf.h
lib/vsnprintf.c
m4/vsnprintf.m4
Depends-on:
vasnprintf
minmax
configure.ac:
gl_FUNC_VSNPRINTF
Makefile.am:
Include:
! "vsnprintf.h"
License:
LGPL
--- 3,24 ----
to a fixed length string
Files:
lib/vsnprintf.c
m4/vsnprintf.m4
Depends-on:
+ stdio
vasnprintf
minmax
configure.ac:
gl_FUNC_VSNPRINTF
+ gl_STDIO_MODULE_INDICATOR([vsnprintf])
Makefile.am:
Include:
! <stdio.h>
License:
LGPL
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- new module stdio,
Bruno Haible <=