Index: trunk/src/emx/include/arpa/inet.h
===================================================================
--- trunk/src/emx/include/arpa/inet.h	(revision 353)
+++ trunk/src/emx/include/arpa/inet.h	(revision 354)
@@ -44,15 +44,6 @@
 #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
-/* @} */
+#ifndef TCPCALL
+#define TCPCALL _System
 #endif
 
@@ -64,20 +55,20 @@
 #include <sys/types.h>
 #include <sys/cdefs.h>
-int             _System inet_aton (const char *, struct in_addr *);
-char *          _System inet_neta (u_long, char *, size_t);
-char *          _System inet_net_ntop (int, const void *, int, char *, size_t);
-int             _System inet_net_pton (int, const char *, void *, size_t);
-int             _System inet_pton (int af, const char *src, void *dst);
-const char *    _System inet_ntop (int af, const void *src, char *dst, size_t s);
-u_int           _System inet_nsap_addr (const char *, u_char *, int maxlen);
-char *          _System inet_nsap_ntoa (int, const u_char *, char *ascii);
+int             TCPCALL inet_aton (const char *, struct in_addr *);
+char *          TCPCALL inet_neta (u_long, char *, size_t);
+char *          TCPCALL inet_net_ntop (int, const void *, int, char *, size_t);
+int             TCPCALL inet_net_pton (int, const char *, void *, size_t);
+int             TCPCALL inet_pton (int af, const char *src, void *dst);
+const char *    TCPCALL inet_ntop (int af, const void *src, char *dst, size_t s);
+u_int           TCPCALL inet_nsap_addr (const char *, u_char *, int maxlen);
+char *          TCPCALL inet_nsap_ntoa (int, const u_char *, char *ascii);
 #endif
 
-extern u_long   _System inet_addr(__const__ char*);
-extern u_long	_System inet_lnaof(struct in_addr);
-extern struct in_addr _System inet_makeaddr(u_long, u_long);
-extern u_long   _System inet_netof(struct in_addr);
-extern u_long   _System inet_network(__const__ char*);
-extern char*    _System inet_ntoa(struct in_addr);
+extern u_long   TCPCALL inet_addr(__const__ char*);
+extern u_long	TCPCALL inet_lnaof(struct in_addr);
+extern struct in_addr TCPCALL inet_makeaddr(u_long, u_long);
+extern u_long   TCPCALL inet_netof(struct in_addr);
+extern u_long   TCPCALL inet_network(__const__ char*);
+extern char*    TCPCALL inet_ntoa(struct in_addr);
 
 #if defined (__cplusplus)
Index: trunk/src/emx/include/arpa/nameser.h
===================================================================
--- trunk/src/emx/include/arpa/nameser.h	(revision 353)
+++ trunk/src/emx/include/arpa/nameser.h	(revision 354)
@@ -362,40 +362,24 @@
 
 
-#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*);
-u_long	_System _getlong(u_char*);
+#ifndef TCPCALL
+#define TCPCALL _System
+#endif
+
+u_short TCPCALL _getshort(u_char*);
+u_long	TCPCALL _getlong(u_char*);
 #ifdef TCPV40HDRS /* newer have this in resolver */
