Re: patch: stdio fiex for UnixWare

2020-10-11 Thread Tim Rice


Hi Bruno,

On Sun, 11 Oct 2020, Bruno Haible wrote:

> I'm applying the patch below, to fix this. The main differences to yours are:
>   * No need to touch the modules freadahead, freadptr, fseterr, since the
> functions __freadahead, __freadptr, __fseterr don't exist on your 
> platform,
True as things stand today. I figured it would be more future proof
so add those now in case __freadahead, __freadptr, __fseterr are added
to UnixWare later.

> .
>   * When we modify a .m4 file, we also need to bump its serial number.

Sorry, I've seen enough patches come by on this list, I should have
remembered that. 

>   * It does not make the code clearer to remove the HAVE___FLBF and 
> HAVE___FPURGE
> tests in fbufmode.c and fpurge.c.

Fine with me.

Thank you for the commit.

-- 
Tim RiceMultitalents(707) 456-1146
t...@multitalents.net





Re: patch: stdio fiex for UnixWare

2020-10-11 Thread Bruno Haible
Tim Rice wrote in
:
> 
> I've attached a patch to address the fact that UnixWare does not have
> stdio_ext.h but has some __X() stdio helper functions.
> 
> Wrap "#include " in HAVE_STDIO_EXT_H insead of HAVE___X

I'm applying the patch below, to fix this. The main differences to yours are:
  * No need to touch the modules freadahead, freadptr, fseterr, since the
functions __freadahead, __freadptr, __fseterr don't exist on your platform,
as you reported in
.
  * When we modify a .m4 file, we also need to bump its serial number.
  * It does not make the code clearer to remove the HAVE___FLBF and 
HAVE___FPURGE
tests in fbufmode.c and fpurge.c.


2020-10-11  Bruno Haible  

stdioext: Avoid compilation errors on UnixWare 7.
Reported by Tim Rice  in
.
* lib/fbufmode.c: Don't include  if it does not exist.
* lib/fpurge.c: Likewise.
* lib/freadable.h: Likewise.
* lib/freading.h: Likewise.
* lib/fwritable.h: Likewise.
* lib/fwriting.h: Likewise.
* m4/fbufmode.m4 (gl_FUNC_FBUFMODE): Test whether  exists.
* m4/fpurge.m4 (gl_FUNC_FPURGE): Likewise.
* m4/freadable.m4 (gl_FUNC_FREADABLE): Likewise.
* m4/freading.m4 (gl_FUNC_FREADING): Likewise.
* m4/fwritable.m4 (gl_FUNC_FWRITABLE): Likewise.
* m4/fwriting.m4 (gl_FUNC_FWRITING): Likewise.

diff --git a/lib/fbufmode.c b/lib/fbufmode.c
index 65a5cfc..a528a63 100644
--- a/lib/fbufmode.c
+++ b/lib/fbufmode.c
@@ -20,7 +20,9 @@
 #include "fbufmode.h"
 
 #if HAVE___FLBF
-# include 
+# if HAVE_STDIO_EXT_H
+#  include 
+# endif
 #endif
 
 #include "stdio-impl.h"
diff --git a/lib/fpurge.c b/lib/fpurge.c
index fc88646..9469ce4 100644
--- a/lib/fpurge.c
+++ b/lib/fpurge.c
@@ -19,8 +19,10 @@
 /* Specification.  */
 #include 
 
-#if HAVE___FPURGE   /* glibc >= 2.2, Haiku, Solaris >= 7, 
Cygwin >= 1.7.10, Android API >= 23 */
-# include 
+#if HAVE___FPURGE   /* glibc >= 2.2, Haiku, Solaris >= 7, 
Cygwin >= 1.7.10, Android API >= 23, musl libc */
+# if HAVE_STDIO_EXT_H
+#  include 
+# endif
 #endif
 #include 
 
