Index: trunk/src/emx/include/emx/fnmatch.h
===================================================================
--- trunk/src/emx/include/emx/fnmatch.h	(revision 1086)
+++ trunk/src/emx/include/emx/fnmatch.h	(revision 1087)
@@ -19,5 +19,5 @@
 
 
-#if !defined (_POSIX_SOURCE) || defined (_WITH_UNDERSCORE)
+#if !defined (_POSIX_SOURCE) || defined (_WITH_UNDERSCORE) || defined(__USE_EMX)
 
 /* emx extensions */
Index: trunk/src/emx/include/features.h
===================================================================
--- trunk/src/emx/include/features.h	(revision 1086)
+++ trunk/src/emx/include/features.h	(revision 1087)
@@ -22,4 +22,8 @@
  *                off_t is 64bits.
  * @changed bird: not GLIBC version numbers.
+ * @chagned bird: _GNU_SOURCE should not set _POSIX_SOURCE or _POSIX_C_SOURCE as that
+ *                means somewhat imporatant exclusions in EMX and BSD style headers.
+ *                Some of this have been fixed by __USE_EMX/_EMX_SOURCE, but that's
+ *                not gonna help enough.
  */
 
@@ -110,4 +114,7 @@
 #undef	__FAVOR_BSD
 #undef	__KERNEL_STRICT_NAMES
+#ifdef __EMX__                          /* bird */
+#undef  __USE_EMX                       /* bird */
+#endif                                  /* bird */
 
 /* Suppress kernel-name space pollution unless user expressedly asks
@@ -133,8 +140,14 @@
 # undef  _ISOC99_SOURCE
 # define _ISOC99_SOURCE	1
+/* bird: sorry, but this isn't causing huge exclusions for BSD or EMX headers. */
+#ifndef __EMX__                         /* bird */
 # undef  _POSIX_SOURCE
 # define _POSIX_SOURCE	1
 # undef  _POSIX_C_SOURCE
 # define _POSIX_C_SOURCE	199506L
+#else                                   /* bird */
+# define __USE_POSIX199309	1       /* bird */
+# define __USE_POSIX199506	1       /* bird */
+#endif                                  /* bird */
 # undef  _XOPEN_SOURCE
 # define _XOPEN_SOURCE	600
@@ -149,4 +162,7 @@
 # undef  _SVID_SOURCE
 # define _SVID_SOURCE	1
+# ifdef __EMX__
+#  define _EMX_SOURCE   1
+# endif
 #endif
 
@@ -259,4 +275,8 @@
 #endif
 
+#if defined(__EMX__) && defined(_EMX_SOURCE) /* bird */
+# define __USE_EMX      1               /* bird */
+#endif                                  /* bird */
+
 #if defined _REENTRANT || defined _THREAD_SAFE
 # define __USE_REENTRANT	1
Index: trunk/src/emx/include/float.h
===================================================================
--- trunk/src/emx/include/float.h	(revision 1086)
+++ trunk/src/emx/include/float.h	(revision 1087)
@@ -62,5 +62,5 @@
 
 
-#if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)
+#if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) || defined(__USE_EMX)
 
 #define M_E             2.71828182845904523536
Index: trunk/src/emx/include/io.h
===================================================================
--- trunk/src/emx/include/io.h	(revision 1086)
+++ trunk/src/emx/include/io.h	(revision 1087)
@@ -86,6 +86,5 @@
 int write (int, __const__ void *, size_t);
 
-#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) \
-    || defined (_WITH_UNDERSCORE)
+#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) || defined (_WITH_UNDERSCORE) || defined(__USE_EMX)
 
 int _access (__const__ char *, int);
Index: trunk/src/emx/include/malloc.h
===================================================================
--- trunk/src/emx/include/malloc.h	(revision 1086)
+++ trunk/src/emx/include/malloc.h	(revision 1087)
@@ -29,6 +29,5 @@
 
 
-#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) \
-    || defined (_WITH_UNDERSCORE)
+#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) || defined (_WITH_UNDERSCORE) || defined(__USE_EMX)
 
 #if !defined (_HEAPOK)
Index: trunk/src/emx/include/pwd.h
===================================================================
--- trunk/src/emx/include/pwd.h	(revision 1086)
+++ trunk/src/emx/include/pwd.h	(revision 1087)
@@ -45,5 +45,5 @@
 struct passwd *_getpwnam (__const__ char *);
 
-#if !defined (_POSIX_SOURCE)
+#if !defined (_POSIX_SOURCE) || defined(__USE_EMX)
 
 struct passwd *getpwent (void);
Index: trunk/src/emx/include/stddef.h
===================================================================
--- trunk/src/emx/include/stddef.h	(revision 1086)
+++ trunk/src/emx/include/stddef.h	(revision 1087)
@@ -79,6 +79,5 @@
 /* bird: EMX - start */
 #define _PTRDIFF_T
-#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) \
-    || defined (_WITH_UNDERSCORE)
+#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) || defined (_WITH_UNDERSCORE) || defined(__USE_EMX)
 unsigned *__threadid (void);
 #define _threadid (__threadid ())
Index: trunk/src/emx/include/stdio.h
===================================================================
--- trunk/src/emx/include/stdio.h	(revision 1086)
+++ trunk/src/emx/include/stdio.h	(revision 1087)
@@ -524,5 +524,5 @@
 extern __inline__ int putchar (int _c) { return putc (_c, stdout); }
 
