* lib/fpurge.h: Delete...
* lib/stdio.in.h (fpurge): ...and declare here, instead.
* lib/fpurge.c (fpurge): Change declaring header.
* modules/fpurge (Files): Drop deleted file.
(Depends-on): Add stdio.
(configure.ac): Set witness.
* modules/stdio (Makefile.am): Support fpurge macros.
* m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Likewise.
* m4/fpurge.m4 (gl_FUNC_FPURGE): Set appropriate variables.
* lib/fflush.c: Update client.
* tests/test-fpurge.c: Likewise.
* NEWS: Mention the change.
Signed-off-by: Eric Blake <ebb9@byu.net>
+2009-06-25 Eric Blake <ebb9@byu.net>
+
+ fpurge: migrate into <stdio.h>
+ * lib/fpurge.h: Delete...
+ * lib/stdio.in.h (fpurge): ...and declare here, instead.
+ * lib/fpurge.c (fpurge): Change declaring header.
+ * modules/fpurge (Files): Drop deleted file.
+ (Depends-on): Add stdio.
+ (configure.ac): Set witness.
+ * modules/stdio (Makefile.am): Support fpurge macros.
+ * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Likewise.
+ * m4/fpurge.m4 (gl_FUNC_FPURGE): Set appropriate variables.
+ * lib/fflush.c: Update client.
+ * tests/test-fpurge.c: Likewise.
+ * NEWS: Mention the change.
+
2009-06-25 Sergey Poznyakoff <gray@gnu.org.ua>
* lib/argp-version-etc.c (program_authors): Add const
Date Modules Changes
+2009-06-25 fpurge The include file is changed from "fpurge.h" to
+ <stdio.h>.
+
2009-04-26 modules/uniconv/u8-conv-from-enc
modules/uniconv/u16-conv-from-enc
modules/uniconv/u32-conv-from-enc
#include <unistd.h>
#include "freading.h"
-#include "fpurge.h"
#include "stdio-impl.h"
#include <config.h>
/* Specification. */
-#include "fpurge.h"
+#include <stdio.h>
#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7 */
# include <stdio_ext.h>
+++ /dev/null
-/* Flushing buffers of a FILE stream.
- Copyright (C) 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _GL_FPURGE_H
-#define _GL_FPURGE_H
-
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Discard all pending buffered I/O on the stream STREAM.
- STREAM must not be wide-character oriented.
- Return 0 if successful. Upon error, return -1 and set errno. */
-#if HAVE_FPURGE
-# define fpurge rpl_fpurge
-#endif
-extern int fpurge (FILE *stream);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GL_FPURGE_H */
/* A GNU-like <stdio.h>.
- Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007-2009 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
fflush (f))
#endif
+#if @GNULIB_FPURGE@
+# if @REPLACE_FPURGE@
+# define fpurge rpl_fpurge
+# endif
+# if @REPLACE_FPURGE@ || !@HAVE_DECL_FPURGE@
+ /* Discard all pending buffered I/O data on STREAM.
+ STREAM must not be wide-character oriented.
+ Return 0 if successful. Upon error, return -1 and set errno. */
+ extern int fpurge (FILE *gl_stream);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fpurge
+# define fpurge(f) \
+ (GL_LINK_WARNING ("fpurge is not always present - " \
+ "use gnulib module fpurge for portability"), \
+ fpurge (f))
+#endif
+
#if @GNULIB_FCLOSE@
# if @REPLACE_FCLOSE@
# define fclose rpl_fclose
-# fpurge.m4 serial 2
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# fpurge.m4 serial 3
+dnl Copyright (C) 2007, 2009 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_FPURGE],
[
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AC_CHECK_FUNCS_ONCE([fpurge])
AC_CHECK_FUNCS_ONCE([__fpurge])
- AC_CHECK_DECLS([fpurge], , , [#include <stdio.h>])
+ AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]])
+ dnl For now, lib/fpurge.c is always compiled.
+ if test "x$ac_cv_func_fpurge" = xyes; then
+ REPLACE_FPURGE=1
+ fi
+ if test "x$ac_cv_have_decl_fpurge" = xno; then
+ HAVE_DECL_FPURGE=0
+ fi
])
-# stdio_h.m4 serial 15
+# stdio_h.m4 serial 16
dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO])
GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
+ GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE])
GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE])
GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC])
GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC])
REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO])
REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL])
REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH])
+ REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE])
+ HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE])
REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE])
HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM])
HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE])
fpurge() function: Flush buffers.
Files:
-lib/fpurge.h
lib/fpurge.c
lib/stdio-impl.h
m4/fpurge.m4
Depends-on:
+stdio
configure.ac:
gl_FUNC_FPURGE
+gl_STDIO_MODULE_INDICATOR([fpurge])
Makefile.am:
lib_SOURCES += fpurge.c
Include:
-"fpurge.h"
+<stdio.h>
License:
LGPL
-e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
-e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
-e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
+ -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \
-e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \
-e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \
-e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \
-e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
-e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
-e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
+ -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \
+ -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
-e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \
-e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
-e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
/* Test of fpurge() function.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
#include <config.h>
-#include "fpurge.h"
-
#include <stdio.h>
+
#include <stdlib.h>
#include <string.h>