diff --git a/lib/freadable.h b/lib/freadable.h
index f05e5fb..9139865 100644
--- a/lib/freadable.h
+++ b/lib/freadable.h
@@ -24,7 +24,9 @@
 
 #if HAVE___FREADABLE /* glibc >= 2.2, Solaris >= 7, Cygwin >= 1.7.34, Android 
API >= 23, musl libc */
 
-# include 
+# if HAVE_STDIO_EXT_H
+#  include 
+# endif
 # define freadable(stream) (__freadable (stream) != 0)
 
 #else
diff --git a/lib/freading.h b/lib/freading.h
index 1891f5a..7bef18e 100644
--- a/lib/freading.h
+++ b/lib/freading.h
@@ -35,7 +35,9 @@
 #if HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ 
> 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))
 /* Solaris >= 7, Cygwin >= 1.7.34, Android API >= 29, not glibc >= 2.2, but 
glibc >= 2.7, or musl libc  */
 
-# include 
+# if HAVE_STDIO_EXT_H
+#  include 
+# endif
 # define freading(stream) (__freading (stream) != 0)
 
 #else
diff --git a/lib/fwritable.h b/lib/fwritable.h
index 509e069..fb9c871 100644
--- a/lib/fwritable.h
+++ b/lib/fwritable.h
@@ -24,7 +24,9 @@
 
 #if HAVE___FWRITABLE /* glibc >= 2.2, Solaris >= 7, Cygwin >= 1.7.34, Android 
API >= 23, musl libc */
 
-# include 
+# if HAVE_STDIO_EXT_H
+#  include 
+# endif
 # define fwritable(stream) (__fwritable (stream) != 0)
 
 #else
diff --git a/lib/fwriting.h b/lib/fwriting.h
index 2d16f42..3aa5d7f 100644
--- a/lib/fwriting.h
+++ b/lib/fwriting.h
@@ -35,7 +35,9 @@
 
 #if HAVE___FWRITING /* glibc >= 2.2, Solaris >= 7, Cygwin >= 1.7.34, Android 
API >= 29, musl libc */
 
-# include 
+# if HAVE_STDIO_EXT_H
+#  include 
+# endif
 # define fwriting(stream) (__fwriting (stream) != 0)
 
 #else
diff --git a/m4/fbufmode.m4 b/m4/fbufmode.m4
index 87e76e0..e2a146f 100644
--- a/m4/fbufmode.m4
+++ b/m4/fbufmode.m4
@@ -1,4 +1,4 @@
-# fbufmode.m4 serial 2
+# fbufmode.m4 serial 3
 dnl Copyright (C) 2007, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,5 +7,6 @@ dnl with or without modifications, as long as this notice is 
preserved.
 AC_DEFUN([gl_FUNC_FBUFMODE],
 [
   dnl Prerequisites of lib/fbufmode.c.
+  AC_CHECK_HEADERS_ONCE([stdio_ext.h])
   AC_CHECK_FUNCS_ONCE([__flbf __fbufsize])
 ])
diff --git a/m4/fpurge.m4 b/m4/fpurge.m4
index 0796a6f..9a486e0 100644
--- a/m4/fpurge.m4
+++ b/m4/fpurge.m4
@@ -1,4 +1,4 @@
-# fpurge.m4 serial 11
+# fpurge.m4 serial 12
 dnl Copyright (C) 2007, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,6 +8,7 @@ AC_DEFUN([gl_FUNC_FPURGE],
 [
   

Re: patch: stdio fiex for UnixWare

2020-09-24 Thread Tim Rice

Hi Paul,

On Thu, 24 Sep 2020, Paul Eggert wrote:

> On 9/24/20 1:49 PM, Tim Rice wrote:
> > Wrap "#include " in HAVE_STDIO_EXT_H insead of HAVE___X
> 
> Shouldn't this also add AC_CHECK_HEADERS_ONCE([stdio_ext.h]) to the
> corresponding .m4 files, as fpending.m4 and getpass.m4 already do?

Seems reasonable.
I've attached stdio_ext_m4.patch


-- 
Tim RiceMultitalents
t...@multitalents.net
ChangeLog
2020-09-24  Tim Rice  
* m4/fbufmode.m4: add AC_CHECK_HEADERS_ONCE([stdio_ext.h])
* m4/fpurge.m4: Likewise.
* m4/freadable.m4: Likewise.
* m4/freadahead.m4: Likewise.
* m4/freading.m4: Likewise.
* m4/freadptr.m4: Likewise.
* m4/fseterr.m4: Likewise.
* m4/fwritable.m4: Likewise.
* m4/fwriting.m4: Likewise.

diff --git a/m4/fbufmode.m4 b/m4/fbufmode.m4
index 87e76e0d7..99f835e5e 100644
--- a/m4/fbufmode.m4
+++ b/m4/fbufmode.m4
@@ -6,6 +6,7 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_FUNC_FBUFMODE],
 [
+  AC_CHECK_HEADERS_ONCE([stdio_ext.h])
   dnl Prerequisites of lib/fbufmode.c.
   AC_CHECK_FUNCS_ONCE([__flbf __fbufsize])
 ])