-#if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)
+#if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) || defined(__USE_EMX)
 
 char *cuserid (char *);
@@ -535,6 +535,5 @@
 
 
-#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) \
-    || defined (_WITH_UNDERSCORE)
+#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) || defined (_WITH_UNDERSCORE) || defined(__USE_EMX)
 
 int _fcloseall (void);
Index: trunk/src/emx/include/stdlib.h
===================================================================
--- trunk/src/emx/include/stdlib.h	(revision 1086)
+++ trunk/src/emx/include/stdlib.h	(revision 1087)
@@ -300,5 +300,5 @@
 #endif
 
-#if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)
+#if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) || defined(__USE_EMX)
 
 #if !defined (OS2_MODE)
@@ -382,6 +382,5 @@
 
 
-#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) \
-    || defined (_WITH_UNDERSCORE)
+#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) || defined (_WITH_UNDERSCORE) || defined(__USE_EMX)
 
 extern char **_environ;
Index: trunk/src/emx/include/string.h
===================================================================
--- trunk/src/emx/include/string.h	(revision 1086)
+++ trunk/src/emx/include/string.h	(revision 1087)
@@ -125,5 +125,5 @@
 /* bird: EMX stuff - start */
 
-#if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)
+#if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) || defined(__USE_EMX)
 #if !defined (_MEMDIF_EQ)
 #define _MEMDIF_EQ 0xffffffff
@@ -144,6 +144,5 @@
 #endif
 
-#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) \
-    || defined (_WITH_UNDERSCORE)
+#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) || defined (_WITH_UNDERSCORE) || defined(__USE_EMX)
 size_t _memcount (__const__ void *, int, size_t);
 size_t _memdif (__const__ void *, __const__ void *, size_t);
Index: trunk/src/emx/include/sys/fcntl.h
===================================================================
--- trunk/src/emx/include/sys/fcntl.h	(revision 1086)
+++ trunk/src/emx/include/sys/fcntl.h	(revision 1087)
@@ -283,5 +283,5 @@
 #define O_BINARY        0x0100
 #define O_SIZE          0x0020          /* EMX used 0x8000 for O_SIZE. */
-#if !defined (_POSIX_SOURCE)
+#if !defined (_POSIX_SOURCE) || defined(__USE_EMX)
 #define O_NOINHERIT     0x1000          /* EMX used 0x1000 for O_NOINHERIT. */
 #endif
@@ -302,5 +302,5 @@
 #endif
 
-#if !defined (_POSIX_SOURCE) || defined (_WITH_UNDERSCORE)
+#if !defined (_POSIX_SOURCE) || defined (_WITH_UNDERSCORE) || defined(__USE_EMX)
 __BEGIN_DECLS
 int _creat (__const__ char *, int);
Index: trunk/src/emx/include/sys/signal.h
===================================================================
--- trunk/src/emx/include/sys/signal.h	(revision 1086)
+++ trunk/src/emx/include/sys/signal.h	(revision 1087)
@@ -104,5 +104,5 @@
 
 
-#if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)
+#if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) || defined(__USE_EMX)
 
 #define SIG_ACK ((void (*)(int))4)
Index: trunk/src/emx/include/sys/stat.h
===================================================================
--- trunk/src/emx/include/sys/stat.h	(revision 1086)
+++ trunk/src/emx/include/sys/stat.h	(revision 1087)
@@ -353,5 +353,5 @@
 
 /* bird: emx stuff - start */
-#if !defined (_POSIX_SOURCE) || defined (_WITH_UNDERSCORE)
+#if !defined (_POSIX_SOURCE) || defined (_WITH_UNDERSCORE) || defined(__USE_EMX)
 int _chmod (__const__ char *, int);
 int _fstat (int, struct stat *);
Index: trunk/src/emx/include/sys/types.h
===================================================================
--- trunk/src/emx/include/sys/types.h	(revision 1086)
+++ trunk/src/emx/include/sys/types.h	(revision 1087)
@@ -346,5 +346,5 @@
 
 /* bird: OS/2 Toolkit Pollution. */
-#if !defined (_POSIX_SOURCE)
+#if !defined (_POSIX_SOURCE) || defined(__USE_EMX)
 #ifdef __32BIT__
 typedef int             long_int;       /* 32-bit compilers */
Index: trunk/src/emx/include/sys/wait.h
===================================================================
--- trunk/src/emx/include/sys/wait.h	(revision 1086)
+++ trunk/src/emx/include/sys/wait.h	(revision 1087)
@@ -22,5 +22,5 @@
 int waitpid (int, int *, int);
 
-#if !defined (_POSIX_SOURCE) || defined (_WITH_UNDERSCORE)
+#if !defined (_POSIX_SOURCE) || defined (_WITH_UNDERSCORE) || defined(__USE_EMX)
 
 int _wait (int *);
Index: trunk/src/emx/include/time.h
===================================================================
--- trunk/src/emx/include/time.h	(revision 1086)
+++ trunk/src/emx/include/time.h	(revision 1087)
@@ -190,5 +190,5 @@
 
 /* bird: EMX/VAC/MSC legacy start. */
-#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) || defined (_WITH_UNDERSCORE)
+#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) || defined (_WITH_UNDERSCORE) || defined(__USE_EMX)
 extern int _daylight;
 extern long _timezone;
