X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ffseeko.c;h=abab5e995221ea3fc95f2af621b057545a0b9d55;hb=112b21e3861a4887731b61888d1388127957ba93;hp=91b853d3ab77c4c7b06ac07a0f6326b9904ca021;hpb=4215bcc7e5202438ec9d981d1753bd442871e05a;p=gnulib.git diff --git a/lib/fseeko.c b/lib/fseeko.c index 91b853d3a..abab5e995 100644 --- a/lib/fseeko.c +++ b/lib/fseeko.c @@ -1,5 +1,5 @@ /* An fseeko() function that, together with fflush(), is POSIX compliant. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2011 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 @@ -25,14 +25,13 @@ #include "stdio-impl.h" +int +fseeko (FILE *fp, off_t offset, int whence) #undef fseeko #if !HAVE_FSEEKO # undef fseek # define fseeko fseek #endif - -int -rpl_fseeko (FILE *fp, off_t offset, int whence) { #if LSEEK_PIPE_BROKEN /* mingw gives bogus answers rather than failure on non-seekable files. */ @@ -70,7 +69,7 @@ rpl_fseeko (FILE *fp, off_t offset, int whence) && fp->_rcount == 0 && fp->_wcount == 0 && fp->_ungetc_count == 0) -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */ if (fp_->_ptr == fp_->_base && (fp_->_ptr == NULL || fp_->_cnt == 0)) #elif defined __UCLIBC__ /* uClibc */ @@ -110,6 +109,11 @@ rpl_fseeko (FILE *fp, off_t offset, int whence) #if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ fp->_flags &= ~_IO_EOF_SEEN; #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ +# if defined __CYGWIN__ + /* fp_->_offset is typed as an integer. */ + fp_->_offset = pos; +# else + /* fp_->_offset is an fpos_t. */ { /* Use a union, since on NetBSD, the compilation flags determine whether fpos_t is typedef'd to off_t or a struct @@ -122,11 +126,12 @@ rpl_fseeko (FILE *fp, off_t offset, int whence) u.o = pos; fp_->_offset = u.f; } +# endif fp_->_flags |= __SOFF; fp_->_flags &= ~__SEOF; #elif defined __EMX__ /* emx+gcc */ fp->_flags &= ~_IOEOF; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */ fp->_flag &= ~_IOEOF; #elif defined __MINT__ /* Atari FreeMiNT */ fp->__offset = pos;