summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-10-17 12:39:30 +0000
committerJim Meyering <jim@meyering.net>1998-10-17 12:39:30 +0000
commit2e29b321166351391b643d3e885a86e0ef52a656 (patch)
treeb3919ea3293321e8b8200b654226455b89ad5145 /lib
parent082787996c876e1a2db2b2ec6b784069e0a4e145 (diff)
downloadcoreutils-2e29b321166351391b643d3e885a86e0ef52a656.tar.xz
Some systems require <unistd.h> to be included before <time.h> for
localtime_r to be declared properly.
Diffstat (limited to 'lib')
-rw-r--r--lib/mktime.c19
-rw-r--r--lib/strftime.c6
2 files changed, 16 insertions, 9 deletions
diff --git a/lib/mktime.c b/lib/mktime.c
index 702051344..a1b71e573 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -28,15 +28,10 @@
# include <config.h>
#endif
-/* Some systems require that one of these symbols be defined in
- order to declare localtime_r properly. */
+/* Some systems need this in order to declare localtime_r properly. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
-#ifndef _REENTRANT
-# define _REENTRANT 1
-#endif
-
#ifdef _LIBC
# define HAVE_LIMITS_H 1
@@ -51,6 +46,12 @@
# define LEAP_SECONDS_POSSIBLE 1
#endif
+/* Some systems require <unistd.h> to be included before <time.h>
+ for localtime_r to be declared properly. */
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
#include <sys/types.h> /* Some systems define `time_t' here. */
#include <time.h>
@@ -132,7 +133,7 @@ time_t __mktime_internal __P ((struct tm *,
#ifdef _LIBC
# define localtime_r __localtime_r
#else
-# if HAVE_LOCALTIME_R == defined (localtime_r)
+# if HAVE_LOCALTIME_R == defined localtime_r
/* Provide our own substitute for a missing or possibly broken localtime_r. */
static struct tm *my_mktime_localtime_r __P ((const time_t *, struct tm *));
static struct tm *
@@ -155,10 +156,10 @@ my_mktime_localtime_r (t, tp)
return 0;
*tp = *l;
return tp;
-# endif /* ! defined (localtime_r) */
+# endif /* ! defined localtime_r */
}
# define localtime_r my_mktime_localtime_r
-# endif /* HAVE_LOCALTIME_R == defined (localtime_r) */
+# endif /* HAVE_LOCALTIME_R == defined localtime_r */
#endif /* ! _LIBC */
diff --git a/lib/strftime.c b/lib/strftime.c
index 519c2998e..33dec1328 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -48,6 +48,12 @@
#include <ctype.h>
#include <sys/types.h> /* Some systems define `time_t' here. */
+/* Some systems require <unistd.h> to be included before <time.h>
+ for localtime_r to be declared properly. */
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>