Tim Rice wrote: > On line 24 of lib/fwriting.c we see > /* This file is not used on systems that have the __fwritable function, > > Should that not be __fwriting instead of __fwritable ?
Indeed. Thanks for the report. Fixed as part of this larger commit: 2020-10-11 Bruno Haible <br...@clisp.org> stdioext: Update comments regarding Cygwin. * lib/fpending.c: Update comments. * lib/fpurge.c: Likewise. * lib/freadable.h: Likewise. * lib/freadable.c: Likewise. * lib/freading.h: Likewise. * lib/freading.c: Likewise. * lib/fwritable.h: Likewise. * lib/fwritable.c: Likewise. * lib/fwriting.h: Likewise. * lib/fwriting.c: Likewise. diff --git a/lib/fpending.c b/lib/fpending.c index 802ebcb..4cc0ea7 100644 --- a/lib/fpending.c +++ b/lib/fpending.c @@ -25,7 +25,7 @@ #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, Cygwin >= 1.7.34, Android API >= 23. */ /* Return the number of pending (aka buffered, unflushed) bytes on the stream, FP, that is open for writing. */ @@ -39,7 +39,7 @@ __fpending (FILE *fp) /* GNU libc, BeOS, Haiku, Linux libc5 */ return fp->_IO_write_ptr - fp->_IO_write_base; #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */ return fp->_p - fp->_bf._base; #elif defined __EMX__ /* emx+gcc */ return fp->_ptr - fp->_buffer; diff --git a/lib/fpurge.c b/lib/fpurge.c index f05da5a..fc88646 100644 --- a/lib/fpurge.c +++ b/lib/fpurge.c @@ -19,7 +19,7 @@ /* Specification. */ #include <stdio.h> -#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7, Android API >= 23 */ +#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7, Cygwin >= 1.7.10, Android API >= 23 */ # include <stdio_ext.h> #endif #include <stdlib.h> @@ -29,13 +29,13 @@ int fpurge (FILE *fp) { -#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7, Android API >= 23, musl libc */ +#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7, Cygwin >= 1.7.10, Android API >= 23, musl libc */ __fpurge (fp); /* The __fpurge function does not have a return value. */ return 0; -#elif HAVE_FPURGE /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin 1.7 */ +#elif HAVE_FPURGE /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin >= 1.7 */ /* Call the system's fpurge function. */ # undef fpurge diff --git a/lib/freadable.c b/lib/freadable.c index 160fc30..b7110cb 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, Cygwin >= 1.7.34, Android API >= 23, + musl libc. */ bool freadable (FILE *fp) @@ -38,7 +39,7 @@ freadable (FILE *fp) /* GNU libc, BeOS, Haiku, Linux libc5 */ return (fp->_flags & _IO_NO_READS) == 0; #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */ return (fp_->_flags & (__SRW | __SRD)) != 0; #elif defined __EMX__ /* emx+gcc */ return (fp->_flags & (_IORW | _IOREAD)) != 0; diff --git a/lib/freadable.h b/lib/freadable.h index 5a17e4a..f05e5fb 100644 --- a/lib/freadable.h +++ b/lib/freadable.h @@ -22,7 +22,7 @@ STREAM must not be wide-character oriented. The result doesn't change until the stream is closed or re-opened. */ -#if HAVE___FREADABLE /* glibc >= 2.2, Solaris >= 7, Android API >= 23, musl libc */ +#if HAVE___FREADABLE /* glibc >= 2.2, Solaris >= 7, Cygwin >= 1.7.34, Android API >= 23, musl libc */ # include <stdio_ext.h> # define freadable(stream) (__freadable (stream) != 0) diff --git a/lib/freading.c b/lib/freading.c index f4dab78..f046676 100644 --- a/lib/freading.c +++ b/lib/freading.c @@ -37,7 +37,7 @@ freading (FILE *fp) || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 && fp->_IO_read_base != NULL)); # elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */ return (fp_->_flags & __SRD) != 0; # elif defined __EMX__ /* emx+gcc */ return (fp->_flags & _IOREAD) != 0; diff --git a/lib/freading.h b/lib/freading.h index 6c5592e..1891f5a 100644 --- a/lib/freading.h +++ b/lib/freading.h @@ -33,7 +33,7 @@ STREAM must not be wide-character oriented. */ #if HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)) -/* Solaris >= 7, Android API >= 29, not glibc >= 2.2, but glibc >= 2.7, or musl libc */ +/* Solaris >= 7, Cygwin >= 1.7.34, Android API >= 29, not glibc >= 2.2, but glibc >= 2.7, or musl libc */ # include <stdio_ext.h> # define freading(stream) (__freading (stream) != 0) diff --git a/lib/fwritable.c b/lib/fwritable.c index fa6231d..51407d7 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, Cygwin >= 1.7.34, Android API >= 23, + musl libc. */ bool fwritable (FILE *fp) @@ -38,7 +39,7 @@ fwritable (FILE *fp) /* GNU libc, BeOS, Haiku, Linux libc5 */ return (fp->_flags & _IO_NO_WRITES) == 0; #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */ return (fp_->_flags & (__SRW | __SWR)) != 0; #elif defined __EMX__ /* emx+gcc */ return (fp->_flags & (_IORW | _IOWRT)) != 0; diff --git a/lib/fwritable.h b/lib/fwritable.h index 44c760c..509e069 100644 --- a/lib/fwritable.h +++ b/lib/fwritable.h @@ -22,7 +22,7 @@ STREAM must not be wide-character oriented. The result doesn't change until the stream is closed or re-opened. */ -#if HAVE___FWRITABLE /* glibc >= 2.2, Solaris >= 7, Android API >= 23, musl libc */ +#if HAVE___FWRITABLE /* glibc >= 2.2, Solaris >= 7, Cygwin >= 1.7.34, Android API >= 23, musl libc */ # include <stdio_ext.h> # define fwritable(stream) (__fwritable (stream) != 0) diff --git a/lib/fwriting.c b/lib/fwriting.c index e0d535d..466d277 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, Cygwin >= 1.7.34, Android API >= 29, + musl libc. */ bool fwriting (FILE *fp) @@ -34,7 +35,7 @@ fwriting (FILE *fp) /* GNU libc, BeOS, Haiku, Linux libc5 */ return (fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) != 0; #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */ return (fp_->_flags & __SWR) != 0; #elif defined __EMX__ /* emx+gcc */ return (fp->_flags & _IOWRT) != 0; diff --git a/lib/fwriting.h b/lib/fwriting.h index 111e3dc..2d16f42 100644 --- a/lib/fwriting.h +++ b/lib/fwriting.h @@ -33,7 +33,7 @@ STREAM must not be wide-character oriented. */ -#if HAVE___FWRITING /* glibc >= 2.2, Solaris >= 7, Android API >= 29, musl libc */ +#if HAVE___FWRITING /* glibc >= 2.2, Solaris >= 7, Cygwin >= 1.7.34, Android API >= 29, musl libc */ # include <stdio_ext.h> # define fwriting(stream) (__fwriting (stream) != 0)