changeset 11239:bfd0fd7f4171

More support for FreeMiNT.
author Bruno Haible <bruno@clisp.org>
date Sun, 01 Mar 2009 02:39:04 +0100
parents 1a25eead93d9
children 641a6d533259
files ChangeLog lib/freading.c lib/fwriting.c
diffstat 3 files changed, 28 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,15 @@
 2009-02-28  Bruno Haible  <bruno@clisp.org>
 
-	* tests/test-freadseek.c (main): Disable test beyond end of file on FreeMiNT.
+	More support for FreeMiNT.
+	* lib/freading.c (freading) [__MINT__]: Use new macros that were added
+	to FreeMiNT today.
+	* lib/fwriting.c (fwriting): Likewise.
+	Based on patch by Alan Hourihane <alanh@fairlite.co.uk>.
+
+2009-02-28  Bruno Haible  <bruno@clisp.org>
+
+	* tests/test-freadseek.c (main): Disable test beyond end of file on
+	FreeMiNT.
 	* tests/test-ftello.c (main): Likewise.
 	Patch by Alan Hourihane <alanh@fairlite.co.uk>.
 
--- a/lib/freading.c
+++ b/lib/freading.c
@@ -47,10 +47,15 @@
   return ((fp->_Mode & 0x2 /* _MOPENW */) == 0
 	  || (fp->_Mode & 0x1000 /* _MREAD */) != 0);
 #elif defined __MINT__              /* Atari FreeMiNT */
-  return (!fp->__mode.__write
-	  || (fp->__mode.__read
-	      && (fp->__buffer < fp->__get_limit
-		  /*|| fp->__bufp == fp->__put_limit ??*/)));
+  if (!fp->__mode.__write)
+    return 1;
+  if (!fp->__mode.__read)
+    return 0;
+# ifdef _IO_CURRENTLY_GETTING /* Flag added on 2009-02-28 */
+  return (fp->__flags & _IO_CURRENTLY_GETTING) != 0;
+# else
+  return (fp->__buffer < fp->__get_limit /*|| fp->__bufp == fp->__put_limit ??*/);
+# endif
 #else
  #error "Please port gnulib freading.c to your platform!"
 #endif
--- a/lib/fwriting.c
+++ b/lib/fwriting.c
@@ -41,10 +41,15 @@
   return ((fp->_Mode & 0x1 /* _MOPENR */) == 0
 	  || (fp->_Mode & 0x2000 /* _MWRITE */) != 0);
 #elif defined __MINT__              /* Atari FreeMiNT */
-  return (!fp->__mode.__read
-	  || (fp->__mode.__write
-	      && (fp->__buffer < fp->__put_limit
-		  /*|| fp->__bufp == fp->__get_limit ??*/)));
+  if (!fp->__mode.__read)
+    return 1;
+  if (!fp->__mode.__write)
+    return 0;
+# ifdef _IO_CURRENTLY_PUTTING /* Flag added on 2009-02-28 */
+  return (fp->__flags & _IO_CURRENTLY_PUTTING) != 0;
+# else
+  return (fp->__buffer < fp->__put_limit /*|| fp->__bufp == fp->__get_limit ??*/);
+# endif
 #else
  #error "Please port gnulib fwriting.c to your platform!"
 #endif