]> Dogcows Code - chaz/tar/commitdiff
(EILSEQ): Include <time.h> and <wchar.h> if <errno.h> does not define
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 25 Sep 2001 18:17:36 +0000 (18:17 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 25 Sep 2001 18:17:36 +0000 (18:17 +0000)
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.

lib/unicodeio.c

index 37b69aaa01cae1f5b9f3fcf379a481afc57aed14..35bb68075ccdf69c8896157f2138bea7977305e9 100644 (file)
 #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
This page took 0.024211 seconds and 4 git commands to generate.