diff --git a/m4/fpurge.m4 b/m4/fpurge.m4
index 0796a6f0e..6bc3c937a 100644
--- a/m4/fpurge.m4
+++ b/m4/fpurge.m4
@@ -8,6 +8,7 @@ AC_DEFUN([gl_FUNC_FPURGE],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_HEADERS_ONCE([stdio_ext.h])
   AC_CHECK_FUNCS_ONCE([fpurge])
   AC_CHECK_FUNCS_ONCE([__fpurge])
   AC_CHECK_DECLS([fpurge], , , [[#include ]])
diff --git a/m4/freadable.m4 b/m4/freadable.m4
index 3237effe0..e5a317ee8 100644
--- a/m4/freadable.m4
+++ b/m4/freadable.m4
@@ -6,5 +6,6 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_FUNC_FREADABLE],
 [
+  AC_CHECK_HEADERS_ONCE([stdio_ext.h])
   AC_CHECK_FUNCS_ONCE([__freadable])
 ])
diff --git a/m4/freadahead.m4 b/m4/freadahead.m4
index 05132b526..5d2d9af87 100644
--- a/m4/freadahead.m4
+++ b/m4/freadahead.m4
@@ -6,5 +6,6 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_FUNC_FREADAHEAD],
 [
+  AC_CHECK_HEADERS_ONCE([stdio_ext.h])
   AC_CHECK_FUNCS_ONCE([__freadahead])
 ])
diff --git a/m4/freading.m4 b/m4/freading.m4
index 440c241e4..10ad2349f 100644
--- a/m4/freading.m4
+++ b/m4/freading.m4
@@ -6,5 +6,6 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_FUNC_FREADING],
 [
+  AC_CHECK_HEADERS_ONCE([stdio_ext.h])
   AC_CHECK_FUNCS_ONCE([__freading])
 ])
diff --git a/m4/freadptr.m4 b/m4/freadptr.m4
index 799703554..88f4965e3 100644
--- a/m4/freadptr.m4
+++ b/m4/freadptr.m4
@@ -6,5 +6,6 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_FUNC_FREADPTR],
 [
+  AC_CHECK_HEADERS_ONCE([stdio_ext.h])
   AC_CHECK_FUNCS_ONCE([__freadptr])
 ])
diff --git a/m4/fseterr.m4 b/m4/fseterr.m4
index 7266579b3..64036790f 100644
--- a/m4/fseterr.m4
+++ b/m4/fseterr.m4
@@ -6,5 +6,6 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_FUNC_FSETERR],
 [
+  AC_CHECK_HEADERS_ONCE([stdio_ext.h])
   AC_CHECK_FUNCS_ONCE([__fseterr])
 ])
diff --git a/m4/fwritable.m4 b/m4/fwritable.m4
index dbe887e88..ac5d71eb4 100644
--- a/m4/fwritable.m4
+++ b/m4/fwritable.m4
@@ -6,5 +6,6 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_FUNC_FWRITABLE],
 [
+  AC_CHECK_HEADERS_ONCE([stdio_ext.h])
   AC_CHECK_FUNCS_ONCE([__fwritable])
 ])
