changeset 8706:6241ddf70c2e

Ensure that <unistd.h> and <fcntl.h> define SEEK_CUR etc.
author Bruno Haible <bruno@clisp.org>
date Wed, 25 Apr 2007 06:46:57 +0000
parents caaaf4823aec
children 04725e6593af
files ChangeLog lib/unistd_.h tests/test-fcntl.c tests/test-stdio.c tests/test-unistd.c
diffstat 5 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-04-25  Bruno Haible  <bruno@clisp.org>
+
+	* lib/unistd_.h: Include <stdio.h> if needed to get the SEEK_* macros.
+	* tests/test-stdio.c: Check that the various SEEK_* macros are defined.
+	* tests/test-unistd.c: Likewise.
+	* tests/test-fcntl.c: Likewise.
+
 2007-04-23  Eric Blake  <ebb9@byu.net>
 
 	* lib/fflush.c: Fix missing include.
--- a/lib/unistd_.h
+++ b/lib/unistd_.h
@@ -22,6 +22,11 @@
 # include @ABSOLUTE_UNISTD_H@
 #endif
 
+/* mingw doesn't define the SEEK_* macros in <unistd.h>.  */
+#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
+# include <stdio.h>
+#endif
+
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
--- a/tests/test-fcntl.c
+++ b/tests/test-fcntl.c
@@ -26,6 +26,9 @@
 	| O_NOCTTY | O_NOFOLLOW | O_NOLINKS | O_RSYNC | O_SYNC
 	| O_BINARY | O_TEXT;
 
+/* Check that the various SEEK_* macros are defined.  */
+int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
+
 int
 main ()
 {
--- a/tests/test-stdio.c
+++ b/tests/test-stdio.c
@@ -21,6 +21,9 @@
 
 #include <stdio.h>
 
+/* Check that the various SEEK_* macros are defined.  */
+int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
+
 int
 main ()
 {
--- a/tests/test-unistd.c
+++ b/tests/test-unistd.c
@@ -21,6 +21,9 @@
 
 #include <unistd.h>
 
+/* Check that the various SEEK_* macros are defined.  */
+int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
+
 int
 main ()
 {