From 5d9da70f1897455ec4e388176e79483fab04ac3a Mon Sep 17 00:00:00 2001 From: Maurilio Longo Date: Mon, 11 Jun 2001 12:18:43 +0000 Subject: [PATCH] 2001-06-11 14:16 GMT+2 Maurilio Longo * source/rtl/net.c ! To compile under OS/2 EMX GCC compiler there were missing include files. NOTE: you need to link socket.a library to every program from now on or you'll get: rtl.a(net.o): Undefined symbol _gethostname referenced from text segment --- harbour/ChangeLog | 6 ++++++ harbour/source/rtl/net.c | 18 +++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bacd83ca16..ad373df430 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,9 @@ +2001-06-11 14:16 GMT+2 Maurilio Longo + * source/rtl/net.c + ! To compile under OS/2 EMX GCC compiler there were missing include files. + NOTE: you need to link socket.a library to every program from now on or you'll get: + rtl.a(net.o): Undefined symbol _gethostname referenced from text segment + 2001-06-10 17:40 UTC-0800 Ron Pinkas + contrib/dot/pp.prg + Restored deleted file. diff --git a/harbour/source/rtl/net.c b/harbour/source/rtl/net.c index e7793310f0..6c6e4b9af8 100644 --- a/harbour/source/rtl/net.c +++ b/harbour/source/rtl/net.c @@ -57,8 +57,20 @@ #include "hbapi.h" #include "hb_io.h" -#if defined(__DJGPP__) || defined(__RSX32__) || defined(__GNUC__) - #include "sys/param.h" +#if defined(__DJGPP__) || defined(__RSX32__) || defined(__GNUC__) && ! defined(HB_OS_OS2) + #include "sys/param.h" + +/* EMX GCC does need a different approach to include gethostname() + NOTE: you need to link socket.a library to every program from now on or you'll get: + rtl.a(net.o): Undefined symbol _gethostname referenced from text segment + */ +#elif defined(__GNUC__) && defined(HB_OS_OS2) + #include "sys/types.h" + #include "sys/socket.h" + #include "sys/ioctl.h" + #include "netdb.h" + #define MAXGETHOSTNAME 256 /* should be enough for a host name */ + #endif /* NOTE: Clipper will only return a maximum of 15 bytes from this function. And it will be padded with spaces. Harbour does the same in the @@ -72,7 +84,7 @@ HB_FUNC( NETNAME ) { char * pszValue = (char *) hb_xgrab(MAXGETHOSTNAME+1); pszValue[ 0 ] = '\0'; - + gethostname (pszValue, MAXGETHOSTNAME); hb_retc( pszValue );