diff --git a/m4/fwriting.m4 b/m4/fwriting.m4
index 4d7cd3ede..a87f35986 100644
--- a/m4/fwriting.m4
+++ b/m4/fwriting.m4
@@ -6,5 +6,6 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_FUNC_FWRITING],
 [
+  AC_CHECK_HEADERS_ONCE([stdio_ext.h])
   AC_CHECK_FUNCS_ONCE([__fwriting])
 ])


Re: patch: stdio fiex for UnixWare

2020-09-24 Thread Tim Rice


Hi Bruno,

On Fri, 25 Sep 2020, Bruno Haible wrote:

> Tim Rice wrote:
> > I've attached a patch to address the fact that UnixWare does not have
> > stdio_ext.h but has some __X() stdio helper functions.
> 
> In which header file are they declared? Can you show these declarations,
> please?
> 
> Bruno

stdio.h

extern size_t   __fbufsiz(FILE *);
extern int  __filbuf(FILE *);
extern int  __flbf(FILE *);
extern int  __flsbuf(int, FILE *);
extern size_t   __fpending(FILE *);
extern void __fpurge(FILE *);
extern int  __freadable(FILE *);
extern int  __freading(FILE *);
extern int  __fwritable(FILE *);
extern int  __fwriting(FILE *);
extern void _flushlbf(void);

-- 
Tim RiceMultitalents
t...@multitalents.net





Re: patch: stdio fiex for UnixWare

2020-09-24 Thread Bruno Haible
Tim Rice wrote:
> I've attached a patch to address the fact that UnixWare does not have
> stdio_ext.h but has some __X() stdio helper functions.

In which header file are they declared? Can you show these declarations,
please?

Bruno




Re: patch: stdio fiex for UnixWare

2020-09-24 Thread Paul Eggert

On 9/24/20 1:49 PM, Tim Rice wrote:

Wrap "#include " in HAVE_STDIO_EXT_H insead of HAVE___X


Shouldn't this also add AC_CHECK_HEADERS_ONCE([stdio_ext.h]) to the 
corresponding .m4 files, as fpending.m4 and getpass.m4 already do?




patch: stdio fiex for UnixWare

2020-09-24 Thread Tim Rice

I've attached a patch to address the fact that UnixWare does not have
stdio_ext.h but has some __X() stdio helper functions.

Wrap "#include " in HAVE_STDIO_EXT_H insead of HAVE___X

-- 
Tim RiceMultitalents
t...@multitalents.net
diff --git a/ChangeLog b/ChangeLog
index 5c4d8f849..51e074bd3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2020-09-24  Tim Rice  
+   UnixWare does not have stdio_ext.h but has some __X() stdio
+   helper functions.
+   * lib/fbufmode.c: Wrap "#include " in HAVE_STDIO_EXT_H
+   * lib/fpurge.c: Likewise.
+   * lib/freadable.h: Likewise.
+   * lib/freadahead.h: Likewise.
+   * lib/freading.h: Likewise.
+   * lib/freadptr.h: Likewise.
+   * lib/fseterr.h: Likewise.
+   * lib/fwritable.h: Likewise.
+   * lib/fwriting.h: Likewise.
+
 2020-09-23  Paul Eggert  
 
regex: fix ignore-case Turkish bug
diff --git a/lib/fbufmode.c b/lib/fbufmode.c
index 65a5cfc82..ec8afd510 100644
--- a/lib/fbufmode.c
+++ b/lib/fbufmode.c
@@ -19,7 +19,7 @@
 /* Specification.  */
 #include "fbufmode.h"
 
-#if HAVE___FLBF
+#if HAVE_STDIO_EXT_H
 # include 
 #endif
 
@@ -61,7 +61,7 @@ fbufmode (FILE *fp)
   else
 return _IONBF;
 # else
