Index: trunk/src/emx/include/arpa/inet.h
===================================================================
--- trunk/src/emx/include/arpa/inet.h	(revision 186)
+++ trunk/src/emx/include/arpa/inet.h	(revision 187)
@@ -44,4 +44,18 @@
 #endif
 
+
+#ifdef TCPV40HDRS
+/** @name tcpip40 function mappings.
+ * @{ */
+#define inet_addr       tcpip40_inet_addr
+#define inet_lnaof      tcpip40_inet_lnaof
+#define inet_makeaddr   tcpip40_inet_makeaddr
+#define inet_netof      tcpip40_inet_netof
+#define inet_network    tcpip40_inet_network
+#define inet_ntoa       tcpip40_inet_ntoa
+/* @} */
+#endif
+
+
 /* External definitions for functions in inet(3) */
 
Index: trunk/src/emx/include/arpa/nameser.h
===================================================================
--- trunk/src/emx/include/arpa/nameser.h	(revision 186)
+++ trunk/src/emx/include/arpa/nameser.h	(revision 187)
@@ -361,4 +361,25 @@
 #endif /*!TCPV40HDRS*/
 
+
+#ifdef TCPV40HDRS
+/** @name tcpip40 function mappings.
+ * @{ */
+#define _getshort           tcpip40__getshort
+#define _getlong            tcpip40__getlong
+#define putshort            tcpip40_putshort
+#define putlong             tcpip40_putlong
+#define dn_expand           tcpip40_dn_expand
+#define dn_comp             tcpip40_dn_comp
+#define dn_find             tcpip40_dn_find
+#define dn_skipname         tcpip40_dn_skipname
+#define res_init            tcpip40_res_init
+#define res_mkquery         tcpip40_res_mkquery
+#define res_send            tcpip40_res_send
+#define res_query           tcpip40_res_query
+#define res_search          tcpip40_res_search
+#define res_querydomain     tcpip40_res_querydomain
+/* @} */
+#endif
+
 /* function prototypes */
 u_short _System _getshort(u_char*);
Index: trunk/src/emx/include/netdb.h
===================================================================
--- trunk/src/emx/include/netdb.h	(revision 186)
+++ trunk/src/emx/include/netdb.h	(revision 187)
@@ -34,5 +34,5 @@
  *
  *	from: @(#)netdb.h	5.15 (Berkeley) 4/3/91
- *	netdb.h,v 1.2 2003/05/19 02:41:00 bird Exp
+ *	netdb.h,v 1.3 2003/05/19 13:20:02 bird Exp
  */
 
@@ -163,4 +163,34 @@
 	int	_serv_stayopen;
 };
+#endif
+
+#ifdef TCPV40HDRS
+/** @name tcpip40 function mappings.
+ * @{ */
+#define gethostname         tcpip40_gethostname
+#define gethostbyname       tcpip40_gethostbyname
+#define gethostbyaddr       tcpip40_gethostbyaddr
+#define getnetbyname        tcpip40_getnetbyname
+#define getnetbyaddr        tcpip40_getnetbyaddr
+#define getservbyname       tcpip40_getservbyname
+#define getservbyport       tcpip40_getservbyport
+#define getservent          tcpip40_getservent
+#define getprotobyname      tcpip40_getprotobyname
+#define getprotobynumber    tcpip40_getprotobynumber
+#define sethostent          tcpip40_sethostent
+#define gethostent          tcpip40_gethostent
+#define endhostent          tcpip40_endhostent
+#define setnetent           tcpip40_setnetent
+#define getnetent           tcpip40_getnetent
+#define endnetent           tcpip40_endnetent
+#define setprotoent         tcpip40_setprotoent
+#define getprotoent         tcpip40_getprotoent
+#define endprotoent         tcpip40_endprotoent
+#define setservent          tcpip40_setservent
+#define getservent          tcpip40_getservent
+#define endservent          tcpip40_endservent
+#define tcp_h_errno         tcpip40_tcp_h_errno
+#define Rgethostbyname      tcpip40_Rgethostbyname
+/* @} */
 #endif
 
