2020-09-30 Tim Rice * lib/stdio-impl.h: Add support for UnixWare * lib/freadahead.c: Use __fpending on Unixware * lib/fflush.c: Update comments for UnixWare * lib/fpending.c: Likewise. * lib/freadable.c: Likewise. * lib/freadptr.c: Likewise. * lib/freadseek.c: Likewise. * lib/fseterr.c: Likewise. * lib/fwritable.c: Likewise. * lib/fwriting.c: Likewise. diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h index 067b95ebd..f745a170b 100644 --- a/lib/stdio-impl.h +++ b/lib/stdio-impl.h @@ -175,7 +175,8 @@ # define fp_ fp # endif -# if defined _SCO_DS /* OpenServer */ +/* OpenServer, UnixWare (best not to use __base on these platforms) */ +# if defined _SCO_DS || defined __USLC__ || defined __sysv5__ # define _cnt __cnt # define _ptr __ptr # define _base __base diff --git a/lib/freadahead.c b/lib/freadahead.c index be14a3dab..aaa2b9b57 100644 --- a/lib/freadahead.c +++ b/lib/freadahead.c @@ -62,10 +62,14 @@ freadahead (FILE *fp) if ((fp_->_flags & _IOWRITING) != 0) return 0; return fp_->_count; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS, UnixWare */ if ((fp_->_flag & _IOWRT) != 0) return 0; +# if defined __USLC__ || defined __sysv5__ + return __fpending(fp_); +# else return fp_->_cnt; +# endif #elif defined __UCLIBC__ /* uClibc */ # ifdef __STDIO_BUFFERS if (fp->__modeflags & __FLAG_WRITING) diff --git a/lib/fflush.c b/lib/fflush.c index b3a40e86a..4e437a623 100644 --- a/lib/fflush.c +++ b/lib/fflush.c @@ -64,7 +64,7 @@ clear_ungetc_buffer (FILE *fp) fp->_ungetc_count = 0; fp->_rcount = - fp->_rcount; } -# elif defined _IOERR /* Minix, AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */ +# elif defined _IOERR /* Minix, AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS, UnixWare */ /* Nothing to do. */ # else /* other implementations */ fseeko (fp, 0, SEEK_CUR); diff --git a/lib/fpending.c b/lib/fpending.c index 802ebcba6..d6e56d07d 100644 --- a/lib/fpending.c +++ b/lib/fpending.c @@ -25,7 +25,8 @@ #include "stdio-impl.h" /* This file is not used on systems that already have the __fpending function, - namely glibc >= 2.2, Solaris >= 7, Android API >= 23. */ + namely glibc >= 2.2, Solaris >= 7, Android API >= 23, + UnixWare 7.1.4 >= MP4 */ /* Return the number of pending (aka buffered, unflushed) bytes on the stream, FP, that is open for writing. */ diff --git a/lib/freadable.c b/lib/freadable.c index 160fc3074..882906175 100644 --- a/lib/freadable.c +++ b/lib/freadable.c @@ -26,7 +26,8 @@ #endif /* This file is not used on systems that have the __freadable function, - namely glibc >= 2.2, Solaris >= 7, Android API >= 23, musl libc. */ + namely glibc >= 2.2, Solaris >= 7, Android API >= 23, musl libc, + UnixWare 7.1.4 >= MP4 */ bool freadable (FILE *fp) diff --git a/lib/freadptr.c b/lib/freadptr.c index 8972cb1d6..c0792c387 100644 --- a/lib/freadptr.c +++ b/lib/freadptr.c @@ -69,7 +69,7 @@ freadptr (FILE *fp, size_t *sizep) return NULL; *sizep = size; return (const char *) fp_->_ptr; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS, UnixWare */ if ((fp_->_flag & _IOWRT) != 0) return NULL; size = fp_->_cnt; diff --git a/lib/freadseek.c b/lib/freadseek.c index a2ef61c2d..60e6389a0 100644 --- a/lib/freadseek.c +++ b/lib/freadseek.c @@ -49,7 +49,7 @@ freadptrinc (FILE *fp, size_t increment) #elif defined __minix /* Minix */ fp_->_ptr += increment; fp_->_count -= increment; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS, UnixWare */ fp_->_ptr += increment; fp_->_cnt -= increment; #elif defined __UCLIBC__ /* uClibc */ diff --git a/lib/fseterr.c b/lib/fseterr.c index 8f32b7e5a..d711bbf12 100644 --- a/lib/fseterr.c +++ b/lib/fseterr.c @@ -42,7 +42,7 @@ fseterr (FILE *fp) fp->_flags |= _IOERR; #elif defined __minix /* Minix */ fp->_flags |= _IOERR; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS, UnixWare */ fp_->_flag |= _IOERR; #elif defined __UCLIBC__ /* uClibc */ fp->__modeflags |= __FLAG_ERROR; diff --git a/lib/fwritable.c b/lib/fwritable.c index fa6231da3..2d173808e 100644 --- a/lib/fwritable.c +++ b/lib/fwritable.c @@ -26,7 +26,8 @@ #endif /* This file is not used on systems that have the __fwritable function, - namely glibc >= 2.2, Solaris >= 7, Android API >= 23, musl libc. */ + namely glibc >= 2.2, Solaris >= 7, Android API >= 23, musl libc, + UnixWare 7.1.4 >= MP4 */ bool fwritable (FILE *fp) diff --git a/lib/fwriting.c b/lib/fwriting.c index e0d535df3..8f4a41b39 100644 --- a/lib/fwriting.c +++ b/lib/fwriting.c @@ -21,8 +21,9 @@ #include "stdio-impl.h" -/* This file is not used on systems that have the __fwritable function, - namely glibc >= 2.2, Solaris >= 7, Android API >= 29, musl libc. */ +/* This file is not used on systems that have the __fwriting function, + namely glibc >= 2.2, Solaris >= 7, Android API >= 29, musl libc, + UnixWare 7.1.4 >= MP4 */ bool fwriting (FILE *fp)