* lib/fbufmode.c (fbufmode) [__minix]: Add conditional code.
* lib/fpurge.c (fpurge): Likewise.
* lib/freadahead.c (freadahead): Likewise.
* lib/freadable.c (freadable): Likewise.
* lib/freading.c (freading): Likewise.
* lib/freadptr.c (freadptr): Likewise.
* lib/freadseek.c (freadptrinc): Likewise.
* lib/fseeko.c (rpl_fseeko): Likewise.
* lib/fseterr.c (fseterr): Likewise.
* lib/fwritable.c (fwritable): Likewise.
* lib/fwriting.c (fwriting): Likewise.
* lib/fflush.c (clear_ungetc_buffer): Update comment.
* m4/fpending.m4 (gl_PREREQ_FPENDING): Add a variant for Minix.
+2011-07-31 Bruno Haible <bruno@clisp.org>
+
+ stdioext: Add support for Minix.
+ * lib/fbufmode.c (fbufmode) [__minix]: Add conditional code.
+ * lib/fpurge.c (fpurge): Likewise.
+ * lib/freadahead.c (freadahead): Likewise.
+ * lib/freadable.c (freadable): Likewise.
+ * lib/freading.c (freading): Likewise.
+ * lib/freadptr.c (freadptr): Likewise.
+ * lib/freadseek.c (freadptrinc): Likewise.
+ * lib/fseeko.c (rpl_fseeko): Likewise.
+ * lib/fseterr.c (fseterr): Likewise.
+ * lib/fwritable.c (fwritable): Likewise.
+ * lib/fwriting.c (fwriting): Likewise.
+ * lib/fflush.c (clear_ungetc_buffer): Update comment.
+ * m4/fpending.m4 (gl_PREREQ_FPENDING): Add a variant for Minix.
+
2011-07-31 Bruno Haible <bruno@clisp.org>
errno: Port to Minix.
return _IOFBF;
#elif defined __EMX__ /* emx+gcc */
return fp->_flags & (_IOLBF | _IONBF | _IOFBF);
+#elif defined __minix /* Minix */
+ return fp->_flags & (_IOLBF | _IONBF | _IOFBF);
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
# if HAVE___FLBF /* Solaris >= 7 */
if (__flbf (fp))
fp->_ungetc_count = 0;
fp->_rcount = - fp->_rcount;
}
-# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
+# elif defined _IOERR /* Minix, AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
/* Nothing to do. */
# else /* other implementations */
fseeko (fp, 0, SEEK_CUR);
fp->_wcount = 0;
fp->_ungetc_count = 0;
return 0;
+# elif defined __minix /* Minix */
+ fp->_ptr = fp->_buf;
+ if (fp->_ptr != NULL)
+ fp->_count = 0;
+ return 0;
# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
fp->_ptr = fp->_base;
if (fp->_ptr != NULL)
return (fp_->_flags & (__SRW | __SRD)) != 0;
#elif defined __EMX__ /* emx+gcc */
return (fp->_flags & (_IORW | _IOREAD)) != 0;
+#elif defined __minix /* Minix */
+ return (fp->_flags & _IOREAD) != 0;
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
return (fp->_flag & (_IORW | _IOREAD)) != 0;
#elif defined __QNX__ /* QNX */
/* equivalent to
(fp->_ungetc_count == 0 ? fp->_rcount : fp->_ungetc_count - fp->_rcount) */
return (fp->_rcount > 0 ? fp->_rcount : fp->_ungetc_count - fp->_rcount);
+#elif defined __minix /* Minix */
+ if ((fp_->_flags & _IOWRITING) != 0)
+ return 0;
+ return fp_->_count;
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
if ((fp_->_flag & _IOWRT) != 0)
return 0;
return (fp_->_flags & __SRD) != 0;
# elif defined __EMX__ /* emx+gcc */
return (fp->_flags & _IOREAD) != 0;
+# elif defined __minix /* Minix */
+ return (fp->_flags & _IOREADING) != 0;
# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
# if defined __sun /* Solaris */
return (fp->_flag & _IOREAD) != 0 && (fp->_flag & _IOWRT) == 0;
abort ();
*sizep = fp->_rcount;
return fp->_ptr;
+#elif defined __minix /* Minix */
+ if ((fp_->_flags & _IOWRITING) != 0)
+ return NULL;
+ size = fp_->_count;
+ if (size == 0)
+ return NULL;
+ *sizep = size;
+ return (const char *) fp_->_ptr;
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
if ((fp_->_flag & _IOWRT) != 0)
return NULL;
#elif defined __EMX__ /* emx+gcc */
fp->_ptr += increment;
fp->_rcount -= increment;
+#elif defined __minix /* Minix */
+ fp_->_ptr += increment;
+ fp_->_count -= increment;
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
fp_->_ptr += increment;
fp_->_cnt -= increment;
&& fp->_rcount == 0
&& fp->_wcount == 0
&& fp->_ungetc_count == 0)
+#elif defined __minix /* Minix */
+ if (fp_->_ptr == fp_->_buf
+ && (fp_->_ptr == NULL || fp_->_count == 0))
#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))
fp_->_flags |= __SERR;
#elif defined __EMX__ /* emx+gcc */
fp->_flags |= _IOERR;
+#elif defined __minix /* Minix */
+ fp->_flags |= _IOERR;
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
fp_->_flag |= _IOERR;
#elif defined __UCLIBC__ /* uClibc */
return (fp_->_flags & (__SRW | __SWR)) != 0;
#elif defined __EMX__ /* emx+gcc */
return (fp->_flags & (_IORW | _IOWRT)) != 0;
+#elif defined __minix /* Minix */
+ return (fp->_flags & _IOWRITE) != 0;
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
return (fp->_flag & (_IORW | _IOWRT)) != 0;
#elif defined __QNX__ /* QNX */
return (fp_->_flags & __SWR) != 0;
#elif defined __EMX__ /* emx+gcc */
return (fp->_flags & _IOWRT) != 0;
+#elif defined __minix /* Minix */
+ return (fp->_flags & _IOWRITING) != 0;
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
return (fp->_flag & _IOWRT) != 0;
#elif defined __UCLIBC__ /* uClibc */
-# serial 16
+# serial 17
# Copyright (C) 2000-2001, 2004-2011 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
'# emx+gcc' \
'fp->_ptr - fp->_buffer' \
\
+ '# Minix' \
+ 'fp->_ptr - fp->_buf' \
+ \
'# VMS' \
'(*fp)->_ptr - (*fp)->_base' \
\