/* Specification. */
#include <stdio.h>
+/* Get lseek. */
+#include <unistd.h>
+
#undef ftello
#if !HAVE_FTELLO
+# undef ftell
# define ftello ftell
#endif
off_t
rpl_ftello (FILE *fp)
{
+#if LSEEK_PIPE_BROKEN
+ /* mingw gives bogus answers rather than failure on non-seekable files. */
+ if (lseek (fileno (fp), 0, SEEK_CUR) == -1)
+ return -1;
+#endif
+
#if defined __SL64 && defined __SCLE /* Cygwin */
if ((fp->_flags & __SL64) == 0)
{