Hi,
I've got three problems compiling neon-0.26.2. I only solved one.

1) parse_dates
I have no tm_gmtoff, so I added an #elif for using HAVE_TIMEZONE.
The test still failed! I modified the functions to add a sequence
point. According to the C standard, "the order of evaluation of
subexpressions and the order in which side effects take place are
both unspecified." As I've got inconsistent results, I guess GMTOFF
has been evaluated on an uninitialized gmt in some cases.

Please *notice*: that patch includes a tested change to ne_dates.c
and an _untested_ change to neon.m4. (I already had HAVE_TIMEZONE.)

2) write_reset and read_reset
It seems Solaris returns EPIPE: "write failed (-3): Broken pipe".
That is not documented in the socket(3socket) man page. I tried
changing standards (e.g. -D_XOPEN_SOURCE_EXTENDED=1 to get SUS
XPG4v2) to no avail. I gave up, an error is an error is an error.

3) dname_readable
That failed on the UTF8 name. Maybe it depends on the way I
compiled openssl.

I'm not on the mailing list, so please cc to me any followups.

Ciao
Ale
--- ./src/ne_dates.original.c   2006-05-23 22:27:37.000000000 +0200
+++ ./src/ne_dates.c    2006-11-24 16:14:22.266386000 +0100
@@ -70,6 +70,9 @@
 #define GMTOFF(t) ((t).__tm_gmtoff)
 #elif defined(WIN32)
 #define GMTOFF(t) (gmt_to_local_win32())
+#elif defined(HAVE_TIMEZONE)
+/* FIXME: the following assumes fixed dst offset of 1 hour */
+#define GMTOFF(t) (-timezone + ((t).tm_isdst>0? 3600: 0))
 #else
 /* FIXME: work out the offset anyway. */
 #define GMTOFF(t) (0)
@@ -122,6 +125,7 @@
     double sec;
     off_t fix;
     int n;
+    time_t result;
 
     /*  it goes: ISO8601: 2001-01-01T12:30:00+03:30 */
     if ((n = sscanf(date, ISO8601_FORMAT_P,
@@ -154,7 +158,8 @@
     gmt.tm_isdst = -1;
     gmt.tm_mon--;
 
-    return mktime(&gmt) + fix + GMTOFF(gmt);
+    result = mktime(&gmt) + fix;
+    return result + GMTOFF(gmt);
 }
 
 /* Takes an RFC1123-formatted date string and returns the time_t.
@@ -164,6 +169,8 @@
     struct tm gmt = {0};
     char wkday[4], mon[4];
     int n;
+    time_t result;
+    
 /*  it goes: Sun, 06 Nov 1994 08:49:37 GMT */
     n = sscanf(date, RFC1123_FORMAT,
            wkday, &gmt.tm_mday, mon, &gmt.tm_year, &gmt.tm_hour,
@@ -177,7 +184,8 @@
      * since the mktime will then fail */
     gmt.tm_mon = n;
     gmt.tm_isdst = -1;
-    return mktime(&gmt) + GMTOFF(gmt);
+    result = mktime(&gmt);
+    return result + GMTOFF(gmt);
 }
 
 /* Takes a string containing a RFC1036-style date and returns the time_t */
@@ -186,6 +194,8 @@
     struct tm gmt = {0};
     int n;
     char wkday[11], mon[4];
+    time_t result;
+
     /* RFC850/1036 style dates: Sunday, 06-Nov-94 08:49:37 GMT */
     n = sscanf(date, RFC1036_FORMAT,
                wkday, &gmt.tm_mday, mon, &gmt.tm_year,
@@ -207,7 +217,8 @@
 
     gmt.tm_mon = n;
     gmt.tm_isdst = -1;
-    return mktime(&gmt) + GMTOFF(gmt);
+    result = mktime(&gmt);
+    return result + GMTOFF(gmt);
 }
 
 
@@ -219,6 +230,8 @@
     struct tm gmt = {0};
     int n;
     char wkday[4], mon[4];
+    time_t result;
+
     n = sscanf(date, ASCTIME_FORMAT,
                wkday, mon, &gmt.tm_mday, 
                &gmt.tm_hour, &gmt.tm_min, &gmt.tm_sec,
@@ -231,7 +244,8 @@
      * since the mktime will then fail */
     gmt.tm_mon = n;
     gmt.tm_isdst = -1;
-    return mktime(&gmt) + GMTOFF(gmt);
+    result = mktime(&gmt);
+    return result + GMTOFF(gmt);
 }
 
 /* HTTP-date parser */
--- ./macros/neon.original.m4   2006-10-30 14:18:51.000000000 +0100
+++ ./macros/neon.m4    2006-11-24 13:58:21.613977000 +0100
@@ -664,7 +664,17 @@
   [#include <time.h>])
 
 if test $ac_cv_member_struct_tm_tm_gmtoff$ac_cv_member_struct_tm___tm_gmtoff = 
nono; then
-  AC_MSG_WARN([no timezone handling in date parsing on this platform])
+  AC_CACHE_CHECK([for timezone global], ne_cv_cc_timezone,
+    AC_TRY_COMPILE([
+      #include <time.h>
+    ], [
+      timezone = 1;
+  ], ne_cv_cc_timezone=yes, ne_cv_cc_timezone=no))
+  if test $ne_cv_cc_timezone = yes; then
+    AC_DEFINE(HAVE_TIMEZONE, 1, [Define if libc defines a timezone variable])
+  else
+    AC_MSG_WARN([no timezone handling in date parsing on this platform])
+  fi
 fi
 
 ifdef([neon_no_zlib], 
_______________________________________________
neon mailing list
[email protected]
http://mailman.webdav.org/mailman/listinfo/neon

Reply via email to