-void	_System putshort(u_short, u_char *);
-void	_System putlong(u_long, u_char *);
-int	_System dn_expand(__const__ u_char*, __const__ u_char*, __const__ u_char*, u_char*, int);
-int	_System dn_comp(__const__ u_char*, u_char*, int, u_char**, u_char**);
-int	_System dn_find(u_char*, u_char*, u_char**, u_char**);
-int	_System dn_skipname(__const__ u_char*, __const__ u_char*);
-int	_System res_init(void);
-int	_System res_mkquery(int, __const__ char*, int, int, __const__ char*, int, __const__ struct rrec*, char*, int);
-int	_System res_send(__const__ char*, int, char*, int);
-int	_System res_query(char*, int, int, u_char*, int);
-int	_System res_search(char*, int, int, u_char*, int);
-int	_System res_querydomain(char*, char*, int, int, u_char*, int);
+void	TCPCALL putshort(u_short, u_char *);
+void	TCPCALL putlong(u_long, u_char *);
+int	TCPCALL dn_expand(__const__ u_char*, __const__ u_char*, __const__ u_char*, u_char*, int);
+int	TCPCALL dn_comp(__const__ u_char*, u_char*, int, u_char**, u_char**);
+int	TCPCALL dn_find(u_char*, u_char*, u_char**, u_char**);
+int	TCPCALL dn_skipname(__const__ u_char*, __const__ u_char*);
+int	TCPCALL res_init(void);
+int	TCPCALL res_mkquery(int, __const__ char*, int, int, __const__ char*, int, __const__ struct rrec*, char*, int);
+int	TCPCALL res_send(__const__ char*, int, char*, int);
+int	TCPCALL res_query(char*, int, int, u_char*, int);
+int	TCPCALL res_search(char*, int, int, u_char*, int);
+int	TCPCALL res_querydomain(char*, char*, int, int, u_char*, int);
 #endif
 
