[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: workaround ftello/fseeko on cygwin 1.5.x
From: |
Eric Blake |
Subject: |
Re: workaround ftello/fseeko on cygwin 1.5.x |
Date: |
Thu, 24 May 2007 03:51:11 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Eric Blake <ebb9 <at> byu.net> writes:
> > Put this into a separate compilation unit, so that fseeko and ftello can
> > share the same cache.
>
> However, the idea of cygfreopen64 has merits on its own, since I plan on
> adding documentation in doc/functions/stdin.texi (and whatever happened to
> stdout and stderr.texi?), so maybe making cygfreopen64 a separate module
> would have other uses.
I'm not doing this part now. I'm not sure I like the name cygfreopen64; the
cyg- prefix is too narrow (perhaps there are other platforms where we can
gracefully convert an existing fd/FILE from narrow to large), and -freopen64
clashes with platforms that have freopen64 as part of their large file support
and taking three parameters. Maybe something like:
/* Ensure that FP supports the full range of off_t offsets. Returns FP
on success, and NULL if FP can only process long offsets and could not
be converted. This is most useful on stdin, stdout, and stderr. */
FILE *
flarge (FILE *fp)
{
if (sizeof (off_t) > sizeof (long int))
{
#if defined __SL64 && defined __SCLE /* cygwin */
/* check for __SL64, and convert if necessary */
...
#elif
/* other platforms... */
#endif
}
return fp;
}
Here's what I'm committing:
2007-05-23 Eric Blake <address@hidden>
Fix fseeko/ftello on cygwin 1.5.24.
* doc/functions/fseeko.texi (fseeko): Document the fix.
* doc/functions/ftello.texi (ftello): Document the fix.
* doc/functions/stdin.texi (stdin): Document the shortcoming.
* doc/functions/stdout.text (stdout): New file.
* doc/functions/stderr.text (stderr): New file.
* doc/gnulib.texi (Function Substitutes): Use new files.
* tests/test-fseeko.c (main): Check for broken fseeko on cygwin
prior to 1.7.0.
* tests/test-ftello.c (main): Likewise for ftello.
* tests/test-fseeko.sh: New file.
* tests/test-ftello.sh: New file.
* modules/fseeko-tests (Makefile.am): Ensure test-fseeko is run
with seekable stdin.
* modules/ftello-tests (Makefile.am): Likewise for test-ftello.
* m4/fseeko.m4 (gl_FUNC_FSEEKO): Detect the cygwin bug.
(gl_REPLACE_FSEEKO): New macro.
* m4/ftello.m4 (gl_FUNC_FTELLO, gl_REPLACE_FTELLO): Likewise.
* modules/fseeko (Files): Distribute fseeko.c.
* modules/ftello (Files): Distribute ftello.c.
* lib/fseeko.c (rpl_fseeko) [__CYGWIN__]: Convert stdin to 64-bit
mode.
* lib/ftello.c (rpl_ftello): New file.
* m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Allow replacement of
fseeko, ftello.
(gl_STDIN_LARGE_OFFSET): New macro.
* modules/stdio (Makefile.am): Perform the replacement.
* lib/stdio_.h (rpl_fseeko, rpl_ftello): Define when needed.
Index: lib/fseeko.c
===================================================================
RCS file: /sources/gnulib/gnulib/lib/fseeko.c,v
retrieving revision 1.3
diff -u -p -r1.3 fseeko.c
--- lib/fseeko.c 29 Apr 2007 12:16:55 -0000 1.3
+++ lib/fseeko.c 24 May 2007 03:05:44 -0000
@@ -44,6 +44,19 @@ rpl_fseeko (FILE *fp, off_t offset, int
# else /* FreeBSD, MacOS X, Cygwin */
# define fp_ub fp->_ub
# endif
+# if defined __SL64 && defined __SCLE /* Cygwin */
+ if ((fp->_flags & __SL64) == 0)
+ {
+ /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
+ mode; but has an fseeko that requires 64-bit mode. */
+ FILE *tmp = fopen ("/dev/null", "r");
+ if (!tmp)
+ return -1;
+ fp->_flags |= __SL64;
+ fp->_seek64 = tmp->_seek64;
+ fclose (tmp);
+ }
+# endif
if (fp->_p == fp->_bf._base
&& fp->_r == 0
&& fp->_w == ((fp->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully
buffered and not currently reading? */
Index: lib/ftello.c
===================================================================
RCS file: lib/ftello.c
diff -N lib/ftello.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/ftello.c 24 May 2007 03:05:44 -0000
@@ -0,0 +1,45 @@
+/* An ftello() function that works around platform bugs.
+ 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 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. */
+
+#include <config.h>
+
+/* Specification. */
+#include <stdio.h>
+
+#undef ftello
+#if !HAVE_FTELLO
+# define ftello ftell
+#endif
+
+off_t
+rpl_ftello (FILE *fp)
+{
+#if defined __SL64 && defined __SCLE /* Cygwin */
+ if ((fp->_flags & __SL64) == 0)
+ {
+ /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
+ mode; but has an ftello that requires 64-bit mode. */
+ FILE *tmp = fopen ("/dev/null", "r");
+ if (!tmp)
+ return -1;
+ fp->_flags |= __SL64;
+ fp->_seek64 = tmp->_seek64;
+ fclose (tmp);
+ }
+#endif
+ return ftello (fp);
+}
Index: lib/stdio_.h
===================================================================
RCS file: /sources/gnulib/gnulib/lib/stdio_.h,v
retrieving revision 1.25
diff -u -p -r1.25 stdio_.h
--- lib/stdio_.h 23 May 2007 22:00:35 -0000 1.25
+++ lib/stdio_.h 24 May 2007 03:05:44 -0000
@@ -42,7 +42,9 @@
#include <stdarg.h>
#include <stddef.h>
-#if (@GNULIB_FFLUSH@ && @REPLACE_FFLUSH@) || (@GNULIB_FSEEKO@ && !
@HAVE_FSEEKO@) || (@GNULIB_FTELLO@ && address@hidden@)
+#if (@GNULIB_FFLUSH@ && @REPLACE_FFLUSH@) \
+ || (@GNULIB_FSEEKO@ && (address@hidden@ || @REPLACE_FSEEKO@)) \
+ || (@GNULIB_FTELLO@ && (address@hidden@ || @REPLACE_FTELLO@))
/* Get off_t. */
# include <sys/types.h>
#endif
@@ -216,7 +218,7 @@ extern int vsprintf (char *str, const ch
# endif
#endif
-#if @GNULIB_FFLUSH@ && @REPLACE_FFLUSH@
+#if (@GNULIB_FFLUSH@ && @REPLACE_FFLUSH@) || (@GNULIB_FSEEKO@ &&
@REPLACE_FSEEKO@)
/* Provide fseek, fseeko functions that are aware of a preceding fflush(). */
# define fseeko rpl_fseeko
extern int fseeko (FILE *fp, off_t offset, int whence);
@@ -250,6 +252,9 @@ typedef int verify_fseeko_types[2 * (siz
/* Assume 'off_t' is the same type as 'long'. */
typedef int verify_ftello_types[2 * (sizeof (off_t) == sizeof (long)) - 1];
# define ftello ftell
+# elif @REPLACE_FTELLO@
+# define ftello rpl_ftello
+extern off_t ftello (FILE *fp);
# endif
#elif defined GNULIB_POSIXCHECK
# undef ftello
Index: doc/gnulib.texi
===================================================================
RCS file: /sources/gnulib/gnulib/doc/gnulib.texi,v
retrieving revision 1.40
diff -u -p -r1.40 gnulib.texi
--- doc/gnulib.texi 1 May 2007 22:37:10 -0000 1.40
+++ doc/gnulib.texi 24 May 2007 03:05:45 -0000
@@ -1543,7 +1543,9 @@ by Gnulib.
* sscanf::
* stat::
* statvfs::
+* stderr::
* stdin::
+* stdout::
* strcasecmp::
* strcat::
* strchr::
@@ -2659,7 +2661,9 @@ by Gnulib.
@include functions/sscanf.texi
@include functions/stat.texi
@include functions/statvfs.texi
address@hidden functions/stderr.texi
@include functions/stdin.texi
address@hidden functions/stdout.texi
@include functions/strcasecmp.texi
@include functions/strcat.texi
@include functions/strchr.texi
@@ -2877,3 +2881,8 @@ generated automatically.
@printindex cp
@bye
+
address@hidden Local Variables:
address@hidden indent-tabs-mode: nil
address@hidden whitespace-check-buffer-indent: nil
address@hidden End:
Index: doc/functions/fseeko.texi
===================================================================
RCS file: /sources/gnulib/gnulib/doc/functions/fseeko.texi,v
retrieving revision 1.1
diff -u -p -r1.1 fseeko.texi
--- doc/functions/fseeko.texi 1 May 2007 15:11:38 -0000 1.1
+++ doc/functions/fseeko.texi 24 May 2007 03:05:45 -0000
@@ -14,6 +14,8 @@ OSF/1 4.0, Solaris 2.5.1, mingw.
@item
The declaration of @code{fseeko} in @code{<stdio.h>} is not enabled by default
on some platforms: glibc 2.3.6.
address@hidden
+This function fails on seekable stdin, stdout, and stderr: cygwin 1.5.x.
@end itemize
Portability problems not fixed by Gnulib:
Index: doc/functions/ftello.texi
===================================================================
RCS file: /sources/gnulib/gnulib/doc/functions/ftello.texi,v
retrieving revision 1.1
diff -u -p -r1.1 ftello.texi
--- doc/functions/ftello.texi 1 May 2007 15:11:38 -0000 1.1
+++ doc/functions/ftello.texi 24 May 2007 03:05:45 -0000
@@ -14,6 +14,8 @@ OSF/1 4.0, Solaris 2.5.1, mingw.
@item
The declaration of @code{ftello} in @code{<stdio.h>} is not enabled by default
on some platforms: glibc 2.3.6.
address@hidden
+This function fails on seekable stdin, stdout, and stderr: cygwin 1.5.x.
@end itemize
Portability problems not fixed by Gnulib:
Index: doc/functions/stderr.texi
===================================================================
RCS file: doc/functions/stderr.texi
diff -N doc/functions/stderr.texi
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ doc/functions/stderr.texi 24 May 2007 03:05:45 -0000
@@ -0,0 +1,20 @@
address@hidden stderr
address@hidden @code{stderr}
address@hidden stderr
+
+POSIX specification: @url{http://www.opengroup.org/susv3xsh/stderr.html}
+
+Gnulib module: ---
+
+Portability problems fixed by Gnulib:
address@hidden
address@hidden itemize
+
+Portability problems not fixed by Gnulib:
address@hidden
address@hidden
+stderr is created in 32-bit mode instead of 64-bit mode: Cygwin 1.5.x.
+One workaround is to use freopen(NULL, ``w+'', stderr) on Cygwin 1.5.21
+or newer. Another is to use the gnulib ftello module and do
+ftello(stderr).
address@hidden itemize
Index: doc/functions/stdin.texi
===================================================================
RCS file: /sources/gnulib/gnulib/doc/functions/stdin.texi,v
retrieving revision 1.1
diff -u -p -r1.1 stdin.texi
--- doc/functions/stdin.texi 1 May 2007 15:11:39 -0000 1.1
+++ doc/functions/stdin.texi 24 May 2007 03:05:45 -0000
@@ -12,4 +12,9 @@ Portability problems fixed by Gnulib:
Portability problems not fixed by Gnulib:
@itemize
address@hidden
+stdin is created in 32-bit mode instead of 64-bit mode: Cygwin 1.5.x.
+One workaround is to use freopen(NULL, ``r'', stdin) on Cygwin 1.5.21
+or newer. Another is to use the gnulib ftello module and do
+ftello(stdin).
@end itemize
Index: doc/functions/stdout.texi
===================================================================
RCS file: doc/functions/stdout.texi
diff -N doc/functions/stdout.texi
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ doc/functions/stdout.texi 24 May 2007 03:05:45 -0000
@@ -0,0 +1,20 @@
address@hidden stdout
address@hidden @code{stdout}
address@hidden stdout
+
+POSIX specification: @url{http://www.opengroup.org/susv3xsh/stdout.html}
+
+Gnulib module: ---
+
+Portability problems fixed by Gnulib:
address@hidden
address@hidden itemize
+
+Portability problems not fixed by Gnulib:
address@hidden
address@hidden
+stdout is created in 32-bit mode instead of 64-bit mode: Cygwin 1.5.x.
+One workaround is to use freopen(NULL, ``w'', stdout) on Cygwin 1.5.21
+or newer. Another is to use the gnulib ftello module and do
+ftello(stdout).
address@hidden itemize
Index: m4/fseeko.m4
===================================================================
RCS file: /sources/gnulib/gnulib/m4/fseeko.m4,v
retrieving revision 1.3
diff -u -p -r1.3 fseeko.m4
--- m4/fseeko.m4 26 Apr 2007 09:33:12 -0000 1.3
+++ m4/fseeko.m4 24 May 2007 03:05:45 -0000
@@ -1,4 +1,4 @@
-# fseeko.m4 serial 1
+# fseeko.m4 serial 2
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,
@@ -8,12 +8,22 @@ AC_DEFUN([gl_FUNC_FSEEKO],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko],
[
AC_TRY_LINK([#include <stdio.h>], [fseeko (stdin, 0, 0);],
- [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
+ [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
])
if test $gl_cv_func_fseeko = no; then
HAVE_FSEEKO=0
+ elif test $gl_cv_var_stdin_large_offset = no; then
+ gl_REPLACE_FSEEKO
fi
])
+
+AC_DEFUN([gl_REPLACE_FSEEKO],
+[
+ AC_LIBOBJ([fseeko])
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+ REPLACE_FSEEKO=1
+])
Index: m4/ftello.m4
===================================================================
RCS file: /sources/gnulib/gnulib/m4/ftello.m4,v
retrieving revision 1.1
diff -u -p -r1.1 ftello.m4
--- m4/ftello.m4 25 Apr 2007 07:51:53 -0000 1.1
+++ m4/ftello.m4 24 May 2007 03:05:45 -0000
@@ -1,4 +1,4 @@
-# ftello.m4 serial 1
+# ftello.m4 serial 2
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,
@@ -8,12 +8,22 @@ AC_DEFUN([gl_FUNC_FTELLO],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
AC_CACHE_CHECK([for ftello], [gl_cv_func_ftello],
[
AC_TRY_LINK([#include <stdio.h>], [ftello (stdin);],
- [gl_cv_func_ftello=yes], [gl_cv_func_ftello=no])
+ [gl_cv_func_ftello=yes], [gl_cv_func_ftello=no])
])
if test $gl_cv_func_ftello = no; then
HAVE_FTELLO=0
+ elif test $gl_cv_var_stdin_large_offset = no; then
+ gl_REPLACE_FTELLO
fi
])
+
+AC_DEFUN([gl_REPLACE_FTELLO],
+[
+ AC_LIBOBJ([ftello])
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+ REPLACE_FTELLO=1
+])
Index: m4/stdio_h.m4
===================================================================
RCS file: /sources/gnulib/gnulib/m4/stdio_h.m4,v
retrieving revision 1.13
diff -u -p -r1.13 stdio_h.m4
--- m4/stdio_h.m4 25 Apr 2007 07:51:53 -0000 1.13
+++ m4/stdio_h.m4 24 May 2007 03:05:45 -0000
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 4
+# stdio_h.m4 serial 5
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,
@@ -47,6 +47,29 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF])
HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
+ REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO])
HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO])
+ REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO])
REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH])
])
+
+dnl Code shared by fseeko and ftello. Determine if large files are supported,
+dnl but stdin does not start as a large file by default.
+AC_DEFUN([gl_STDIN_LARGE_OFFSET],
+ [
+ AC_CACHE_CHECK([whether stdin defaults to large file offsets],
+ [gl_cv_var_stdin_large_offset],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>],
+[#if defined __SL64 && defined __SCLE /* cygwin */
+ /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
+ fseeko/ftello needlessly fail. This bug was fixed at the same time
+ that cygwin started exporting asnprintf (cygwin 1.7.0), so we use
+ that as a link-time test for cross-compiles rather than building
+ a runtime test. */
+ size_t s;
+ if (asnprintf (NULL, &s, ""))
+ return 0;
+#endif])],
+ [gl_cv_var_stdin_large_offset=yes],
+ [gl_cv_var_stdin_large_offset=no])])
+])
Index: modules/fseeko
===================================================================
RCS file: /sources/gnulib/gnulib/modules/fseeko,v
retrieving revision 1.2
diff -u -p -r1.2 fseeko
--- modules/fseeko 26 Apr 2007 09:33:12 -0000 1.2
+++ modules/fseeko 24 May 2007 03:05:45 -0000
@@ -2,6 +2,7 @@ Description:
fseeko() function: Reposition a FILE stream.
Files:
+lib/fseeko.c
m4/fseeko.m4
Depends-on:
Index: modules/fseeko-tests
===================================================================
RCS file: /sources/gnulib/gnulib/modules/fseeko-tests,v
retrieving revision 1.1
diff -u -p -r1.1 fseeko-tests
--- modules/fseeko-tests 25 Apr 2007 07:40:58 -0000 1.1
+++ modules/fseeko-tests 24 May 2007 03:05:45 -0000
@@ -1,10 +1,13 @@
Files:
tests/test-fseeko.c
+tests/test-fseeko.sh
Depends-on:
configure.ac:
Makefile.am:
-TESTS += test-fseeko
+TESTS += test-fseeko.sh
+TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-fseeko
+EXTRA_DIST += test-fseeko.sh
Index: modules/ftello
===================================================================
RCS file: /sources/gnulib/gnulib/modules/ftello,v
retrieving revision 1.2
diff -u -p -r1.2 ftello
--- modules/ftello 26 Apr 2007 09:33:12 -0000 1.2
+++ modules/ftello 24 May 2007 03:05:45 -0000
@@ -2,6 +2,7 @@ Description:
ftello() function: Retrieve the position of a FILE stream.
Files:
+lib/ftello.c
m4/ftello.m4
Depends-on:
Index: modules/ftello-tests
===================================================================
RCS file: /sources/gnulib/gnulib/modules/ftello-tests,v
retrieving revision 1.1
diff -u -p -r1.1 ftello-tests
--- modules/ftello-tests 25 Apr 2007 07:52:28 -0000 1.1
+++ modules/ftello-tests 24 May 2007 03:05:45 -0000
@@ -1,10 +1,13 @@
Files:
tests/test-ftello.c
+tests/test-ftello.sh
Depends-on:
configure.ac:
Makefile.am:
-TESTS += test-ftello
+TESTS += test-ftello.sh
+TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-ftello
+EXTRA_DIST += test-ftello.sh
Index: modules/stdio
===================================================================
RCS file: /sources/gnulib/gnulib/modules/stdio,v
retrieving revision 1.14
diff -u -p -r1.14 stdio
--- modules/stdio 17 May 2007 06:14:30 -0000 1.14
+++ modules/stdio 24 May 2007 03:05:45 -0000
@@ -47,7 +47,9 @@ stdio.h: stdio_.h
-e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
-e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
-e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \
+ -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
-e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \
+ -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
-e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/stdio_.h; \
Index: tests/test-fseeko.c
===================================================================
RCS file: /sources/gnulib/gnulib/tests/test-fseeko.c,v
retrieving revision 1.1
diff -u -p -r1.1 test-fseeko.c
--- tests/test-fseeko.c 25 Apr 2007 07:40:58 -0000 1.1
+++ tests/test-fseeko.c 24 May 2007 03:05:45 -0000
@@ -27,8 +27,6 @@
int
main ()
{
- off_t pos = fseeko (stdin, (off_t)0, SEEK_CUR);
- (void)pos;
-
- return 0;
+ /* This test assumes stdin is seekable. */
+ return fseeko (stdin, (off_t)0, SEEK_CUR) != 0;
}
Index: tests/test-fseeko.sh
===================================================================
RCS file: tests/test-fseeko.sh
diff -N tests/test-fseeko.sh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/test-fseeko.sh 24 May 2007 03:05:45 -0000
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+./test-fseeko${EXEEXT} < "$srcdir/test-fseeko.sh"
Index: tests/test-ftello.c
===================================================================
RCS file: /sources/gnulib/gnulib/tests/test-ftello.c,v
retrieving revision 1.1
diff -u -p -r1.1 test-ftello.c
--- tests/test-ftello.c 25 Apr 2007 07:52:28 -0000 1.1
+++ tests/test-ftello.c 24 May 2007 03:05:45 -0000
@@ -27,8 +27,7 @@
int
main ()
{
+ /* This test assumes stdin is seekable. */
off_t pos = ftello (stdin);
- (void)pos;
-
- return 0;
+ return pos < 0;
}
Index: tests/test-ftello.sh
===================================================================
RCS file: tests/test-ftello.sh
diff -N tests/test-ftello.sh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/test-ftello.sh 24 May 2007 03:05:45 -0000
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+./test-ftello${EXEEXT} < "$srcdir/test-ftello.sh"