X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ffreadptr.c;h=05f501bfeb34a8fadbfb810977a805f58748058e;hb=11b16d3cdc4646f80822751dc6882b21c9da2a22;hp=6e08b4858ea76807030a524b0479cfff9507b450;hpb=284866a44c1115e8786a23c7a50d3e710fc75afd;p=gnulib.git diff --git a/lib/freadptr.c b/lib/freadptr.c index 6e08b4858..05f501bfe 100644 --- a/lib/freadptr.c +++ b/lib/freadptr.c @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -29,7 +29,7 @@ freadptr (FILE *fp, size_t *sizep) size_t size; /* Keep this code in sync with freadahead! */ -#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ +#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ if (fp->_IO_write_ptr > fp->_IO_write_base) return NULL; size = fp->_IO_read_end - fp->_IO_read_ptr; @@ -85,6 +85,18 @@ freadptr (FILE *fp, size_t *sizep) return NULL; *sizep = size; return (const char *) fp->_Next; +#elif defined __MINT__ /* Atari FreeMiNT */ + if (!fp->__mode.__read) + return NULL; + size = fp->__get_limit - fp->__bufp; + if (size == 0) + return NULL; + *sizep = size; + return fp->__bufp; +#elif defined SLOW_BUT_NO_HACKS /* users can define this */ + /* This implementation is correct on any ANSI C platform. It is just + awfully slow. */ + return NULL; #else #error "Please port gnulib freadptr.c to your platform! Look at the definition of fflush, fread, getc, getc_unlocked on your system, then report this to bug-gnulib." #endif