Re: [htdig3-dev] Re: iTools version of ht://Dig on MacOS X


Subject: Re: [htdig3-dev] Re: iTools version of ht://Dig on MacOS X
From: Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Date: Wed Feb 16 2000 - 11:59:53 PST


According to Geoff Hutchison:
> I requested a copy of the source from Tenon Intersystems' version of
> ht://Dig that they package for their "iTools" product that runs on
> MacOS X and now LinuxPPC--of course the latter is simply a version of
> the RPM.
>
> Anyway, here's where you can get the source:
> http://iris2.sysci.org/tenon/htdig-3.1.2.src.itools.osx.tar.gz
>
> Beware, they include the binaries as well as an uncompressed tar of
> the binaries! It's really big.
>
> I haven't had a chance to do a comparison between the trees, but it
> is actually based on 3.1.2--their WebTen version of ht://Dig, which
> is also named '3.1.2' was 3.1.0b2 last time I checked.
>
> I won't do any sort of merge for the 3-1-x tree, but I assume people
> would like me to merge in any changes for the 3-2-x tree? Since Mac
> OS X Server is based on BSD, I'd be interested to see what changes
> they made.

As far as I can tell, all you'd have to do is apply the patch below, and
configure using "./configure --prefix=/Local/Library/WebServer/htdig".
The patch applies to 3.1.4, and should apply to the upcoming 3.1.5
as well. It's a pretty simple patch, but not exactly clean, as they
never bothered with declarations for the my*() functions and let the
compiler assume int for everything. I think a cleaner approach would
be to rename the method names that conflict with the socket library
functions, so that you can do away with the "::" overrides, and add a
test in the autoconf stuff for sys/malloc.h as well as malloc.h. Come
to think of it, why use malloc.h at at all? DB2_db::db_init() uses
calloc() to allocate and clear a DB_ENV object, but it should probably
use "new" and memset() instead, then you can do away with malloc.h.

--- htdig-3.1.2/htlib/Connection.cc Wed Apr 21 21:47:58 1999
+++ htdig-3.1.2.itools.osx/htlib/Connection.cc Sun Jun 6 22:16:41 1999
@@ -144,7 +144,7 @@ int Connection::close()
     connected = 0;
     if (sock >= 0)
     {
- int ret = ::close(sock);
+ int ret = myclose(sock);
         sock = -1;
         return ret;
     }
@@ -228,10 +228,10 @@ int Connection::connect(int allow_EINTR)
 
     for (;;)
     {
- status = ::connect(sock, (struct sockaddr *)&server, sizeof(server));
+ status = myconnect(sock, (struct sockaddr *)&server, sizeof(server));
         if (status < 0 && errno == EINTR && !allow_EINTR)
         {
- ::close(sock);
+ myclose(sock);
             open();
             continue;
         }
@@ -251,11 +251,11 @@ int Connection::connect(int allow_EINTR)
         // to close the socket and create a new one in order to do any
         // more with it.
         //
- ::close(sock);
+ myclose(sock);
         open();
     }
 #else
- ::close(sock);
+ myclose(sock);
     open(0);
 #endif
 
@@ -269,7 +269,7 @@ int Connection::connect(int allow_EINTR)
 //
 int Connection::bind()
 {
- if (::bind(sock, (struct sockaddr *)&server, sizeof(server)) == NOTOK)
+ if (mybind(sock, (struct sockaddr *)&server, sizeof(server)) == NOTOK)
     {
         return NOTOK;
     }
@@ -297,7 +297,7 @@ int Connection::get_port()
 //
 int Connection::listen(int n)
 {
- return ::listen(sock, n);
+ return mylisten(sock, n);
 }
 
 
@@ -310,7 +310,7 @@ Connection *Connection::accept(int priv)
 
     while (1)
     {
- newsock = ::accept(sock, (struct sockaddr *)0, (GETPEERNAME_LENGTH_T *)0);
+ newsock = myaccept(sock, (struct sockaddr *)0, (GETPEERNAME_LENGTH_T *)0);
         if (newsock == NOTOK && errno == EINTR)
             continue;
         break;
--- htdig-3.1.2/htlib/DB2_db.cc Wed Apr 21 21:47:58 1999
+++ htdig-3.1.2.itools.osx/htlib/DB2_db.cc Sun Jun 6 22:16:55 1999
@@ -44,7 +44,7 @@ static char RCSid[] = "$Id: DB2_db.cc,v
 #include <errno.h>
 #include <stdlib.h>
 #include <fstream.h>
-#include <malloc.h>
+#include <sys/malloc.h>
 #include <unistd.h>
 
 // Where do I need this for? I don't know.
--- htdig-3.1.2/htlib/Makefile.in Wed Apr 21 21:47:58 1999
+++ htdig-3.1.2.itools.osx/htlib/Makefile.in Sun Jun 6 22:13:20 1999
@@ -16,6 +16,7 @@ OBJS= Configuration.o Connection.o Datab
                 URL.o URLTrans.o cgi.o \
                 good_strtok.o io.o strcasecmp.o \
                 strptime.o mytimegm.o HtCodec.o HtWordCodec.o \
+ myconnection.o mywrite.o \
                 HtURLCodec.o regex.o HtWordType.o
 
 TARGET= libht.a
--- htdig-3.1.2/htlib/String.cc Wed Apr 21 21:47:58 1999
+++ htdig-3.1.2.itools.osx/htlib/String.cc Sun Jun 6 22:10:13 1999
@@ -198,7 +198,7 @@ int String::write(int fd) const
         
     while (left)
     {
- int result = ::write(fd, wptr, left);
+ int result = mywrite(fd, wptr, left);
                 
         if (result < 0)
             return result;
--- htdig-3.1.2/htlib/myconnection.c Sun Jun 6 22:00:00 1999
+++ htdig-3.1.2.itools.osx/htlib/myconnection.c Sun Jun 6 22:16:31 1999
@@ -0,0 +1,24 @@
+myconnect( sock,addr,len )
+{
+ return( connect(sock,addr,len ) );
+}
+
+mybind( sock,addr,len )
+{
+ return( bind( sock,addr,len ) );
+}
+
+mylisten( sock,n )
+{
+ return( listen(sock,n) );
+}
+
+myaccept( sock,addr,len )
+{
+ return( accept(sock,addr,len) );
+}
+
+myclose( n )
+{
+ return( close(n) );
+}
--- htdig-3.1.2/htlib/mywrite.c Sun Jun 6 22:00:00 1999
+++ htdig-3.1.2.itools.osx/htlib/mywrite.c Sun Jun 6 22:13:03 1999
@@ -0,0 +1,4 @@
+mywrite( fid,buf,cnt )
+{
+ return( write( fid,buf,cnt ) );
+}

-- 
Gilles R. Detillieux              E-mail: <grdetil@scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

------------------------------------ To unsubscribe from the htdig3-dev mailing list, send a message to htdig3-dev-unsubscribe@htdig.org You will receive a message to confirm this.



This archive was generated by hypermail 2b28 : Wed Feb 16 2000 - 12:03:03 PST