Index: trunk/src/emx/include/resolv.h
===================================================================
--- trunk/src/emx/include/resolv.h	(revision 186)
+++ trunk/src/emx/include/resolv.h	(revision 187)
@@ -34,5 +34,5 @@
  *
  *	from: @(#)resolv.h	5.15 (Berkeley) 4/3/91
- *	resolv.h,v 1.2 2003/05/19 02:41:00 bird Exp
+ *	resolv.h,v 1.3 2003/05/19 13:20:02 bird Exp
  */
 
@@ -160,7 +160,11 @@
 #ifdef TCPV40HDRS
 
+/** @name tcpip40 function mappings.
+ * @{ */
+#define _res tcpip40__res
+/* @} */
 extern	struct state _res;
 
-#else
+#else /* !TCPV40HDRS: */
 
 /*
Index: trunk/src/emx/include/sys/ioccom.h
===================================================================
--- trunk/src/emx/include/sys/ioccom.h	(revision 186)
+++ trunk/src/emx/include/sys/ioccom.h	(revision 187)
@@ -74,10 +74,8 @@
 __BEGIN_DECLS
 #ifdef TCPV40HDRS
-/* We must use a different ioctl function in this mode because of the
- * different _IOC macro and hence IOCTL value.
- */
-#define ioctl       tcpip40_ioctl
-#define _ioctl      tcpip40__ioctl
+/** @name tcpip40 function mappings.
+ * @{ */
 #define so_ioctl    tcpip40_so_ioctl
+/* @} */
 
 /** The v40 socket ioctl interface.
Index: trunk/src/emx/include/sys/select.h
===================================================================
--- trunk/src/emx/include/sys/select.h	(revision 186)
+++ trunk/src/emx/include/sys/select.h	(revision 187)
@@ -86,5 +86,8 @@
  */
 int _System bsdselect(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *);
+/** @name tcpip40 function mappings.
+ * @{ */
 #define os2_select  tcpip40_os2_select
+/* @} */
 #endif
 /** This is the TCPIP OS/2 styled select. */
Index: trunk/src/emx/include/sys/socket.h
===================================================================
--- trunk/src/emx/include/sys/socket.h	(revision 186)
+++ trunk/src/emx/include/sys/socket.h	(revision 187)
@@ -432,4 +432,40 @@
 #endif
 
+#ifdef TCPV40HDRS
+/** @name tcpip40 function mappings.
+ * @{ */
+#define accept                  tcpip40_accept
+#define bind                    tcpip40_bind
+#define connect                 tcpip40_connect
+#define gethostid               tcpip40_gethostid
+#define getpeername             tcpip40_getpeername
+#define getsockname             tcpip40_getsockname
+#define getsockopt              tcpip40_getsockopt
+#define listen                  tcpip40_listen
+#define recv                    tcpip40_recv
+#define recvfrom                tcpip40_recvfrom
+#define recvmsg                 tcpip40_recvmsg
+#define send                    tcpip40_send
+#define sendto                  tcpip40_sendto
+#define sendmsg                 tcpip40_sendmsg
+#define setsockopt              tcpip40_setsockopt
+#define shutdown                tcpip40_shutdown
+#define socket                  tcpip40_socket
+#define socketpair              tcpip40_socketpair
+#define addsockettolist         tcpip40_addsockettolist
+#define removesocketfromlist    tcpip40_removesocketfromlist
+#define sock_init               tcpip40_sock_init
+#define sock_errno              tcpip40_sock_errno
+#define psock_errno             tcpip40_psock_errno
+#define soclose                 tcpip40_soclose
+#define so_cancel               tcpip40_so_cancel
+#define Raccept                 tcpip40_Raccept
+#define Rbind                   tcpip40_Rbind
+#define Rconnect                tcpip40_Rconnect
+#define Rgetsockname            tcpip40_Rgetsockname
+#define Rlisten                 tcpip40_Rlisten
+/* @} */
+#endif
+
 int     _System accept (int, struct sockaddr *, int *);
 int     _System bind (int, __const__ struct sockaddr *, int);
Index: trunk/src/emx/include/sys/time.h
===================================================================
--- trunk/src/emx/include/sys/time.h	(revision 186)
+++ trunk/src/emx/include/sys/time.h	(revision 187)
@@ -156,4 +156,11 @@
 
 #if defined(TCPV40HDRS) || !defined(_POSIX_SOURCE)
+/** @name tcpip40 function mappings.
+ * @{ */
+/* utimes, gettimeofday and settimeofday is EMX so no mapping is needed. */
+#define adjtime       tcpip40_adjtime
+#define getitimer     tcpip40_getitimer
+#define setitimer     tcpip40_setitimer
+/* @} */
 int     _System utimes (__const__ char *, __const__ struct timeval *);
 int     _System gettimeofday (struct timeval *, struct timezone *);
Index: trunk/src/emx/include/sys/uio.h
===================================================================
--- trunk/src/emx/include/sys/uio.h	(revision 186)
+++ trunk/src/emx/include/sys/uio.h	(revision 187)
@@ -46,4 +46,10 @@
 #endif
 
+/** @name tcpip40 function mappings.
+ * @{ */
+#define readv         tcpip40_readv
+#define writev       tcpip40_writev
+/* @} */
+
 int _System readv (int, __const__ struct iovec *, int);
 int _System writev (int, __const__ struct iovec *, int);
Index: trunk/src/emx/include/types.h
===================================================================
--- trunk/src/emx/include/types.h	(revision 186)
+++ trunk/src/emx/include/types.h	(revision 187)
@@ -11,24 +11,15 @@
 #include <sys/types.h>
 
-
 #ifdef TCPV40HDRS
 
-#define NIL ((char *) 0)
-
-#define PZERO 0
-#define BSD 43
 #include <errno.h>
 /*#include <nerrno.h> */
 #include <sys/time.h>
 #include <utils.h>
+#include <strings.h> /* index() */
 
-#define MAXHOSTNAMELEN 120
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 260
-#endif
-#define MAXSOCKETS 2048
-
-#define index(string,c) strchr((string),(c))
-
+#define NIL ((char *) 0)
+#define PZERO 0
+#define BSD 43
 #ifndef TRUE
 #define TRUE 1
@@ -37,5 +28,9 @@
 #define FALSE 0
 #endif
-
+#define MAXHOSTNAMELEN 120
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 260
+#endif
+#define MAXSOCKETS 2048
 
 #else  /* TCPV40HDRS */
Index: trunk/src/emx/include/unistd.h
===================================================================
--- trunk/src/emx/include/unistd.h	(revision 186)
+++ trunk/src/emx/include/unistd.h	(revision 187)
@@ -225,6 +225,15 @@
 #include <sys/cdefs.h>
 #include <sys/types.h>
+/** @name tcpip40 function mappings.
+ * @{ */
+#define soclose         tcpip40_soclose
+#define gethostid       tcpip40_gethostid
+#define gethostname     tcpip40_gethostname
+#define iruserok        tcpip40_iruserok
+#define rcmd            tcpip40_rcmd
+#define rresvport       tcpip40_rresvport
+#define ruserok         tcpip40_ruserok
+/* @} */
 int     _System     soclose (int);
-
 #ifndef _POSIX_SOURCE
 int     _System     gethostid (void);
Index: trunk/src/emx/include/utils.h
===================================================================
--- trunk/src/emx/include/utils.h	(revision 186)
+++ trunk/src/emx/include/utils.h	(revision 187)
@@ -5,4 +5,10 @@
 #ifdef TCPV40HDRS
 
+/** @name tcpip40 function mappings.
+ * @{ */
+#define lswap   tcpip40_lswap
+#define bswap   tcpip40_bswap
+#define rexec   tcpip40_rexec
+/* @} */
 unsigned long   _System lswap(unsigned long);
 unsigned short  _System bswap(unsigned short);
