+2008-03-29 Bruno Haible <bruno@clisp.org>
+
+ * tests/test-fflush2.c (main): Temporarily disable the contents of
+ this test.
+ * m4/fflush.m4 (gl_FUNC_FFLUSH): Add a TODO.
+ Reported by Eric Blake.
+
2008-03-28 Simon Josefsson <simon@josefsson.org>
* lib/gc.h (enum Gc_hash): Add GC_SHA224.
-# fflush.m4 serial 4
+# fflush.m4 serial 5
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007-2008 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#include <unistd.h>
]], [[FILE *f = fopen ("conftest.txt", "r");
char buffer[10];
- int fd = fileno (f);
- if (!f || 0 > fd || fread (buffer, 1, 5, f) != 5)
+ int fd;
+ if (f == NULL)
+ return 1;
+ fd = fileno (f);
+ if (fd < 0 || fread (buffer, 1, 5, f) != 5)
return 2;
/* For deterministic results, ensure f read a bigger buffer. */
if (lseek (fd, 0, SEEK_CUR) == 5)
/* POSIX requires fflush-fseek to set file offset of fd. */
if (fflush (f) != 0 || fseek (f, 0, SEEK_CUR) != 0)
return 4;
- return !(lseek (fd, 0, SEEK_CUR) == 5);
+ if (lseek (fd, 0, SEEK_CUR) != 5)
+ return 5;
+ /* TODO: Verify behaviour of fflush after ungetc, see
+ <http://lists.gnu.org/archive/html/bug-gnulib/2008-03/msg00131.html>. */
+ return 0;
]])], [gl_cv_func_fflush_stdin=yes], [gl_cv_func_fflush_stdin=no],
[dnl Pessimistically assume fflush is broken. This is wrong for
dnl at least glibc and cygwin; but lib/fflush.c takes this into account.
int
main (int argc, char **argv)
{
+#if 0
+ /* Check fflush after a backup ungetc() call. This is case 1 in terms of
+ <http://lists.gnu.org/archive/html/bug-gnulib/2008-03/msg00131.html>.
+ The Austin Group has not yet decided how this should behave. */
+#endif
+#if 0
+ /* Check fflush after a non-backup ungetc() call. This is case 1 in terms of
+ <http://lists.gnu.org/archive/html/bug-gnulib/2008-03/msg00131.html>.
+ The Austin Group has not yet decided how this should behave. */
/* Check that fflush after a non-backup ungetc() call discards the ungetc
buffer. This is mandated by POSIX
<http://www.opengroup.org/susv3/functions/ungetc.html>:
c = fgetc (stdin);
ASSERT (c == '/');
+#endif
return 0;
}