summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2001-09-25 18:17:36 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2001-09-25 18:17:36 +0000
commit1ad624bbbc38cb07899152df9eafb7f5adde71b5 (patch)
treed9f6c2a7243e3fdfbea6bfa01c3bda635eb022b9
parent02a275c6ac80029c692614e6f9d6896777089b96 (diff)
downloadtar-1ad624bbbc38cb07899152df9eafb7f5adde71b5.tar.gz
(EILSEQ): Include <time.h> and <wchar.h> if <errno.h> does not define
EILSEQ, because BSD/OS 4.1 defines EILSEQ in <wchar.h>, which requires <time.h>. Define a replacement EILSEQ to be ENOENT, not EINVAL, since callers may want to distinguish EINVAL and EILSEQ.
-rw-r--r--lib/unicodeio.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/unicodeio.c b/lib/unicodeio.c
index 37b69aaa..35bb6807 100644
--- a/lib/unicodeio.c
+++ b/lib/unicodeio.c
@@ -37,8 +37,25 @@
#ifndef errno
extern int errno;
#endif
+
+/* Define EILSEQ and ENOTSUP as portably as possible. Some
+ nonstandard systems, like SunOS 4, don't have EILSEQ. Others, like
+ BSD/OS 4.1, define it in <wchar.h>. Callers that use EILSEQ and/or
+ ENOTSUP and that want to be portable to these nonstandard systems
+ should mimic the following includes and defines. */
+
+/* BSD/OS 4.1 wchar.h defines EILSEQ, but it requires FILE (defined in
+ <stdio.h>, included above) and struct tm (defined in <time.h>) to
+ be declared. */
+#if HAVE_WCHAR_H && ! defined EILSEQ
+# include <time.h>
+# include <wchar.h>
+#endif
+
+/* Do not define EILSEQ to be EINVAL, since callers may want to
+ distinguish EINVAL and EILSEQ. */
#ifndef EILSEQ
-# define EILSEQ EINVAL
+# define EILSEQ ENOENT
#endif
#ifndef ENOTSUP
# define ENOTSUP EINVAL