-#  if HAVE___FLBF   /* Solaris >= 7 */
+#  if HAVE___FLBF   /* Solaris >= 7, UnixWare 7.1.4 >= MP4 */
   if (__flbf (fp))
 return _IOLBF;
 #  else
diff --git a/lib/fpurge.c b/lib/fpurge.c
index f05da5abb..2af81a605 100644
--- a/lib/fpurge.c
+++ b/lib/fpurge.c
@@ -19,7 +19,7 @@
 /* Specification.  */
 #include 
 
-#if HAVE___FPURGE   /* glibc >= 2.2, Haiku, Solaris >= 7, 
Android API >= 23 */
+#if HAVE_STDIO_EXT_H/* glibc >= 2.2, Haiku, Solaris >= 7, 
Android API >= 23 */
 # include 
 #endif
 #include 
@@ -29,7 +29,7 @@
 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, 
Android API >= 23, musl libc, UnixWare 7.1.4 >= MP4 */
 
   __fpurge (fp);
   /* The __fpurge function does not have a return value.  */
diff --git a/lib/freadable.h b/lib/freadable.h
index 5a17e4a03..c664b7d26 100644
--- a/lib/freadable.h
+++ b/lib/freadable.h
@@ -22,9 +22,11 @@
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, Android API >= 23, musl 
libc, UnixWare 7.1.4 >= MP4 */
 
-# include 
+# if HAVE_STDIO_EXT_H
+#  include 
+# endif
 # define freadable(stream) (__freadable (stream) != 0)
 
 #else
diff --git a/lib/freadahead.h b/lib/freadahead.h
index b971d5a06..d76b306ac 100644
--- a/lib/freadahead.h
+++ b/lib/freadahead.h
@@ -29,7 +29,9 @@
 
 #if HAVE___FREADAHEAD /* musl libc */
 
-# include 
+# if HAVE_STDIO_EXT_H
+#  include 
+# endif
 # define freadahead(stream) __freadahead (stream)
 
 #else
diff --git a/lib/freading.h b/lib/freading.h
index 6c5592ec0..11deadc2d 100644
--- a/lib/freading.h
+++ b/lib/freading.h
@@ -33,9 +33,11 @@
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, Android API >= 29, not glibc >= 2.2, but glibc >= 2.7, or 
musl libc, UnixWare 7.1.4 >= MP4 */
 
-# include 
+# if HAVE_STDIO_EXT_H
+#  include 
+# endif
 # define freading(stream) (__freading (stream) != 0)
 
 #else
diff --git a/lib/freadptr.h b/lib/freadptr.h
index 07d2d727d..fc91a0b32 100644
--- a/lib/freadptr.h
+++ b/lib/freadptr.h
@@ -30,7 +30,9 @@
 
 #if HAVE___FREADPTR /* musl libc */
 
-# include 
+# if HAVE_STDIO_EXT_H
+#  include 
+# endif
 # define freadptr(stream,sizep) __freadptr (stream, sizep)
 
 #else
diff --git a/lib/fseterr.h b/lib/fseterr.h
index bbeb6619f..81ca5b4d2 100644
--- a/lib/fseterr.h
+++ b/lib/fseterr.h
@@ -25,7 +25,9 @@
 
 #if HAVE___FSETERR /* musl libc */
 
-# include 
+# if HAVE_STDIO_EXT_H
+#  include 
+# endif
 # define fseterr(fp) __fseterr (fp)
 
 #else
diff --git a/lib/fwritable.h b/lib/fwritable.h
index 44c760cf3..d8a705d34 100644
--- a/lib/fwritable.h
+++ b/lib/fwritable.h
@@ -22,9 +22,11 @@
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, Android API >= 23, musl 
libc, UnixWare 7.1.4 >= MP4 */
 
-# include 
+# if HAVE_STDIO_EXT_H
+#  include 
+# endif
 # define fwritable(stream) (__fwritable (stream) != 0)
 
 #else
diff --git a/lib/fwriting.h b/lib/fwriting.h
index 111e3dcb5..961e8a963 100644
---