[xml] libxml2-2.4.13 compiled for SunOS 4.1.3 (fwd)



Daniel Veillard <veillard redhat com>
23.01.02 13:21

hum, I would really prefer that you send this to the list xml gnome org
I can't test this myself, though a lot of people are "portability experts"
there, and I would prefer a more general review,

  thanks in advance,

  Daniel

----- Forwarded message from Juergen Weigert netvision de -----
From: Juergen Weigert netvision de
To: jw cs fau de
Subject: libxml2-2.4.13 compiled for SunOS 4.1.3
Date: Fri, 5 Apr 2002 18:03:10 +0200

--
  > [  Juergen Weigert, neTVision
<   [  0911 / 92699440
  > [  jw netvision de
----- Weitergeleitet von Juergen Weigert/netvision/de am 05.04.02 18:03 
-----


Juergen Weigert
23.01.02 11:02

 
        An:     daniel veillard com, veillard redhat com
        Kopie: 
        Thema:  libxml2-2.4.13 compiled for SunOS 4.1.3

I have an old Sparchstation LX which is way to slow to run a modern 
Solaris. 
So I stick to good old SunOS 4.1.3 U1 (which is only a partial posix)


While upgrading to Perl 5.6.1, Parser::XML required libxml2, I took 
libxml2-2.4.13.tar.gz from ftp.xmlsoft.org
the following patch is required to make my gcc-2.7.2.3 grok the library on 
the LX:
It is not elegant. I abuse xmlmemory.c to smuggle in missing library 
functions.
(strerror is not really used by the library, if config.h forbids, but the 
helpers like xmllint.c use it.)
I did not investigate, why an fprintf() prototype is missing, some c-files 
give only a warning, other fail without it.
My sprintf returns a pointer to the buffer instead of a length. p += 
strlen(sprintf(...)); would do the trick for me, but you won't like it.

The poor 50 Mhz CPU is still ticking through the regression tests. the 
patch does not reflect my changes to the Makefile:
For all regression tests, I changed "@(for i in ..." into "-@(for i in 
..."
I don't seem to get zero exit codes everywhere, even where diff reports 
that all is fine.

thanks,

        jw.


--- libxml2-2.4.13/xmlmemory.c.orig     Wed Jan 23 00:52:45 2002
+++ libxml2-2.4.13/xmlmemory.c  Wed Jan 23 01:00:44 2002
@@ -755,3 +755,23 @@
     return(0);
 }
 
+
+#ifdef sun
+/* sunos 413 won't compile this without help , jw */
+
+#ifndef HAVE_STRERROR
+char *strerror(int errnum)
+{
+  static char buf[30];
+  sprintf(buf, "dummy strerror(%d)\n", errnum);
+  return buf;
+}
+#endif
+
+void * memmove(void *dest, const void *src, size_t n)
+{
+  /* the sunos413u1 version of bcopy handles overlaps! jw */
+  return bcopy(src, dest, n);
+}
+#endif
+
--- libxml2-2.4.13/libxml.h.orig        Wed Jan 23 00:56:06 2002
+++ libxml2-2.4.13/libxml.h     Wed Jan 23 00:56:06 2002
@@ -32,4 +32,12 @@
 #endif
 #define IN_LIBXML
 
+#ifdef sun
+/* sunos 413 won't compile this without help , jw */
+# ifndef CLOCKS_PER_SEC
+#  define CLOCKS_PER_SEC 100
+# endif
+extern int fprintf();
+#endif
+
 #endif /* ! __XML_LIBXML_H__ */
--- libxml2-2.4.13/uri.c.orig   Wed Jan 23 01:06:06 2002
+++ libxml2-2.4.13/uri.c        Wed Jan 23 01:06:06 2002
@@ -371,7 +371,8 @@
                        return(NULL);
                    }
                }
-               len += sprintf((char *) &ret[len], ":%d", uri->port);
+               sprintf((char *) &ret[len], ":%d", uri->port);
+               len += strlen((char *) &ret[len]);
            }
        } else if (uri->authority != NULL) {
            if (len + 3 >= max) {
--- libxml2-2.4.13/nanohttp.c.orig      Tue Jan  1 04:35:06 2002
+++ libxml2-2.4.13/nanohttp.c   Tue Jan 22 19:59:36 2002
@@ -1111,23 +1111,38 @@
 
     if (proxy) {
        if (ctxt->port != 80) {
-           p += sprintf( p, "%s http://%s:%d%s";, method, ctxt->hostname,
+           /* solaris sprintf does not return strlen, jw */
+           sprintf( p, "%s http://%s:%d%s";, method, ctxt->hostname,
                        ctxt->port, ctxt->path );
+           p += strlen(p);
        }
        else
-           p += sprintf( p, "%s http://%s%s";, method,
+         {
+           sprintf( p, "%s http://%s%s";, method,
                        ctxt->hostname, ctxt->path);
+           p += strlen(p);
+         }
     }
     else
-       p += sprintf( p, "%s %s", method, ctxt->path);
+      {
+       sprintf( p, "%s %s", method, ctxt->path);
+       p += strlen(p);
+      }
 
-    p += sprintf(p, " HTTP/1.0\r\nHost: %s\r\n", ctxt->hostname);
+    sprintf(p, " HTTP/1.0\r\nHost: %s\r\n", ctxt->hostname);
+    p += strlen(p);
 
     if (contentType != NULL && *contentType) 
-       p += sprintf(p, "Content-Type: %s\r\n", *contentType);
+      {
+       sprintf(p, "Content-Type: %s\r\n", *contentType);
+       p += strlen(p);
+      }
 
     if (headers != NULL)
-       p += sprintf( p, "%s", headers );
+      {
+       sprintf( p, "%s", headers );
+       p += strlen(p);
+      }
 
     if (input != NULL)
        sprintf(p, "Content-Length: %d\r\n\r\n", ilen );
--- libxml2-2.4.13/xmlIO.c.orig Wed Jan 23 01:09:55 2002
+++ libxml2-2.4.13/xmlIO.c      Wed Jan 23 01:09:55 2002
@@ -711,9 +711,10 @@
     /*  Set the header data.  The CRC will be needed for the trailer  */
 
     buff->crc = crc32( 0L, Z_NULL, 0 );
-    hdr_lgth = sprintf( (char *)buff->zbuff, "%c%c%c%c%c%c%c%c%c%c",
+    sprintf( (char *)buff->zbuff, "%c%c%c%c%c%c%c%c%c%c",
                        GZ_MAGIC1, GZ_MAGIC2, Z_DEFLATED, 
                        0, 0, 0, 0, 0, 0, LXML_ZLIB_OS_CODE );
+    hdr_lgth = strlen( (char *)buff->zbuff);
     buff->zctrl.next_out  = buff->zbuff + hdr_lgth;
     buff->zctrl.avail_out = buff->size - hdr_lgth;
 
----- End forwarded message -----

--
 o \  Juergen Weigert         unix-software __/
<V> | jw netvision de         creator    __/
 \  | jw cs fau de                    __/
(/) | _______________________________/                     vim:set noai wm=8



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]