<<< Date Index >>>     <<< Thread Index >>>

[PATCH] Lacking strtok_r



Here's a patch to allow compilation on old systems without strtok_r.  The
patch doesn't bother removing the unused "p" pointer, but that's hardly the
only warning showing up...

>>> Dan
-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
--- ./url.c.orig        Mon Nov  5 00:00:07 2007
+++ ./url.c     Wed Mar 19 18:28:31 2008
@@ -233,9 +233,13 @@
   url_pct_decode (tmp);
   e->to = rfc822_parse_adrlist (e->to, tmp);
 
+#ifdef HAVE_STRTOK_R
   tag = headers ? strtok_r (headers, "&", &p) : NULL;
-  
   for (; tag; tag = strtok_r (NULL, "&", &p))
+#else
+  tag = headers ? strtok (headers, "&") : NULL;
+  for (; tag; tag = strtok (NULL, "&"))
+#endif
   {
     if ((value = strchr (tag, '=')))
       *value++ = '\0';
--- ./configure.ac.orig Thu Jan 10 00:00:07 2008
+++ ./configure.ac      Wed Mar 19 18:45:46 2008
@@ -333,7 +333,7 @@
 AC_TYPE_PID_T
 AC_CHECK_TYPE(ssize_t, int)
 
-AC_CHECK_FUNCS(fgetpos memmove setegid srand48 strerror)
+AC_CHECK_FUNCS(fgetpos memmove setegid srand48 strerror strtok_r)
 
 AC_REPLACE_FUNCS([setenv strcasecmp strdup strsep])