From 3443f401a26a62f110baef866e536b45feafee9c Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Mon, 31 Aug 2009 13:46:36 +0000 Subject: [PATCH] 2009-08-31 15:46 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/config/detect.mk * harbour/source/rtl/Makefile * harbour/source/rtl/hbsocket.c + added support for TCPIP in DOS builds using WATTCP/WATT-32 library. The latest release of Watt-32 is available at http://www.bgnett.no/~giva/ --- harbour/ChangeLog | 8 ++++++++ harbour/config/detect.mk | 13 +++++++++++++ harbour/source/rtl/Makefile | 7 +++++++ harbour/source/rtl/hbsocket.c | 18 ++++++++++++++++-- 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c1e4b67aa2..0f68b3a079 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,14 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-31 15:46 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/config/detect.mk + * harbour/source/rtl/Makefile + * harbour/source/rtl/hbsocket.c + + added support for TCPIP in DOS builds using WATTCP/WATT-32 library. + The latest release of Watt-32 is available at + http://www.bgnett.no/~giva/ + 2009-08-31 16:00 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) * harbour/contrib/rddsql/sddfb/fbirddd.c * fixed 64bits compile warnings diff --git a/harbour/config/detect.mk b/harbour/config/detect.mk index 84a921c203..9e47e4fa30 100644 --- a/harbour/config/detect.mk +++ b/harbour/config/detect.mk @@ -23,6 +23,7 @@ export HB_HAS_GPM := export HB_HAS_SLANG := export HB_HAS_CURSES := export HB_HAS_X11 := +export HB_HAS_TCP := # Exclude Harbour-wide features prohibiting commercial use @@ -113,6 +114,18 @@ _DET_INC_HEAD := /X11/Xlib.h include $(TOP)$(ROOT)config/detfun.mk +# Detect WATTCP/WATT-32 in DOS builds + +_DET_DSP_NAME := WATTCP/WATT-32 +_DET_VAR_INC_ := HB_INC_TCP +_DET_VAR_HAS_ := HB_HAS_TCP +_DET_FLT_PLAT := dos +_DET_FLT_COMP := +_DET_INC_DEFP := $(if $(WATT_ROOT),$(WATT_ROOT)/inc,) /usr/include +_DET_INC_HEAD := /sys/socket.h + +include $(TOP)$(ROOT)config/detfun.mk + # Finished _DET_OPT_VERB := diff --git a/harbour/source/rtl/Makefile b/harbour/source/rtl/Makefile index 780d0d69fa..10ec277bee 100644 --- a/harbour/source/rtl/Makefile +++ b/harbour/source/rtl/Makefile @@ -280,5 +280,12 @@ DIRS := \ gtwvt \ gtxwc \ +ifeq ($(HB_HAS_TCP),yes) + HB_CFLAGS += -DHB_HAS_TCP + ifneq ($(HB_INC_TCP),) + HB_CFLAGS += -I$(HB_INC_TCP) + endif +endif + include $(TOP)$(ROOT)config/lib.mk include $(TOP)$(ROOT)config/dir.mk diff --git a/harbour/source/rtl/hbsocket.c b/harbour/source/rtl/hbsocket.c index f673a6e347..38fba6bb23 100644 --- a/harbour/source/rtl/hbsocket.c +++ b/harbour/source/rtl/hbsocket.c @@ -52,7 +52,7 @@ #include "hbsocket.h" -#if defined( HB_OS_DOS ) +#if defined( HB_OS_DOS ) && !defined( HB_HAS_TCP ) # if !defined( HB_SOCKET_OFF ) # define HB_SOCKET_OFF # endif @@ -146,6 +146,14 @@ # else /* test shows that GCC 3.3.6 does not support inet_pton() and inet_ntop() */ # endif +#elif defined( HB_OS_DOS ) +# define HB_HAS_INET_ATON +# define HB_HAS_INET_PTON +# define HB_HAS_INET_NTOP +# define HB_HAS_SOCKADDR_STORAGE +# define HB_HAS_ADDRINFO +# define HB_HAS_INET6_ADDR_CONST +/* # define HB_HAS_INET6 */ #endif @@ -179,7 +187,7 @@ #undef HB_OS_WIN #endif -#if defined( HB_OS_OS2 ) || defined( HB_OS_WIN ) +#if defined( HB_OS_OS2 ) || defined( HB_OS_WIN ) || defined( HB_OS_DOS ) # define socklen_t int #endif @@ -187,6 +195,12 @@ # define INET_ADDRSTRLEN 16 #endif +#if defined( HB_OS_DOS ) && !defined( SHUT_RD ) +# define SHUT_RD 0 +# define SHUT_WR 1 +# define SHUT_RDWR 2 +#endif + #if defined( __WATCOMC__ ) && defined( HB_OS_LINUX ) && !defined( IP_ADD_MEMBERSHIP ) /* it's missed in OpenWatcom 1.8 Linux header files :-( */ # define IP_ADD_MEMBERSHIP 35