Index: trunk/src/emx/include/netdb.h
===================================================================
--- trunk/src/emx/include/netdb.h	(revision 353)
+++ trunk/src/emx/include/netdb.h	(revision 354)
@@ -34,5 +34,5 @@
  *
  *	from: @(#)netdb.h	5.15 (Berkeley) 4/3/91
- *	netdb.h,v 1.3 2003/05/19 13:20:02 bird Exp
+ *	netdb.h,v 1.4 2003/07/11 11:39:47 bird Exp
  */
 
@@ -165,60 +165,33 @@
 #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
-
+#ifndef TCPCALL
+#define TCPCALL _System
+#endif
 
 /* BSD */
-int                 _System gethostname( char *, int );
-struct hostent *    _System gethostbyname( __const__ char * );
-struct hostent *    _System gethostbyaddr( __const__ char *, int, int );
-struct netent *     _System getnetbyname( __const__ char * );
-struct netent *     _System getnetbyaddr( unsigned long, int );
-struct servent *    _System getservbyname( __const__ char *, char * );
-struct servent *    _System getservbyport( int, __const__ char * );
-struct servent *    _System getservent( void );
-struct protoent *   _System getprotobyname( __const__ char * );
-struct protoent *   _System getprotobynumber( int );
-void                _System sethostent( int );
-struct hostent *    _System gethostent( void );
-void                _System endhostent(void);
-void                _System setnetent( int );
-struct netent *     _System getnetent( void );
-void                _System endnetent(void);
-void                _System setprotoent( int );
-struct protoent *   _System getprotoent( void );
-void                _System endprotoent(void);
-void                _System setservent( int );
-struct servent *    _System getservent( void );
-void                _System endservent(void);
+int                 TCPCALL gethostname( char *, int );
+struct hostent *    TCPCALL gethostbyname( __const__ char * );
+struct hostent *    TCPCALL gethostbyaddr( __const__ char *, int, int );
+struct netent *     TCPCALL getnetbyname( __const__ char * );
+struct netent *     TCPCALL getnetbyaddr( unsigned long, int );
+struct servent *    TCPCALL getservbyname( __const__ char *, char * );
+struct servent *    TCPCALL getservbyport( int, __const__ char * );
+struct servent *    TCPCALL getservent( void );
+struct protoent *   TCPCALL getprotobyname( __const__ char * );
+struct protoent *   TCPCALL getprotobynumber( int );
+void                TCPCALL sethostent( int );
+struct hostent *    TCPCALL gethostent( void );
+void                TCPCALL endhostent(void);
+void                TCPCALL setnetent( int );
+struct netent *     TCPCALL getnetent( void );
+void                TCPCALL endnetent(void);
+void                TCPCALL setprotoent( int );
+struct protoent *   TCPCALL getprotoent( void );
+void                TCPCALL endprotoent(void);
+void                TCPCALL setservent( int );
+struct servent *    TCPCALL getservent( void );
+void                TCPCALL endservent(void);
 #ifndef TCPV40HDRS
-struct hostent *    _System gethostbyname2( __const__ char *, int );
+struct hostent *    TCPCALL gethostbyname2( __const__ char *, int );
 #endif
 
@@ -226,10 +199,10 @@
 /* OS2 Additions */
 #ifdef TCPV40HDRS
-int                 _System tcp_h_errno(void);
-struct hostent *    _System Rgethostbyname(char *); /* Socks additions */
+int                 TCPCALL tcp_h_errno(void);
+struct hostent *    TCPCALL Rgethostbyname(char *); /* Socks additions */
 #else
-const char *        _System hstrerror(int);
-/* void               _System sethostfile(const char *); */
-int *               _System tcp_h_errno1(void);
+const char *        TCPCALL hstrerror(int);
+/* void               TCPCALL sethostfile(const char *); */
+int *               TCPCALL tcp_h_errno1(void);
 #endif
 
Index: trunk/src/emx/include/resolv.h
===================================================================
--- trunk/src/emx/include/resolv.h	(revision 353)
+++ trunk/src/emx/include/resolv.h	(revision 354)
@@ -34,5 +34,5 @@
  *
  *	from: @(#)resolv.h	5.15 (Berkeley) 4/3/91
- *	resolv.h,v 1.3 2003/05/19 13:20:02 bird Exp
+ *	resolv.h,v 1.4 2003/07/11 11:39:47 bird Exp
  */
 
@@ -160,8 +160,4 @@
 #ifdef TCPV40HDRS
 
-/** @name tcpip40 function mappings.
- * @{ */
-#define _res tcpip40__res
-/* @} */
 extern	struct state _res;
 
@@ -192,5 +188,9 @@
         res_sendhookact;
 
-typedef res_sendhookact (* _System res_send_qhook)(struct sockaddr_in * const *ns,
+#ifndef TCPCALL
+#define TCPCALL _System
+#endif
+
+typedef res_sendhookact (* TCPCALL res_send_qhook)(struct sockaddr_in * const *ns,
                                               const u_char **query,
                                               int *querylen,
@@ -199,5 +199,5 @@
                                               int *resplen);
 
-typedef res_sendhookact (* _System res_send_rhook)(const struct sockaddr_in *ns,
+typedef res_sendhookact (* TCPCALL res_send_rhook)(const struct sockaddr_in *ns,
                                               const u_char *query,
                                               int querylen,
@@ -264,54 +264,54 @@
 #define res_close       __res_close
 
-int             _System res_hnok(const char *);
-int             _System res_ownok(const char *);
-int             _System res_mailok(const char *);
-int             _System res_dnok(const char *);
-int             _System sym_ston(const struct res_sym *, char *, int *);
-const char *    _System sym_ntos(const struct res_sym *, int, int *);
-const char *    _System sym_ntop(const struct res_sym *, int, int *);
-int             _System b64_ntop(u_char const *, size_t, char *, size_t);
-int             _System b64_pton(char const *, u_char *, size_t);
-int             _System loc_aton(const char *, u_char *);
-const char *    _System loc_ntoa(const u_char *, char *);
-int             _System dn_skipname(const u_char *, const u_char *);
-void            _System fp_resstat(struct __res_state *, int);
-void            _System fp_query(const u_char *, int);
-void            _System fp_nquery(const u_char *, int, int);
-const char *    _System hostalias(const char *);
-void            _System putlong(u_int32_t, u_char *);
-void            _System putshort(u_int16_t, u_char *);
-const char *    _System p_class(int);
-const char *    _System p_time(u_int32_t);
-const char *    _System p_type(int);
-void            _System p_query(const u_char *);
-const u_char *  _System p_cdnname(const u_char *, const u_char *, int, int);
-const u_char *  _System p_cdname(const u_char *, const u_char *, int);
-const u_char *  _System p_fqnname(const u_char *cp, const u_char *msg,
+int             TCPCALL res_hnok(const char *);
+int             TCPCALL res_ownok(const char *);
+int             TCPCALL res_mailok(const char *);
+int             TCPCALL res_dnok(const char *);
+int             TCPCALL sym_ston(const struct res_sym *, char *, int *);
+const char *    TCPCALL sym_ntos(const struct res_sym *, int, int *);
+const char *    TCPCALL sym_ntop(const struct res_sym *, int, int *);
+int             TCPCALL b64_ntop(u_char const *, size_t, char *, size_t);
+int             TCPCALL b64_pton(char const *, u_char *, size_t);
+int             TCPCALL loc_aton(const char *, u_char *);
+const char *    TCPCALL loc_ntoa(const u_char *, char *);
+int             TCPCALL dn_skipname(const u_char *, const u_char *);
+void            TCPCALL fp_resstat(struct __res_state *, int);
+void            TCPCALL fp_query(const u_char *, int);
+void            TCPCALL fp_nquery(const u_char *, int, int);
+const char *    TCPCALL hostalias(const char *);
+void            TCPCALL putlong(u_int32_t, u_char *);
+void            TCPCALL putshort(u_int16_t, u_char *);
+const char *    TCPCALL p_class(int);
+const char *    TCPCALL p_time(u_int32_t);
+const char *    TCPCALL p_type(int);
+void            TCPCALL p_query(const u_char *);
+const u_char *  TCPCALL p_cdnname(const u_char *, const u_char *, int, int);
+const u_char *  TCPCALL p_cdname(const u_char *, const u_char *, int);
+const u_char *  TCPCALL p_fqnname(const u_char *cp, const u_char *msg,
                                              int, char *, int);
-const u_char *  _System p_fqname(const u_char *, const u_char *, int);
-const u_char *  _System p_rr(const u_char *, const u_char *, int);
-const char *    _System p_option(u_long option);
-char *          _System p_secstodate(u_long);
-int             _System dn_count_labels(char *);
-int             _System dn_comp(const char *, u_char *, int,
+const u_char *  TCPCALL p_fqname(const u_char *, const u_char *, int);
+const u_char *  TCPCALL p_rr(const u_char *, const u_char *, int);
+const char *    TCPCALL p_option(u_long option);
+char *          TCPCALL p_secstodate(u_long);
+int             TCPCALL dn_count_labels(char *);
+int             TCPCALL dn_comp(const char *, u_char *, int,
                                 u_char **, u_char **);
-int             _System dn_expand(const u_char *, const u_char *, const u_char *,
+int             TCPCALL dn_expand(const u_char *, const u_char *, const u_char *,
                                   char *, int);
-int             _System res_init(void);
-u_int           _System res_randomid(void);
-int             _System res_query(const char *, int, int, u_char *, int);
-int             _System res_search(const char *, int, int, u_char *, int);
-int             _System res_querydomain(const char *, const char *, int, int, u_char *, int);
-int             _System res_mkquery(int, const char *, int, int, const u_char *, int,
+int             TCPCALL res_init(void);
+u_int           TCPCALL res_randomid(void);
+int             TCPCALL res_query(const char *, int, int, u_char *, int);
+int             TCPCALL res_search(const char *, int, int, u_char *, int);
+int             TCPCALL res_querydomain(const char *, const char *, int, int, u_char *, int);
+int             TCPCALL res_mkquery(int, const char *, int, int, const u_char *, int,
                                     const u_char *, u_char *, int);
-int             _System res_send(const u_char *, int, u_char *, int);
-int             _System res_isourserver(const struct sockaddr_in *);
-int             _System res_nameinquery(const char *, int, int,
+int             TCPCALL res_send(const u_char *, int, u_char *, int);
+int             TCPCALL res_isourserver(const struct sockaddr_in *);
+int             TCPCALL res_nameinquery(const char *, int, int,
                                         const u_char *, const u_char *);
-int             _System res_queriesmatch(const u_char *, const u_char *,
+int             TCPCALL res_queriesmatch(const u_char *, const u_char *,
                                          const u_char *, const u_char *);
-void            _System res_close(void);
-int             _System dn_find(u_char *exp_dn, u_char *msg,
+void            TCPCALL res_close(void);
+int             TCPCALL dn_find(u_char *exp_dn, u_char *msg,
                                u_char **dnptrs, u_char **lastdnptr);
 #endif /* !TCPV40HDRS */
Index: trunk/src/emx/include/sys/ioccom.h
===================================================================
--- trunk/src/emx/include/sys/ioccom.h	(revision 353)
+++ trunk/src/emx/include/sys/ioccom.h	(revision 354)
@@ -72,16 +72,15 @@
 #include <sys/cdefs.h>
 
+#ifndef TCPCALL
+#define TCPCALL _System
+#endif
+
 __BEGIN_DECLS
 #ifdef TCPV40HDRS
-/** @name tcpip40 function mappings.
- * @{ */
-#define so_ioctl    tcpip40_so_ioctl
-/* @} */
-
 /** The v40 socket ioctl interface.
  * @remark sys based libc have separeate handle spaces for sockets and files
  *         therefore this socket specific call.
  */
-int         _System so_ioctl __P((int, int, char *, int));
+int         TCPCALL so_ioctl __P((int, int, char *, int));
 #else
 /** The v41+ BSD socket ioctl interface.
@@ -89,7 +88,7 @@
  *         therefore this socket specific call.
  */
-int         _System so_ioctl __P((int, unsigned long, ...));
+int         TCPCALL so_ioctl __P((int, unsigned long, ...));
 /** The v41+ OS/2 specific socket ioctl interface. */
-int         _System os2_ioctl __P((int, unsigned long, char *, int));
+int         TCPCALL os2_ioctl __P((int, unsigned long, char *, int));
 #endif
 
Index: trunk/src/emx/include/sys/select.h
===================================================================
--- trunk/src/emx/include/sys/select.h	(revision 353)
+++ trunk/src/emx/include/sys/select.h	(revision 354)
@@ -95,8 +95,4 @@
  */
 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 353)
+++ trunk/src/emx/include/sys/socket.h	(revision 354)
@@ -432,58 +432,26 @@
 #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);
-int     _System connect (int, __const__ struct sockaddr *, int);
-int     _System gethostid (void);
-int     _System getpeername (int, struct sockaddr *, int *);
-int     _System getsockname (int, struct sockaddr *, int *);
-int     _System getsockopt (int, int, int, void *, int *);
-int     _System listen (int, int);
-int     _System recv (int, void *, int, int);
-int     _System recvfrom (int, void *, int, int, struct sockaddr *, int *);
-int     _System recvmsg (int, struct msghdr *, int);
-int     _System send (int, __const__ void *, int, int);
-int     _System sendto (int, __const__ void *, int, int, __const__ struct sockaddr *, int);
-int     _System sendmsg (int, __const__ struct msghdr *, int);
-int     _System setsockopt (int, int, int, __const__ void *, int);
-int     _System shutdown (int, int);
-int     _System socket (int, int, int);
-int     _System socketpair (int, int, int, int *);
+#ifndef TCPCALL
+#define TCPCALL _System
+#endif
+
+int     TCPCALL accept (int, struct sockaddr *, int *);
+int     TCPCALL bind (int, __const__ struct sockaddr *, int);
+int     TCPCALL connect (int, __const__ struct sockaddr *, int);
+int     TCPCALL gethostid (void);
+int     TCPCALL getpeername (int, struct sockaddr *, int *);
+int     TCPCALL getsockname (int, struct sockaddr *, int *);
+int     TCPCALL getsockopt (int, int, int, void *, int *);
+int     TCPCALL listen (int, int);
+int     TCPCALL recv (int, void *, int, int);
+int     TCPCALL recvfrom (int, void *, int, int, struct sockaddr *, int *);
+int     TCPCALL recvmsg (int, struct msghdr *, int);
+int     TCPCALL send (int, __const__ void *, int, int);
+int     TCPCALL sendto (int, __const__ void *, int, int, __const__ struct sockaddr *, int);
+int     TCPCALL sendmsg (int, __const__ struct msghdr *, int);
+int     TCPCALL setsockopt (int, int, int, __const__ void *, int);
+int     TCPCALL shutdown (int, int);
+int     TCPCALL socket (int, int, int);
+int     TCPCALL socketpair (int, int, int, int *);
 
 /* EMX addition */
@@ -491,33 +459,33 @@
 
 #ifndef TCPV40HDRS
-int     _System accept_and_recv (long, long*, struct sockaddr *, long*, struct sockaddr*, long*, caddr_t, size_t);
+int     TCPCALL accept_and_recv (long, long*, struct sockaddr *, long*, struct sockaddr*, long*, caddr_t, size_t);
 #endif
 
 /* OS/2 additions */
-void    _System addsockettolist(int);
-int     _System removesocketfromlist(int);
+void    TCPCALL addsockettolist(int);
+int     TCPCALL removesocketfromlist(int);
 #include <sys/ioccom.h>
 #ifdef TCPV40HDRS
 #include <sys/select.h>
 #endif
-int     _System sock_init( void );
-int     _System sock_errno( void );
-void    _System psock_errno( char * );
-int     _System soclose( int );
-int     _System so_cancel(int);
-int     _System Raccept(int, struct sockaddr *, int *);
+int     TCPCALL sock_init( void );
+int     TCPCALL sock_errno( void );
+void    TCPCALL psock_errno( char * );
+int     TCPCALL soclose( int );
+int     TCPCALL so_cancel(int);
+int     TCPCALL Raccept(int, struct sockaddr *, int *);
 #ifdef TCPV40HDRS
 struct sockaddr_in;
-int     _System Rbind(int, struct sockaddr_in *, int, struct sockaddr_in *);
-#else
-int     _System Rbind(int, struct sockaddr *, int, struct sockaddr *);
-#endif
-int     _System Rconnect(int, const struct sockaddr *, int);
-int     _System Rgetsockname(int, struct sockaddr *, int *);
-int     _System Rlisten(int, int);
-#ifndef TCPV40HDRS
-ssize_t _System send_file(int *, struct sf_parms *, int );
-char *  _System sock_strerror(int);
-int     _System getinetversion(char *);
+int     TCPCALL Rbind(int, struct sockaddr_in *, int, struct sockaddr_in *);
+#else
+int     TCPCALL Rbind(int, struct sockaddr *, int, struct sockaddr *);
+#endif
+int     TCPCALL Rconnect(int, const struct sockaddr *, int);
+int     TCPCALL Rgetsockname(int, struct sockaddr *, int *);
+int     TCPCALL Rlisten(int, int);
+#ifndef TCPV40HDRS
+ssize_t TCPCALL send_file(int *, struct sf_parms *, int );
+char *  TCPCALL sock_strerror(int);
+int     TCPCALL getinetversion(char *);
 #endif
 
@@ -525,5 +493,9 @@
 /* more OS/2 stuff. */
 #ifndef MAXSOCKETS
-#define MAXSOCKETS	2048
+#ifdef TCPV40HDRS
+#define MAXSOCKETS  2048
+#else
+#define MAXSOCKETS  32768
+#endif
 #endif
 
Index: trunk/src/emx/include/sys/time.h
===================================================================
--- trunk/src/emx/include/sys/time.h	(revision 353)
+++ trunk/src/emx/include/sys/time.h	(revision 354)
@@ -156,20 +156,19 @@
 
 #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
-/* @} */
 /* These are libc functions so no _System convention. */
 int     utimes (__const__ char *, __const__ struct timeval *);
 int     gettimeofday (struct timeval *, struct timezone *);
 int     settimeofday (__const__ struct timeval *, __const__ struct timezone *);
+
 #ifndef TCPV40HDRS
 #include <sys/cdefs.h>
-int     _System adjtime(const struct timeval *, struct timeval *);
-int     _System getitimer(int, struct itimerval *);
-int     _System setitimer(int, const struct itimerval *, struct itimerval *);
+
+#ifndef TCPCALL
+#define TCPCALL _System
+#endif
+
+int     TCPCALL adjtime(const struct timeval *, struct timeval *);
+int     TCPCALL getitimer(int, struct itimerval *);
+int     TCPCALL setitimer(int, const struct itimerval *, struct itimerval *);
 #endif
 #endif /* TCPV40HDRS */
Index: trunk/src/emx/include/sys/uio.h
===================================================================
--- trunk/src/emx/include/sys/uio.h	(revision 353)
+++ trunk/src/emx/include/sys/uio.h	(revision 354)
@@ -62,14 +62,13 @@
         UIO_USERISPACE          /* from user I space */
 };
-/** @name tcpip40 function mappings.
- * @{ */
-#define so_readv        tcpip40_readv
-#define so_writev       tcpip40_writev
-/* @} */
 #endif
 
 /* TCPIP versions */
-int _System so_readv (int, __const__ struct iovec *, int);
-int _System so_writev (int, __const__ struct iovec *, int);
+#ifndef TCPCALL
+#define TCPCALL _System
+#endif
+
+int TCPCALL so_readv (int, __const__ struct iovec *, int);
+int TCPCALL so_writev (int, __const__ struct iovec *, int);
 
 /* EMX versions */
Index: trunk/src/emx/include/unistd.h
===================================================================
--- trunk/src/emx/include/unistd.h	(revision 353)
+++ trunk/src/emx/include/unistd.h	(revision 354)
@@ -226,25 +226,21 @@
 
 /* Toolkit compatibility */
+#ifndef TCPCALL
+#define TCPCALL _System
+#endif
+
 #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);
+int     TCPCALL     soclose (int);
 #ifndef _POSIX_SOURCE
-int     _System     gethostid (void);
-int     _System     gethostname (char *, int);
-int     _System     iruserok (unsigned long, int, const char *, const char *);
-int     _System     rcmd (char **, int, const char *, const char *, const char *, int *);
-int     _System     rresvport (int *);
-int     _System     ruserok (const char *, int, const char *, const char *);
+int     TCPCALL     gethostid (void);
+int     TCPCALL     gethostname (char *, int);
+#ifndef TCPV40HDRS
+int     TCPCALL     iruserok (unsigned long, int, const char *, const char *);
+int     TCPCALL     rcmd (char **, int, const char *, const char *, const char *, int *);
+int     TCPCALL     rresvport (int *);
+int     TCPCALL     ruserok (const char *, int, const char *, const char *);
 #include <sys/select.h>
+#endif /* !TCP40HDRS */
 #endif /* !_POSIX_SOURCE */
 
Index: trunk/src/emx/include/utils.h
===================================================================
--- trunk/src/emx/include/utils.h	(revision 353)
+++ trunk/src/emx/include/utils.h	(revision 354)
@@ -3,15 +3,13 @@
 #define _UTILS_H_
 
+#ifndef TCPCALL
+#define TCPCALL _System
+#endif
+
 #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);
-int             _System rexec(char **, int, char *, char *, char *, int *);
+unsigned long   TCPCALL lswap(unsigned long);
+unsigned short  TCPCALL bswap(unsigned short);
+int             TCPCALL rexec(char **, int, char *, char *, char *, int *);
 
 /* Definition for bswap */
@@ -23,7 +21,11 @@
 #define copyout(x,y,z)  memcpy((y),(x),(z))
 #ifndef XP_OS2_VACPP /* mozilla */
+/* We've got the real thing now. (aliased at least)
 #define strcasecmp(x,y)     strcmpi((x),(y))
 #define strncasecmp(x,y,z)  strnicmp(x,y,z)
+*/
 #endif
+int strcasecmp (__const__ char *, __const__ char *);
+int strncasecmp (__const__ char *, __const__ char *, size_t);
 
 #ifndef MIN
@@ -39,5 +41,5 @@
 
 #else
-int     _System rexec(char **, int, char *, char *, char *, int *);
+int     TCPCALL rexec(char **, int, char *, char *, char *, int *);
 #endif /*TCPV40HDRS*/
 
