bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Make errno.h define EILSEQ on old LynxOS systems.


From: Joel Brobecker
Subject: [PATCH] Make errno.h define EILSEQ on old LynxOS systems.
Date: Thu, 25 Oct 2012 09:04:01 -0400

Hello,

In trying to compile mbrtowc.c on LynxOS 178, I got an error because
EILSEQ is not defined. Indeed, the system itself is too old, and is
missing that definition.

Initially, I tried to find a way that would be completely generic:
Check errno.h and do nothing if found. Otherwise, check wchar.h and
use the value from there if found. Otherwise define it using an
arbitrary value. But I felt that this was rapidly becoming very
complicated, and not worth the effort. So, in the end, I followed
the KISS principle.

ChangeLog:

        * lib/errno.in.h: On Lynx systems, define EILSEQ if not already
        defined by errno.h.
        * m4/errno_h.m4: Add check for EILSEQ.

Tested by compiling mbrtowc.c on LynxOS 5.0 where EILSEQ is available,
and LynxOS 178 2.2.2, where it is not.

Would the following patch be OK for inclusion?

Thank you,
-- 
Joel

---
 lib/errno.in.h |   15 +++++++++++++++
 m4/errno_h.m4  |    3 +++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/lib/errno.in.h b/lib/errno.in.h
index 4fba101..08d7e5f 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -270,5 +270,20 @@
 #  define GNULIB_defined_ENOTRECOVERABLE 1
 # endif
 
+/* On LynxOS, EILSEQ is normally defined in errno.h.  If not defined
+   there, the system is too old and is missing its definition.
+   One example of such old system is LynxOS 178 version 2.2.2.  */
+
+#if defined __Lynx__
+#  ifndef EILSEQ
+     /* All LynxOS systems that do define EILSEQ define it as 84.
+       But we cannot use the same value here, because it might
+       already be taken.  For instance, on LynxOS 178 version 2.x,
+       84 is ELIBBAD - corrupted shared library.  So we use an
+       arbitrary value instead.  */
+#    define EILSEQ 2015
+#  endif
+#endif
+
 #endif /* address@hidden@_ERRNO_H */
 #endif /* address@hidden@_ERRNO_H */
diff --git a/m4/errno_h.m4 b/m4/errno_h.m4
index 1e76ba2..a43a912 100644
--- a/m4/errno_h.m4
+++ b/m4/errno_h.m4
@@ -58,6 +58,9 @@ booboo
 #if !defined ENOTRECOVERABLE
 booboo
 #endif
+#if !defined EILSEQ
+booboo
+#endif
       ],
       [gl_cv_header_errno_h_complete=no],
       [gl_cv_header_errno_h_complete=yes])
-- 
1.7.0.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]